@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:ital,wght@0,700;1,700&display=swap');

:root {
  color-scheme: dark;
  --ink: #0a0b0d;
  --paper: #121316;
  --paper-2: #18191d;
  --line: rgba(244, 235, 215, .13);
  --line-strong: rgba(244, 235, 215, .23);
  --cream: #f1e9da;
  --muted: #a39d93;
  --red: #a93337;
  --red-bright: #db5757;
  --amber: #d7a65b;
  --green: #69a981;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: "DM Sans", system-ui, sans-serif;
  background: #090a0c;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }

.scene {
  position: fixed;
  inset: 0;
  z-index: -3;
  background: url("./noir-city.png") center / cover no-repeat;
  filter: saturate(.72) contrast(1.06);
}
.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(5, 6, 8, .52), rgba(5, 6, 8, .84) 55%, #090a0c 100%),
    radial-gradient(circle at 50% 15%, transparent 0 15%, rgba(5, 6, 8, .42) 75%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: .12;
  background:
    repeating-linear-gradient(17deg, transparent 0 3px, rgba(255,255,255,.018) 3px 4px),
    repeating-linear-gradient(103deg, transparent 0 5px, rgba(0,0,0,.045) 5px 6px);
}

.site-header {
  width: min(1180px, calc(100% - 30px));
  margin: 0 auto;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: env(safe-area-inset-top);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border: 1px solid var(--line-strong); display: grid; place-items: center;
  font-family: "Playfair Display", serif; font-size: 1.45rem; transform: rotate(45deg);
  background: rgba(18, 19, 22, .72); box-shadow: inset 0 0 20px rgba(169, 51, 55, .18);
}
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand > span:last-child { display: grid; line-height: 1; }
.brand strong { font: 700 1.05rem "Playfair Display", serif; letter-spacing: .06em; }
.brand small { color: var(--muted); font-size: .62rem; letter-spacing: .22em; text-transform: uppercase; margin-top: 5px; }
.server-seal { display: flex; align-items: center; gap: 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .64rem; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(105, 169, 129, .12); }

main { width: min(1180px, calc(100% - 30px)); margin: 0 auto; padding: 28px 0 80px; }
.landing-view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 470px); gap: clamp(35px, 8vw, 110px); align-items: center; min-height: calc(100vh - 138px); }
.hero { max-width: 640px; padding: 40px 0; }
.kicker, .eyebrow { margin: 0; color: var(--amber); text-transform: uppercase; letter-spacing: .2em; font-size: .68rem; font-weight: 700; }
.hero h1 { margin: 15px 0 24px; font: 700 clamp(3.6rem, 8vw, 6.8rem)/.86 "Playfair Display", Georgia, serif; letter-spacing: -.055em; text-wrap: balance; }
.hero h1 em { color: #c9bca8; font-weight: 700; }
.hero-copy { max-width: 570px; color: #c9c2b7; font-size: clamp(1rem, 1.6vw, 1.17rem); line-height: 1.75; }
.briefing-entry {
  border: 1px solid rgba(215,166,91,.38);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(215,166,91,.12), rgba(8,9,11,.55));
  color: var(--cream);
  min-height: 56px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
}
.briefing-entry:hover { border-color: rgba(215,166,91,.7); background: rgba(215,166,91,.16); transform: translateY(-1px); }
.briefing-entry > span { grid-row: 1 / 3; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--amber); color: #16120d; font-size: .62rem; padding-left: 2px; }
.briefing-entry b { font: 700 .92rem "Playfair Display", serif; }
.briefing-entry small { color: var(--muted); font-size: .64rem; margin-top: 2px; }
.briefing-entry-hero { margin-top: 24px; min-width: min(100%, 335px); }
.briefing-entry-lobby { width: 100%; margin-top: 16px; }
.trust-strip { display: flex; gap: 1px; margin-top: 32px; }
.trust-strip span { padding: 12px 18px; color: var(--muted); font-size: .77rem; border: 1px solid var(--line); background: rgba(10, 11, 13, .48); }
.trust-strip span:first-child { border-radius: 6px 0 0 6px; }
.trust-strip span:last-child { border-radius: 0 6px 6px 0; }
.trust-strip b { color: var(--cream); }

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(24, 25, 29, .94), rgba(13, 14, 17, .94));
  box-shadow: var(--shadow);
  border-radius: 8px;
  backdrop-filter: blur(16px);
}
.casebook { padding: clamp(20px, 4vw, 30px); position: relative; }
.casebook::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(255,255,255,.025); pointer-events: none; border-radius: 4px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2, .lobby-panel h2, .action-panel h2, .waiting-panel h2, .investigation-panel h2 { margin: 5px 0 0; font: 700 1.48rem "Playfair Display", serif; }
.icon-button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); font-size: 1.3rem; }
.icon-button:hover { border-color: var(--line-strong); color: var(--cream); }

.field { display: grid; gap: 8px; margin-top: 21px; }
.field > span { color: #c4bdb3; font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
input, select {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 5px;
  background: rgba(4, 5, 7, .58); color: var(--cream); padding: 0 14px; outline: none;
}
input::placeholder { color: #696760; }
input:focus, select:focus { border-color: rgba(215, 166, 91, .62); box-shadow: 0 0 0 3px rgba(215, 166, 91, .08); }
.room-browser-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 25px 0 10px; }
.room-browser-heading span { font-size: .82rem; font-weight: 700; }
.room-browser-heading small { color: var(--muted); }
.room-list { display: grid; gap: 8px; max-height: 232px; overflow: auto; padding-right: 3px; }
.room-card {
  border: 1px solid var(--line); background: rgba(4,5,7,.42); border-radius: 6px; padding: 11px;
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 11px; text-align: left; cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s;
}
.room-card:hover { background: rgba(169,51,55,.12); border-color: rgba(219,87,87,.35); transform: translateX(2px); }
.room-monogram, .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #25262b; border: 1px solid var(--line); font: 700 .9rem "Playfair Display", serif; }
.room-details { display: grid; gap: 3px; min-width: 0; }
.room-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.room-details small { color: var(--muted); font-size: .68rem; }
.room-code-mini { color: var(--amber); font: 700 .74rem ui-monospace, monospace; letter-spacing: .1em; }
.empty-rooms { padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); }
.empty-rooms span { display: block; font-size: 1.8rem; }
.empty-rooms strong { display: block; color: var(--cream); margin-top: 4px; }
.empty-rooms p { margin: 4px 0 0; font-size: .78rem; }
.code-join { margin-top: 13px; padding-top: 14px; border-top: 1px solid var(--line); }
.code-join > span { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 7px; }
.code-join > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
#room-code { font: 700 1rem ui-monospace, monospace; letter-spacing: .22em; text-transform: uppercase; }
.button { min-height: 46px; padding: 0 18px; border-radius: 5px; border: 1px solid transparent; font-weight: 700; cursor: pointer; transition: filter .18s, transform .18s, border-color .18s; }
.button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: wait; }
.button-primary { background: linear-gradient(180deg, #b53c40, #85272b); border-color: #c85155; box-shadow: 0 7px 25px rgba(169,51,55,.18); }
.button-secondary { background: #25262b; border-color: var(--line); }
.button-quiet { background: transparent; border-color: var(--line-strong); color: #d4cdc0; min-height: 38px; }
.full { width: 100%; }
.create-case { margin-top: 14px; border-top: 1px solid var(--line); }
.create-case summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 17px 1px 4px; }
.create-case summary::-webkit-details-marker { display: none; }
.create-case summary span { display: grid; font-weight: 700; font-family: "Playfair Display", serif; }
.create-case summary small { font: 500 .66rem "DM Sans", sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 3px; }
.create-case summary i { font-style: normal; color: var(--amber); font-size: 1.25rem; transition: rotate .2s; }
.create-case[open] summary i { rotate: 45deg; }
.setting-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.timer-scale-note { margin: 11px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.5; }
.create-body .button { margin-top: 18px; }
.fine-print { margin: 12px 0 0; color: #807c75; font-size: .68rem; line-height: 1.5; }
.error { color: #ee8888; margin: 12px 0 0; min-height: 1em; font-size: .8rem; }

.game-view { padding-top: 10px; }
.room-bar { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; }
.room-bar h2 { margin: 4px 0 0; font: 700 clamp(1.25rem, 3vw, 1.65rem) "Playfair Display", serif; }
.room-tools { display: flex; align-items: center; gap: 9px; }
.narrator-controls { display: flex; align-items: stretch; }
.narrator-button, .narrator-repeat {
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.22);
  color: var(--muted);
  cursor: pointer;
}
.narrator-button { display: flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 5px 0 0 5px; }
.narrator-button span { color: var(--amber); font-size: 1rem; }
.narrator-button b { font-size: .65rem; white-space: nowrap; }
.narrator-button.is-on { color: #cce8d5; border-color: rgba(105,169,129,.4); background: rgba(105,169,129,.1); }
.narrator-repeat { padding: 0 9px; border-left: 0; border-radius: 0 5px 5px 0; font-size: .62rem; }
.narrator-button:disabled, .narrator-repeat:disabled { opacity: .45; cursor: not-allowed; }
.code-button { border: 1px solid var(--line); border-radius: 5px; background: rgba(0,0,0,.22); min-width: 105px; padding: 7px 11px; cursor: pointer; display: grid; }
.code-button span { color: var(--amber); font: 700 1rem ui-monospace, monospace; letter-spacing: .14em; }
.code-button small { color: var(--muted); font-size: .58rem; }
.game-view.onboarding-active .game-layout { display: none; }
.pregame-onboarding {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 16px;
  min-height: 620px;
  padding: clamp(22px, 5vw, 48px);
  border-color: rgba(215,166,91,.28);
  background:
    linear-gradient(145deg, rgba(17,18,22,.97), rgba(7,8,10,.98)),
    radial-gradient(circle at 78% 20%, rgba(169,51,55,.2), transparent 42%);
}
.pregame-onboarding::before {
  content: "CONFIDENTIAL";
  position: absolute;
  right: -38px;
  bottom: 58px;
  z-index: -1;
  rotate: -8deg;
  color: rgba(255,255,255,.025);
  font: 700 clamp(3.5rem, 10vw, 8rem) "Playfair Display", serif;
  letter-spacing: -.04em;
}
.onboarding-atmosphere { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.onboarding-atmosphere::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 82% 18%, rgba(174,49,52,.23), transparent 34%),
    linear-gradient(112deg, transparent 55%, rgba(215,166,91,.055) 55.2%, transparent 55.7%);
}
.onboarding-atmosphere i {
  position: absolute;
  top: -15%;
  width: 1px;
  height: 130%;
  background: linear-gradient(transparent, rgba(215,166,91,.17), transparent);
  transform: rotate(17deg);
  animation: briefingLight 8s ease-in-out infinite alternate;
}
.onboarding-atmosphere i:nth-child(1) { right: 11%; }
.onboarding-atmosphere i:nth-child(2) { right: 29%; animation-delay: -2.6s; opacity: .55; }
.onboarding-atmosphere i:nth-child(3) { left: 18%; animation-delay: -5.1s; opacity: .28; }
@keyframes briefingLight { from { translate: -14px 0; opacity: .18; } to { translate: 18px 0; opacity: .7; } }
.onboarding-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.onboarding-header strong {
  display: block;
  margin-top: 7px;
  color: #d8d0c3;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.onboarding-audio { display: flex; gap: 7px; }
.onboarding-audio .button { min-height: 38px; padding: 0 12px; font-size: .67rem; }
.onboarding-audio .is-on { color: #cce8d5; border-color: rgba(105,169,129,.45); background: rgba(105,169,129,.13); }
.onboarding-rollcall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 7px;
  margin: clamp(22px, 4vw, 34px) 0;
}
.onboarding-rollcall > span {
  min-width: 0;
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 31px 1fr;
  grid-template-rows: auto auto;
  gap: 1px 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(0,0,0,.24);
  animation: rollCall .42s both;
  animation-delay: calc(var(--rollcall-index) * 55ms);
}
.onboarding-rollcall > span.self { border-color: rgba(215,166,91,.45); background: rgba(215,166,91,.08); }
.onboarding-rollcall > span.bot { border-style: dashed; }
.onboarding-rollcall i {
  grid-row: 1 / 3;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #25262b;
  color: var(--amber);
  font: normal 700 .72rem "Playfair Display", serif;
}
.onboarding-rollcall b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.onboarding-rollcall small { color: var(--muted); font-size: .55rem; }
@keyframes rollCall { from { opacity: 0; transform: translateY(9px) scale(.97); } to { opacity: 1; transform: none; } }
.onboarding-chapter {
  width: min(820px, 100%);
  min-height: 245px;
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: start;
  gap: clamp(18px, 4vw, 34px);
  padding: clamp(22px, 4vw, 34px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.onboarding-sigil {
  width: 70px;
  height: 88px;
  display: grid;
  place-items: center;
  color: var(--red-bright);
  border: 1px solid rgba(219,87,87,.36);
  background: rgba(69,10,14,.22);
  box-shadow: inset 0 0 30px rgba(169,51,55,.12), 0 12px 40px rgba(0,0,0,.25);
  font: 700 1.8rem "Playfair Display", serif;
}
.onboarding-kicker { margin: 0 0 7px; color: var(--amber); font-size: .63rem; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.onboarding-chapter h1 { margin: 0; font: 700 clamp(2.15rem, 5vw, 4rem)/.98 "Playfair Display", serif; text-wrap: balance; }
.onboarding-chapter > div > p:not(.onboarding-kicker) { max-width: 720px; line-height: 1.6; }
.onboarding-chapter #onboarding-copy { margin: 14px 0 0; color: #d8d0c3; font-size: clamp(.94rem, 2vw, 1.1rem); }
.onboarding-detail { margin: 9px 0 0; color: var(--muted); font-size: .78rem; }
.onboarding-progress { display: flex; align-items: center; gap: 7px; margin-top: 20px; }
.onboarding-progress span { width: 22px; height: 3px; border-radius: 99px; background: rgba(255,255,255,.12); transition: width .2s, background .2s; }
.onboarding-progress span.passed { background: rgba(105,169,129,.6); }
.onboarding-progress span.current { width: 44px; background: var(--amber); box-shadow: 0 0 14px rgba(215,166,91,.24); }
.onboarding-status {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.onboarding-status strong { display: block; font-size: .76rem; }
.onboarding-status small { display: block; margin-top: 4px; color: var(--muted); font-size: .61rem; line-height: 1.45; }
.onboarding-security {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(105,169,129,.3);
  border-radius: 99px;
  color: #a9d4b7;
  background: rgba(105,169,129,.07);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.onboarding-actions { margin-top: 24px; display: flex; justify-content: space-between; gap: 12px; }
.onboarding-actions > div { display: flex; gap: 9px; }
.onboarding-actions .button { min-height: 48px; }
.onboarding-actions .button.is-ready { background: linear-gradient(180deg, #397653, #26543c); border-color: #57976f; }
.onboarding-skip { min-width: 168px; display: grid; place-content: center; gap: 2px; text-align: center; }
.onboarding-skip strong { font-size: .76rem; }
.onboarding-skip small { color: var(--muted); font-size: .56rem; font-weight: 500; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(285px, .75fr); gap: 16px; margin-top: 16px; align-items: start; }
.game-main, .game-side { display: grid; gap: 16px; }
.phase-card { padding: clamp(23px, 5vw, 42px); min-height: 315px; position: relative; overflow: hidden; }
.phase-card::after { content: "CASE FILE"; position: absolute; right: -24px; bottom: 4px; font: 700 4.2rem "Playfair Display", serif; color: rgba(255,255,255,.025); rotate: -7deg; pointer-events: none; }
.phase-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.phase-label { padding: 7px 10px; border: 1px solid rgba(215,166,91,.3); color: var(--amber); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; border-radius: 3px; }
.phase-night_mafia, .phase-voting { color: #ed8383; border-color: rgba(219,87,87,.35); }
.phase-briefing { color: #ead09f; border-color: rgba(215,166,91,.48); background: rgba(215,166,91,.06); }
.phase-complete { color: #96d4ac; border-color: rgba(105,169,129,.4); }
.round-label { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; }
.countdown { margin-top: 28px; font: 500 clamp(2.5rem, 8vw, 4.5rem)/1 ui-monospace, monospace; letter-spacing: -.08em; }
.timeline { height: 2px; background: rgba(255,255,255,.07); margin: 15px 0 30px; }
.timeline i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--red), var(--amber)); transition: width .25s linear; }
.phase-card h1 { position: relative; z-index: 1; margin: 0; max-width: 680px; font: 700 clamp(2rem, 5vw, 3.5rem)/1.03 "Playfair Display", serif; }
.phase-card > p { position: relative; z-index: 1; color: #bab3a8; line-height: 1.65; max-width: 670px; margin: 14px 0 0; }
.lobby-panel, .action-panel, .waiting-panel, .investigation-panel { padding: clamp(20px, 4vw, 30px); }
.lobby-panel > p:not(.eyebrow), .action-panel > p:not(.eyebrow), .waiting-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.lobby-panel .button { margin-top: 14px; }
.lobby-panel .button.is-ready { background: linear-gradient(180deg, #397653, #26543c); border-color: #57976f; }
.role-preview { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 20px; }
.role-preview span { padding: 6px 9px; border: 1px solid var(--line); color: var(--muted); font-size: .68rem; border-radius: 3px; }
.role-preview b { color: var(--cream); }
.start-guide {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(215, 166, 91, .28);
  border-radius: 5px;
  background: rgba(215, 166, 91, .055);
}
.start-guide h3 { margin: 6px 0 5px; font: 700 1.25rem "Playfair Display", serif; }
.start-guide > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.test-lab {
  margin-top: 18px;
  padding: 19px;
  border: 2px solid rgba(105, 169, 129, .52);
  border-radius: 5px;
  background: linear-gradient(135deg, rgba(105, 169, 129, .14), rgba(4, 5, 7, .2));
  display: grid;
  gap: 13px;
}
.test-lab > div > span {
  display: inline-block;
  color: #b9e5c8;
  background: rgba(105, 169, 129, .13);
  border: 1px solid rgba(105, 169, 129, .28);
  border-radius: 99px;
  padding: 4px 8px;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.test-lab strong { display: block; margin-top: 8px; font: 700 1rem "Playfair Display", serif; }
.test-lab p { margin: 4px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.test-lab label { display: grid; gap: 6px; }
.test-lab label > span { color: #a9c9b4; font-size: .65rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.button-test { background: rgba(105, 169, 129, .12); border-color: rgba(105, 169, 129, .4); color: #c9ebd4; }
.close-room-zone {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 15px;
}
.close-room-zone strong { font-size: .78rem; }
.close-room-zone p { margin: 3px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.45; }
.button-danger-quiet { min-height: 38px; background: transparent; border-color: rgba(219, 87, 87, .3); color: #d68b8b; font-size: .7rem; }
.button-danger-quiet.armed { background: rgba(169, 51, 55, .18); border-color: rgba(219, 87, 87, .65); color: #ffb0b0; }
.role-dossier { overflow: hidden; }
.dossier-cover { padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); }
.dossier-cover h2 { margin: 4px 0 0; font: 700 1.35rem "Playfair Display", serif; }
.dossier-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.role-secret { min-height: 195px; padding: 28px; display: grid; grid-template-columns: 90px 1fr; gap: 24px; align-items: center; position: relative; transition: filter .25s; }
.role-secret::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 10% 50%, rgba(169,51,55,.12), transparent 45%); pointer-events: none; }
.role-secret.concealed { filter: blur(16px); user-select: none; pointer-events: none; }
.role-sigil { width: 86px; height: 110px; border: 1px solid rgba(169,51,55,.35); display: grid; place-items: center; color: var(--red-bright); font: 700 3rem "Playfair Display", serif; background: rgba(0,0,0,.3); box-shadow: inset 0 0 35px rgba(169,51,55,.11); }
.role-secret small { color: var(--muted); text-transform: uppercase; letter-spacing: .18em; font-size: .62rem; }
.role-secret h3 { margin: 2px 0 8px; font: 700 2.3rem "Playfair Display", serif; }
.role-secret p { margin: 0; color: #bcb5aa; line-height: 1.55; font-size: .88rem; }
.mafia-team { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.mafia-team small { width: 100%; }
.mafia-team span { border: 1px solid rgba(219,87,87,.25); padding: 5px 8px; color: #e59696; font-size: .7rem; border-radius: 3px; }
.action-panel { border-color: rgba(169,51,55,.35); box-shadow: 0 20px 70px rgba(71,12,15,.22); }
.private-help-button {
  min-height: 34px;
  margin-top: 11px;
  padding: 0 11px;
  border: 1px solid rgba(215,166,91,.32);
  border-radius: 4px;
  background: rgba(215,166,91,.07);
  color: #dfc89f;
  font-size: .66rem;
  font-weight: 700;
  cursor: pointer;
}
.private-help-button:hover { border-color: rgba(215,166,91,.65); background: rgba(215,166,91,.12); }
.status-replay { position: relative; z-index: 2; }
.action-status { margin-top: 14px; color: #91c9a4; background: rgba(105,169,129,.08); border: 1px solid rgba(105,169,129,.22); padding: 9px 11px; border-radius: 4px; font-size: .75rem; }
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 8px; margin-top: 20px; }
.target-card { min-height: 100px; border: 1px solid var(--line); border-radius: 5px; background: rgba(5,6,8,.48); padding: 13px; cursor: pointer; text-align: left; display: grid; grid-template-columns: 32px 1fr; align-items: center; gap: 4px 9px; }
.target-card:hover { border-color: rgba(219,87,87,.5); background: rgba(169,51,55,.1); }
.target-card:disabled { cursor: default; opacity: .46; border-color: var(--line); background: rgba(5,6,8,.3); }
.target-card > span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #292a2f; grid-row: 1 / 3; font-size: .72rem; }
.target-card strong { font-size: .82rem; }
.target-card small { color: var(--red-bright); font-size: .65rem; }
.phase-ready-panel { padding: clamp(20px, 4vw, 28px); display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: center; border-color: rgba(215,166,91,.3); }
.phase-ready-panel h2 { margin: 5px 0 0; font: 700 1.4rem "Playfair Display", serif; }
.phase-ready-panel > div:first-child > p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.ready-progress { min-width: 140px; padding: 12px; border: 1px solid var(--line); border-radius: 4px; text-align: center; background: rgba(0,0,0,.18); }
.ready-progress strong { display: block; color: var(--amber); font-size: .86rem; }
.ready-progress small { display: block; margin-top: 4px; color: var(--muted); font-size: .58rem; line-height: 1.4; }
.phase-control-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 10px; }
.phase-ready-panel .button { margin: 0; }
.phase-ready-panel .button.is-ready { background: linear-gradient(180deg, #397653, #26543c); border-color: #57976f; }
.waiting-panel { display: flex; align-items: center; gap: 22px; }
.waiting-orbit { flex: 0 0 auto; width: 48px; height: 48px; border: 1px solid var(--line-strong); border-radius: 50%; position: relative; animation: orbit 2s linear infinite; }
.waiting-orbit::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); top: -4px; left: 20px; box-shadow: 0 0 12px var(--amber); }
@keyframes orbit { to { rotate: 360deg; } }
.finding { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.finding span { color: var(--muted); font-size: .68rem; }
.finding b { font-size: .66rem; letter-spacing: .1em; padding: 5px 7px; border: 1px solid var(--line); }
.finding.is-mafia b { color: #ed8383; border-color: rgba(219,87,87,.35); }
.finding.not-mafia b { color: #91c9a4; border-color: rgba(105,169,129,.3); }

.players-panel { padding: 20px; }
.players-panel h2 { margin: 4px 0 0; font: 700 1.35rem "Playfair Display", serif; }
.count-chip { font-size: .68rem; color: var(--muted); border: 1px solid var(--line); padding: 5px 8px; border-radius: 99px; }
.player-list { display: grid; margin-top: 16px; }
.player-row { display: grid; grid-template-columns: 38px 1fr 9px; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); }
.player-row.arriving { animation: playerArrives .45s both; animation-delay: calc(var(--arrival-index) * 45ms); }
@keyframes playerArrives { from { opacity: 0; transform: translateX(-9px); } to { opacity: 1; transform: none; } }
.player-row.self { background: linear-gradient(90deg, rgba(215,166,91,.06), transparent); }
.player-row.bot .avatar { border-style: dashed; color: #a9d4b7; }
.player-row.eliminated { opacity: .48; }
.player-row.eliminated .avatar { filter: grayscale(1); }
.player-info { display: grid; gap: 2px; min-width: 0; }
.player-info strong { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; }
.player-info em { color: var(--amber); font: 500 .58rem "DM Sans", sans-serif; text-transform: uppercase; letter-spacing: .08em; }
.player-info small { color: var(--muted); font-size: .64rem; text-transform: capitalize; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #57585c; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(105,169,129,.5); }
.history-panel { padding: 0 20px; }
.history-panel summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; padding: 18px 0; font: 700 1rem "Playfair Display", serif; }
.history-panel summary::-webkit-details-marker { display: none; }
.history-list { padding-bottom: 18px; }
.history-list article { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; }
.history-list article span { color: var(--amber); font-size: .58rem; text-transform: uppercase; letter-spacing: .1em; }
.history-list article strong { font-size: .76rem; }
.history-list article p, .history-empty { color: var(--muted); font-size: .68rem; line-height: 1.5; margin: 0; }
.leave-button { border: 0; background: transparent; color: #7d7a74; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: .72rem; justify-self: center; }
.role-help-open, .game-status-open { overflow: hidden; }
.role-help-overlay, .game-status-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}
.game-status-overlay { z-index: 55; }
.role-help-backdrop, .game-status-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3,4,6,.9);
  backdrop-filter: blur(9px);
}
.role-help-card, .game-status-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(92dvh, 820px);
  overflow: auto;
  padding: clamp(20px, 4vw, 32px);
  border-color: rgba(215,166,91,.3);
  overscroll-behavior: contain;
}
.role-help-card:focus, .game-status-card:focus { outline: 1px solid rgba(215,166,91,.55); outline-offset: 2px; }
.role-help-card > header, .game-status-card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.role-help-card h2, .game-status-card h2 { margin: 6px 0 0; font: 700 clamp(1.8rem, 6vw, 2.65rem)/1 "Playfair Display", serif; }
.role-help-identity, .game-status-hero {
  margin-top: 22px;
  padding: 20px;
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(169,51,55,.3);
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(169,51,55,.12), rgba(0,0,0,.2));
}
.role-help-identity > span, .game-status-hero > span {
  width: 60px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(219,87,87,.35);
  background: rgba(0,0,0,.24);
  color: var(--red-bright);
  font: 700 2rem "Playfair Display", serif;
}
.role-help-identity strong, .game-status-hero strong { font: 700 1.15rem "Playfair Display", serif; }
.role-help-identity p, .game-status-hero p { margin: 7px 0 0; color: #c4bdb2; font-size: .78rem; line-height: 1.55; }
.role-help-steps { margin-top: 20px; }
.role-help-steps h3 { margin: 0 0 9px; font: 700 1rem "Playfair Display", serif; }
.role-help-steps ol, .game-status-details { margin: 0; padding: 0; list-style: none; counter-reset: private-steps; display: grid; gap: 7px; }
.role-help-steps li, .game-status-details li {
  position: relative;
  padding: 11px 12px 11px 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: #c4bdb2;
  background: rgba(0,0,0,.16);
  font-size: .74rem;
  line-height: 1.5;
}
.role-help-steps li::before {
  counter-increment: private-steps;
  content: counter(private-steps);
  position: absolute;
  left: 12px;
  color: var(--amber);
  font: 700 .68rem ui-monospace, monospace;
}
.role-help-secret { margin: 16px 0; padding: 11px 12px; color: #a9d4b7; border-left: 2px solid var(--green); background: rgba(105,169,129,.07); font-size: .69rem; line-height: 1.5; }
.game-status-details { margin-top: 18px; }
.game-status-details li { padding-left: 30px; }
.game-status-details li::before { content: "—"; position: absolute; left: 11px; color: var(--amber); }
.rematch-panel { margin-top: 20px; padding: 18px; border: 1px solid rgba(105,169,129,.3); border-radius: 6px; background: rgba(105,169,129,.07); }
.rematch-panel h3 { margin: 5px 0 7px; font: 700 1.25rem "Playfair Display", serif; }
.rematch-panel > p:not(.eyebrow) { margin: 0; color: #b4b0a7; font-size: .72rem; line-height: 1.5; }
.rematch-panel > strong { display: block; margin-top: 13px; color: #b9e5c8; font-size: .76rem; }
.rematch-panel > small { display: block; margin-top: 4px; color: var(--muted); font-size: .61rem; line-height: 1.45; }
.rematch-panel .button { margin-top: 13px; }
.rematch-panel .button.is-ready { background: linear-gradient(180deg, #397653, #26543c); border-color: #57976f; }
.game-status-actions { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.briefing-open { overflow: hidden; }
.briefing-overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px; }
.briefing-backdrop { position: absolute; inset: 0; background: rgba(4,5,7,.87); backdrop-filter: blur(8px); }
.briefing-sheet {
  position: relative;
  width: min(820px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  padding: clamp(20px, 4vw, 34px);
  overscroll-behavior: contain;
}
.briefing-sheet:focus { outline: 1px solid rgba(215,166,91,.5); outline-offset: 2px; }
.briefing-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.briefing-header h2 { margin: 6px 0 8px; font: 700 clamp(1.9rem, 5vw, 3rem)/1 "Playfair Display", serif; }
.briefing-header > div > p:last-child { margin: 0; max-width: 580px; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.briefing-controls {
  position: sticky;
  top: -1px;
  z-index: 2;
  margin: 0 -4px;
  padding: 14px 4px;
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 8px;
  align-items: center;
  background: linear-gradient(180deg, rgba(18,19,22,.99) 75%, rgba(18,19,22,.78));
}
.briefing-controls .button { min-height: 40px; font-size: .72rem; }
.briefing-controls [aria-pressed="true"] { color: #cce8d5; border-color: rgba(105,169,129,.45); background: rgba(105,169,129,.13); }
.briefing-controls small { color: var(--muted); font-size: .61rem; line-height: 1.4; text-align: right; }
#briefing-recording, #onboarding-opening-audio, #cloned-announcement-audio { display: none; }
.briefing-transcript { margin-top: 12px; }
.briefing-transcript:focus { outline: 1px solid rgba(215,166,91,.45); outline-offset: 5px; }
.briefing-lead, .briefing-signoff {
  margin: 20px 0;
  color: #d5cbbb;
  font: 700 1.02rem/1.65 "Playfair Display", serif;
}
.briefing-transcript ol { list-style: none; margin: 0; padding: 0; display: grid; }
.briefing-transcript li { display: grid; grid-template-columns: 38px 1fr; gap: 14px; padding: 18px 0; border-top: 1px solid var(--line); }
.briefing-transcript li > span { color: var(--amber); font: 700 .66rem ui-monospace, monospace; letter-spacing: .08em; padding-top: 4px; }
.briefing-transcript h3 { margin: 0 0 6px; font: 700 1.14rem "Playfair Display", serif; }
.briefing-transcript li p { margin: 0; color: #aaa49a; font-size: .78rem; line-height: 1.65; }
.briefing-signoff { border-top: 1px solid var(--line); padding-top: 20px; margin-bottom: 0; color: var(--amber); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); translate: -50% 130%; opacity: 0; padding: 11px 17px; background: #e9dfcf; color: #16171a; border-radius: 4px; font-weight: 700; font-size: .78rem; box-shadow: var(--shadow); z-index: 20; transition: translate .25s, opacity .25s; }
.toast.show { translate: -50% 0; opacity: 1; }

@media (max-width: 820px) {
  .site-header { min-height: 70px; }
  .server-seal span:last-child { display: none; }
  main { padding-top: 8px; width: min(100% - 22px, 680px); }
  .landing-view { grid-template-columns: 1fr; min-height: auto; gap: 10px; }
  .hero { padding: 34px 4px 22px; }
  .hero h1 { font-size: clamp(3.35rem, 18vw, 5.4rem); }
  .hero-copy { font-size: .95rem; line-height: 1.65; }
  .briefing-entry-hero { width: 100%; }
  .trust-strip { margin-top: 24px; width: 100%; }
  .trust-strip span { flex: 1; padding: 10px 7px; text-align: center; }
  .casebook { margin-bottom: 30px; }
  .game-layout { grid-template-columns: 1fr; }
  .game-side { grid-row: auto; }
  .phase-card { min-height: 295px; }
}

@media (max-width: 480px) {
  .site-header { width: calc(100% - 22px); }
  .brand-mark { width: 34px; height: 34px; }
  .hero h1 { margin-top: 12px; }
  .trust-strip span { font-size: .65rem; }
  .setting-grid { grid-template-columns: 1fr; gap: 0; }
  .room-details small { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .room-code-mini { display: none; }
  .room-card { grid-template-columns: 38px 1fr; }
  .room-bar { padding: 13px 14px; }
  .room-tools { align-items: stretch; }
  .room-bar { align-items: flex-start; }
  .narrator-controls { display: grid; }
  .narrator-button { border-radius: 5px 5px 0 0; min-height: 34px; padding: 0 7px; }
  .narrator-repeat { border-left: 1px solid var(--line); border-top: 0; border-radius: 0 0 5px 5px; min-height: 28px; }
  .code-button { min-width: 86px; }
  .pregame-onboarding { min-height: calc(100dvh - 150px); padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .onboarding-header { align-items: flex-start; }
  .onboarding-audio { display: grid; grid-template-columns: 1fr; max-width: 128px; }
  .onboarding-audio .button { min-height: 34px; padding: 0 8px; }
  .onboarding-rollcall { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 20px 0; }
  .onboarding-rollcall > span { grid-template-columns: 27px 1fr; padding: 7px 8px; }
  .onboarding-rollcall i { width: 27px; height: 27px; }
  .onboarding-chapter { min-height: 300px; grid-template-columns: 48px 1fr; gap: 13px; padding: 22px 0; }
  .onboarding-sigil { width: 46px; height: 62px; font-size: 1.15rem; }
  .onboarding-chapter h1 { font-size: clamp(2rem, 10vw, 2.65rem); }
  .onboarding-chapter #onboarding-copy { font-size: .91rem; }
  .onboarding-detail { font-size: .72rem; }
  .onboarding-status { align-items: flex-start; }
  .onboarding-security { display: none; }
  .onboarding-actions { display: grid; }
  .onboarding-actions > div { display: grid; grid-template-columns: .7fr 1.3fr; }
  .onboarding-actions > .button { order: 2; width: 100%; }
  .phase-card { padding: 23px 20px; min-height: 280px; }
  .phase-card::after { font-size: 2.8rem; }
  .countdown { margin-top: 24px; }
  .phase-card h1 { font-size: 2.15rem; }
  .role-secret { grid-template-columns: 64px 1fr; gap: 14px; padding: 20px 16px; }
  .role-sigil { width: 62px; height: 86px; font-size: 2.2rem; }
  .role-secret h3 { font-size: 1.75rem; }
  .role-secret p { font-size: .78rem; }
  .dossier-cover { padding: 15px 16px; }
  .dossier-cover { align-items: flex-start; }
  .dossier-actions { display: grid; }
  .dossier-actions .button { padding: 0 10px; font-size: .66rem; }
  .target-grid { grid-template-columns: 1fr 1fr; }
  .phase-ready-panel { grid-template-columns: 1fr; }
  .phase-control-actions { grid-template-columns: 1fr; }
  .ready-progress { width: 100%; }
  .close-room-zone { grid-template-columns: 1fr; }
  .close-room-zone .button { width: 100%; margin-top: 0; }
  .role-help-overlay, .game-status-overlay { padding: 0; align-items: end; }
  .role-help-card, .game-status-card {
    width: 100%;
    max-height: 94dvh;
    border-radius: 10px 10px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }
  .role-help-identity, .game-status-hero { grid-template-columns: 50px 1fr; padding: 15px; gap: 12px; }
  .role-help-identity > span, .game-status-hero > span { width: 48px; height: 60px; font-size: 1.55rem; }
  .game-status-actions { grid-template-columns: 1fr; }
  .briefing-overlay { padding: 0; align-items: end; }
  .briefing-sheet { width: 100%; max-height: 94dvh; border-radius: 10px 10px 0 0; padding: 20px 16px calc(22px + env(safe-area-inset-bottom)); }
  .briefing-controls { grid-template-columns: 1fr 1fr; }
  .briefing-controls .button { padding: 0 9px; }
  .briefing-controls small { grid-column: 1 / -1; text-align: left; }
  .briefing-transcript li { grid-template-columns: 30px 1fr; gap: 9px; }
}

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