:root {
  --accent: #6366f1;
  --accent-2: #a855f7;
  --accent-3: #22d3ee;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --ink: #14152b;
  --ink-2: #4a4d6a;
  --ink-3: #8a8da8;
  --line: #e8e9f3;
  --bg: #f4f5fb;
  --card: #ffffff;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(31, 33, 74, 0.08);
  --shadow-lg: 0 24px 60px rgba(31, 33, 74, 0.16);
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.hidden { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
  box-shadow: 0 8px 20px rgba(99, 102, 241, .28);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
.btn.block { width: 100%; }
.btn.ghost {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line);
}
.btn.ghost:hover { box-shadow: 0 0 0 1px #d6d8ea, 0 6px 16px rgba(31,33,74,.06); }
.btn.danger { background: linear-gradient(135deg, #f87171, var(--danger)); box-shadow: 0 8px 20px rgba(239,68,68,.25); }
.btn.sm { padding: 9px 14px; font-size: 13.5px; border-radius: 11px; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .select {
  width: 100%;
  padding: 13px 15px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: #fbfbfe;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input:focus, .select:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8da8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 15px center; padding-right: 40px; }

.alert {
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 14px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.alert.ok { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* ---------- Phone shell ---------- */
.phone-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(168,85,247,.16), transparent 55%),
    var(--bg);
}
.phone-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-lg);
  padding: 30px 24px;
  border: 1px solid rgba(255,255,255,.7);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand .logo {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 22px;
  box-shadow: 0 10px 24px rgba(124,92,255,.35);
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }

h2.title { font-size: 22px; margin: 0 0 6px; }
p.sub { color: var(--ink-3); font-size: 14px; margin: 0 0 22px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: rgba(255,255,255,.85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .who { font-size: 14px; color: var(--ink-2); font-weight: 600; }

/* ---------- Player vote ---------- */
.vote-hero { text-align: center; margin-bottom: 18px; }
.vote-hero .topic {
  font-size: 27px; font-weight: 800; line-height: 1.25;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.timer-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 12px;
  background: #f1f2fb; color: var(--ink); border-radius: 999px; padding: 8px 16px;
  font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums;
}
.timer-pill.urgent { background: #fef2f2; color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

.candidates { display: grid; gap: 11px; margin-top: 6px; }
.cand {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 16px; border: 1.6px solid var(--line);
  background: #fbfbfe; text-align: left; width: 100%; font-size: 17px; font-weight: 600; color: var(--ink);
  transition: all .18s ease;
}
.cand:hover { border-color: #cdd0ef; transform: translateY(-1px); }
.cand.selected {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 26px rgba(99,102,241,.32);
}
.cand .avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #e9eafd, #f5e9ff); color: var(--accent); font-weight: 800; font-size: 15px;
  flex: none;
}
.cand.selected .avatar { background: rgba(255,255,255,.22); color: #fff; }
.cand .check { margin-left: auto; opacity: 0; font-weight: 800; }
.cand.selected .check { opacity: 1; }

.banner {
  text-align: center; padding: 16px; border-radius: 16px; margin-bottom: 16px; font-weight: 700;
  background: #f1f2fb; color: var(--ink-2);
}
.banner.live { background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(168,85,247,.12)); color: var(--accent); }
.banner.done { background: #ecfdf5; color: #047857; }

/* ---------- Combined entry (all logins together) ---------- */
.entry-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(99,102,241,.18), transparent 60%),
    radial-gradient(800px 500px at 100% 0%, rgba(168,85,247,.16), transparent 55%),
    var(--bg);
}
.entry-head { text-align: center; margin-bottom: 30px; }
.entry-head .logo {
  width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 14px; font-size: 27px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 14px 34px rgba(124,92,255,.35);
}
.entry-head h1 { font-size: 28px; margin: 0 0 8px; letter-spacing: .3px; }
.entry-head p { color: var(--ink-3); font-size: 15px; margin: 0; }
.entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; width: 100%; max-width: 940px; }
.entry-grid .phone-card { max-width: none; margin: 0; }
.entry-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; background: #eef0fb; color: var(--accent); margin-bottom: 14px;
}
.entry-foot { margin-top: 26px; }
.entry-foot a {
  display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  transition: transform .15s ease, box-shadow .2s ease;
}
.entry-foot a:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
@media (max-width: 820px) { .entry-grid { grid-template-columns: 1fr; } }

/* ---------- Landing ---------- */
.landing { max-width: 940px; margin: 0 auto; padding: 56px 20px; }
.landing .head { text-align: center; margin-bottom: 40px; }
.landing .head .logo { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 18px; font-size: 30px; }
.landing .head h1 { font-size: 34px; margin: 0 0 10px; }
.landing .head p { color: var(--ink-3); font-size: 16px; margin: 0; }
.role-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 760px) { .role-grid { grid-template-columns: 1fr; } }
.role {
  background: var(--card); border-radius: 22px; padding: 26px; border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease;
  display: block;
}
.role:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.role .ico { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; font-size: 24px; margin-bottom: 14px; }
.role h3 { margin: 0 0 6px; font-size: 19px; }
.role p { margin: 0; color: var(--ink-3); font-size: 14px; line-height: 1.55; }
.ico-1 { background: linear-gradient(135deg, #e0e7ff, #ede9fe); }
.ico-2 { background: linear-gradient(135deg, #d1fae5, #cffafe); }
.ico-3 { background: linear-gradient(135deg, #ffe4e6, #ffedd5); }

/* ---------- Admin ---------- */
.admin { max-width: 1080px; margin: 0 auto; padding: 26px 20px 60px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.admin-head h1 { font-size: 24px; margin: 0; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel h2 { font-size: 16px; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.panel h2 .dot { width: 8px; height: 8px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 120px; margin-bottom: 0; }

.list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; max-height: 320px; overflow: auto; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px;
  background: #fafafe; border: 1px solid var(--line);
}
.list-item .grow { flex: 1; }
.list-item .name { font-weight: 700; font-size: 15px; }
.list-item .meta { font-size: 12.5px; color: var(--ink-3); }
.list-item .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ink-2); }
.empty { color: var(--ink-3); font-size: 14px; padding: 14px; text-align: center; }

.tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: #eef0fb; color: var(--ink-2); font-weight: 600; }
.tag.live { background: #ecfdf5; color: #047857; }
.tag.off { background: #f3f4f6; color: #6b7280; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.toggle:last-child { border-bottom: none; }
.toggle .lbl { font-size: 14px; font-weight: 600; }
.toggle .desc { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.switch { width: 46px; height: 27px; border-radius: 999px; background: #d9dbe9; position: relative; transition: background .2s ease; border: none; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: transform .2s ease; box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.switch.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.switch.on::after { transform: translateX(19px); }

/* ================= Display (big screen) ================= */
body.display-mode {
  background: radial-gradient(1400px 900px at 50% -20%, #251a5e 0%, #100b2e 45%, #07060f 100%);
  color: #fff; overflow: hidden;
}
.display {
  height: 100vh; display: flex; flex-direction: column; padding: 3.2vh 3.6vw; gap: 2.4vh;
}
.display-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.display-title {
  font-size: clamp(30px, 4.6vw, 76px); font-weight: 900; letter-spacing: .5px; line-height: 1.1;
  background: linear-gradient(120deg, #fff 10%, #c4b5fd 45%, #67e8f9 90%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.display-sub { color: rgba(255,255,255,.55); font-size: clamp(13px, 1.3vw, 20px); margin-top: .6vh; font-weight: 600; }

.clock {
  flex: none; display: grid; place-items: center; width: clamp(90px, 9vw, 150px); height: clamp(90px, 9vw, 150px);
  border-radius: 50%; position: relative; font-weight: 800; font-size: clamp(30px, 3.4vw, 56px);
  font-variant-numeric: tabular-nums;
}
.clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.clock .track { fill: none; stroke: rgba(255,255,255,.10); stroke-width: 7; }
.clock .prog { fill: none; stroke: url(#clockGrad); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.clock.urgent { color: #fca5a5; }
.clock small { position: absolute; bottom: 22%; font-size: 12px; font-weight: 600; color: rgba(255,255,255,.45); }

.chart { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: clamp(10px, 1.7vh, 22px); overflow: hidden; }
.bar-row { display: flex; align-items: center; gap: clamp(10px, 1.4vw, 22px); }
.bar-name {
  width: calc(clamp(90px, 13vw, 230px) * var(--name-scale, 1));
  font-size: calc(clamp(15px, 1.7vw, 28px) * var(--name-scale, 1));
  font-weight: 700; text-align: right; flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: font-size .45s cubic-bezier(.2,.8,.2,1), width .45s cubic-bezier(.2,.8,.2,1), color .3s ease, text-shadow .3s ease;
}
.bar-row.lead .bar-name { font-weight: 900; color: #fbbf24; text-shadow: 0 0 28px rgba(251,191,36,.7); }
.bar-track { flex: 1; height: clamp(30px, 4.6vh, 60px); background: rgba(255,255,255,.06); border-radius: 999px; overflow: hidden; position: relative; }
.bar-fill {
  height: 100%; border-radius: 999px; min-width: 0;
  background: linear-gradient(90deg, #6366f1, #a855f7, #22d3ee);
  transition: width .5s cubic-bezier(.22,1,.36,1);
  box-shadow: 0 0 26px rgba(129,140,248,.45);
}
.bar-row.lead .bar-fill { background: linear-gradient(90deg, #fbbf24, #f97316, #f43f5e); box-shadow: 0 0 30px rgba(251,146,60,.5); }
.bar-count { width: clamp(44px, 5vw, 90px); font-size: clamp(17px, 1.9vw, 34px); font-weight: 900; font-variant-numeric: tabular-nums; color: #fff; flex: none; }

.display-foot { display: flex; align-items: center; justify-content: space-between; color: rgba(255,255,255,.5); font-size: clamp(13px, 1.2vw, 19px); font-weight: 600; }
.display-foot .pulse-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #34d399; margin-right: 9px; box-shadow: 0 0 0 0 rgba(52,211,153,.7); animation: ring 1.6s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 100% { box-shadow: 0 0 0 14px rgba(52,211,153,0); } }

.center-msg { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; color: rgba(255,255,255,.7); }
.center-msg .big { font-size: clamp(26px, 3vw, 46px); font-weight: 800; color: #fff; }
.center-msg .ico { font-size: clamp(50px, 6vw, 90px); opacity: .9; }

.winner-overlay {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(900px 600px at 50% 40%, rgba(251,191,36,.22), rgba(10,8,25,.92) 60%);
  backdrop-filter: blur(6px); z-index: 50; text-align: center; animation: fadein .4s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.winner-overlay .wtitle {
  font-size: clamp(20px, 2.4vw, 42px); font-weight: 700; color: rgba(255,255,255,.92);
  padding: 10px 28px; border-radius: 999px; background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.18); max-width: 90vw;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.winner-overlay .crown { font-size: clamp(50px, 7vw, 110px); animation: pop .6s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.winner-overlay .wnames {
  display: flex; flex-direction: column; align-items: center; gap: 1vh;
  max-width: 96vw; max-height: 62vh;
}
.winner-overlay .wname {
  font-size: clamp(64px, 13vw, 240px); font-weight: 900; line-height: .98; letter-spacing: 2px;
  background: linear-gradient(120deg, #fde68a, #fb923c, #f472b6);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: pop .6s cubic-bezier(.2,1.4,.4,1);
  max-width: 95vw;
}
/* 平局：所有名字用同一字号（一样大），并排/换行全部显示 */
.winner-overlay.multi .wnames { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 1vh 4vw; }
.winner-overlay.multi .crown { font-size: clamp(38px, 5vw, 80px); }
.winner-overlay.multi .wname { font-size: clamp(44px, 9vw, 160px); letter-spacing: 1px; }
.winner-overlay.multi-3 .wname { font-size: clamp(34px, 6.5vw, 120px); }
.winner-overlay.multi-4 .wname { font-size: clamp(28px, 5vw, 92px); }
.winner-overlay .wtie {
  font-size: clamp(16px, 1.7vw, 28px); font-weight: 800; letter-spacing: 8px;
  color: #fcd34d; text-indent: 8px;
}
.winner-overlay .wsub { color: rgba(255,255,255,.7); font-size: clamp(16px, 1.8vw, 28px); font-weight: 600; }
.winner-overlay .wvotes { color: #fcd34d; font-weight: 800; font-size: clamp(20px, 2.4vw, 38px); }

/* confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 49; overflow: hidden; }
.confetti i { position: absolute; top: -12vh; width: 10px; height: 16px; opacity: .9; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(120vh) rotate(720deg); } }

/* fullscreen hint */
.fs-hint { position: fixed; right: 16px; bottom: 14px; z-index: 60; background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 8px 13px; font-size: 13px; }

/* ================= Ideal team portrait ================= */
.survey-hint { margin-top: 10px; color: var(--ink-3); font-size: 14px; font-weight: 600; }
.survey-prompts { display: flex; flex-direction: column; gap: 16px; margin-top: 6px; }
.survey-prompt { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.sp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sp-head .sp-index {
  flex: none; width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 13px; font-weight: 800;
}
.sp-head .sp-title { flex: 1; font-size: 16px; font-weight: 800; }
.sp-head .sp-count { flex: none; font-size: 12.5px; font-weight: 700; color: var(--accent); background: #eef0fb; border-radius: 999px; padding: 3px 10px; }
.survey-options { display: flex; flex-direction: column; gap: 9px; }
.survey-chip {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 13px; border: 1.6px solid var(--line); background: #fbfbfe;
  font-size: 15px; font-weight: 600; color: var(--ink); transition: all .16s ease;
}
.survey-chip:hover { border-color: #cdd0ef; }
.survey-chip .grow { flex: 1; }
.survey-chip .check { opacity: 0; font-weight: 800; }
.survey-chip.selected {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 22px rgba(99,102,241,.28);
}
.survey-chip.selected .check { opacity: 1; }

/* admin survey editor */
.sp-admin { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fafafe; }
.sp-admin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sp-admin-head .sp-index { font-size: 15px; font-weight: 800; }
.sp-admin-opts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.opt-row { display: flex; align-items: center; gap: 8px; }
.opt-row .input { flex: 1; }
.opt-row .tag { flex: none; }
textarea.input { min-height: 58px; resize: vertical; line-height: 1.5; padding-top: 11px; padding-bottom: 11px; }
.ico-4 { background: linear-gradient(135deg, #ede9fe, #fae8ff); }
.ico-5 { background: linear-gradient(135deg, #cffafe, #dbeafe); }

/* portrait big screen */
.portrait-grid { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 34px); overflow: hidden; }
.portrait-col { display: flex; flex-direction: column; min-height: 0; }
.portrait-col .pc-title { font-size: clamp(15px, 1.5vw, 26px); font-weight: 800; margin-bottom: 1.6vh; color: #fff; }
.portrait-chart { flex: 1; justify-content: flex-start; gap: clamp(8px, 1.2vh, 16px); }
.portrait-chart .bar-name { width: clamp(70px, 8vw, 150px); font-size: clamp(12px, 1.1vw, 19px); }
.portrait-chart .bar-count { width: clamp(28px, 3vw, 52px); font-size: clamp(13px, 1.2vw, 21px); }
.portrait-chart .bar-track { height: clamp(16px, 2.6vh, 34px); }
.portrait-person { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 34px); align-content: start; }
.portrait-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 20px; padding: clamp(14px, 1.6vw, 28px); }
.portrait-card .pc-title { font-size: clamp(15px, 1.5vw, 26px); font-weight: 800; color: rgba(255,255,255,.92); margin-bottom: 1.4vh; }
.pc-tags { display: flex; flex-wrap: wrap; gap: clamp(8px, 1vh, 16px); }
.pc-tag {
  font-size: clamp(18px, 2.4vw, 44px); font-weight: 800; padding: .3vh 1.2vw; border-radius: 14px;
  color: #fff; background: linear-gradient(135deg, rgba(99,102,241,.55), rgba(168,85,247,.55));
  border: 1px solid rgba(255,255,255,.2);
}
.pc-empty { color: rgba(255,255,255,.45); font-size: clamp(14px, 1.4vw, 22px); font-weight: 600; }
@media (max-width: 820px) {
  .portrait-grid, .portrait-person { grid-template-columns: 1fr; }
}

/* collapsible survey editor */
details.sp-admin { padding: 0; }
details.sp-admin > summary.sp-admin-sum {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px;
  padding: 14px; font-weight: 700;
}
details.sp-admin > summary.sp-admin-sum::-webkit-details-marker { display: none; }
details.sp-admin > summary.sp-admin-sum::after {
  content: ""; width: 9px; height: 9px; margin-left: auto; flex: none;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform .2s ease;
}
details.sp-admin[open] > summary.sp-admin-sum::after { transform: rotate(-135deg); }
.sp-admin-body { padding: 0 14px 14px; }
.sp-admin-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sp-admin-tools .meta { font-size: 12.5px; color: var(--ink-3); }

/* survey options: compact 4-per-row chips on phones */
.survey-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.survey-chip {
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 2px; padding: 9px 4px;
  font-size: 12.5px; line-height: 1.3; border-radius: 11px;
  min-height: 44px; word-break: break-word; height: 100%;
}
.survey-chip .grow { flex: none; width: 100%; }
.survey-chip .check { display: none; }
@media (max-width: 320px) { .survey-options { gap: 6px; } .survey-chip { font-size: 11.5px; } }

/* ================= Team goals & flow ================= */
.team-goal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 36px; }
.goal-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px; box-shadow: var(--shadow); text-align: center;
}
.goal-card.primary {
  background: linear-gradient(135deg, rgba(99,102,241,.10), rgba(168,85,247,.12));
  border-color: rgba(124,92,255,.35);
  box-shadow: 0 18px 44px rgba(124,92,255,.20);
}
.goal-label { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.goal-num {
  font-size: clamp(44px, 8vw, 84px); font-weight: 900; line-height: 1.05; margin: 8px 0 4px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.goal-num span { font-size: .4em; margin-left: 3px; -webkit-text-fill-color: var(--ink-2); }
.goal-sub { font-size: 13px; color: var(--ink-3); }

.team-sec { font-size: 20px; margin: 0 0 16px; }
.team-sec:not(:first-of-type) { margin-top: 36px; }

.flow { display: flex; align-items: stretch; gap: 8px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; }
.flow-node {
  flex: 1 1 0; min-width: 148px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 14px; box-shadow: var(--shadow);
}
.flow-node .fn-role { font-size: 16px; font-weight: 800; margin-bottom: 6px; }
.flow-node .fn-desc { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.flow-node.final { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.flow-node.final .fn-role { color: #fff; }
.flow-node.final .fn-desc { color: rgba(255,255,255,.88); }
.flow-arrow { align-self: center; flex: none; font-size: 22px; font-weight: 900; color: var(--ink-3); }

.team-foot { text-align: center; margin-top: 32px; color: var(--ink-2); font-size: 15px; font-weight: 600; line-height: 1.7; }

@media (max-width: 760px) {
  .team-goal-grid { grid-template-columns: 1fr; }
  .flow { flex-direction: column; flex-wrap: wrap; overflow: visible; }
  .flow-node { min-width: 0; }
  .flow-arrow { transform: rotate(90deg); }
}

/* ------------------------------------------------------------------ */
/* Home — synced on-screen display                                     */
/* ------------------------------------------------------------------ */

.home { margin: 0; height: 100vh; overflow: hidden; background: #0b1020; color: #e5e9f5; }

.home-stage {
  display: block;
  width: 100vw;
  height: 100vh;
  border: 0;
  background: #0b1020;
}

.home-idle {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  background: radial-gradient(1200px 700px at 50% -10%, #1e2a55 0%, #0b1020 60%);
}

.home-logo { font-size: clamp(56px, 6vw, 118px); line-height: 1; }
.home-title {
  margin: 0;
  font-size: clamp(42px, 6vw, 128px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 4px;
}
.home-tip { margin: 0; font-size: clamp(16px, 1.6vw, 30px); color: #9aa6c4; }
.home-goal {
  margin-top: 10px;
  padding: 8px 22px;
  border-radius: 999px;
  font-size: 18px;
  letter-spacing: 2px;
  color: #cdc4ff;
  background: rgba(124, 92, 255, .18);
  border: 1px solid rgba(124, 92, 255, .5);
}

.home-login {
  position: fixed;
  right: 14px;
  bottom: 12px;
  z-index: 90;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  text-decoration: none;
  color: rgba(229, 233, 245, .55);
  background: rgba(11, 16, 32, .55);
  border: 1px solid rgba(229, 233, 245, .15);
}
.home-login:hover { color: #fff; background: rgba(11, 16, 32, .85); }

.board-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.board-btn { flex: 1; min-width: 120px; }
.board-btn.active { color: #fff; border-color: transparent; background: linear-gradient(135deg, #6366f1, #a855f7); }

@media (max-width: 640px) {
  .home-title { font-size: 24px; letter-spacing: 1px; }
  .home-tip { font-size: 14px; }
  .home-goal { font-size: 16px; }
}

/* ---------- History: expandable round details ---------- */

.hist-item { display: block; }
.hist-item > summary.list-item { list-style: none; cursor: pointer; }
.hist-item > summary.list-item::-webkit-details-marker { display: none; }
.hist-item > summary.list-item::after {
  content: '▾';
  flex: none;
  font-size: 12px;
  color: var(--ink-3);
  transition: transform .2s ease;
}
.hist-item[open] > summary.list-item { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.hist-item[open] > summary.list-item::after { transform: rotate(180deg); }

.hist-body {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 14px 13px;
  background: #fff;
  border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 13px 13px;
}
.hist-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.hist-row .hist-name { flex: none; min-width: 56px; font-weight: 700; }
.hist-row.lead .hist-name { color: #d97706; }
.hist-row .tag { flex: none; }
.hist-voters { flex: 1; color: var(--ink-2); font-size: 12.5px; }

/* ---------- Timed mini-games (shake / money) ---------- */
.bar-rank {
  flex: none; width: clamp(26px, 3vw, 54px); text-align: center;
  font-size: calc(clamp(15px, 1.7vw, 28px) * var(--name-scale, 1));
  font-weight: 800; color: rgba(255,255,255,.5); font-variant-numeric: tabular-nums;
}
.bar-row.lead .bar-rank { color: #fbbf24; text-shadow: 0 0 24px rgba(251,191,36,.6); }

.game-phone {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 26px 22px; text-align: center;
}
.game-status { font-size: 18px; font-weight: 800; color: var(--ink); }
.game-play { display: flex; flex-direction: column; align-items: center; }
.game-counter {
  font-size: 96px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.game-unit { font-size: 18px; font-weight: 700; color: var(--ink-3); margin-top: 6px; }
.game-timer { font-size: 17px; font-weight: 700; color: var(--ink-2); }
.game-timer b { color: var(--accent); font-size: 22px; font-variant-numeric: tabular-nums; }
.game-rank {
  font-size: 16px; font-weight: 800; color: var(--ink);
  background: #eef0fb; border-radius: 999px; padding: 10px 20px;
}
.game-hint { font-size: 13.5px; color: var(--ink-3); font-weight: 600; max-width: 300px; }
.game-arm { max-width: 320px; }
.game-manual { max-width: 320px; }

.game-swipe {
  width: min(90vw, 360px); height: min(58vh, 460px); border-radius: 26px;
  background: linear-gradient(160deg, #ecfdf5, #e0f2fe);
  border: 2px dashed #a5b4fc; position: relative; overflow: hidden;
  display: grid; place-items: center; touch-action: none; user-select: none;
}
.game-swipe.disabled { opacity: .55; filter: grayscale(.4); }
.swipe-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; }
.game-money {
  font-size: 64px; font-weight: 900; font-variant-numeric: tabular-nums; color: #047857;
  text-shadow: 0 6px 18px rgba(16,185,129,.25);
}
.game-sub { font-size: 16px; font-weight: 700; color: var(--ink-2); }
.swipe-hint { font-size: 15px; font-weight: 800; color: var(--accent); margin-top: 8px; }
.swipe-float { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.swipe-float-item {
  position: absolute; bottom: 22%; transform: translateX(-50%);
  font-size: 26px; font-weight: 900; color: #f59e0b;
  animation: billUp .9s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes billUp {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -170px) scale(1.2); }
}

/* ---------- Admin: timed game control ---------- */
.game-ctl { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-top: 14px; }
.game-ctl:first-of-type { margin-top: 0; }
.game-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.game-name { font-size: 15px; font-weight: 800; }
