/* 深夜唱片行：黑膠唱片是主視覺。底色偏暖、對比放低，看久了不刺眼。
   歌手代表色只留給唱片圓標、主要按鈕、進度與分數，其他地方一律用中性色。
   顏色刻意只做暗色一套；--accent／--accent-2／--on-accent 會依歌手由 JS 覆寫。 */
:root {
  --bg: #15130f;
  --bg-2: #1d1a16;
  --surface: rgba(255, 244, 228, 0.04);
  --surface-2: rgba(255, 244, 228, 0.075);
  --line: rgba(255, 244, 228, 0.1);
  --line-strong: rgba(255, 244, 228, 0.28);
  --text: #ebe3d5;
  --muted: #a69d8f;
  --faint: #70685d;
  --accent: #d5869e;
  --accent-2: #dfb9d0;
  --on-accent: #291420;
  --good: #8fc7a0;
  --bad: #d98b7c;
  --vinyl: #121110;
  --vinyl-groove: #1d1b19;

  --font-display: "Unbounded", "Noto Sans TC", system-ui, sans-serif;
  --font-body: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 14px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

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

body {
  background:
    radial-gradient(900px 520px at 50% -180px, rgba(255, 226, 184, 0.07), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease;
}

/* 一層很淡的底片顆粒，讓畫面不那麼「數位」 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

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

.hidden {
  display: none !important;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px calc(56px + env(safe-area-inset-bottom, 0px));
}

/* 手機瀏覽器的網址列、工具列會蓋住頁面最底下；
   遊戲畫面多留一段空白，揭曉後才捲得到讓「下一題」露在工具列上方的位置 */
#screen-play {
  padding-bottom: 96px;
}

.screen {
  display: none;
  animation: rise 0.35s ease;
}

.screen.active {
  display: block;
}

@keyframes rise {
  from {
    opacity: 0.4;
    transform: translateY(6px);
  }
}

/* ---------- 共用小元件 ---------- */
.eyebrow,
.label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.primary,
.secondary,
.ghost {
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.primary:active,
.secondary:active {
  transform: scale(0.97);
}

.primary {
  background: var(--accent);
  color: var(--on-accent);
}

.secondary {
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.secondary:not(:disabled):hover {
  border-color: var(--line-strong);
}

.ghost {
  color: var(--muted);
}

.ghost:hover {
  color: var(--text);
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--text);
}

.icon-btn svg,
.mode-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- 黑膠唱片 ---------- */
.vinyl {
  --size: 200px;
  position: relative;
  width: var(--size);
  height: var(--size);
  max-width: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.vinyl-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, transparent 0 30%, rgba(0, 0, 0, 0.35) 30.5% 31.5%, transparent 32%),
    repeating-radial-gradient(circle, var(--vinyl) 0 1.5px, var(--vinyl-groove) 1.5px 3px),
    var(--vinyl);
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* 固定不轉的反光，唱片轉起來才看得出在轉 */
.vinyl::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: conic-gradient(
    from 30deg,
    transparent 0deg,
    rgba(255, 255, 255, 0.09) 25deg,
    transparent 55deg,
    transparent 180deg,
    rgba(255, 255, 255, 0.06) 210deg,
    transparent 240deg
  );
}

.vinyl-label {
  position: relative;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--accent-2), var(--accent) 70%);
  color: var(--on-accent);
  font-size: calc(var(--size) * 0.14);
  line-height: 1;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25) inset;
}

/* 中心孔：只有載入中的唱片有，其他唱片的圓標中間要放圖示 */
.vinyl-loading .vinyl-label::after {
  content: "";
  position: absolute;
  width: 7%;
  height: 7%;
  min-width: 5px;
  min-height: 5px;
  border-radius: 50%;
  background: var(--bg);
}

.spin {
  animation: spin 9s linear infinite;
}

.spin.fast {
  animation-duration: 1.6s;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 首頁 ---------- */
.home-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding-top: 8px;
}

.vinyl-hero {
  --size: 168px;
  margin: 6px 0 4px;
}

.vinyl-hero #hero-icon {
  position: relative;
  z-index: 1;
  font-size: 30px;
}

h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 8.5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.tagline {
  margin: 0;
  color: var(--muted);
  text-wrap: balance;
}

.picker {
  margin-top: 28px;
  display: grid;
  gap: 8px;
}

.picker-row {
  display: flex;
  gap: 10px;
}

.avatar {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25) inset;
}

/* 目前歌手卡片：點了打開選歌面板 */
.artist-trigger {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.artist-trigger:hover {
  border-color: var(--line-strong);
}

.trigger-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.trigger-name {
  font-size: 18px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artist-meta {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trigger-action {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* 觸控裝置沒有鍵盤快捷鍵，不顯示提示 */
@media (pointer: coarse) {
  .trigger-action kbd {
    display: none;
  }
}

.dice-btn {
  flex: none;
  width: 68px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.2s ease;
}

.dice-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.dice-btn:active {
  transform: rotate(-20deg) scale(0.95);
}

.dice-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.dice-btn svg circle {
  fill: currentColor;
  stroke: none;
}

/* 首頁的快速換歌手：最近玩過的（第一次來就是百大前幾名） */
.quick-artists {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: 2px -16px 0;
  padding: 2px 16px;
}

.quick-artists::-webkit-scrollbar {
  display: none;
}

.quick-label {
  flex: none;
  margin-right: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.quick-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 150px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.quick-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.quick-chip .avatar {
  width: 24px;
  height: 24px;
  font-size: 10px;
  box-shadow: none;
}

.quick-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 換歌手時首頁唱片快轉一下 */
.vinyl-hero.shuffle .vinyl-disc {
  animation: spin 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) 1, spin 9s linear 0.6s infinite;
}

/* ---------- 選歌手面板 ---------- */
.sheet {
  width: 100%;
  max-width: 560px;
  height: min(88vh, 760px);
  height: min(88dvh, 760px);
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--bg-2);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* 面板打開時鎖住後面的頁面，手機上才不會滑面板時連背景一起捲 */
html:has(dialog[open]) {
  overflow: hidden;
}

.sheet[open] {
  animation: sheet-up 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sheet::backdrop {
  background: rgba(8, 7, 5, 0.7);
  backdrop-filter: blur(4px);
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    height: min(80vh, 720px);
    height: min(80dvh, 720px);
    border-bottom: 1px solid var(--line);
    border-radius: 22px;
  }
}

.sheet-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 12px 20px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
}

.sheet-count {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.search {
  position: relative;
  margin: 0 16px;
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

#artist-search {
  width: 100%;
  padding: 13px 14px 13px 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

#artist-search::placeholder {
  color: var(--faint);
}

#artist-search:focus {
  outline: none;
  border-color: var(--line-strong);
}

/* 分類：可左右滑的底線分頁。
   底下那條線用內陰影畫，分頁的底線才能直接疊在上面、不必往外溢出 1px；
   溢出的話 overflow-x: auto 會連帶讓整排也能上下捲 */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  padding: 12px 16px 0;
  box-shadow: inset 0 -1px 0 var(--line);
  scrollbar-width: none;
  transition: opacity 0.15s ease;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs.dimmed {
  opacity: 0.45;
}

.tab {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 10px 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}

.tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
}

.results {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 8px 16px;
}

.results-group {
  position: sticky;
  top: -6px;
  z-index: 1;
  margin: 0;
  padding: 12px 12px 6px;
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.results-empty {
  margin: 40px 24px;
  text-align: center;
  color: var(--muted);
}

.artist-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 12px;
  text-align: left;
}

.artist-row:hover,
.artist-row:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.artist-row:focus-visible {
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.artist-row .avatar {
  width: 40px;
  height: 40px;
  font-size: 13px;
}

.row-rank {
  display: none;
  flex: none;
  width: 22px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--faint);
  text-align: right;
}

.artist-row.ranked .row-rank {
  display: block;
}

.row-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.row-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  font-size: 12px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-avatar {
  font-size: 20px;
}

.row-best {
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

/* 抽歌手面板：比選歌手面板矮，只放範圍、三張卡、再抽一次 */
/* 對話框要用 fit-content 才會縮到內容高度，auto 會被撐滿整個畫面 */
.draw-sheet {
  height: fit-content;
}

.draw-sheet .sheet-body {
  height: auto;
}

.draw-label {
  margin: 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--faint);
}

.draw-sheet .tabs {
  padding-top: 4px;
}

.draw-cards {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.artist-row.draw-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.artist-row.draw-card:hover {
  border-color: var(--line-strong);
}

.draw-card .avatar {
  width: 48px;
  height: 48px;
  font-size: 15px;
}

.draw-card .row-name {
  font-size: 17px;
}

.draw-card .row-check {
  font-size: 13px;
}

.draw-actions {
  display: flex;
  justify-content: center;
  padding: 0 16px 20px;
}

.row-check {
  flex: none;
  color: var(--accent);
  font-weight: 900;
}

.artist-row[aria-selected="true"] .row-name {
  color: var(--text);
}

/* 模式清單：五種玩法同一層，排成一列按鈕 */
.modes {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-align: left;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.mode-card:hover {
  transform: translateX(3px);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.mode-icon {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.mode-card:hover .mode-icon {
  color: var(--accent);
}

.mode-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.mode-name {
  font-size: 17px;
  font-weight: 900;
}

.mode-best {
  flex: none;
  max-width: 34%;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--muted);
}

.mode-best:empty {
  display: none;
}

.mode-go {
  flex: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.segmented {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.segmented legend {
  padding: 0;
  margin-bottom: 8px;
}

.segments {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.segments label {
  position: relative;
  cursor: pointer;
}

.segments input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segments span {
  display: block;
  text-align: center;
  padding: 8px 4px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.segments label:hover span {
  color: var(--text);
}

.segments input:checked + span {
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line-strong) inset;
  color: var(--text);
}

.segments input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.fineprint {
  margin-top: 36px;
  text-align: center;
  color: var(--faint);
  font-size: 11px;
}

/* ---------- 載入 ---------- */
#screen-loading {
  text-align: center;
  padding-top: 72px;
}

.vinyl-loading {
  --size: 120px;
  margin: 0 auto 28px;
}

.loading-text {
  color: var(--muted);
  max-width: 34ch;
  margin: 0 auto;
}

.loading-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

/* ---------- 遊戲中 ---------- */
.hud {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.hud-round {
  justify-self: center;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#hud-round,
#hud-score {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hud-score {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

#hud-score {
  font-size: 20px;
  color: var(--text);
}

.progress {
  height: 3px;
  background: var(--surface-2);
  border-radius: 999px;
  margin: 14px 0 28px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.4s ease;
}

.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.vinyl-play {
  --size: 210px;
  padding: 0;
  transition: transform 0.12s ease;
}

.vinyl-play:active {
  transform: scale(0.97);
}

.vinyl-play .vinyl-disc {
  inset: 10px;
}

.vinyl-play.is-playing .vinyl-disc {
  animation: spin 1.8s linear infinite;
}

.vinyl-play .vinyl-label {
  font-size: 28px;
}

#play-icon {
  position: relative;
  z-index: 1;
  /* ▶ 字形視覺上偏左，往右推一點才置中 */
  padding-left: 0.12em;
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  z-index: 1;
  pointer-events: none;
}

.ring circle {
  fill: none;
  stroke-width: 3;
}

.ring-bg {
  stroke: var(--line);
}

.ring-fg {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
}

.clip-label {
  margin: 6px 0 0;
  font-weight: 700;
}

.steps {
  display: flex;
  gap: 6px;
}

.step {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--faint);
}

.step.on {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- 歌詞模式 ---------- */
.lyric-song {
  margin: 0;
  font-weight: 900;
  font-size: 18px;
  text-align: center;
  text-wrap: balance;
}

.lyric-card {
  width: 100%;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px 22px;
  border-radius: var(--radius);
  background: var(--bg-2);
  border: 1px solid var(--line);
}

.lyric-line {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  animation: rise 0.3s ease;
}

.lyric-dim {
  color: var(--muted);
  font-size: 17px;
  font-weight: 500;
}

.lyric-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
}

.blank {
  display: inline-block;
  margin: 0 3px;
  padding: 0 6px;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
  letter-spacing: 0.08em;
}

.blank.filled {
  color: var(--good);
  border-color: var(--good);
}

.lyric-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.lyric-credit {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
}

.lyric-credit a {
  color: var(--muted);
}

.clue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: grid;
  gap: 10px;
  counter-reset: clue;
}

.clue-list li {
  counter-increment: clue;
  position: relative;
  padding: 14px 16px 14px 52px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: rise 0.3s ease;
}

.clue-list li::before {
  content: "0" counter(clue);
  position: absolute;
  left: 16px;
  top: 15px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--faint);
}

.clue-list li.emoji {
  font-size: 30px;
  letter-spacing: 0.1em;
  padding-top: 8px;
  padding-bottom: 8px;
}

.clue-list li.emoji::before {
  top: 22px;
}

.clue-list li.cover img {
  display: block;
  width: 160px;
  max-width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 10px;
}

.worth {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 24px 0 10px;
}

/* 選項做成唱片背面的曲目表 */
.options {
  display: grid;
  border-top: 1px solid var(--line);
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
  text-align: left;
  padding: 15px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease;
}

.option:not(:disabled):hover {
  background: var(--surface);
}

.option:not(:disabled):hover .option-num {
  color: var(--text);
}

.option:disabled {
  opacity: 1;
  cursor: default;
}

.option-num {
  flex: none;
  width: 22px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--faint);
}

.option-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.option.correct {
  background: color-mix(in srgb, var(--good) 14%, transparent);
  color: var(--good);
}

.option.correct .option-num {
  color: var(--good);
}

.option.wrong {
  background: color-mix(in srgb, var(--bad) 14%, transparent);
  color: var(--bad);
  animation: shake 0.35s ease;
}

.option.wrong .option-num {
  color: var(--bad);
}

@keyframes shake {
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

.reveal {
  margin-top: 20px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 16px;
  align-items: center;
  animation: rise 0.3s ease;
}

#reveal-art {
  width: 104px;
  height: 104px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#reveal-art.hidden + .reveal-info {
  grid-column: 1 / -1;
}

.reveal-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.reveal-info p {
  margin: 0;
}

.verdict {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.verdict.good {
  color: var(--good);
}

.verdict.bad {
  color: var(--bad);
}

.reveal-title {
  font-size: 20px;
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.reveal-meta {
  color: var(--muted);
  font-size: 13px;
}

#reveal-link {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

#reveal-link:hover {
  text-decoration: underline;
}

#btn-next {
  grid-column: 1 / -1;
}

/* ---------- 分享成績圖 ---------- */
.share-sheet {
  height: min(92vh, 900px);
  height: min(92dvh, 900px);
}

/* 預覽區吃掉剩下的高度，圖片在裡面等比縮放，不會壓到下方按鈕 */
.share-preview {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px 16px 14px;
}

#share-img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.share-loading {
  color: var(--muted);
}

.share-preview.busy #share-img {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

/* 成績圖背景：唱片或專輯封面，一排可以左右滑 */
.share-bg {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 14px 20px;
}

.share-bgs {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 3px 16px 3px 3px;
}

.share-bgs::-webkit-scrollbar {
  display: none;
}

.bg-thumb {
  flex: none;
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line);
  opacity: 0.7;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.bg-thumb:hover {
  opacity: 1;
}

.bg-thumb[aria-checked="true"] {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--text);
}

.bg-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 預設背景的縮圖畫成一張小唱片 */
.bg-vinyl {
  background:
    radial-gradient(circle, var(--accent) 0 16%, transparent 17%),
    repeating-radial-gradient(circle, var(--vinyl) 0 1.5px, var(--vinyl-groove) 1.5px 3px);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
}

.share-actions a {
  color: var(--text);
  text-decoration: none;
}

.share-hint {
  margin: 10px 0 16px;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
}

/* ---------- 結算 ---------- */
#screen-result {
  text-align: center;
  padding-top: 20px;
}

.result-score {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1;
}

#result-score {
  font-size: clamp(72px, 22vw, 104px);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.result-max {
  font-size: 22px;
  color: var(--faint);
  margin-left: 6px;
}

.result-title {
  font-size: 22px;
  font-weight: 900;
  margin: 0;
  text-wrap: balance;
}

.result-sub {
  color: var(--muted);
  margin: 6px 0 24px;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  text-align: left;
  border-top: 1px solid var(--line);
  counter-reset: track;
}

.result-list li {
  counter-increment: track;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 11px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.result-list li::before {
  content: counter(track, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--faint);
}

.rl-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-list li.has-play {
  grid-template-columns: 28px 1fr auto auto;
}

.rl-play {
  align-self: center;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.rl-play:hover {
  background: var(--surface-2);
}

.result-hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.rl-mark {
  font-family: var(--font-mono);
  font-weight: 600;
}

.result-list .good .rl-mark {
  color: var(--good);
}

.result-list .bad .rl-mark {
  color: var(--bad);
}

.result-list .bad .rl-title {
  color: var(--muted);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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