/* ==========================================================================
   猜数字 · 联机对战 —— 样式
   ========================================================================== */

:root {
  --bg: #070b17;
  --bg-soft: #0c1326;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e9eefc;
  --muted: #8d9ac0;
  --accent: #4de2ff;
  --accent-2: #a377ff;
  --gold: #ffcf5c;
  --ok: #46e6a0;
  --warn: #ffb547;
  --danger: #ff6b81;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.95);
  --font: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overscroll-behavior-y: contain;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(77, 226, 255, 0.12), transparent 65%),
    radial-gradient(800px 520px at 92% 8%, rgba(163, 119, 255, 0.16), transparent 62%),
    radial-gradient(700px 700px at 50% 110%, rgba(70, 230, 160, 0.08), transparent 60%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.5;
  animation: float 22s ease-in-out infinite;
}

.orb-1 {
  width: 380px;
  height: 380px;
  top: -120px;
  left: -80px;
  background: rgba(77, 226, 255, 0.22);
}

.orb-2 {
  width: 460px;
  height: 460px;
  top: 12%;
  right: -160px;
  background: rgba(163, 119, 255, 0.2);
  animation-delay: -7s;
}

.orb-3 {
  width: 320px;
  height: 320px;
  bottom: -140px;
  left: 32%;
  background: rgba(70, 230, 160, 0.14);
  animation-delay: -14s;
}

@keyframes float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, -34px, 0) scale(1.06);
  }
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 26px 16px 60px;
  padding-top: calc(26px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(16px + env(safe-area-inset-left, 0px));
  padding-right: calc(16px + env(safe-area-inset-right, 0px));
  animation: fade-in 0.35s ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------- 通用组件 ------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.022));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: rise 0.4s ease both;
}

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

.card + .card {
  margin-top: 14px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

p {
  margin: 0;
}

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

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease,
    opacity 0.18s ease, box-shadow 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.26);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #04121c;
  box-shadow: 0 14px 34px -16px rgba(77, 226, 255, 0.9);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6ceaff, #b795ff);
  border-color: transparent;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
}

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 500;
}

.btn-quiet:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.btn-block {
  width: 100%;
}

.field {
  display: block;
}

.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 7px;
  letter-spacing: 0.05em;
}

input[type='text'],
input[type='tel'] {
  width: 100%;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  padding: 13px 15px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[type='text']:focus,
input[type='tel']:focus {
  border-color: rgba(77, 226, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(77, 226, 255, 0.14);
}

input::placeholder {
  color: #5b6787;
}

.hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.error-text {
  color: var(--danger);
  font-size: 13.5px;
  min-height: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}

.pill-ok {
  color: var(--ok);
  border-color: rgba(70, 230, 160, 0.4);
  background: rgba(70, 230, 160, 0.1);
}

.pill-warn {
  color: var(--warn);
  border-color: rgba(255, 181, 71, 0.4);
  background: rgba(255, 181, 71, 0.1);
}

.pill-turn {
  color: #04121c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  font-weight: 700;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4a5670;
  flex: none;
}

.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(70, 230, 160, 0.16);
}

.dot.off {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 107, 129, 0.16);
}

/* --------------------------------- 首页 --------------------------------- */

.hero {
  text-align: center;
  padding: 18px 0 26px;
}

.logo {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(77, 226, 255, 0.5));
  animation: bob 3.4s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.hero h1 {
  font-size: clamp(30px, 8vw, 44px);
  margin: 14px 0 8px;
  letter-spacing: 0.12em;
  background: linear-gradient(120deg, #ffffff 12%, var(--accent) 52%, var(--accent-2) 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  color: var(--muted);
  font-size: 13.5px;
  letter-spacing: 0.05em;
}

.home-card {
  max-width: 460px;
  margin: 0 auto;
}

.home-actions {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin: 18px 0;
  letter-spacing: 0.1em;
}

.divider::before,
.divider::after {
  content: '';
  height: 1px;
  flex: 1;
  background: var(--line);
}

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

.join-row input {
  text-align: center;
  letter-spacing: 0.5em;
  font-family: var(--mono);
  font-size: 20px;
  padding-left: 0.5em;
}

.rules {
  max-width: 460px;
  margin: 14px auto 0;
  padding: 0;
  overflow: hidden;
}

.rules summary {
  cursor: pointer;
  padding: 15px 20px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rules summary::-webkit-details-marker {
  display: none;
}

.rules summary::after {
  content: '＋';
  margin-left: auto;
  color: var(--accent);
}

.rules[open] summary::after {
  content: '－';
}

.rules-body {
  padding: 0 20px 20px;
  font-size: 13.5px;
  color: #b9c4e0;
}

.rules-body ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 9px;
}

.rules-body b {
  color: var(--text);
}

/* -------------------------------- 房间大厅 ------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.room-code {
  display: flex;
  align-items: center;
  gap: 10px;
}

.room-code .label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.room-code strong {
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(77, 226, 255, 0.45);
}

.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.icon-btn:hover {
  color: var(--text);
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.seat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.seat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
}

.seat.empty {
  border-style: dashed;
  background: transparent;
  color: #5b6787;
  font-size: 13.5px;
  justify-content: center;
}

.seat.turn {
  border-color: rgba(77, 226, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(77, 226, 255, 0.2), 0 0 26px -8px rgba(77, 226, 255, 0.6);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #04121c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
  user-select: none;
}

.avatar.bot {
  background: linear-gradient(135deg, #7f8daa, #4c5876);
  color: #eaf1ff;
}

.avatar.dim {
  background: linear-gradient(135deg, #2b3550, #1d2539);
  color: var(--muted);
}

.seat-main {
  min-width: 0;
  flex: 1;
}

.seat-main strong {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-main small {
  color: var(--muted);
  font-size: 12px;
}

.seat-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* 设置项 */

.setting {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}

.setting:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting:first-child {
  padding-top: 0;
}

.setting > span {
  font-size: 13px;
  color: var(--muted);
}

.seg {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.seg-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 13px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.seg-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
}

.seg-btn.active {
  color: #04121c;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  font-weight: 700;
}

.seg-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.lobby-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

/* -------------------------------- 选暗号 -------------------------------- */

.phase-head {
  text-align: center;
  margin-bottom: 18px;
}

.phase-head h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.phase-timer {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.phase-timer b {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 16px;
}

.otp {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 22px 0;
}

.otp-box {
  width: 62px;
  height: 76px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: rgba(0, 0, 0, 0.32);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 34px;
  font-weight: 600;
  color: var(--text);
  transition: all 0.16s ease;
  position: relative;
}

.otp-box.filled {
  border-color: rgba(77, 226, 255, 0.6);
  box-shadow: 0 0 24px -6px rgba(77, 226, 255, 0.7), inset 0 0 18px -8px rgba(77, 226, 255, 0.6);
  animation: pop 0.18s ease;
}

@keyframes pop {
  from {
    transform: scale(0.9);
  }
  to {
    transform: scale(1);
  }
}

.otp-box.next::after {
  content: '';
  position: absolute;
  bottom: 12px;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 340px;
  margin: 0 auto 18px;
}

.key {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  color: var(--text);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  height: 58px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
  touch-action: manipulation;
}

.key:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05));
}

.key:active:not(:disabled) {
  transform: scale(0.95);
  background: rgba(77, 226, 255, 0.2);
}

.key.fn {
  font-size: 15px;
  color: var(--muted);
  font-family: var(--font);
}

/* --------------------------------- 对局 --------------------------------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
}

.hud .secret-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 207, 92, 0.1);
  border: 1px solid rgba(255, 207, 92, 0.3);
  color: var(--gold);
  font-size: 12.5px;
}

.hud .secret-chip b {
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.16em;
}

.board {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 860px) {
  .board {
    grid-template-columns: minmax(0, 1fr);
  }
}

.stage {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stage.mine {
  border-color: rgba(77, 226, 255, 0.4);
  box-shadow: 0 0 0 1px rgba(77, 226, 255, 0.18), 0 24px 60px -30px rgba(77, 226, 255, 0.8);
}

.turn-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.target-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 16px;
}

.target-card .label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.14em;
}

.target-card .who {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.target-card .up {
  font-size: 11.5px;
  color: #5b6787;
}

.ring-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto 8px;
}

.ring {
  width: 132px;
  height: 132px;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 7;
}

.ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.2s linear;
}

.ring-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.ring-num b {
  font-family: var(--mono);
  font-size: 32px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ring-num small {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.16em;
}

.ring-wrap.urgent .ring-fill {
  stroke: var(--danger);
}

.ring-wrap.urgent .ring-num b {
  color: var(--danger);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.ring-wrap.idle .ring-num b {
  color: var(--muted);
  font-size: 22px;
}

/* 侧栏 */

.aside {
  display: grid;
  gap: 14px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

.player-row + .player-row {
  margin-top: 2px;
}

.player-row.turn {
  background: rgba(77, 226, 255, 0.09);
  box-shadow: inset 0 0 0 1px rgba(77, 226, 255, 0.28);
}

.player-row .name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.player-row .name small {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pips {
  display: flex;
  gap: 4px;
  flex: none;
}

.pip {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.13);
}

.pip.on {
  background: var(--ok);
  box-shadow: 0 0 10px rgba(70, 230, 160, 0.6);
}

.pip.best {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(255, 207, 92, 0.6);
}

/* 战况流 */

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  max-height: 46vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  padding: 7px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.032);
  animation: slide-in 0.28s ease both;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.feed-item.mine {
  background: rgba(77, 226, 255, 0.075);
}

.feed-item.system {
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  justify-content: center;
  text-align: center;
  padding: 3px 6px;
}

.feed-item.system.warn {
  color: var(--warn);
}

.feed-item.system.good {
  color: var(--ok);
}

.feed-item .who {
  color: var(--muted);
  font-size: 12.5px;
  flex: none;
  max-width: 78px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-chip {
  font-family: var(--mono);
  font-size: 14.5px;
  letter-spacing: 0.14em;
  padding: 2px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  flex: none;
}

.code-chip.win {
  border-color: rgba(255, 207, 92, 0.7);
  color: var(--gold);
  box-shadow: 0 0 20px -4px rgba(255, 207, 92, 0.7);
  animation: pop 0.3s ease;
}

.fb-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  flex: none;
}

.fb-chip.f0 {
  color: #8d9ac0;
  background: rgba(255, 255, 255, 0.06);
}

.fb-chip.f1 {
  color: #7fd0ff;
  background: rgba(77, 226, 255, 0.13);
}

.fb-chip.f2 {
  color: var(--accent);
  background: rgba(77, 226, 255, 0.2);
}

.fb-chip.f3 {
  color: var(--gold);
  background: rgba(255, 207, 92, 0.18);
}

.fb-chip.f4 {
  color: #04121c;
  background: linear-gradient(135deg, var(--gold), #ff9f43);
}

/* -------------------------------- 结算 --------------------------------- */

.winner-card {
  text-align: center;
  padding: 30px 20px 26px;
  position: relative;
  overflow: hidden;
}

.winner-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(420px 200px at 50% 0%, rgba(255, 207, 92, 0.22), transparent 70%);
  pointer-events: none;
}

.crown {
  font-size: 48px;
  line-height: 1;
  animation: bob 2.6s ease-in-out infinite;
  filter: drop-shadow(0 10px 26px rgba(255, 207, 92, 0.6));
}

.winner-card h2 {
  font-size: clamp(24px, 6vw, 34px);
  margin: 14px 0 6px;
  background: linear-gradient(120deg, #fff, var(--gold) 60%, #ff9f43);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.winner-card p {
  color: var(--muted);
  font-size: 13.5px;
}

.reveal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.reveal-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  font-size: 13.5px;
}

.reveal-list .code {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 18px;
  letter-spacing: 0.18em;
  color: var(--accent);
}

.reveal-list li.winner {
  border-color: rgba(255, 207, 92, 0.45);
  background: rgba(255, 207, 92, 0.08);
}

.reveal-list li.winner .code {
  color: var(--gold);
}

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

.actions .btn {
  flex: 1;
  min-width: 140px;
}

/* -------------------------------- 其他 --------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 24px);
  background: rgba(15, 22, 40, 0.96);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 13.5px;
  box-shadow: 0 20px 46px -18px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: all 0.26s ease;
  z-index: 50;
  max-width: min(88vw, 420px);
  text-align: center;
}

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

.toast.bad {
  border-color: rgba(255, 107, 129, 0.5);
  color: #ffd7dd;
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: 13px;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid rgba(255, 181, 71, 0.35);
  background: rgba(255, 181, 71, 0.1);
  color: #ffdCA0;
}

.banner .spinner {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 181, 71, 0.35);
  border-top-color: var(--warn);
  animation: spin 0.8s linear infinite;
  flex: none;
}

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

.waiting-block {
  text-align: center;
  padding: 22px 10px;
  color: var(--muted);
  font-size: 13.5px;
}

.waiting-block .big {
  font-family: var(--mono);
  font-size: 26px;
  color: var(--text);
  letter-spacing: 0.2em;
  margin: 6px 0 12px;
}

.grid-2 {
  display: grid;
  gap: 14px;
}

@media (min-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.self-note {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 14px;
}

.self-note b {
  font-family: var(--mono);
  color: var(--gold);
  letter-spacing: 0.16em;
}

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

.last-guess {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
  margin: -4px 0 10px;
}

.last-guess .fb-chip {
  margin-left: 0;
}

/* --------------------------- 猜测记录（记录表） --------------------------- */

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  max-height: 34vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  animation: slide-in 0.24s ease both;
}

.log-row.win {
  background: rgba(255, 207, 92, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 207, 92, 0.4);
}

.log-n {
  flex: none;
  width: 22px;
  text-align: right;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.log-row .fb-chip {
  margin-left: auto;
}

.log-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

@media (min-width: 720px) {
  .log-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.record-card.winner {
  border-color: rgba(255, 207, 92, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 207, 92, 0.18), var(--shadow);
}

.record-card .section-head h3 {
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 0;
}

/* ------------------------------ 登录 / 我的 ------------------------------ */

.login-tabs {
  display: flex;
  gap: 8px;
  padding: 5px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.login-tab {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.16s ease;
  touch-action: manipulation;
}

.login-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04121c;
}

.me-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.me-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.me-main strong {
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.me-main small {
  color: var(--muted);
  font-size: 12px;
}

.dev-code {
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  background: rgba(255, 207, 92, 0.12);
  border: 1px solid rgba(255, 207, 92, 0.35);
  color: var(--gold);
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
}

.dev-code b {
  font-family: var(--mono);
  font-size: 19px;
  letter-spacing: 0.2em;
  display: inline-block;
  margin-left: 4px;
}

.code-input {
  text-align: center;
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 0.42em;
  padding-left: 0.42em;
}

.logout-row {
  text-align: center;
  margin-top: 22px;
}

/* ------------------------- 手机联机 / 智能设备 ------------------------- */

.url-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.url-chip {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px dashed var(--line-strong);
  background: rgba(0, 0, 0, 0.3);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.16s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.url-chip:active {
  background: rgba(77, 226, 255, 0.12);
  border-style: solid;
}

.url-chip span {
  display: block;
  color: var(--muted);
  font-family: var(--font);
  font-size: 11.5px;
  margin-top: 2px;
}

.btn,
.key,
.seg-btn,
.icon-btn,
.url-chip,
summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* 轮到自己时轻微呼吸，手机上一眼能看到 */
.stage.mine {
  animation: mine-glow 2.6s ease-in-out infinite;
}

@keyframes mine-glow {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(77, 226, 255, 0.18), 0 24px 60px -30px rgba(77, 226, 255, 0.8);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(77, 226, 255, 0.45), 0 26px 70px -26px rgba(77, 226, 255, 1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .stage.mine {
    animation: none;
  }
}

/* 小屏手机：留足拇指区，键盘按钮更大 */
@media (max-width: 420px) {
  .otp-box {
    width: 54px;
    height: 66px;
    font-size: 28px;
  }

  .app {
    padding-top: calc(18px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .key {
    height: 62px;
    font-size: 24px;
  }

  .keypad {
    max-width: none;
    gap: 9px;
  }

  .btn {
    padding: 14px 18px;
  }

  .ring-wrap,
  .ring {
    width: 116px;
    height: 116px;
  }

  .ring-num b {
    font-size: 28px;
  }

  .feed-list {
    max-height: 38vh;
  }
}

@media (max-width: 360px) {
  .otp-box {
    width: 46px;
    height: 58px;
    font-size: 24px;
  }

  .otp {
    gap: 8px;
  }
}

/* 横屏手机：压缩纵向留白，把键盘留在视野内 */
@media (max-height: 560px) and (orientation: landscape) {
  .hero {
    padding: 6px 0 12px;
  }

  .logo {
    font-size: 28px;
  }

  .ring-wrap,
  .ring {
    width: 92px;
    height: 92px;
  }

  .key {
    height: 46px;
    font-size: 19px;
  }

  .otp-box {
    width: 46px;
    height: 56px;
    font-size: 24px;
  }

  .otp {
    margin: 10px 0;
  }
}
