@charset "UTF-8";
@font-face {
  font-family: "SimKai Hanzi";
  src: url("assets/fonts/simkai-hanzi.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
}

:root {
  color-scheme: dark;
  --ink: #173945;
  --cream: #f9efde;
  --teal: #073f46;
  --accent: #e9a15d;
  --muted: #afccca;
  --green: #256f57;
  font-family: "SimKai Hanzi", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--teal);
  color: var(--cream);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(ellipse at 10% 70%, #0c5458 0, transparent 65%), var(--teal);
  min-height: 100vh;
  overflow-x: hidden;
}

button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
.reel-center:focus-visible {
  outline: 3px solid #ffbd70;
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
}

main {
  max-width: 1440px;
  margin: auto;
  padding: 24px 32px 18px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--muted);
  margin: 0 0 6px;
}

h1 {
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.1;
  letter-spacing: -1.2px;
  margin: 0;
  font-weight: 750;
}

.title-dot {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid #5a7976;
  border-radius: 40px;
  padding: 8px 18px;
  min-width: 88px;
}

.score span {
  font-size: 22px;
}

.score strong {
  font-size: 21px;
}

.sound-button {
  background: none;
  color: var(--muted);
  border: none;
  font-size: 12px;
  padding: 10px 0;
}

.clue-panel {
  background: var(--cream);
  color: var(--ink);
  border-radius: 12px;
  border-top: 4px solid var(--accent);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 132px;
  box-shadow: 0 6px 24px #00272c18;
}

.stamp {
  border: 2px solid #b7634b;
  color: #b7634b;
  transform: rotate(-9deg);
  font-family: "SimKai Hanzi", serif;
  font-weight: 500;
  font-size: 38px;
  line-height: 1;
  padding: 8px;
  flex-shrink: 0;
}

.clue-copy {
  flex: 1;
  min-width: 0;
}

.clue-label {
  font-family: "SimKai Hanzi", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(18px, 1.8vw, 24px);
  letter-spacing: 1px;
  font-weight: 500;
  margin: 0 0 8px;
  color: #79776c;
}

.clue-label span {
  margin-left: 14px;
  color: #aaa08c;
}

h2 {
  margin: 0;
}

#clue {
  font-family: "SimKai Hanzi", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(20px, 2.2vw, 31px);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.6px;
}

.hanzi-block {
  position: relative;
  cursor: pointer;
  padding: 2px 0;
  border-radius: 4px;
  transition: background 0.2s;
  word-wrap: break-word;
  white-space: nowrap;
}

.hanzi-block:hover {
  background: #f0f0f0;
}

.popup {
  position: fixed;
  transform: translate(-50%, -100%);
  background: #3b5a7c;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s, visibility 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  line-height: normal;
  text-align: center;
}

.popup::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #3b5a7c;
}

.popup.persistent {
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.pinyin {
  display: block;
  color: #f1c40f;
  font-size: 20px;
  font-weight: 600;
}

.reveal-hanzi,
#play-forecast {
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #c4b6a0;
  background: #efe3cd;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
}

#translation {
  margin: 8px 0 0;
  color: #6b6e63;
  font-size: 14px;
}

.debug-answers {
  margin: 8px 0 0;
  color: #785020;
  font-size: 13px;
  font-weight: 700;
}

.clue-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.clue-tools button {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  color: var(--ink);
  background: transparent;
  border: 1px solid #c4b6a0;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 12px;
  min-width: 102px;
}

.clue-tools button[aria-pressed="true"] {
  background: #efe3cd;
}

.clue-tools button span {
  color: #927d5e;
}

.round-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin: 16px 0 12px;
  font-size: 12px;
}

.round-meta p {
  margin: 0;
  color: #e6eeea;
}

.round-meta span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.3px;
}

.slot-machine {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}

.slot-column {
  background: #0d4b52;
  border: 2px solid #49767a;
  border-radius: 16px;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.slot-column.matched {
  border-color: #8bc6a1;
  box-shadow: 0 0 0 2px #8bc6a155;
}

.slot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}

.slot-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.slot-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.slot-status {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 12px;
  background: #07363c;
  color: var(--muted);
}

.slot-column.matched .slot-status {
  background: var(--green);
  color: #fff;
}

/* Time Box above each reel */
.time-box {
  background: var(--cream);
  color: var(--ink);
  border: 3px solid #234c58;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: inset 0 2px 5px #00000014;
}

/* 5-Option 24-Hour Drum Picker */
.iphone-time-picker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    180deg,
    #d6c7ae 0%,
    #f6efe2 26%,
    #fffdf8 50%,
    #f6efe2 74%,
    #d6c7ae 100%
  );
  border: 2px solid #234c58;
  border-radius: 14px;
  padding: 4px 10px;
  overflow: hidden;
  box-shadow: inset 0 6px 14px #0000001c;
  user-select: none;
}

.iphone-time-picker::before {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 36px;
  transform: translateY(-50%);
  background: #17394512;
  border-top: 1.5px solid #17394545;
  border-bottom: 1.5px solid #17394545;
  border-radius: 7px;
  pointer-events: none;
}

.slot-column.matched .iphone-time-picker::before {
  background: #256f571c;
  border-color: var(--green);
}

.time-roll {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  touch-action: none;
}

.roll-row {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  text-align: center;
  padding: 0 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.roll-prev,
.roll-next {
  height: 26px;
  font-size: 14px;
  font-weight: 500;
  color: #546a72;
  opacity: 0.65;
  transform: scale(0.9);
  transition: opacity 0.14s, color 0.14s, background 0.14s;
  border-radius: 5px;
}

.roll-prev:hover:not(:disabled),
.roll-next:hover:not(:disabled) {
  opacity: 0.95;
  color: var(--ink);
  background: #f3c28645;
}

.roll-center {
  height: 36px;
  font-size: clamp(20px, 2vw, 25px);
  font-weight: 500;
  letter-spacing: 0.8px;
  color: var(--ink);
  gap: 8px;
}

.roll-center::before {
  content: ">";
  color: #b7634b;
  font-weight: 500;
  font-size: 0.85em;
}

.roll-center::after {
  content: "<";
  color: #b7634b;
  font-weight: 500;
  font-size: 0.85em;
}

.slot-column.matched .roll-center::before,
.slot-column.matched .roll-center::after {
  color: var(--green);
}

.roll-center:focus-visible {
  outline: 3px solid #ffbd70;
  outline-offset: 1px;
  border-radius: 6px;
}


/* Curved Slot Reel Drum */
.reel-drum {
  background: linear-gradient(180deg, #dfd2bc 0%, #fff8eb 24%, #fff8eb 76%, #dfd2bc 100%);
  color: var(--ink);
  border: 3px solid #234c58;
  border-radius: 28px / 80px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 8px 18px #0000001f;
}

.reel-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 6px 12px;
  text-align: center;
}

.reel-prev,
.reel-next {
  min-height: 64px;
  opacity: 0.62;
  transition: opacity 0.15s, background 0.15s;
}

.reel-prev:hover:not(:disabled),
.reel-next:hover:not(:disabled) {
  opacity: 0.92;
  background: #f3c28640;
}

.reel-prev img,
.reel-next img {
  width: 60px;
  height: 45px;
  object-fit: contain;
  flex-shrink: 0;
}

.reel-center {
  min-height: 112px;
  border-top: 3px solid #173945;
  border-bottom: 3px solid #173945;
  background: #fffdf8;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  position: relative;
}

.slot-column.matched .reel-center {
  background: #eaf7ef;
  border-color: var(--green);
}

.reel-center img {
  width: 104px;
  height: 78px;
  object-fit: contain;
}

.reel-hint {
  font-size: 10px;
  color: #6c7a7e;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: #073f4660;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.celebration > div {
  background: var(--cream);
  color: var(--ink);
  padding: 30px 65px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 20px 70px #001c3570;
  animation: arrive 0.2s ease-out;
}

.celebration span {
  font-size: 65px;
}

.celebration strong {
  font-size: 25px;
}

.celebration small {
  color: #8a6b40;
  font-size: 20px;
}

.setup {
  max-width: 650px;
  margin: 45px auto 65px;
  text-align: center;
  background: #10525a;
  padding: 30px;
  border-radius: 12px;
  border: 1px solid #427277;
}

.setup p {
  color: #d2dfda;
  line-height: 1.7;
  font-size: 14px;
}

.setup-icon {
  font-size: 60px;
  color: var(--accent);
}

code {
  font-size: 12px;
}

footer {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  color: #9dbbb6;
  font-size: 10px;
  letter-spacing: 0.3px;
  padding-top: 18px;
}

.footer-separator {
  margin: 0 9px;
  color: #6c9691;
}

[hidden] {
  display: none !important;
}

.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;
}

@keyframes arrive {
  from {
    transform: translateY(8px) scale(0.95);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  main {
    padding: 16px 14px;
  }
  .masthead {
    margin-bottom: 14px;
  }
  .clue-panel {
    gap: 14px;
    padding: 14px 16px;
    min-height: 104px;
  }
  .stamp {
    font-size: 28px;
    padding: 6px;
  }
  .slot-machine {
    gap: 10px;
  }
  .slot-column {
    padding: 10px 10px 12px;
  }
  .time-box {
    padding: 8px 8px;
    gap: 6px;
  }
  .period-btn {
    padding: 6px 10px;
    font-size: 13px;
  }
  .iphone-time-picker {
    padding: 3px 6px;
    gap: 4px;
  }
  .time-roll {
    min-width: 36px;
  }
  .time-roll.hour-roll {
    min-width: 44px;
  }

  .reel-center {
    min-height: 92px;
  }
  .reel-center img {
    width: 80px;
    height: 60px;
  }
  .reel-prev,
  .reel-next {
    min-height: 52px;
  }
  .reel-prev img,
  .reel-next img {
    width: 48px;
    height: 36px;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .slot-machine {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .stamp {
    display: none;
  }
  .clue-panel {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .clue-tools {
    flex-direction: row;
  }
  .clue-copy {
    flex-basis: 100%;
  }
  #clue {
    font-size: 22px;
  }
  footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#audio-status {
  margin: 8px 0 0;
  font-size: 14px;
}

#audio-status:empty {
  display: none;
}
