/* ---- style.css ---- */
:root {
  --bg: #FFF6E5;
  --ink: #2B2340;
  --ink-2: #6B6380;
  --line: #2B2340;
  --card: #FFFFFF;
  --coral: #FF6B6B;
  --coral-d: #E85555;
  --mint: #3CCFB4;
  --mint-l: #D9F7F0;
  --sun: #FFD84D;
  --sun-l: #FFF1B8;
  --grape: #8C7BFF;
  --grape-l: #ECE8FF;
  --pink-l: #FFE1E1;
  --radius: 20px;
  --shadow: 4px 4px 0 var(--line);
  --shadow-s: 3px 3px 0 var(--line);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- background ---------- */
#bg-deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
.b1 { width: 260px; height: 260px; background: var(--sun-l); top: -80px; right: -70px; }
.b2 { width: 200px; height: 200px; background: var(--mint-l); bottom: 60px; left: -90px; }
.b3 { width: 140px; height: 140px; background: var(--grape-l); bottom: -40px; right: 20px; }

.app {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
}

/* ---------- boot ---------- */
.boot { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.boot-logo { font-size: 34px; font-weight: 900; letter-spacing: 1px; }
.boot-dots { display: flex; gap: 8px; }
.boot-dots i, .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink); display: inline-block; animation: bounce 1s infinite ease-in-out; }
.boot-dots i:nth-child(2), .dots i:nth-child(2) { animation-delay: .15s; }
.boot-dots i:nth-child(3), .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .35; } 40% { transform: translateY(-7px); opacity: 1; } }
.dots { display: inline-flex; gap: 5px; vertical-align: middle; }
.dots i { width: 6px; height: 6px; }

/* ---------- common ---------- */
.card {
  background: var(--card);
  border: 2.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.label { font-size: 14px; font-weight: 700; margin-bottom: 8px; display: block; }

.btn {
  appearance: none; border: 2.5px solid var(--line); border-radius: 16px;
  background: var(--card); box-shadow: var(--shadow-s);
  padding: 14px 18px; font-size: 17px; font-weight: 800; cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .2s, opacity .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; user-select: none;
}
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--coral); color: #fff; }
.btn-mint { background: var(--mint); color: var(--ink); }
.btn-sun { background: var(--sun); }
.btn-grape { background: var(--grape); color: #fff; }
.btn-ghost { background: transparent; box-shadow: none; border-style: dashed; font-weight: 700; font-size: 15px; padding: 11px 14px; }
.btn-ghost:active:not(:disabled) { transform: none; }
.btn-sm { padding: 9px 12px; font-size: 14px; border-radius: 12px; width: auto; }
.btn-link { background: none; border: none; box-shadow: none; padding: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; width: auto; cursor: pointer; }

.input {
  width: 100%; border: 2.5px solid var(--line); border-radius: 14px; background: #fff;
  padding: 13px 14px; font-size: 17px; font-weight: 600; outline: none;
  transition: box-shadow .15s;
}
.input:focus { box-shadow: 0 0 0 4px var(--sun-l); }
.input::placeholder { color: #B5AEC4; font-weight: 500; }

.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.seg button {
  border: 2.5px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 0;
  font-weight: 800; font-size: 14px; cursor: pointer;
}
.seg button.on { background: var(--sun); box-shadow: var(--shadow-s); }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px;
  border: 2px solid var(--line); font-size: 12.5px; font-weight: 800; background: #fff; white-space: nowrap;
}
.tag.mint { background: var(--mint-l); }
.tag.sun { background: var(--sun-l); }
.tag.pink { background: var(--pink-l); }
.tag.grape { background: var(--grape-l); }
.tag.gray { background: #F1EFF5; color: var(--ink-2); border-color: #B5AEC4; }

/* ---------- home ---------- */
.hero { text-align: center; padding: 18px 0 8px; }
.logo { font-size: 44px; font-weight: 900; line-height: 1.05; letter-spacing: 1px; position: relative; display: inline-block; }
.logo .q { color: var(--coral); display: inline-block; animation: wobble 2.4s infinite ease-in-out; transform-origin: 50% 80%; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-8deg); } 60% { transform: rotate(4deg); } }
.logo-sub { margin-top: 10px; font-size: 15px; color: var(--ink-2); font-weight: 600; }
.bubbles { display: flex; justify-content: center; gap: 10px; margin: 16px 0 4px; }
.bubble {
  border: 2.5px solid var(--line); border-radius: 16px; padding: 8px 14px; font-weight: 900; font-size: 18px; box-shadow: var(--shadow-s);
  position: relative;
}
.bubble.l { background: var(--mint); transform: rotate(-5deg); animation: bumpL 2.6s infinite ease-in-out; }
.bubble.r { background: var(--sun); transform: rotate(5deg); animation: bumpR 2.6s infinite ease-in-out; }
.bubble.m { background: var(--coral); color: #fff; animation: pop 2.6s infinite ease-in-out; }
@keyframes bumpL { 0%, 100% { transform: rotate(-5deg) translateX(0); } 50% { transform: rotate(-5deg) translateX(6px); } }
@keyframes bumpR { 0%, 100% { transform: rotate(5deg) translateX(0); } 50% { transform: rotate(5deg) translateX(-6px); } }
@keyframes pop { 0%, 40%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }

.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.rule { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 8px; text-align: center; }
.rule b { display: block; font-size: 22px; margin-bottom: 2px; }
.rule span { font-size: 12.5px; font-weight: 700; line-height: 1.35; display: block; }

.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, #C9C2D6 0 6px, transparent 6px 11px); }

/* ---------- lobby ---------- */
.room-code {
  font-size: 40px; font-weight: 900; letter-spacing: 8px; text-align: center;
  font-family: "SF Mono", ui-monospace, Menlo, monospace; padding: 6px 0 2px;
}
.invite-box {
  border: 2px dashed var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; word-break: break-all;
  background: #FFFBF2; color: var(--ink-2); user-select: all; -webkit-user-select: all;
}
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.player { text-align: center; }
.avatar {
  width: 72px; height: 72px; margin: 0 auto 8px; border-radius: 50%; border: 2.5px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 900; box-shadow: var(--shadow-s);
}
.avatar.a { background: var(--mint); }
.avatar.b { background: var(--sun); }
.avatar.empty { background: #fff; border-style: dashed; box-shadow: none; color: #B5AEC4; animation: breathe 1.6s infinite ease-in-out; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.player .name { font-weight: 800; font-size: 15px; max-width: 130px; margin: 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-mark { font-weight: 900; font-size: 22px; color: var(--coral); }

/* ---------- play ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.round-badge {
  background: var(--ink); color: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 900; font-size: 15px;
  box-shadow: 3px 3px 0 var(--coral);
}
.timer { position: relative; width: 46px; height: 46px; flex: none; }
.timer svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.timer .t-bg { fill: #fff; stroke: var(--line); stroke-width: 2.5; }
.timer .t-fg { fill: none; stroke: var(--mint); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.timer .t-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; }
.timer.warn .t-fg { stroke: var(--coral); }
.timer.warn .t-num { color: var(--coral-d); animation: tick 1s infinite; }
@keyframes tick { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }

.status-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pstat {
  background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 9px 10px; display: flex; align-items: center; gap: 8px; min-width: 0;
}
.pstat .dot { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; flex: none; }
.pstat .dot.a { background: var(--mint); }
.pstat .dot.b { background: var(--sun); }
.pstat .meta { min-width: 0; }
.pstat .nm { font-weight: 800; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pstat .st { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-top: 1px; }
.pstat .st.ok { color: #13A58A; }
.pstat .st.off { color: var(--coral-d); }

.clue {
  background: var(--grape-l); border: 2.5px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.clue-title { font-size: 13px; font-weight: 800; color: var(--ink-2); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.clue-words { display: flex; align-items: center; justify-content: center; gap: 10px; }
.clue-word {
  flex: 1; max-width: 44%; background: #fff; border: 2.5px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center;
  font-size: 22px; font-weight: 900; word-break: break-all; position: relative;
}
.clue-word small { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-2); margin-top: 3px; }
.clue-word.empty { color: #B5AEC4; font-size: 16px; }
.clue-plus { font-weight: 900; font-size: 22px; color: var(--grape); }
.clue-hint { text-align: center; margin-top: 10px; font-size: 13.5px; font-weight: 700; }
.first-clue { text-align: center; padding: 6px 0; }
.first-clue .big { font-size: 22px; font-weight: 900; margin-bottom: 4px; }

.history-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 210px; overflow-y: auto; }
.h-item { display: grid; grid-template-columns: 38px 1fr 1fr; gap: 8px; align-items: center; font-size: 14px; font-weight: 700; }
.h-item .r { font-size: 12px; color: var(--ink-2); font-weight: 800; }
.h-item .w { background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 5px 8px; text-align: center; word-break: break-all; }
.h-item .w.empty { color: #B5AEC4; border-color: #B5AEC4; }

.compose .input { font-size: 22px; text-align: center; padding: 16px 14px; font-weight: 800; }
.counter { text-align: right; font-size: 12px; color: var(--ink-2); font-weight: 700; margin-top: 6px; }
.err { color: var(--coral-d); font-size: 13.5px; font-weight: 700; min-height: 18px; margin-top: 4px; text-align: center; }
#h-err:empty, #j-err:empty { display: none; }
a.btn { color: var(--ink); }

.locked { text-align: center; padding: 22px 16px; }
.locked .seal {
  display: inline-block; padding: 12px 22px; border: 2.5px solid var(--line); border-radius: 16px; background: var(--mint);
  font-size: 26px; font-weight: 900; box-shadow: var(--shadow-s); transform: rotate(-2deg); margin: 6px 0 14px; word-break: break-all;
}
.locked .wait { font-weight: 800; font-size: 15px; }

.giveup-wrap { margin-top: auto; padding-top: 18px; text-align: center; }

/* ---------- reveal ---------- */
.reveal-head { text-align: center; margin: 4px 0 18px; }
.reveal-head .t { font-size: 28px; font-weight: 900; }
.reveal-head .s { font-size: 14px; color: var(--ink-2); font-weight: 700; margin-top: 6px; }
.flip-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; perspective: 900px; }
.flip { position: relative; height: 150px; }
.flip-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.3, 1.4, .5, 1); }
.flip.open .flip-inner { transform: rotateY(180deg); }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 2.5px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10px; text-align: center;
}
.flip-front { background: repeating-linear-gradient(45deg, var(--grape) 0 12px, #9D8EFF 12px 24px); color: #fff; font-size: 40px; font-weight: 900; }
.flip-back { transform: rotateY(180deg); background: #fff; }
.flip-back .w { font-size: 28px; font-weight: 900; word-break: break-all; line-height: 1.15; }
.flip-back .w.empty { font-size: 18px; color: #B5AEC4; }
.flip-back .who { margin-top: 10px; font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--line); }
.flip.a .flip-back .who { background: var(--mint-l); }
.flip.b .flip-back .who { background: var(--sun-l); }
.flip.hit .flip-back { background: var(--sun); animation: hitpulse .6s .8s both; }
@keyframes hitpulse { 0% { transform: rotateY(180deg) scale(1); } 50% { transform: rotateY(180deg) scale(1.08); } 100% { transform: rotateY(180deg) scale(1); } }

.decide { display: flex; flex-direction: column; gap: 12px; }
.decide-note { text-align: center; font-size: 13.5px; font-weight: 700; color: var(--ink-2); min-height: 20px; }
.decide-note.hl { color: var(--ink); }

.boom { text-align: center; font-size: 40px; font-weight: 900; color: var(--coral); animation: boomIn .5s .9s both cubic-bezier(.3, 1.6, .5, 1); }
@keyframes boomIn { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 100% { transform: scale(1) rotate(-4deg); opacity: 1; } }

/* ---------- result ---------- */
.result-hero { text-align: center; padding: 10px 0 4px; }
.result-hero .kicker { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.result-hero .num { font-size: 64px; font-weight: 900; line-height: 1; margin: 8px 0 4px; }
.result-hero .num em { font-style: normal; color: var(--coral); }
.result-hero .num small { font-size: 24px; font-weight: 900; }
.result-hero .num em { font-size: 72px; }
.title-badge {
  display: inline-block; margin-top: 10px; padding: 9px 18px; background: var(--sun); border: 2.5px solid var(--line); border-radius: 999px;
  font-size: 20px; font-weight: 900; box-shadow: var(--shadow-s); transform: rotate(-2deg);
}
.result-hero .quote { margin-top: 12px; font-size: 14.5px; font-weight: 700; color: var(--ink-2); }
.pair-names { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 12px; font-weight: 800; }

.chain { display: flex; flex-direction: column; gap: 10px; }
.chain-head { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 8px; font-size: 12.5px; font-weight: 800; color: var(--ink-2); text-align: center; }
.chain-item { display: grid; grid-template-columns: 44px 1fr 1fr; gap: 8px; align-items: stretch; }
.chain-item .r {
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 900; border-radius: 10px; background: var(--ink); color: #fff;
}
.chain-item .w {
  border: 2px solid var(--line); border-radius: 12px; padding: 9px 6px; text-align: center; font-weight: 800; font-size: 16px; background: #fff; word-break: break-all;
}
.chain-item .w.a { background: var(--mint-l); }
.chain-item .w.b { background: var(--sun-l); }
.chain-item .w.empty { color: #B5AEC4; background: #fff; border-color: #B5AEC4; font-size: 14px; }
.chain-item.hit .w { background: var(--sun); box-shadow: var(--shadow-s); }
.chain-item.hit .r { background: var(--coral); }
.chain-note { font-size: 12px; font-weight: 700; color: var(--ink-2); grid-column: 2 / 4; text-align: center; margin-top: -4px; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- toast / modal ---------- */
.toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 800; font-size: 14.5px; max-width: 88vw;
  box-shadow: 3px 3px 0 var(--coral); animation: toastIn .3s cubic-bezier(.3, 1.5, .5, 1);
}
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { transform: translateY(20px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(14px); opacity: 0; } }

.net-banner {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  background: var(--coral); color: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 7px 16px; font-size: 13px; font-weight: 800;
}

.modal { position: fixed; inset: 0; z-index: 60; background: rgba(43, 35, 64, .45); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .2s; }
.modal-card { width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto; }
.modal-card h3 { margin: 0 0 8px; font-size: 20px; font-weight: 900; }
.modal-card p { margin: 0 0 16px; color: var(--ink-2); font-weight: 600; font-size: 14.5px; line-height: 1.5; }
.share-img { width: 100%; border-radius: 14px; border: 2.5px solid var(--line); display: block; margin-bottom: 12px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 45; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border: 1.5px solid var(--line); border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }

.fade-in { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.state-page { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 16px; text-align: center; }
.state-page .emoji { font-size: 56px; }
.state-page h2 { margin: 0; font-size: 24px; font-weight: 900; }
.state-page p { margin: 0; color: var(--ink-2); font-weight: 600; }

@media (max-width: 360px) {
  .logo { font-size: 38px; }
  .room-code { font-size: 32px; letter-spacing: 6px; }
  .flip-back .w { font-size: 22px; }
}

/* ================= v6：多人 / 众里寻TA ================= */
:root { --peach: #FF9EBB; --peach-l: #FFE1EA; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  text-align: left; background: #fff; border: 2.5px solid var(--line); border-radius: 16px; padding: 12px;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: transform .08s, box-shadow .15s, background .2s;
}
.mode-card b { font-size: 17px; font-weight: 900; }
.mode-card em { font-style: normal; align-self: flex-start; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border: 2px solid var(--line); border-radius: 999px; background: #fff; }
.mode-card span { font-size: 12.5px; color: var(--ink-2); font-weight: 600; line-height: 1.45; }
.mode-card.on { background: var(--sun-l); box-shadow: var(--shadow-s); }
.mode-card.on b::before { content: "✓ "; color: var(--coral); }
.hint-line { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; line-height: 1.5; }

.slots-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slots-grid .avatar { width: 56px; height: 56px; font-size: 24px; }
.slots-grid .player .name { font-size: 13.5px; max-width: 76px; }
.avatar.c { background: var(--peach); }
.avatar.d { background: var(--grape); color: #fff; }
.pstat .dot.c, .dot-s.c { background: var(--peach); }
.pstat .dot.d, .dot-s.d { background: var(--grape); color: #fff; }
.dot-s { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); margin-right: 6px; vertical-align: -1px; }
.dot-s.a { background: var(--mint); } .dot-s.b { background: var(--sun); }

.status-row.n3 { grid-template-columns: repeat(3, 1fr); gap: 7px; }
.status-row.n4 { grid-template-columns: repeat(2, 1fr); gap: 7px; }
.status-row.n3 .pstat { padding: 7px; gap: 6px; }
.status-row.n3 .pstat .dot { width: 26px; height: 26px; font-size: 12px; }
.status-row.n3 .pstat .nm { font-size: 12.5px; }

.clue-grid { display: grid; gap: 8px; }
.clue-grid.n3 { grid-template-columns: repeat(3, 1fr); }
.clue-grid.n4 { grid-template-columns: repeat(2, 1fr); }
.clue-grid .clue-word { max-width: none; font-size: 18px; padding: 10px 6px; }
.clue-word.hit { background: var(--sun); }

.flip-row.n3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.flip-row.n4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.flip-row.n3 .flip, .flip-row.n4 .flip { height: 140px; }
.flip-row.n3 .flip-back .w { font-size: 19px; }
.flip-row.n4 .flip-back .w { font-size: 22px; }
.flip-row.n3 .flip-front, .flip-row.n4 .flip-front { font-size: 32px; }
.flip-row.n3 .flip-back .who { font-size: 11px; padding: 2px 6px; margin-top: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flip.c .flip-back .who { background: var(--peach-l); }
.flip.d .flip-back .who { background: var(--grape-l); }
.flip.hit .flip-back { background: var(--sun); }

.claim-btn {
  margin-top: 8px; border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 5px 8px;
  font-size: 12px; font-weight: 800; cursor: pointer; line-height: 1.3; max-width: 100%;
}
.claim-btn.mine { background: var(--mint-l); }
.claim-btn.ask { background: var(--coral); color: #fff; animation: askPulse 1.2s infinite; }
@keyframes askPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,107,107,.55); } 50% { box-shadow: 0 0 0 6px rgba(255,107,107,0); } }
.claim-btn.done { background: var(--ink); color: #fff; }
.claim-btn.off { border-color: #B5AEC4; color: #B5AEC4; }
.flip-row.n3 .claim-btn { font-size: 11px; padding: 4px 5px; }

.cr-score { padding: 14px 16px; margin-bottom: 14px; }
.score-line { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 0; font-weight: 800; font-size: 14.5px; border-bottom: 2px dashed #EEE9F3; }
.score-line:last-child { border-bottom: none; }
.score-line .tag { margin-left: 4px; }

.best-cp { margin-top: 14px; }
.cp-pair { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 6px; }
.cp-pair .tag { font-size: 15px; padding: 6px 12px; }
.cp-pair .heart { color: var(--coral); font-size: 20px; animation: tick 1.2s infinite; }
.tag.al { background: var(--mint-l); } .tag.bl { background: var(--sun-l); }
.tag.cl { background: var(--peach-l); } .tag.dl { background: var(--grape-l); }

.my-cp { text-align: center; background: var(--peach-l); }
.my-cp .label { margin-bottom: 4px; }
.my-cp-name { font-size: 24px; font-weight: 900; margin: 4px 0; }

.cp-row { display: grid; grid-template-columns: 1fr 1.1fr 30px; gap: 10px; align-items: center; padding: 6px 0; }
.cp-row-name { font-weight: 800; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-bar { height: 14px; background: #F1EFF5; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.cp-bar i { display: block; height: 100%; background: var(--coral); border-radius: 999px; }
.cp-row-num { font-weight: 900; text-align: right; }

.chain-item .w.c { background: var(--peach-l); }
.chain-item .w.d { background: var(--grape-l); }
.chain-item .w.paired { background: var(--sun); box-shadow: 2px 2px 0 var(--line); }
.chain-item .w { font-size: 14px; padding: 8px 4px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-item .w.hit { background: var(--sun); }

.share-scroll { max-height: 62vh; overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: 14px; }
.share-scroll .share-img { margin-bottom: 0; }

.rank-special { text-align: center; background: var(--sun-l); border: 2.5px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow-s); }
.rank-special b { display: block; font-size: 22px; font-weight: 900; }
.rank-special span { display: block; font-size: 12.5px; color: var(--ink-2); font-weight: 700; margin-top: 2px; }
.score-line .rank-title { font-size: 11.5px; padding: 3px 8px; margin-left: 6px; }

/* ================= v17：2 人模式 + 3–8 人 =================
   座位色从 4 个补到 8 个；5 人以上的网格单独给一套尺寸，
   否则 8 张词卡挤在 4 栏里，字会横向溢出。 */
:root {
  --sky: #6EC1FF;  --sky-l: #DCEEFF;
  --lime: #A6E36B; --lime-l: #E9F9D4;
  --amber: #FFA45B; --amber-l: #FFE8D5;
  --slate: #9AA7C7; --slate-l: #E6EAF3;
}

/* ---------- 座位色（e–h） ---------- */
.avatar.e { background: var(--sky); }
.avatar.f { background: var(--lime); }
.avatar.g { background: var(--amber); }
.avatar.h { background: var(--slate); color: #fff; }
.pstat .dot.e, .dot-s.e { background: var(--sky); }
.pstat .dot.f, .dot-s.f { background: var(--lime); }
.pstat .dot.g, .dot-s.g { background: var(--amber); }
.pstat .dot.h, .dot-s.h { background: var(--slate); color: #fff; }
.flip.e .flip-back .who { background: var(--sky-l); }
.flip.f .flip-back .who { background: var(--lime-l); }
.flip.g .flip-back .who { background: var(--amber-l); }
.flip.h .flip-back .who { background: var(--slate-l); }
.tag.el { background: var(--sky-l); }
.tag.fl { background: var(--lime-l); }
.tag.gl { background: var(--amber-l); }
.tag.hl { background: var(--slate-l); }
.chain-item .w.e { background: var(--sky-l); }
.chain-item .w.f { background: var(--lime-l); }
.chain-item .w.g { background: var(--amber-l); }
.chain-item .w.h { background: var(--slate-l); }

/* ---------- 出词页：5–8 人状态卡与线索卡 ---------- */
.status-row.n5, .status-row.n6, .status-row.n7, .status-row.n8 {
  grid-template-columns: repeat(2, 1fr); gap: 7px;
}
.status-row.n5 .pstat, .status-row.n6 .pstat,
.status-row.n7 .pstat, .status-row.n8 .pstat { padding: 7px 8px; gap: 6px; }
.status-row.n5 .pstat .dot, .status-row.n6 .pstat .dot,
.status-row.n7 .pstat .dot, .status-row.n8 .pstat .dot { width: 26px; height: 26px; font-size: 12px; }
.status-row.n5 .pstat .nm, .status-row.n6 .pstat .nm,
.status-row.n7 .pstat .nm, .status-row.n8 .pstat .nm { font-size: 12.5px; }

.clue-grid.n5, .clue-grid.n6 { grid-template-columns: repeat(3, 1fr); }
.clue-grid.n7, .clue-grid.n8 { grid-template-columns: repeat(2, 1fr); }
.clue-grid.n5 .clue-word, .clue-grid.n6 .clue-word,
.clue-grid.n7 .clue-word, .clue-grid.n8 .clue-word { font-size: 16px; padding: 9px 5px; }

/* ---------- 揭晓页：翻牌网格 ---------- */
.flip-row.n5, .flip-row.n6 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.flip-row.n7, .flip-row.n8 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
.flip-row.n5 .flip, .flip-row.n6 .flip { height: 132px; }
.flip-row.n7 .flip, .flip-row.n8 .flip { height: 140px; }
.flip-row.n5 .flip-front, .flip-row.n6 .flip-front,
.flip-row.n7 .flip-front, .flip-row.n8 .flip-front { font-size: 30px; }
.flip-row.n5 .flip-back .w, .flip-row.n6 .flip-back .w { font-size: 17px; }
.flip-row.n7 .flip-back .w, .flip-row.n8 .flip-back .w { font-size: 21px; }
.flip-row.n5 .flip-back .who, .flip-row.n6 .flip-back .who,
.flip-row.n7 .flip-back .who, .flip-row.n8 .flip-back .who {
  font-size: 11px; padding: 2px 6px; margin-top: 6px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.flip-row.n5 .claim-btn, .flip-row.n6 .claim-btn { font-size: 10.5px; padding: 4px 4px; margin-top: 6px; }
.flip-row.n7 .claim-btn, .flip-row.n8 .claim-btn { font-size: 11.5px; padding: 5px 6px; margin-top: 6px; }

/* ---------- 结算页：每局记录表格（人越多列越窄，字号跟着收） ---------- */
.chain.n5 .chain-item .w, .chain.n6 .chain-item .w { font-size: 13px; padding: 8px 4px; }
.chain.n7 .chain-item .w, .chain.n8 .chain-item .w { font-size: 11px; padding: 7px 2px; }
.chain.n5 .chain-head, .chain.n6 .chain-head { font-size: 11.5px; }
.chain.n7 .chain-head, .chain.n8 .chain-head { font-size: 10.5px; }
.chain.n7 .chain-item, .chain.n8 .chain-item { gap: 5px; }
.chain.n7 .chain-head, .chain.n8 .chain-head { gap: 5px; }
.chain.n5 .chain-item .r, .chain.n6 .chain-item .r,
.chain.n7 .chain-item .r, .chain.n8 .chain-item .r { font-size: 12px; }

/* 8 人时 CP 榜与个人分一行放不下，允许横向省略而不是换行挤爆 */
.cp-row-name { min-width: 0; }
.score-line { min-width: 0; }
.score-line > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- style-memphis.css ---- */
/* ==========================================================================
   默契猜词 · Memphis 皮肤
   只覆盖视觉层：颜色、描边、阴影、字体与装饰；不改布局、DOM 和玩法逻辑。
   加载顺序必须放在 style.css 之后。
   ========================================================================== */

:root {
  --bg: #FFF3DC;
  --paper: #FFF3DC;
  --paper-2: #FFFDF6;
  --ink: #121212;
  --ink-2: #5B5145;
  --line: #121212;
  --card: #FFFDF6;

  /* 第一版高饱和孟菲斯配色 */
  --coral: #FF3D7F;
  --coral-d: #C2185B;
  --mint: #1FD3A3;
  --mint-l: #C9FFF2;
  --sun: #FFD43B;
  --sun-l: #FFF2AC;
  --grape: #A98BFF;
  --grape-l: #EDE6FF;
  --pink-l: #FFD7E2;

  /* 8 个座位色：薄荷 / 太阳 / 粉 / 葡萄 / 电蓝 / 青柠 / 琥珀 / 石板 */
  --peach: #FF3D7F;
  --peach-l: #FFD7E2;
  --sky: #2F5BFF;
  --sky-l: #DCE4FF;
  --lime: #A6E36B;
  --lime-l: #ECFFD4;
  --amber: #FFA45B;
  --amber-l: #FFE8D5;
  --slate: #9AA7C7;
  --slate-l: #E6EAF3;

  --radius: 18px;
  --shadow: 6px 6px 0 var(--line);
  --shadow-s: 4px 4px 0 var(--line);
  --shadow-l: 8px 8px 0 var(--line);

  --font-mem: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono-mem: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

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

body {
  background-color: var(--bg);
  background-image: radial-gradient(rgba(18, 18, 18, 0.09) 1.1px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-mem);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--sun);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   背景：固定几何贴纸，不压正文
   -------------------------------------------------------------------------- */
#bg-deco {
  background: none;
}

#bg-deco .blob {
  filter: none;
  opacity: 1;
  border: 3px solid var(--ink);
  border-radius: 50%;
}

#bg-deco .b1 {
  width: 140px;
  height: 140px;
  background: var(--coral);
  top: -78px;
  right: -68px;
}

#bg-deco .b2 {
  width: 120px;
  height: 120px;
  background: var(--sky);
  bottom: 92px;
  left: -82px;
}

#bg-deco .b3 {
  width: 86px;
  height: 86px;
  background: conic-gradient(var(--ink) 25%, var(--sun) 0 50%, var(--ink) 0 75%, var(--sun) 0) 0 0 / 16px 16px;
  border-radius: 0;
  bottom: -16px;
  right: 12px;
  transform: rotate(8deg);
}

#bg-deco::before,
#bg-deco::after {
  content: "";
  position: absolute;
  display: block;
}

#bg-deco::before {
  width: 112px;
  height: 38px;
  left: -10px;
  bottom: 28%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 16'%3E%3Cpath d='M2 13 10 3l8 10L26 3l8 10L42 3' fill='none' stroke='%23FF7A18' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: rotate(9deg);
}

#bg-deco::after {
  width: 70px;
  height: 70px;
  right: 4px;
  top: 38%;
  background-image: radial-gradient(rgba(18, 18, 18, 0.5) 1.7px, transparent 1.9px);
  background-size: 10px 10px;
}

/* --------------------------------------------------------------------------
   通用
   -------------------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 3.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stack { gap: 14px; }

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

.label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.label::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--coral);
  border: 2px solid var(--line);
  transform: rotate(45deg);
}

/* --------------------------------------------------------------------------
   按钮
   -------------------------------------------------------------------------- */
.btn {
  background: var(--paper-2);
  border: 3.5px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-s);
  font-weight: 900;
  letter-spacing: 0.02em;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.18s ease, opacity 0.18s ease;
}

.btn:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--line);
}

.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--line);
}

.btn-primary {
  background: var(--coral);
  color: var(--ink);
}

.btn-mint {
  background: var(--mint);
  color: var(--ink);
}

.btn-sun {
  background: var(--sun);
  color: var(--ink);
}

.btn-grape {
  background: var(--grape);
  color: var(--ink);
}

.btn-sm {
  width: auto;
  padding: 10px 12px;
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--line);
  font-size: 13.5px;
}

.btn-ghost {
  background: transparent;
  border: 2.5px dashed var(--line);
  box-shadow: none;
}

.btn-ghost:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}

.btn-link {
  color: var(--ink-2);
  font-weight: 800;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 2px;
}

/* --------------------------------------------------------------------------
   输入 / 分段 / 标签 / 分隔
   -------------------------------------------------------------------------- */
.input {
  background: #FFFFFF;
  border: 3px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
  outline: none;
  transition: box-shadow 0.12s ease, transform 0.12s ease;
}

.input::placeholder { color: #8A8071; font-weight: 600; }

.input:focus {
  outline: 3px solid var(--sky);
  outline-offset: 1px;
  box-shadow: 4px 4px 0 var(--sky);
  transform: translate(-1px, -1px);
}

.seg { gap: 7px; }

.seg button {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 900;
  padding: 11px 0;
  box-shadow: 2px 2px 0 transparent;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.18s ease;
}

.seg button:hover { background: #FFFFFF; }

.seg button.on {
  background: var(--sun);
  box-shadow: 3px 3px 0 var(--line);
  transform: rotate(-1deg);
}

.seg button.on:hover { background: var(--sun); }

.tag {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  box-shadow: 1.5px 1.5px 0 var(--line);
  font-weight: 900;
}

.tag.mint { background: var(--mint); }
.tag.sun { background: var(--sun); }
.tag.pink { background: var(--coral); }
.tag.grape { background: var(--grape); }
.tag.gray {
  background: #F2E7D5;
  color: var(--ink-2);
  border-color: var(--line);
  box-shadow: none;
}

.divider {
  color: var(--ink-2);
  font-weight: 800;
}

.divider::before,
.divider::after {
  height: 0;
  border-top: 3px dashed rgba(18, 18, 18, 0.55);
  background: none;
}

/* --------------------------------------------------------------------------
   首页
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: 12px 0 10px;
}

.hero::after,
.reveal-head::after,
.result-hero::after {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  background: var(--sun);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  filter: drop-shadow(2px 2px 0 var(--line));
  transform: rotate(12deg);
  pointer-events: none;
}

.hero::after {
  top: 24px;
  left: 2px;
  right: auto;
}

.logo {
  display: inline-block;
  font-size: clamp(40px, 11vw, 48px);
  font-weight: 900;
  line-height: 1.06;
  letter-spacing: -2.5px;
  color: var(--paper-2);
  -webkit-text-stroke: 2.5px var(--line);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--coral);
}

.logo .q {
  display: inline-block;
  color: var(--coral);
  -webkit-text-stroke: 2.5px var(--line);
  text-shadow: 2px 2px 0 var(--sun);
}

@supports not (-webkit-text-stroke: 1px #000) {
  .logo { color: var(--ink); text-shadow: 4px 4px 0 var(--coral); }
  .logo .q { color: var(--coral); text-shadow: 2px 2px 0 var(--sun); }
}

.logo-sub {
  margin-top: 10px;
  color: #3A3328;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.65;
}

.bubbles { gap: 8px; margin-top: 16px; }

.bubble {
  border: 3px solid var(--line);
  border-radius: 14px 18px 12px 16px;
  box-shadow: var(--shadow-s);
  font-size: 18px;
  font-weight: 900;
}

.bubble.l { background: var(--mint); color: var(--ink); }
.bubble.m { background: var(--coral); color: var(--ink); }
.bubble.r { background: var(--sun); color: var(--ink); }

.mode-grid { gap: 12px; }

.mode-card {
  position: relative;
  background: var(--paper-2);
  border: 3.5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-s);
  padding: 14px 12px;
  transition: transform 0.1s ease, box-shadow 0.12s ease, background 0.18s ease;
}

.mode-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--line);
}

.mode-card b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16.5px;
  font-weight: 900;
  letter-spacing: -0.2px;
}

.mode-card em {
  align-self: flex-start;
  margin-top: 2px;
  padding: 2px 8px;
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  border-radius: 999px;
  box-shadow: 1.5px 1.5px 0 var(--line);
  font-size: 11px;
  font-weight: 900;
}

.mode-card span {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}

.mode-card.on {
  background: var(--sun);
  box-shadow: var(--shadow);
  transform: rotate(-0.6deg);
}

.mode-card.on:hover {
  transform: translate(-1px, -1px) rotate(-0.6deg);
  box-shadow: 7px 7px 0 var(--line);
}

.mode-card.on b::before {
  content: "✓";
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--sun);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.mode-card.on::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 13px;
  height: 13px;
  background: var(--coral);
  border: 2px solid var(--line);
  border-radius: 50%;
  box-shadow: 1px 1px 0 var(--line);
}

.hint-line {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.err {
  color: var(--coral-d);
  font-weight: 800;
}

/* --------------------------------------------------------------------------
   大厅
   -------------------------------------------------------------------------- */
.room-code {
  color: var(--ink);
  font-family: var(--mono-mem);
  font-size: 40px;
  letter-spacing: 6px;
  text-shadow: 4px 4px 0 var(--sun);
}

.invite-box {
  background: var(--paper-2);
  border: 2.5px dashed var(--line);
  border-radius: 10px;
  color: var(--ink-2);
  font-family: var(--mono-mem);
  font-size: 12px;
}

.vs-mark {
  color: var(--coral-d);
  font-size: 24px;
  text-shadow: 2px 2px 0 var(--sun);
}

.player .name { font-weight: 900; }

.avatar {
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
}

.avatar.a { background: var(--mint); color: var(--ink); }
.avatar.b { background: var(--sun); color: var(--ink); }
.avatar.c { background: var(--peach); color: var(--ink); }
.avatar.d { background: var(--grape); color: var(--ink); }
.avatar.e { background: var(--sky); color: var(--paper-2); }
.avatar.f { background: var(--lime); color: var(--ink); }
.avatar.g { background: var(--amber); color: var(--ink); }
.avatar.h { background: var(--slate); color: var(--paper-2); }

.avatar.empty {
  background: var(--paper-2);
  border-style: dashed;
  box-shadow: none;
  color: #8A8071;
}

/* 8 个座位的小圆点同步配色 */
.pstat .dot.a, .dot-s.a { background: var(--mint); }
.pstat .dot.b, .dot-s.b { background: var(--sun); }
.pstat .dot.c, .dot-s.c { background: var(--peach); }
.pstat .dot.d, .dot-s.d { background: var(--grape); color: var(--ink); }
.pstat .dot.e, .dot-s.e { background: var(--sky); color: var(--paper-2); }
.pstat .dot.f, .dot-s.f { background: var(--lime); }
.pstat .dot.g, .dot-s.g { background: var(--amber); }
.pstat .dot.h, .dot-s.h { background: var(--slate); color: var(--paper-2); }

/* --------------------------------------------------------------------------
   出词页
   -------------------------------------------------------------------------- */
.topbar { margin-bottom: 12px; }

.round-badge {
  background: var(--ink);
  color: var(--paper-2);
  border: 2.5px solid var(--line);
  box-shadow: 3px 3px 0 var(--coral);
}

.timer {
  filter: drop-shadow(3px 3px 0 var(--line));
}

.timer .t-bg {
  fill: var(--paper-2);
  stroke: var(--line);
  stroke-width: 3;
}

.timer .t-fg { stroke: var(--mint); stroke-width: 5; }
.timer.warn .t-fg { stroke: var(--coral); }
.timer.warn .t-num { color: var(--coral-d); }

.status-row { gap: 10px; }

.pstat {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 2.5px 2.5px 0 var(--line);
}

.pstat .dot { border: 2.5px solid var(--line); }
.pstat .st.ok { color: #0A7A64; }
.pstat .st.off { color: var(--coral-d); }

.clue {
  background: var(--sun-l);
  border: 3.5px solid var(--line);
  box-shadow: var(--shadow);
}

.clue-word {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
}

.clue-word.hit { background: var(--sun); }
.clue-plus { color: var(--coral-d); }
.clue-hint { font-weight: 700; }

.history-list { gap: 8px; }

.h-item .w {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
}

.h-item .w.empty {
  color: #8A8071;
  border-color: #8A8071;
}

.compose .input {
  background: #FFFFFF;
  font-size: 24px;
}

.counter { color: var(--ink-2); font-weight: 800; }

.locked .seal {
  background: var(--mint);
  border: 3px solid var(--line);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--line);
  transform: rotate(-2deg);
}

/* --------------------------------------------------------------------------
   揭晓页
   -------------------------------------------------------------------------- */
.reveal-head {
  position: relative;
}

.reveal-head::after {
  top: 2px;
  right: 2px;
  background: var(--sun);
}

.reveal-head .t {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: -1px;
  text-shadow: 3px 3px 0 var(--sun);
}

.reveal-head .s { color: var(--ink-2); font-weight: 700; }

.flip-row { gap: 14px; }

.flip-face {
  border: 3.5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.flip-front {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 50%, var(--paper-2) 0 30%, transparent 31%),
    repeating-linear-gradient(45deg, var(--sky) 0 12px, var(--sun) 12px 24px);
  text-shadow: 3px 3px 0 var(--sun);
}

.flip-back { background: var(--paper-2); color: var(--ink); }

/* 每张牌按座位带一层很浅的底色，打开后整排是彩色贴纸墙；
   命中时统一压到黄色，保证“撞上”比座位色更醒目。 */
.flip.a .flip-back { background: var(--mint-l); }
.flip.b .flip-back { background: var(--sun-l); }
.flip.c .flip-back { background: var(--peach-l); }
.flip.d .flip-back { background: var(--grape-l); }
.flip.e .flip-back { background: var(--sky-l); }
.flip.f .flip-back { background: var(--lime-l); }
.flip.g .flip-back { background: var(--amber-l); }
.flip.h .flip-back { background: var(--slate-l); }

.flip.a .flip-back .who,
.flip.b .flip-back .who,
.flip.c .flip-back .who,
.flip.d .flip-back .who,
.flip.e .flip-back .who,
.flip.f .flip-back .who,
.flip.g .flip-back .who,
.flip.h .flip-back .who {
  background: var(--paper-2);
}

.flip.hit .flip-back {
  background: var(--sun);
  box-shadow: var(--shadow);
}

.flip.hit .flip-back::after {
  content: "撞!";
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  background: var(--coral);
  border: 2.5px solid var(--line);
  border-radius: 6px;
  box-shadow: 2px 2px 0 var(--line);
  font-size: 11px;
  font-weight: 900;
  transform: rotate(6deg);
}

.flip.hit .flip-back .who { background: var(--paper-2); }

.boom {
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--coral);
}

.claim-btn {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
  box-shadow: 2px 2px 0 var(--line);
  font-weight: 800;
}

.claim-btn.mine { background: var(--mint-l); }
.claim-btn.ask {
  background: var(--coral);
  color: var(--ink);
  animation: memAsk 1.2s infinite;
}

@keyframes memAsk {
  0%, 100% { box-shadow: 2px 2px 0 var(--line), 0 0 0 0 rgba(255, 61, 127, 0.5); }
  50% { box-shadow: 2px 2px 0 var(--line), 0 0 0 6px rgba(255, 61, 127, 0); }
}

.claim-btn.done {
  background: var(--ink);
  color: var(--paper-2);
}

.claim-btn.off {
  border-color: #8A8071;
  color: #8A8071;
  box-shadow: none;
}

.decide-note { color: var(--ink-2); font-weight: 700; }

/* --------------------------------------------------------------------------
   结算页
   -------------------------------------------------------------------------- */
.result-hero {
  position: relative;
}

.result-hero::after {
  top: 4px;
  right: 4px;
  background: var(--sun);
}

.result-hero .kicker { color: var(--ink-2); }

.result-hero .num {
  color: var(--ink);
  text-shadow: 5px 5px 0 var(--sun);
}

.result-hero .num em { color: var(--coral); }

.title-badge {
  background: var(--sun);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
  font-weight: 900;
}

.result-hero .quote { color: var(--ink-2); }

.chain-head { color: var(--ink-2); }

.chain-item .r {
  background: var(--ink);
  color: var(--paper-2);
  border-radius: 8px;
}

.chain-item .w {
  background: var(--paper-2);
  border: 2.5px solid var(--line);
}

.chain-item .w.empty {
  color: #8A8071;
  border-color: #8A8071;
  background: var(--paper-2);
}

.chain-item.hit .w {
  background: var(--sun);
  box-shadow: 2px 2px 0 var(--line);
}

.chain-item.hit .r {
  background: var(--coral);
  color: var(--ink);
}

.chain-item .w.paired {
  background: var(--sun);
  box-shadow: 2px 2px 0 var(--line);
}

.cr-score { padding: 14px 16px; }

.score-line {
  border-bottom: 2px dashed rgba(18, 18, 18, 0.22);
}

.cp-bar {
  background: #F3E8D5;
  border: 2.5px solid var(--line);
}

.cp-bar i { background: var(--coral); }

.my-cp {
  background: var(--peach-l);
  border: 3.5px solid var(--line);
  box-shadow: var(--shadow);
}

.my-cp-name { font-weight: 900; }

.rank-special {
  background: var(--sun-l);
  border: 3px solid var(--line);
  box-shadow: 4px 4px 0 var(--line);
}

.best-cp .cp-pair .tag { font-weight: 900; }

.share-img {
  border: 3px solid var(--line);
  border-radius: 14px;
}

/* --------------------------------------------------------------------------
   提示 / 弹窗 / 异常页
   -------------------------------------------------------------------------- */
.toast {
  background: var(--ink);
  color: var(--paper-2);
  border: 2.5px solid var(--paper-2);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--coral);
  font-weight: 800;
}

.net-banner {
  background: var(--coral);
  color: var(--ink);
  border: 2.5px solid var(--line);
  box-shadow: 3px 3px 0 var(--line);
  font-weight: 800;
}

.modal { background: rgba(18, 18, 18, 0.55); }

.modal-card {
  border: 3.5px solid var(--line);
  box-shadow: var(--shadow-l);
}

.modal-card p { color: var(--ink-2); }

.state-page .emoji { filter: drop-shadow(3px 3px 0 var(--coral)); }

.state-page h2 {
  font-size: 28px;
  letter-spacing: -1px;
}

.boot-logo {
  color: var(--paper-2);
  -webkit-text-stroke: 2.5px var(--line);
  font-size: 38px;
  font-weight: 900;
  text-shadow: 4px 4px 0 var(--coral);
}

@supports not (-webkit-text-stroke: 1px #000) {
  .boot-logo { color: var(--ink); text-shadow: 4px 4px 0 var(--coral); }
}

/* --------------------------------------------------------------------------
   可访问性与动效
   -------------------------------------------------------------------------- */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
}

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

@media (max-width: 380px) {
  .room-code { font-size: 34px; letter-spacing: 4px; }
  .mode-card b { font-size: 15.5px; }
  .mode-card span { font-size: 12px; }
  .reveal-head .t { font-size: 28px; }
}

@media (max-width: 340px) {
  .mode-grid { grid-template-columns: 1fr; }
}
