/* BTOWN PARTY — a Btown Games production.
   One sheet, three faces: body.face-phone (attendee), body.face-host
   (Stephen's console), body.face-screen (projector / TV). The palette is a
   mixer at dusk: espresso room, string-light amber, cream type. */

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

:root {
  --room: #221a14;        /* espresso */
  --room-2: #2d221a;
  --card: #35291f;
  --line: #4a3a2c;
  --cream: #f6eedd;
  --cream-dim: #c9b894;
  --amber: #f2a24a;       /* string lights */
  --amber-deep: #d97f1e;
  --glow: #ffd9a0;
  --green: #4fae6d;       /* approve */
  --red: #c9502f;         /* reject */
  --hold: #8a7db8;        /* hold */
}

html, body {
  min-height: 100%;
  background: var(--room);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body {
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(242, 162, 74, 0.14), transparent 70%),
    var(--room);
}

.hidden { display: none !important; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* ------------------------------------------------------------ furniture */

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 14px) 18px calc(env(safe-area-inset-bottom) + 32px);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0 4px;
}
.brand .b-party {
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--amber);
  font-size: 18px;
}
.brand .b-sub {
  color: var(--cream-dim);
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin: 10px 0;
}

h1 { font-size: 26px; line-height: 1.2; margin-bottom: 8px; }
h2 { font-size: 20px; line-height: 1.25; }
p { line-height: 1.45; }
.dim { color: var(--cream-dim); }
.small { font-size: 13px; }

.big-btn {
  display: block;
  width: 100%;
  padding: 15px;
  margin-top: 14px;
  border-radius: 14px;
  background: var(--amber);
  color: #2b1a06;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 0 var(--amber-deep);
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--amber-deep); }
.big-btn:disabled { opacity: 0.45; box-shadow: none; }

/* "host your own" pitch at the bottom of the join card (hidden on QR deep links) */
.host-pitch {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.host-pitch h2 { font-size: 17px; margin: 0 0 4px; }
.host-pitch .host-btn {
  background: var(--room-2);
  color: var(--cream);
  border: 1px solid var(--amber);
  box-shadow: 0 4px 0 var(--line);
  text-align: center;
  text-decoration: none;
}
.host-pitch .host-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.host-practice { margin-top: 10px; text-align: center; }
.host-practice a { color: var(--cream-dim); }

.chip-btn {
  display: inline-block;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--room-2);
  color: var(--cream);
  font-size: 14px;
  font-weight: 650;
}
.chip-btn:active { transform: scale(0.97); }

input[type="text"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--room-2);
  color: var(--cream);
  font-size: 17px;
}
input[type="text"]::placeholder { color: rgba(246, 238, 221, 0.35); }
input.code-input {
  text-transform: uppercase;
  letter-spacing: 0.5em;
  font-weight: 800;
  text-align: center;
  font-size: 24px;
}

.error-line {
  color: #ff9d7e;
  font-size: 14px;
  min-height: 20px;
  margin-top: 8px;
}

.footer {
  margin-top: auto;
  padding-top: 24px;
  text-align: center;
  font-size: 12.5px;
  color: var(--cream-dim);
}
.footer a { color: var(--amber); text-decoration: none; }

.demo-banner {
  background: var(--hold);
  color: #1d1830;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  border-radius: 10px;
  padding: 7px 10px;
  margin: 8px 0;
}

/* ------------------------------------------------- attendee: check-in */

.checkin-q { margin: 14px 0 6px; }
.opt-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--room-2);
  font-size: 16px;
}
.opt-btn.sel {
  border-color: var(--amber);
  background: rgba(242, 162, 74, 0.16);
  font-weight: 700;
}

.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 2px;
}
.progress-dots i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--line);
}
.progress-dots i.on { background: var(--amber); }

/* ------------------------------------------------- attendee: idle/collect */

.idle-hero {
  text-align: center;
  padding: 12vh 8px 8px;
}
.idle-hero .lantern {
  font-size: 54px;
  display: inline-block;
  animation: sway 3.2s ease-in-out infinite;
}
@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}
.idle-hero h1 { margin-top: 10px; }

.collect-ask {
  color: var(--amber);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 13px;
}
.collect-question { margin: 6px 0 12px; }
.collect-opt {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--room-2);
  font-size: 17px;
}
.collect-opt.sel {
  border-color: var(--amber);
  background: rgba(242, 162, 74, 0.16);
  font-weight: 700;
}
.pct-wrap { margin-top: 16px; }
.pct-wrap label { display: block; font-size: 15px; margin-bottom: 8px; }
.pct-wrap strong { color: var(--amber); font-size: 18px; }
input[type="range"] {
  width: 100%;
  accent-color: var(--amber);
  height: 34px;
}

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

.host-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0;
}
.host-code {
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.24em;
  color: var(--amber);
}
.host-stat { color: var(--cream-dim); font-size: 14px; }

.host-hint { color: var(--cream-dim); font-size: 14px; margin-bottom: 8px; }

.question-pick {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px 14px;
  margin-top: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--room-2);
}
.question-pick .qp-text { display: block; font-size: 16px; font-weight: 650; }
.question-pick .qp-meta { display: block; font-size: 12.5px; color: var(--cream-dim); margin-top: 3px; }
.question-pick.played { opacity: 0.55; }
.question-pick:active { border-color: var(--amber); }

.roster {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.roster .who {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--room-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
}
.roster .who.away { opacity: 0.5; }
.roster .who .no-checkin { color: var(--cream-dim); }

/* mode picker tabs (hidden automatically when only one mode is installed) */
.mode-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}
.mode-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--room-2);
  text-align: left;
}
.mode-tab.active {
  border-color: var(--amber);
  background: var(--card);
  box-shadow: 0 0 0 1px var(--amber) inset;
}
.mode-tab-title { font-weight: 700; }
.mode-tab-tag {
  color: var(--cream-dim);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mod-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.mod-row:last-child { border-bottom: none; }
.mod-who { font-weight: 700; min-width: 72px; }
.mod-what { flex: 1; color: var(--cream-dim); font-size: 14.5px; }
.mod-btns { display: flex; gap: 6px; }
.mod-btns button {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--room-2);
  font-size: 16px;
}
.mod-row.approved .b-ok { background: var(--green); border-color: var(--green); }
.mod-row.rejected .b-no { background: var(--red); border-color: var(--red); }
.mod-row.held .b-hold { background: var(--hold); border-color: var(--hold); }
.mod-row.approved .mod-who::after { content: " ✓"; color: var(--green); }

.host-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.host-actions .big-btn { flex: 1; min-width: 150px; margin-top: 0; }

/* ------------------------------------------------- narrated reveal view */

#narrated {
  position: fixed;
  inset: 0;
  z-index: 40;
  background:
    radial-gradient(1000px 420px at 50% -160px, rgba(242, 162, 74, 0.18), transparent 70%),
    var(--room);
  display: flex;
  flex-direction: column;
  padding: max(env(safe-area-inset-top), 18px) 22px calc(env(safe-area-inset-bottom) + 18px);
}
#narratedTitle {
  color: var(--amber);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 15px;
}
#narratedLines {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4vh;
}
#narratedLines .n-line {
  font-size: clamp(26px, 6.5vw, 44px);
  font-weight: 800;
  line-height: 1.22;
  animation: rise 0.45s ease-out both;
}
#narratedLines .n-line:nth-child(2) { animation-delay: 0.25s; }
#narratedLines .n-line:nth-child(3) { animation-delay: 0.5s; }
#narratedLines .n-line:nth-child(n+4) { animation-delay: 0.7s; }
#narratedLines .n-line.secondary { color: var(--cream-dim); font-size: clamp(20px, 4.5vw, 30px); }
#narratedControls { display: flex; gap: 10px; }
#narratedControls .big-btn { margin-top: 0; }
#narratedStep { text-align: center; color: var(--cream-dim); font-size: 13px; padding: 8px 0; }

/* ---------------------------------------------------------- screen face */

body.face-screen { overflow: hidden; }
#stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4vmin;
}
#stage .stage-inner { width: min(92vw, 1400px); }

#joinCorner {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  text-align: center;
  z-index: 10;
}
#joinCorner svg { display: block; width: 140px; height: 140px; border-radius: 8px; }
#joinCorner .jc-code {
  font-weight: 900;
  letter-spacing: 0.3em;
  color: var(--amber);
  font-size: 22px;
  margin-top: 8px;
}
#joinCorner .jc-hint { color: var(--cream-dim); font-size: 12.5px; margin-top: 2px; }

.screen-kicker {
  color: var(--amber);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(16px, 2.2vmin, 26px);
}
.screen-title {
  font-size: clamp(40px, 8vmin, 96px);
  font-weight: 900;
  line-height: 1.08;
  margin: 2vmin 0;
}
.screen-sub {
  color: var(--cream-dim);
  font-size: clamp(18px, 3vmin, 34px);
}
.screen-count {
  margin-top: 3vmin;
  font-size: clamp(20px, 3.2vmin, 36px);
  color: var(--glow);
  font-weight: 700;
}

/* screen: reveal beats */
.beat-kicker {
  color: var(--amber);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(16px, 2.4vmin, 28px);
}
.beat-question {
  font-size: clamp(34px, 6.4vmin, 84px);
  font-weight: 900;
  line-height: 1.12;
  margin: 2.4vmin 0;
}
.beat-question.small {
  font-size: clamp(20px, 3vmin, 40px);
  color: var(--cream-dim);
  font-weight: 700;
}
.beat-drumroll {
  font-size: clamp(34px, 6vmin, 80px);
  font-weight: 900;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.75; transform: scale(0.985); }
}
.beat-sub {
  color: var(--cream-dim);
  font-size: clamp(18px, 2.8vmin, 32px);
  margin-top: 1.6vmin;
}
.beat-options { margin-top: 2vmin; }
.beat-option {
  font-size: clamp(26px, 4.6vmin, 60px);
  font-weight: 800;
  padding: 1.4vmin 0;
}
.beat-winner {
  font-size: clamp(44px, 9vmin, 110px);
  font-weight: 900;
  color: var(--glow);
  margin: 2vmin 0 1vmin;
  text-shadow: 0 0 40px rgba(242, 162, 74, 0.35);
}

.beat-bars { margin-top: 3vmin; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(18vmin, 32vmin) 1fr 9vmin;
  align-items: center;
  gap: 2vmin;
  margin: 2vmin 0;
}
.bar-label {
  text-align: right;
  font-size: clamp(18px, 3vmin, 38px);
  font-weight: 700;
}
.bar-track {
  height: clamp(26px, 5vmin, 64px);
  background: var(--room-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: var(--w);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber-deep), var(--amber));
  transform-origin: left;
  animation: grow 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.bar-row.winner .bar-fill {
  background: linear-gradient(90deg, var(--amber), var(--glow));
  box-shadow: 0 0 30px rgba(255, 217, 160, 0.4);
}
.bar-row.winner .bar-label { color: var(--glow); }
@keyframes grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.bar-pct {
  text-align: left;
  font-size: clamp(18px, 3.2vmin, 40px);
  font-weight: 900;
  color: var(--glow);
  animation: rise 0.4s ease-out both;
}

.beat-board {
  list-style: none;
  margin-top: 3vmin;
  display: inline-block;
  min-width: min(70vw, 800px);
}
.beat-board li {
  display: flex;
  justify-content: space-between;
  gap: 4vmin;
  font-size: clamp(22px, 4vmin, 52px);
  font-weight: 800;
  padding: 1.2vmin 2vmin;
  border-bottom: 1px solid var(--line);
}
.beat-board li:first-child { color: var(--glow); }
.beat-board li strong { color: var(--amber); }

.land { animation: rise 0.5s ease-out both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* screen lobby scoreboard teaser */
.lobby-board {
  margin-top: 3vmin;
  color: var(--cream-dim);
  font-size: clamp(16px, 2.4vmin, 28px);
}
.lobby-board strong { color: var(--amber); }

/* --------------------------------------------------------- small screens */

@media (max-width: 420px) {
  .host-code { font-size: 24px; }
}
