/* 每日游戏中心 —— 与两个游戏共用同一套纸面 + 硬阴影设计语言 */
:root {
  color-scheme: light;
  --background: #fbf8f1;
  --surface: #fffdf6;
  --ink: #16130d;
  --muted: #6c665a;
  --soft: #c9c2b2;
  --line: #1b1812;
  --accent: #00b8c4;
  --yellow: #ffd21f;
  --danger: #d32121;
  --blue: #1488d8;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --shadow-hard: 4px 4px 0 var(--line);
  --grid-hue: 205;
  --cell-bg: hsl(var(--grid-hue) 70% 95%);
  --cell-border: hsl(var(--grid-hue) 48% 32%);
  --cell-text: hsl(var(--grid-hue) 55% 15%);
  --cell-correct: hsl(var(--grid-hue) 78% 70%);
  --pad-hue: 174;
  --pad-bg: hsl(var(--pad-hue) 70% 92%);
  --pad-border: hsl(var(--pad-hue) 55% 30%);
  --font-tech: "Rajdhani", "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-family: var(--font-tech);
}

[data-theme="dark"] {
  color-scheme: dark;
  --background: #14130f;
  --surface: #211f18;
  --ink: #f4f1e8;
  --muted: #a59c88;
  --soft: #4a463b;
  --line: #ece6d4;
  --cell-bg: hsl(var(--grid-hue) 32% 22%);
  --cell-border: hsl(var(--grid-hue) 60% 70%);
  --cell-text: #ffffff;
  --cell-correct: hsl(var(--grid-hue) 62% 44%);
  --pad-bg: hsl(var(--pad-hue) 30% 24%);
  --pad-border: hsl(var(--pad-hue) 60% 66%);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
.hidden { display: none !important; }

body {
  min-height: 100dvh;
  background:
    radial-gradient(rgba(22, 19, 13, .05) 1px, transparent 1.4px) 0 0 / 26px 26px,
    var(--background);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

[data-theme="dark"] body {
  background:
    radial-gradient(rgba(244, 241, 232, .045) 1px, transparent 1.4px) 0 0 / 26px 26px,
    var(--background);
}

.shell {
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 20px 40px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wordmark {
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.wordmark strong { font-size: 26px; letter-spacing: 1px; }
.wordmark span {
  font-size: 19px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.user-button {
  min-height: 46px;
  max-width: 170px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--line);
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.user-button:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }
.user-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line); background: var(--soft); flex: none; }
.user-button.signed-in .user-dot { background: var(--accent); }
.user-button b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Hero ---------- */
.hero { padding: clamp(26px, 6vh, 56px) 0 8px; }
.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.hero h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 52px);
  line-height: 1.12;
  letter-spacing: 1px;
}
.hero h1::after {
  content: "";
  display: block;
  width: 76px;
  height: 8px;
  margin-top: 14px;
  border-radius: 4px;
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--line);
}
.intro { margin: 16px 0 0; max-width: 560px; color: var(--muted); font-size: 16px; font-weight: 600; line-height: 1.6; }

/* ---------- Game cards ---------- */
.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: clamp(22px, 5vh, 40px);
}
@media (min-width: 760px) {
  .game-grid { grid-template-columns: 1fr 1fr; align-items: stretch; }
}

.game-card {
  display: flex;
  flex-direction: column;
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform .18s ease, box-shadow .18s ease;
}
.game-card:hover { transform: translate(-3px, -3px); box-shadow: 7px 7px 0 var(--line); }
.game-card:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--line); }
.game-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.card-visual {
  display: grid;
  place-items: center;
  min-height: 168px;
  border-bottom: 3px solid var(--line);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.visual-seconds { background: linear-gradient(160deg, hsl(var(--pad-hue) 62% 90%), var(--surface) 78%); }
[data-theme="dark"] .visual-seconds { background: linear-gradient(160deg, hsl(var(--pad-hue) 34% 20%), var(--surface) 78%); }
.visual-schulte { background: linear-gradient(160deg, hsl(var(--grid-hue) 62% 90%), var(--surface) 78%); }
[data-theme="dark"] .visual-schulte { background: linear-gradient(160deg, hsl(var(--grid-hue) 32% 20%), var(--surface) 78%); }

/* 秒感预览：计时圆钮 + 呼吸回波 */
.timing-preview { position: relative; display: grid; place-items: center; }
.timing-pad {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--pad-bg);
  border: 4px solid var(--pad-border);
  box-shadow: 5px 5px 0 var(--line);
  transition: transform .18s ease, box-shadow .18s ease;
}
.timing-pad b { font-size: 30px; color: var(--pad-border); letter-spacing: 1px; }
.timing-echo, .timing-ring {
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 3px solid var(--pad-border);
  opacity: 0;
  animation: echo 2.6s ease-out infinite;
}
.timing-ring { animation-delay: 1.3s; }
@keyframes echo {
  0% { transform: scale(1); opacity: .55; }
  70%, 100% { transform: scale(1.65); opacity: 0; }
}
.game-card:hover .timing-pad { transform: scale(.92); box-shadow: 2px 2px 0 var(--line); }

/* 方格预览：3×3 数字盘，悬停时依次点亮 */
.grid-preview {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 7px;
}
.grid-preview span {
  display: grid;
  place-items: center;
  height: 44px;
  border-radius: 10px;
  background: var(--cell-bg);
  border: 2.5px solid var(--cell-border);
  color: var(--cell-text);
  font-size: 20px;
  font-weight: 700;
}
.game-card:hover .grid-preview span { animation: cellHit 1.5s ease infinite; animation-delay: calc(var(--i) * .12s); }
@keyframes cellHit {
  0%, 18%, 100% { background: var(--cell-bg); }
  8% { background: var(--cell-correct); transform: scale(.92); }
}

.card-body { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px 20px; flex: 1; }
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.overline { font-size: 12.5px; font-weight: 700; letter-spacing: 2.5px; color: var(--muted); }
.status-tag {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--yellow);
  white-space: nowrap;
}
.status-tag.quiet { background: var(--surface); color: var(--muted); }
.card-body h2 { margin: 0; font-size: 27px; letter-spacing: 1px; }
.card-description { margin: 0; color: var(--muted); font-size: 14.5px; font-weight: 600; line-height: 1.65; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-tag {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  font-weight: 700;
  background: hsl(var(--grid-hue) 70% 95%);
  color: var(--cell-border);
}
[data-theme="dark"] .mode-tag { background: hsl(var(--grid-hue) 32% 22%); color: hsl(var(--grid-hue) 60% 70%); }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 6px;
}
.stat { display: flex; flex-direction: column; gap: 1px; }
.stat small { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted); }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }
.enter { font-size: 15.5px; font-weight: 700; color: var(--blue); white-space: nowrap; }
.enter i { font-style: normal; display: inline-block; transition: transform .18s ease; }
.game-card:hover .enter i { transform: translateX(4px); }

.timezone-note { margin: 26px 0 0; text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 16, 8, .55); backdrop-filter: blur(3px); }
[data-theme="dark"] .modal-backdrop { background: rgba(0, 0, 0, .7); }
.modal-card {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 6px 6px 0 var(--line);
  padding: 22px;
}
.modal-card h2 { margin: 4px 0 14px; font-size: 24px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border: 2.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--line);
}
.modal-close:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--line); }

.user-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.user-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.user-form input {
  min-height: 48px;
  border: 2.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--background);
  color: var(--ink);
  padding: 10px 13px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
}
.user-form input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }

.primary-button, .secondary-button {
  min-height: 48px;
  border: 3px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--line);
  transition: transform .15s ease, box-shadow .15s ease;
}
.primary-button { background: var(--blue); color: #fff; }
.secondary-button { background: var(--surface); color: var(--ink); }
.primary-button:hover, .secondary-button:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--line); }
.primary-button:active, .secondary-button:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.primary-button:disabled, .secondary-button:disabled { opacity: .6; cursor: wait; }

.form-switch {
  display: block;
  width: 100%;
  margin-top: 14px;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.form-switch b { color: var(--blue); }

.signed-in-panel { display: flex; flex-direction: column; gap: 10px; }
.signed-in-panel span { font-size: 13px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted); }
.signed-in-panel strong { font-size: 26px; }
.signed-in-panel button { margin-top: 8px; }

.inline-message { margin: 12px 0 0; color: var(--danger); font-size: 13px; font-weight: 700; min-height: 18px; }
.privacy-hint { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; font-weight: 600; line-height: 1.6; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 30;
  max-width: min(420px, calc(100vw - 32px));
  border: 2.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--ink);
  color: var(--background);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .25);
}

/* ---------- 动效 ---------- */
.rise { opacity: 0; transform: translateY(14px); animation: rise .5s ease forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
.topbar.rise { animation-delay: .02s; }
.hero.rise { animation-delay: .08s; }
.game-card.rise:nth-child(1) { animation-delay: .16s; }
.game-card.rise:nth-child(2) { animation-delay: .26s; }

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

@media (max-width: 560px) {
  .shell { padding: 12px 14px 30px; }
  .wordmark strong { font-size: 22px; }
  .wordmark span { font-size: 16px; }
  .card-visual { min-height: 150px; }
}
