/* 页面外壳：底板、工具栏、弹层。撕历本体在 calendar.css。 */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: #5e0c0b;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #f6efdf;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

.footnote {
  margin: 16px 6px 0;
  max-width: 420px;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.7;
  color: rgba(255, 232, 200, 0.72);
}

.footnote a {
  color: #ffe6ad;
}

/* 底部工具栏：iPhone 上一直够得着 */
.toolbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(94, 12, 11, 0) 0%, rgba(74, 8, 7, 0.92) 42%, #470605 100%);
}

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid rgba(255, 232, 200, 0.34);
  border-radius: 999px;
  background: rgba(255, 240, 214, 0.08);
  color: #ffe9cf;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.12s ease, background 0.12s ease;
}

.pill:active {
  transform: scale(0.96);
  background: rgba(255, 240, 214, 0.18);
}

.pill.strong {
  background: linear-gradient(180deg, #d42a22, #a81613);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.pill.tear {
  background: linear-gradient(180deg, #e8d9b6, #cbb98f);
  border-color: rgba(255, 255, 255, 0.4);
  color: #6b1411;
}

.pill.pick {
  overflow: hidden;
}

.pill.pick input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* 弹层 */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 4, 3, 0.82);
  backdrop-filter: blur(3px);
}

.overlay[hidden] {
  display: none;
}

.sheet-out {
  width: min(430px, 92vw);
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  border-radius: 12px;
  background: #f6efdf;
  color: #221d18;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.sheet-out h2 {
  margin: 0 0 6px;
  font-size: 16px;
  color: #a81613;
}

.sheet-out .hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.6;
  color: #5b5145;
}

.sheet-out img {
  width: 100%;
  display: block;
  border-radius: 6px;
  border: 1px solid #d9cbb0;
  background: #f6efdf;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

.overlay-actions .pill {
  border-color: rgba(168, 22, 19, 0.35);
  background: rgba(168, 22, 19, 0.08);
  color: #8e1210;
}

.overlay-actions .pill.strong {
  background: linear-gradient(180deg, #d42a22, #a81613);
  color: #fff;
  border-color: transparent;
}

.sheet-out.rules ul {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.8;
  color: #3c332a;
}

.sheet-out.rules li b {
  color: #a81613;
}

.sheet-out.rules li.plus::marker {
  color: #a81613;
}

/* 撕页动画 */
.sheet.tearing-next {
  animation: tearNext 0.42s cubic-bezier(0.3, 0.7, 0.2, 1);
}

.sheet.tearing-prev {
  animation: tearPrev 0.42s cubic-bezier(0.3, 0.7, 0.2, 1);
}

@keyframes tearNext {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  45% {
    transform: translateY(-16px) rotate(-1.6deg);
    opacity: 0.75;
  }
  100% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}

@keyframes tearPrev {
  0% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
  45% {
    transform: translateY(14px) rotate(1.4deg);
    opacity: 0.7;
  }
  100% {
    transform: translateY(0) rotate(0);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet.tearing-next,
  .sheet.tearing-prev {
    animation: none;
  }
}
