/* Wedding Shoe Game — shared styles (phone / screen / host) */

:root {
  --bride-color: #e91e63;
  --groom-color: #2196f3;
  --both-color: #9c27b0;
  --bg: #14121f;
  --panel: #201c31;
  --panel-2: #2a2440;
  --text: #f5f2ff;
  --muted: #9c93b8;
  --good: #4caf50;
  --bad: #ef5350;
  --gold: #ffd54f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100%;
}

body.phone    { padding: env(safe-area-inset-top) 16px calc(24px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; }
body.screen   { padding: 24px 40px; }
body.host     { padding: 24px; max-width: 860px; margin: 0 auto; }

h1, h2, h3 { line-height: 1.15; }

.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- shared bits ---------- */

.badge {
  display: inline-block;
  background: var(--panel-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  color: var(--muted);
}

.btn {
  appearance: none;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  color: #fff;
  padding: 14px 22px;
  background: var(--panel-2);
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--bride-color), var(--groom-color)); }
.btn.ghost { background: transparent; border: 2px solid var(--panel-2); }
.btn.danger { background: var(--bad); }

/* ---------- phone: join ---------- */

.join-card { margin-top: 10vh; text-align: center; }
.join-card .title { font-size: clamp(28px, 8vw, 40px); margin: 18px 0 6px; }
.join-card .subtitle { color: var(--muted); margin-bottom: 34px; }
.join-card .rings { font-size: 64px; }
.join-card input {
  width: 100%;
  font-size: 22px;
  padding: 16px;
  text-align: center;
  border-radius: 16px;
  border: 2px solid var(--panel-2);
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.join-card input:focus { border-color: var(--bride-color); }
.join-card .btn { width: 100%; margin-top: 14px; font-size: 20px; padding: 16px; }
.join-err { color: var(--bad); margin-top: 12px; min-height: 1.4em; }

/* ---------- phone: game ---------- */

.phone .round-tag { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.phone .q-text { font-size: clamp(24px, 6.5vw, 34px); margin: 12px 0 18px; min-height: 3.2em; }

.timerbar { height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.timerbar > div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--gold), #ff8a65); transition: width .3s linear; }
.timerbar.urgent > div { background: var(--bad); }
.timer-num { font-size: 30px; font-weight: 800; margin: 8px 0 16px; }

.choices { display: grid; gap: 14px; margin-top: 8px; }
.choice {
  display: flex; align-items: center; gap: 14px;
  padding: 22px 18px;
  border-radius: 20px;
  font-size: clamp(20px, 6vw, 26px);
  font-weight: 800;
  color: #fff;
  border: 3px solid rgba(255,255,255,.12);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.choice .em { font-size: 1.35em; }
.choice:active { transform: scale(.98); }
.choice.bride { background: var(--bride-color); }
.choice.groom { background: var(--groom-color); }
.choice.both  { background: var(--both-color); }
.choice:disabled { filter: saturate(.2) brightness(.55); }
.choice.picked { outline: 4px solid #fff; }

.voted-note { text-align: center; margin-top: 18px; color: var(--muted); }
.big-emoji { font-size: 64px; text-align: center; margin: 24px 0; }

.verdict { border-radius: 20px; padding: 18px; margin: 14px 0; text-align: center; font-size: 20px; }
.verdict.win { background: rgba(76,175,80,.15); border: 2px solid var(--good); }
.verdict.miss { background: rgba(239,83,80,.12); border: 2px solid var(--bad); }
.verdict .pts { font-size: 34px; font-weight: 800; display: block; margin-top: 6px; }

.score-strip {
  position: sticky; bottom: 0;
  display: flex; justify-content: space-between;
  background: var(--panel);
  border-radius: 14px;
  padding: 10px 16px;
  margin-top: 20px;
  font-weight: 700;
}

.still-playing {
  margin-top: 20px;
  width: 100%;
  padding: 20px;
  font-size: 22px;
  border-radius: 20px;
  border: none;
  background: var(--gold);
  color: #241d00;
  font-weight: 800;
  cursor: pointer;
}

/* ---------- leaderboard (screen + reveal) ---------- */

.lb { list-style: none; }
.lb li {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--panel);
  margin-bottom: 6px;
}
.lb .rank { width: 2em; color: var(--muted); font-weight: 700; }
.lb .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pts { font-weight: 800; }
.lb li.me { outline: 2px solid var(--gold); }
.lb .medal { font-size: 1.2em; }

/* ---------- big screen ---------- */

.screen .topbar { display: flex; justify-content: space-between; align-items: center; }
.screen .topbar h1 { font-size: clamp(20px, 3vw, 34px); }

.screen .stage {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-top: 20px;
}
@media (min-width: 1000px) {
  .screen .stage.with-side { grid-template-columns: 2.2fr 1fr; }
}

.screen .q-card { background: var(--panel); border-radius: 28px; padding: 40px 44px; min-height: 46vh; display: flex; flex-direction: column; justify-content: center; }
.screen .q-round { color: var(--muted); font-size: 22px; margin-bottom: 14px; }
.screen .q-text { font-size: clamp(36px, 5.5vw, 76px); line-height: 1.15; }

.screen .timer-wrap { margin-top: 30px; }
.screen .timerbar { height: 16px; }
.screen .timer-num { font-size: 54px; }

.screen .vote-count { margin-top: 10px; color: var(--muted); font-size: 22px; }

.bars { margin-top: 26px; display: grid; gap: 18px; }
.bar-row .bar-label { display: flex; justify-content: space-between; font-size: 26px; font-weight: 700; margin-bottom: 6px; }
.bar-row .bar {
  height: 52px; border-radius: 14px; background: var(--panel-2);
  overflow: hidden; position: relative;
}
.bar-row .bar > div {
  height: 100%; width: 0;
  border-radius: 14px;
  transition: width .8s cubic-bezier(.2,.8,.2,1);
}
.bar-row.bride .bar > div { background: var(--bride-color); }
.bar-row.groom .bar > div { background: var(--groom-color); }
.bar-row.both  .bar > div { background: var(--both-color); }
.bar-row.correct .bar { outline: 4px solid var(--gold); }
.bar-row.correct .bar-label { color: var(--gold); }

.qr-panel { background: var(--panel); border-radius: 28px; padding: 40px; text-align: center; align-self: start; }
.qr-panel .qr { background: #fff; border-radius: 20px; padding: 18px; display: inline-block; }
.qr-panel .qr svg { display: block; width: min(38vh, 320px); height: auto; }
.qr-panel .url { font-size: clamp(22px, 3.4vw, 40px); font-weight: 800; margin-top: 18px; word-break: break-all; }

.podium { display: flex; align-items: flex-end; justify-content: center; gap: 18px; margin: 30px 0; }
.podium .step { background: var(--panel); border-radius: 18px 18px 0 0; padding: 18px 26px; text-align: center; width: min(240px, 28vw); }
.podium .step .nm { font-size: clamp(18px, 2.4vw, 30px); font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .step .sc { color: var(--gold); font-weight: 800; font-size: clamp(16px, 2vw, 26px); }
.podium .step.first  { height: 240px; border-top: 6px solid var(--gold); }
.podium .step.second { height: 190px; border-top: 6px solid #cfd8dc; }
.podium .step.third  { height: 150px; border-top: 6px solid #b08d57; }
.podium .medal-big { font-size: 40px; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

/* ---------- host ---------- */

.host .card { background: var(--panel); border-radius: 20px; padding: 24px; margin-bottom: 18px; }
.host .row { display: flex; gap: 12px; flex-wrap: wrap; }
.host .row .btn { flex: 1; min-width: 140px; }
.host .mark-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 10px; }
.host .mark-row .btn { font-size: 22px; padding: 26px 10px; }
.host .login { max-width: 380px; margin: 10vh auto 0; text-align: center; }
.host .login input { width: 100%; padding: 14px; border-radius: 12px; border: 2px solid var(--panel-2); background: var(--panel-2); color: var(--text); font-size: 18px; margin-bottom: 10px; }
.host .status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; color: var(--muted); }
.host .status-grid b { color: var(--text); font-size: 26px; display: block; }

/* host display view (second device) */
.host.disp { max-width: 1000px; }
.host.disp .disp-q { font-size: clamp(26px, 4vw, 44px); line-height: 1.2; margin: 14px 0 22px; }
.host.disp .timerbar { height: 12px; margin-bottom: 10px; }
.host.disp .timer-num { font-size: 40px; margin: 0 0 10px; }
.host.disp .answer-chip {
  margin-top: 18px; padding: 14px 18px; border-radius: 14px;
  background: rgba(255,213,79,.12); border: 2px solid var(--gold);
  font-size: 22px; text-align: center;
}

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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