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

:root {
  --red: #e8321d;
  --red-dark: #b5260f;
  --yellow: #f0c040;
  --green: #4ade80;
  --black: #0b0b0a;
  --surface: #131311;
  --card: #1c1b18;
  --border: #2a2926;
  --white: #f2ede4;
  --muted: #a09890;
}

html { scroll-behavior: smooth; }

body {
  background: var(--black);
  color: var(--white);
  font-family: 'Instrument Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 1.5rem;
  background: rgba(11,11,10,.92);
  backdrop-filter: blur(12px);
  border-bottom: .5px solid var(--border);
}
.nav-logo {
  font-family: 'Bebas Neue', sans-serif; font-size: 1.4rem;
  letter-spacing: .04em; color: var(--white); text-decoration: none;
  display: flex; align-items: center; gap: 7px;
}
.nav-logo span:first-of-type { color: var(--red); }
.nav-mp-badge {
  font-size: .65rem; font-family: 'Instrument Sans', sans-serif;
  font-weight: 700; letter-spacing: .1em;
  background: var(--red); color: #fff;
  padding: 2px 7px; border-radius: 100px;
}
.nav-link { font-size: 13px; color: var(--muted); text-decoration: none; transition: color .14s; }
.nav-link:hover { color: var(--white); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #444; transition: background .3s;
}
.live-dot.connected { background: var(--green); }
.room-code-nav {
  font-family: 'Bebas Neue', sans-serif; font-size: 1.1rem;
  letter-spacing: .1em; color: var(--muted);
}

/* ── SCREENS ── */
.screen { display: none; flex: 1; padding-top: 58px; }
.screen.active { display: flex; }

.section-wrap {
  max-width: 540px; width: 100%;
  margin: 0 auto; padding: 2rem 1.5rem 3rem;
  display: flex; flex-direction: column; gap: .6rem;
}

/* ── HOME ── */
main.home-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 5rem 1.5rem 3rem;
}
.home-inner {
  max-width: 460px; width: 100%;
  display: flex; flex-direction: column; gap: 2rem;
}
.home-hero { text-align: center; }
.home-dice { font-size: 3rem; line-height: 1; margin-bottom: 1rem; }
.home-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: .92; letter-spacing: .02em;
}
.home-title span { color: var(--red); display: block; }
.home-sub { font-size: 15px; color: #c8c0b8; line-height: 1.65; margin-top: .75rem; }

.home-actions { display: flex; flex-direction: column; gap: .75rem; }
.home-divider {
  display: flex; align-items: center; gap: .75rem;
  font-size: 12px; color: #3a3936;
}
.home-divider::before, .home-divider::after {
  content: ''; flex: 1; height: .5px; background: var(--border);
}
.join-input-wrap { display: flex; gap: 8px; }
.join-input {
  flex: 1; background: var(--card); border: .5px solid var(--border);
  color: var(--white); font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem; letter-spacing: .15em; text-align: center;
  padding: .75rem 1rem; border-radius: 12px; outline: none;
  text-transform: uppercase; transition: border-color .14s;
}
.join-input:focus { border-color: var(--red); }
.join-input::placeholder {
  font-family: 'Instrument Sans', sans-serif;
  font-size: 14px; letter-spacing: 0; color: var(--muted);
}
.btn-join {
  background: var(--card); border: .5px solid var(--border); color: var(--white);
  font-family: 'Instrument Sans', sans-serif; font-size: 14px; font-weight: 600;
  padding: .75rem 1.25rem; border-radius: 12px; cursor: pointer; transition: all .14s;
  white-space: nowrap;
}
.btn-join:hover { border-color: #555; }

.home-features { display: flex; flex-direction: column; gap: 8px; }
.feat {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted);
}
.feat-icon { font-size: 1rem; line-height: 1; }

/* ── TYPOGRAPHY ── */
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted);
}
.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: .03em; line-height: 1;
}
.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: .5rem; }

/* ── INPUTS ── */
.text-input {
  width: 100%; background: var(--card); border: .5px solid var(--border);
  color: var(--white); font-family: 'Instrument Sans', sans-serif;
  font-size: 15px; padding: 11px 14px; border-radius: 12px;
  outline: none; transition: border-color .14s; margin-top: .3rem;
}
.text-input:focus { border-color: var(--red); }
.text-input::placeholder { color: var(--muted); }

/* ── BUTTONS ── */
.btn-primary {
  width: 100%; background: var(--red); color: #fff; border: none;
  font-family: 'Bebas Neue', sans-serif; font-size: 1.4rem; letter-spacing: .06em;
  padding: 1rem; border-radius: 13px; cursor: pointer;
  transition: background .14s, transform .1s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { background: var(--red-dark); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .4; pointer-events: none; }
.btn-icon { font-size: 1.1rem; }

.btn-share {
  width: 100%; background: var(--card); border: .5px solid var(--border);
  color: var(--white); font-family: 'Instrument Sans', sans-serif;
  font-size: 13px; font-weight: 600; padding: .8rem; border-radius: 12px;
  cursor: pointer; transition: all .14s; text-align: center;
}
.btn-share:hover { border-color: #555; }

.btn-home {
  display: block; text-align: center; width: 100%;
  background: transparent; border: .5px solid var(--border); color: var(--muted);
  font-family: 'Instrument Sans', sans-serif; font-size: 14px; font-weight: 500;
  padding: .8rem; border-radius: 12px; cursor: pointer; text-decoration: none;
  transition: all .14s; margin-top: .5rem;
}
.btn-home:hover { border-color: #555; color: var(--white); }

/* ── ROOM CODE ── */
.code-display {
  font-family: 'Bebas Neue', sans-serif; font-size: 3.5rem;
  letter-spacing: .2em; color: var(--white); text-align: center;
  background: var(--card); border: 1px solid rgba(232,50,29,.3);
  border-radius: 16px; padding: 1.25rem; line-height: 1;
  margin-top: .3rem;
}
.code-url { font-size: 12px; color: var(--muted); text-align: center; margin-top: .4rem; }

/* ── ROUNDS ── */
.rounds-row {
  display: flex; align-items: center; gap: 16px;
  margin-top: .3rem;
}
.rounds-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); border: .5px solid var(--border);
  color: var(--white); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .14s;
}
.rounds-btn:hover { border-color: #555; background: #252420; }
.rounds-val {
  font-family: 'Bebas Neue', sans-serif; font-size: 2rem;
  color: var(--white); min-width: 32px; text-align: center; line-height: 1;
}

/* ── CAT PILLS ── */
.cat-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-top: .3rem; }
.cpill {
  background: transparent; border: .5px solid var(--border); color: var(--muted);
  font-family: 'Instrument Sans', sans-serif; font-size: 12px; font-weight: 500;
  padding: 5px 13px; border-radius: 100px; cursor: pointer; transition: all .14s;
  letter-spacing: .04em;
}
.cpill:hover { border-color: #555; color: var(--white); }
.cpill.on { background: var(--white); color: var(--black); border-color: var(--white); }

/* ── LOBBY ── */
.player-list { display: flex; flex-direction: column; gap: 8px; margin-top: .4rem; }
.player-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: .5px solid var(--border);
  border-radius: 12px; padding: .7rem 1rem;
  animation: fadeUp .3s ease both;
}
.player-item.host { border-color: rgba(232,50,29,.3); }
.p-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.p-name { font-size: 14px; font-weight: 500; color: var(--white); flex: 1; }
.p-tag { font-size: 11px; font-weight: 600; }
.p-tag.host { color: var(--red); }
.p-tag.ready { color: var(--green); }
.p-tag.you { color: var(--yellow); }

.lobby-settings {
  background: var(--card); border: .5px solid var(--border);
  border-radius: 12px; padding: 1rem; margin-top: .5rem;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px;
}
.ls-row { display: flex; justify-content: space-between; align-items: center; }
.ls-label { color: var(--muted); }
.ls-value { color: var(--white); font-weight: 500; }

.online-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); display: inline-block; margin-right: 5px;
}

/* ── GAME SCREEN ── */
.game-wrap {
  max-width: 560px; width: 100%; margin: 0 auto;
  padding: 1.5rem 1.25rem 2.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  padding-top: calc(58px + 1.5rem);
}
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.progress-label { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.progress-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.pdot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); transition: background .2s; }
.pdot.done { background: var(--red); }
.pdot.now { background: var(--yellow); }

.scoreboard { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.scoreboard::-webkit-scrollbar { display: none; }
.score-card {
  flex: 0 0 auto; min-width: 88px; background: var(--card);
  border: .5px solid var(--border); border-radius: 12px; padding: .7rem .85rem;
  transition: border-color .2s, background .2s;
}
.score-card.active { border-color: var(--red); background: #1c1510; }
.score-card.you { border-color: var(--yellow); }
.sc-name { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-score { font-family: 'Bebas Neue', sans-serif; font-size: 1.9rem; color: var(--white); line-height: 1; margin: .2rem 0; }
.sc-tag { font-size: 10px; font-weight: 500; }
.sc-tag.active { color: var(--red); }
.sc-tag.you { color: var(--yellow); }
.sc-tag.pass { color: #3a3936; }

.turn-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(232,50,29,.12); border: .5px solid rgba(232,50,29,.3);
  border-radius: 100px; padding: 6px 14px;
  font-size: 13px; color: var(--red); font-weight: 600; width: fit-content;
}

.dare-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 2rem 1.75rem;
  text-align: center; min-height: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .85rem; position: relative;
}
.dc-chip {
  position: absolute; top: 1rem; left: 1rem;
  font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 100px; background: #252420; color: var(--muted);
}
.dc-num { position: absolute; top: 1rem; right: 1rem; font-size: 11px; color: #3a3936; }
.dice { font-size: 2.6rem; line-height: 1; user-select: none; }
.dare-text { font-size: clamp(1rem, 2.2vw, 1.25rem); font-weight: 500; line-height: 1.5; color: var(--white); max-width: 380px; transition: opacity .15s; }
.dare-text.hide { opacity: 0; }

.btn-roll {
  width: 100%; background: var(--red); color: #fff; border: none;
  font-family: 'Bebas Neue', sans-serif; font-size: 1.5rem; letter-spacing: .06em;
  padding: 1rem; border-radius: 13px; cursor: pointer; transition: background .14s, transform .1s;
}
.btn-roll:hover { background: var(--red-dark); }
.btn-roll:active { transform: scale(.97); }

.dare-actions { display: flex; gap: 9px; }
.btn-done {
  flex: 2; background: var(--green); color: #0b0b0a; border: none;
  font-family: 'Bebas Neue', sans-serif; font-size: 1.3rem; letter-spacing: .06em;
  padding: .9rem 1rem; border-radius: 13px; cursor: pointer; transition: all .14s;
}
.btn-done:hover { background: #22c55e; }
.btn-pass {
  flex: 1; background: var(--card); color: var(--muted);
  border: .5px solid var(--border); font-family: 'Instrument Sans', sans-serif;
  font-size: 13px; font-weight: 500; padding: .9rem 1rem;
  border-radius: 13px; cursor: pointer; transition: all .14s;
}
.btn-pass:hover { color: var(--white); border-color: #555; }

.spectate-card {
  background: var(--surface); border: .5px solid var(--border);
  border-radius: 16px; padding: 1.5rem; text-align: center;
}
.sp-label { font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.sp-player { font-family: 'Bebas Neue', sans-serif; font-size: 1.8rem; letter-spacing: .03em; color: var(--white); }
.sp-player span { color: var(--red); }
.sp-dare { font-size: 14px; color: #c8c0b8; line-height: 1.6; margin-top: .5rem; font-style: italic; }
.sp-status { font-size: 12px; color: var(--yellow); font-weight: 500; margin-top: .75rem; }
.next-hint {
  background: var(--card); border: .5px solid var(--border);
  border-radius: 12px; padding: .85rem 1rem; text-align: center;
  font-size: 13px; color: var(--muted);
}

/* ── RESULTS ── */
.winner-block { text-align: center; padding: 1rem 0 .5rem; }
.winner-emoji { font-size: 3rem; line-height: 1; margin-bottom: .5rem; }
.winner-name { font-family: 'Bebas Neue', sans-serif; font-size: clamp(2rem, 7vw, 3.5rem); letter-spacing: .03em; }
.winner-sub { font-size: 13px; color: var(--muted); margin-top: .4rem; }

.leaderboard { display: flex; flex-direction: column; gap: 8px; }
.lb-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: .5px solid var(--border);
  border-radius: 12px; padding: .9rem 1rem;
}
.lb-row.first { border-color: var(--yellow); background: #1e1c10; }
.lb-pos { font-family: 'Bebas Neue', sans-serif; font-size: 1.2rem; color: var(--muted); min-width: 22px; }
.lb-row.first .lb-pos { color: var(--yellow); }
.lb-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; flex-shrink: 0; }
.lb-name { font-size: 14px; font-weight: 500; color: var(--white); flex: 1; }
.lb-bar-wrap { flex: 2; height: 5px; background: #252420; border-radius: 100px; overflow: hidden; }
.lb-bar { height: 100%; background: var(--red); border-radius: 100px; transition: width .6s ease; }
.lb-row.first .lb-bar { background: var(--yellow); }
.lb-score { font-family: 'Bebas Neue', sans-serif; font-size: 1.2rem; color: var(--white); min-width: 26px; text-align: right; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 2rem; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--white); color: #0b0b0a;
  font-size: 13px; font-weight: 600; padding: 10px 22px;
  border-radius: 100px; opacity: 0; transition: all .22s;
  pointer-events: none; z-index: 999; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── ANIMATIONS ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── RESPONSIVE ── */
@media(max-width:480px) {
  .code-display { font-size: 2.8rem; letter-spacing: .15em; }
  .game-wrap { padding: calc(58px + 1rem) 1rem 2rem; }
}
