:root {
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #111827;
  --indigo: #4f46e5;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 校验码 / 互动页 ---------- */

.capture-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 30px 20px;
  background:
    radial-gradient(900px 600px at 50% -12%, #eef2ff 0%, rgba(238, 242, 255, 0) 62%),
    radial-gradient(720px 520px at 112% 112%, #fef3c7 0%, rgba(254, 243, 199, 0) 58%),
    #ffffff;
}

.code-card {
  width: min(360px, 86vw);
  text-align: center;
}

.code-card h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.code-card p.sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.capture-page #code {
  width: 100%;
  padding: 14px 12px;
  font-size: 30px;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #f8fafc;
  color: var(--fg);
}

.capture-page #code:focus {
  border-color: #111827;
  background: #fff;
}

button.primary {
  width: 100%;
  margin-top: 14px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

button.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px -12px rgba(15, 23, 42, 0.55);
}

button.primary:disabled {
  opacity: 0.5;
  cursor: default;
}

button.ghost,
a.ghost {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  background: #fff;
  border: 1px solid #d7dfeb;
  border-radius: 9px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

button.ghost:hover,
a.ghost:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.msg {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}

/* 游戏介绍卡 */

.intro-card {
  width: min(430px, 92vw);
  text-align: center;
  animation: rise 0.4s ease both;
}

.intro-card .badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--indigo);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.intro-card h1 {
  margin: 14px 0 8px;
  font-size: 34px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.intro-card .lead {
  margin: 0 0 20px;
  color: #475569;
  font-size: 14.5px;
}

.rules {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 10px;
  text-align: left;
}

.rules li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid #e8edf5;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #475569;
}

.rules li > span {
  font-size: 20px;
  line-height: 1.1;
}

.rules li b {
  display: block;
  margin-bottom: 2px;
  color: #0f172a;
  font-size: 13.5px;
  font-weight: 650;
}

button.primary.big {
  margin-top: 0;
  padding: 15px 18px;
  font-size: 16px;
  font-weight: 650;
  border-radius: 14px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  box-shadow: 0 16px 30px -16px rgba(79, 70, 229, 0.8);
}

.intro-card .fine {
  margin: 14px 0 0;
  color: #94a3b8;
  font-size: 12px;
  line-height: 1.65;
}

/* ---------- 游戏画面 ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  background: #0b1020;
  touch-action: none;
}

.cam {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top));
  left: 16px;
  right: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  pointer-events: none;
}

.pill {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  font-variant-numeric: tabular-nums;
}

.pill b {
  font-size: 20px;
  font-weight: 700;
}

.pill span {
  font-size: 11px;
  opacity: 0.75;
}

.face-hint {
  position: absolute;
  left: 50%;
  bottom: calc(20% + 42px);
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(253, 230, 138, 0.35);
  color: #fde68a;
  font-size: 12.5px;
  white-space: nowrap;
}

.loading {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 14px;
  white-space: nowrap;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: clamp(84px, 22vw, 150px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 10px 44px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.countdown.pop {
  animation: cd 0.32s ease-out;
}

@keyframes cd {
  from {
    transform: scale(1.45);
    opacity: 0.2;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.pose {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.32));
}

.pose > div {
  padding: 14px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
  font-size: 16px;
  font-weight: 650;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.result {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(9, 12, 24, 0.55);
  backdrop-filter: blur(12px);
}

.result-card {
  width: min(400px, 90vw);
  padding: 30px 26px;
  border-radius: 22px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  animation: rise 0.4s ease both;
}

.result-emoji {
  font-size: 40px;
  line-height: 1;
}

.result-card h2 {
  margin: 10px 0 4px;
  font-size: 19px;
  font-weight: 650;
}

.result-score {
  margin: 0;
  color: var(--indigo);
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-status {
  margin: 14px 0 0;
  color: #334155;
  font-size: 14px;
}

.result-status.ok {
  color: #059669;
  font-weight: 650;
}

.result-note {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.6;
}

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

/* ---------- 后台（亮色） ---------- */

body.admin {
  min-height: 100vh;
  background: #f4f6fb;
  color: #0f172a;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e6eaf2;
  backdrop-filter: blur(10px);
}

.top h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 28px 70px;
  display: grid;
  gap: 18px;
}

.card {
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -24px rgba(15, 23, 42, 0.35);
}

.card h2 {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}

.code {
  color: #0f172a;
  font-size: 44px;
  font-weight: 700;
  letter-spacing: 0.3em;
  font-variant-numeric: tabular-nums;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.stat {
  padding: 16px 18px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 12px;
}

.stat b {
  display: block;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat span {
  color: #64748b;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.shot {
  position: relative;
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.shot img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #eef2f7;
}

.shot .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  color: #64748b;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.shot .del {
  padding: 0;
  border: 0;
  background: transparent;
  color: #dc2626;
  font-size: 11px;
  cursor: pointer;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

input[type="date"],
input[type="password"] {
  padding: 9px 12px;
  border: 1px solid #d7dfeb;
  border-radius: 9px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
}

input[type="date"]:focus,
input[type="password"]:focus {
  outline: 2px solid #c7d2fe;
  border-color: #6366f1;
}

/* ---------- 登录（亮色） ---------- */

body.login {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(820px 520px at 50% -12%, #eef2ff 0%, rgba(238, 242, 255, 0) 62%),
    #f6f8fc;
  color: #0f172a;
}

.login-card {
  width: min(360px, 90vw);
  padding: 30px 28px;
  background: #fff;
  border: 1px solid #e6eaf2;
  border-radius: 18px;
  box-shadow: 0 28px 70px -34px rgba(15, 23, 42, 0.35);
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 650;
}

.login-card p {
  margin: 0 0 22px;
  color: #64748b;
  font-size: 13px;
}

.login-card input {
  width: 100%;
  margin-bottom: 12px;
}

.login-card button {
  width: 100%;
}

@media (max-width: 520px) {
  .top {
    padding: 12px 16px;
  }

  .wrap {
    padding: 18px 16px 56px;
  }

  .intro-card h1 {
    font-size: 30px;
  }
}