@font-face {
  font-family: "Outfit";
  src: url("../../fonts/outfit-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../../fonts/outfit-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../../fonts/outfit-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #08090d;
  --ink: #f6f3ec;
  --muted: rgba(246, 243, 236, 0.62);
  --accent: #e4d2b0;
  --line: rgba(255, 255, 255, 0.1);
  --hover: rgba(255, 255, 255, 0.06);
  --panel: rgba(12, 14, 20, 0.9);
  --input: rgba(255, 255, 255, 0.04);
  --face-top: linear-gradient(180deg, #3d465e 0%, #2c3346 42%, #242b3b 100%);
  --face-bottom: linear-gradient(180deg, #1c2230 0%, #131822 100%);
  --hinge: rgba(0, 0, 0, 0.72);
  --card-shadow: 0 16px 28px rgba(0, 0, 0, 0.32);
  --orb-a: rgba(92, 118, 214, 0.5);
  --orb-b: rgba(206, 148, 92, 0.34);
  --vignette: rgba(0, 0, 0, 0.5);
  --danger-ink: #1a140c;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3eee6;
  --ink: #1c1915;
  --muted: rgba(28, 25, 21, 0.58);
  --accent: #8d5a2b;
  --line: rgba(40, 28, 16, 0.12);
  --hover: rgba(40, 28, 16, 0.06);
  --panel: rgba(255, 251, 245, 0.92);
  --input: rgba(255, 255, 255, 0.72);
  --face-top: linear-gradient(180deg, #ffffff 0%, #fbf7f1 46%, #f1ebe3 100%);
  --face-bottom: linear-gradient(180deg, #e9e2d8 0%, #ddd4c8 100%);
  --hinge: rgba(48, 34, 18, 0.16);
  --card-shadow: 0 14px 26px rgba(72, 48, 20, 0.12);
  --orb-a: rgba(255, 186, 138, 0.7);
  --orb-b: rgba(150, 182, 230, 0.62);
  --vignette: rgba(92, 68, 40, 0.14);
  --danger-ink: #fffaf3;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: "Outfit", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  transition: background-color 0.45s ease, color 0.45s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 46%, var(--vignette) 100%);
}

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

button { cursor: pointer; }

::selection {
  background: var(--accent);
  color: var(--danger-ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(30px);
  z-index: 0;
  pointer-events: none;
  transition: background-color 0.6s ease;
}

.orb-a {
  width: 46vw;
  height: 46vw;
  min-width: 280px;
  min-height: 280px;
  background: var(--orb-a);
  top: -14vw;
  left: -10vw;
  animation: drift-a 22s ease-in-out infinite alternate;
}

.orb-b {
  width: 40vw;
  height: 40vw;
  min-width: 240px;
  min-height: 240px;
  background: var(--orb-b);
  right: -12vw;
  bottom: -16vw;
  animation: drift-b 27s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(8vw, 6vh, 0) scale(1.14); }
}

@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to { transform: translate3d(-6vw, -4vh, 0) scale(0.9); }
}

.topbar {
  position: fixed;
  z-index: 5;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-actions { display: flex; gap: 10px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: inherit;
  text-decoration: none;
  backdrop-filter: blur(16px);
  font-size: 14px;
  letter-spacing: 0.12em;
}

.back-link svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  backdrop-filter: blur(16px);
  transition: transform 0.35s ease, background 0.3s ease, border-color 0.3s ease;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn .icon-exit { display: none; }

.icon-btn.is-full .icon-enter { display: none; }

.icon-btn.is-full .icon-exit { display: block; }

.icon-btn:hover { background: var(--hover); }

.icon-btn.gear:hover { transform: rotate(18deg); }

.icon-btn:active { transform: scale(0.96); }

.stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 4vw, 88px);
  padding: 92px clamp(20px, 6vw, 96px);
  animation: enter 1s cubic-bezier(0.16, 0.84, 0.32, 1) both;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.date-block { min-width: 8.5rem; }

.year {
  display: flex;
  align-items: baseline;
  gap: 0.18em;
  margin: 0;
  font-size: clamp(56px, 6.4vw, 116px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.88;
}

.year small {
  font-size: 0.28em;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 500;
}

.month {
  margin: 0.28em 0 0;
  font-size: clamp(28px, 2.5vw, 46px);
  font-weight: 500;
  letter-spacing: 0.18em;
  line-height: 1.2;
}

.dayline {
  width: max-content;
  margin: 1.05rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.08em;
}

.jump { animation: jump 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }

@keyframes jump {
  0% { opacity: 0; transform: translateY(0.42em); }
  58% { opacity: 1; transform: translateY(-0.05em); }
  100% { opacity: 1; transform: translateY(0); }
}

.time-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 100%;
}

.clock {
  display: flex;
  align-items: flex-start;
  gap: 0.03em;
  font-size: clamp(52px, 7vw, 140px);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.group {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.group-digits { display: flex; gap: 0.075em; }

.caption {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0.18em;
}

.digit-wrap { height: 1.28em; }

.digit-wrap.play { animation: hop 0.48s ease; }

@keyframes hop {
  0% { transform: translateY(0); }
  32% { transform: translateY(-0.045em); }
  100% { transform: translateY(0); }
}

.digit {
  position: relative;
  width: 0.9em;
  height: 1.28em;
  perspective: 4.4em;
  transform-style: preserve-3d;
}

.face {
  position: absolute;
  left: 0;
  width: 100%;
  height: calc(50% - 1.5px);
  overflow: hidden;
  transition: background 0.45s ease, box-shadow 0.45s ease;
}

.face span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.face-top,
.flip-top {
  top: 0;
  border-radius: 0.12em 0.12em 0.04em 0.04em;
  background: var(--face-top);
  z-index: 1;
}

.face-bottom,
.flip-bottom {
  bottom: 0;
  border-radius: 0.04em 0.04em 0.12em 0.12em;
  background: var(--face-bottom);
  box-shadow: var(--card-shadow);
  z-index: 1;
}

.face-top span,
.flip-top span { top: 0; }

.face-bottom span,
.flip-bottom span { top: -100%; }

.flip-top,
.flip-bottom {
  visibility: hidden;
  pointer-events: none;
  backface-visibility: hidden;
}

.flip-top {
  transform-origin: center bottom;
  z-index: 3;
}

.flip-bottom {
  transform-origin: center top;
  transform: rotateX(90deg);
  z-index: 2;
}

.digit.play .flip-top {
  visibility: visible;
  animation: flipTop 0.28s ease-in forwards;
}

.digit.play .flip-bottom {
  visibility: visible;
  animation: flipBottom 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) 0.28s forwards;
}

.digit.play .flip-top::after,
.digit.play .flip-bottom::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
}

.digit.play .flip-top::after { animation: shadeOn 0.28s ease-in forwards; }

.digit.play .flip-bottom::after { animation: shadeOff 0.32s ease-out 0.28s forwards; }

@keyframes flipTop {
  from { transform: rotateX(0deg); }
  to { transform: rotateX(-90deg); }
}

@keyframes flipBottom {
  from { transform: rotateX(90deg); }
  to { transform: rotateX(0deg); }
}

@keyframes shadeOn {
  from { opacity: 0.05; }
  to { opacity: 0.38; }
}

@keyframes shadeOff {
  from { opacity: 0.34; }
  to { opacity: 0; }
}

.digit::after {
  content: "";
  position: absolute;
  left: 7%;
  right: 7%;
  top: calc(50% - 1px);
  height: 2px;
  background: var(--hinge);
  z-index: 4;
  pointer-events: none;
}

.colon {
  width: 0.52em;
  height: 1.28em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.26em;
  flex: none;
}

.colon i {
  width: 0.1em;
  height: 0.1em;
  border-radius: 50%;
  background: var(--accent);
  display: block;
}

.sweep {
  width: min(220px, 34%);
  height: 2px;
  margin-top: 1.35rem;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.sweep i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
}

.zone-label {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 1.15rem 0 0;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.06em;
}

.zone-label .offset {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay[hidden] { display: none !important; }

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  width: min(440px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 26px 22px 18px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  transform: translateX(28px);
  opacity: 0;
  transition: transform 0.42s cubic-bezier(0.16, 0.84, 0.32, 1), opacity 0.3s ease;
  user-select: text;
}

.overlay.open .drawer {
  transform: none;
  opacity: 1;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.section-label {
  margin: 22px 0 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: transparent;
  text-align: left;
}

.choice.text-choice {
  align-items: center;
  justify-content: center;
  min-height: 48px;
  font-size: 15px;
}

.choice[aria-checked="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.swatch {
  display: block;
  width: 100%;
  height: 36px;
  border-radius: 8px;
}

.swatch-dark {
  background:
    linear-gradient(90deg, transparent 0 18%, #e4d2b0 18% 22%, transparent 22% 28%, #2c3346 28% 46%, transparent 46% 52%, #2c3346 52% 70%, transparent 70%),
    linear-gradient(180deg, #2a3144, #12151c);
}

.swatch-light {
  background:
    linear-gradient(90deg, transparent 0 18%, #8d5a2b 18% 22%, transparent 22% 28%, #fff 28% 46%, transparent 46% 52%, #fff 52% 70%, transparent 70%),
    linear-gradient(180deg, #f7f1e8, #e4d9cb);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
}

.search svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  padding: 12px 0;
  font-size: 16px;
}

.zone-list {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  margin: 0 -8px;
  padding: 0 8px 12px;
}

.zone-list::-webkit-scrollbar { width: 8px; }

.zone-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
}

.zone-item {
  width: 100%;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 11px 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
}

.zone-item:hover,
.zone-item[aria-selected="true"] { background: var(--hover); }

.mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.zone-item[aria-selected="true"] .mark { background: var(--accent); }

.name {
  overflow: hidden;
  font-size: 15px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.local,
.off {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.off {
  min-width: 4.6rem;
  text-align: right;
  color: var(--accent);
}

.empty {
  margin: 28px 0;
  color: var(--muted);
  text-align: center;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .stage {
    flex-direction: column;
    justify-content: center;
    gap: 28px;
    padding: 92px 18px 36px;
  }

  .time-block { order: -1; }

  .date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .year { justify-content: center; }

  .dayline { margin-inline: auto; }

  .caption { letter-spacing: 0.12em; }
}

@media (max-height: 740px) and (min-width: 861px) {
  .year { font-size: clamp(44px, 8vh, 92px); }
  .month { font-size: clamp(24px, 4vh, 36px); }
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .stage,
  .jump,
  .digit-wrap.play { animation: none; }

  .overlay,
  .drawer,
  .icon-btn,
  .face { transition: none; }

  .stage { opacity: 1; transform: none; }
}
