:root {
  color-scheme: light;
  --ink: #171411;
  --muted: #70685d;
  --line: rgba(23, 20, 17, 0.14);
  --paper: #f7f1e8;
  --paper-strong: #fffaf1;
  --carbon: #211c18;
  --carbon-2: #332b25;
  --ember: #e4572e;
  --mint: #2a9d8f;
  --gold: #e9b44c;
  --violet: #6b5ca5;
  --red: #c83e4d;
  --green: #1f8f66;
  --shadow: 0 22px 60px rgba(23, 20, 17, 0.16);
  --soft-shadow: 0 12px 36px rgba(23, 20, 17, 0.1);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 20, 17, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 20, 17, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 20% 15%, rgba(233, 180, 76, 0.18), transparent 34%),
    linear-gradient(135deg, #fffaf1 0%, #f5ebdd 47%, #edf5f2 100%);
  background-size:
    32px 32px,
    32px 32px,
    auto,
    auto;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(100%, var(--max));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 18px clamp(14px, 2.5vw, 28px) 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 10px 0;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--paper-strong);
  background: var(--carbon);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
}

.brand strong,
.brand small {
  display: block;
  line-height: 1;
}

.brand strong {
  font-size: 1rem;
  letter-spacing: 0;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.topbar-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-status .room-chip,
.topbar-status .mode-chip,
.topbar-status .status-pill {
  color: var(--carbon);
  background: rgba(255, 250, 241, 0.72);
  border-color: var(--line);
  box-shadow: 0 8px 18px rgba(23, 20, 17, 0.07);
}

.topbar-status .status-pill.open {
  color: #0f5f45;
  background: rgba(31, 143, 102, 0.13);
  border-color: rgba(31, 143, 102, 0.25);
}

.topbar-status .status-pill.locked {
  color: #7a2430;
  background: rgba(200, 62, 77, 0.12);
  border-color: rgba(200, 62, 77, 0.26);
}

.activity-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(300px, 44vw);
  min-height: 34px;
  padding: 0 10px;
  color: var(--carbon);
  background: rgba(255, 250, 241, 0.78);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(23, 20, 17, 0.08);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: activityIn 240ms ease both;
}

.topbar-status.is-steady-render .activity-pill {
  animation: none;
}

.activity-pill.leave,
.activity-pill.kick {
  color: #7a2430;
  background: rgba(200, 62, 77, 0.12);
  border-color: rgba(200, 62, 77, 0.26);
}

.activity-pill.join,
.activity-pill.host {
  color: #0f5f45;
  background: rgba(31, 143, 102, 0.13);
  border-color: rgba(31, 143, 102, 0.25);
}

@keyframes activityIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app {
  padding-top: 14px;
}

.view {
  animation: viewIn 420ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.app.is-steady-render .view {
  animation: none;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: clamp(18px, 4vw, 44px);
  align-items: stretch;
  min-height: calc(100dvh - 128px);
}

.intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  color: var(--carbon);
  background: rgba(255, 250, 241, 0.72);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 750;
  box-shadow: 0 8px 22px rgba(23, 20, 17, 0.08);
}

.eyebrow.mini {
  padding: 6px 9px;
  font-size: 0.74rem;
  box-shadow: none;
}

.project-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  width: fit-content;
  max-width: 100%;
  padding: 9px 11px;
  color: var(--carbon);
  background: rgba(255, 250, 241, 0.68);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(23, 20, 17, 0.08);
}

.project-strip span,
.project-strip strong,
.project-strip small {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.project-strip span {
  font-weight: 900;
}

.project-strip small {
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 12ch;
  font-size: clamp(3.1rem, 8.2vw, 7rem);
  line-height: 0.88;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 58ch;
  color: #413b35;
  font-size: clamp(1rem, 2.2vw, 1.24rem);
  line-height: 1.55;
}

.hero-board {
  position: relative;
  display: grid;
  min-height: 430px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(33, 28, 24, 0.96), rgba(49, 41, 35, 0.98)),
    var(--carbon);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-board::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(120deg, rgba(0, 0, 0, 0.2), #000 42%, rgba(0, 0, 0, 0.5));
}

.hero-board-inner {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.board-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--paper-strong);
}

.room-chip,
.mode-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 10px;
  color: var(--paper-strong);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 750;
}

.hero-word-stack {
  align-self: center;
  display: grid;
  gap: 14px;
}

.word-card {
  position: relative;
  display: grid;
  gap: 13px;
  min-height: 160px;
  padding: clamp(18px, 3vw, 26px);
  overflow: hidden;
  color: var(--paper-strong);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.word-card::after {
  position: absolute;
  right: -34px;
  bottom: -58px;
  width: 200px;
  height: 200px;
  content: "";
  background:
    linear-gradient(90deg, transparent 48%, rgba(233, 180, 76, 0.26) 49%, rgba(233, 180, 76, 0.26) 51%, transparent 52%),
    linear-gradient(180deg, transparent 48%, rgba(233, 180, 76, 0.22) 49%, rgba(233, 180, 76, 0.22) 51%, transparent 52%);
  background-size: 22px 22px;
  transform: rotate(-12deg);
}

.word-card small {
  color: rgba(255, 250, 241, 0.66);
  font-weight: 750;
  text-transform: uppercase;
}

.word-card strong {
  position: relative;
  z-index: 1;
  overflow-wrap: anywhere;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.word-card span {
  position: relative;
  z-index: 1;
  color: rgba(255, 250, 241, 0.7);
}

.board-players {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.mini-player {
  min-width: 0;
  padding: 10px;
  color: var(--paper-strong);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.mini-player span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 800;
}

.mini-player small {
  color: rgba(255, 250, 241, 0.58);
}

.panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  min-width: 0;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(255, 250, 241, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.panel h2 {
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.input-row {
  display: flex;
  gap: 10px;
  min-width: 0;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.input-wrap > svg,
.input-wrap > i {
  position: absolute;
  left: 13px;
  width: 19px;
  height: 19px;
  color: var(--muted);
  pointer-events: none;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input {
  min-height: 50px;
  padding: 0 14px;
}

.input-wrap input {
  padding-left: 42px;
}

textarea {
  min-height: 84px;
  resize: vertical;
  padding: 13px 14px;
}

input:focus,
textarea:focus {
  background: #fff;
  border-color: rgba(42, 157, 143, 0.72);
  box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.14);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 0;
  min-height: 46px;
  padding: 0 15px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease;
}

.btn svg,
.btn i {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 20, 17, 0.12);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  color: #fffaf1;
  background: var(--carbon);
  border-color: var(--carbon);
}

.btn.accent {
  color: #fff;
  background: var(--ember);
  border-color: var(--ember);
}

.btn.good {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.btn.ghost {
  color: var(--carbon);
  background: rgba(255, 255, 255, 0.44);
}

.btn.danger {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.btn.icon {
  width: 44px;
  padding: 0;
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.room-layout,
.game-layout,
.result-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: clamp(14px, 2.5vw, 24px);
  align-items: start;
}

.game-layout {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 340px);
}

.game-layout.text-mode {
  grid-template-columns: minmax(320px, 0.95fr) minmax(230px, 320px) minmax(360px, 1.1fr);
}

.mobile-game-bar {
  display: none;
}

.result-layout {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 340px);
}

.side-panel,
.main-panel,
.chat-panel,
.result-panel {
  min-width: 0;
  background: rgba(255, 250, 241, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.side-panel,
.main-panel,
.result-panel {
  padding: clamp(16px, 2.4vw, 24px);
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title h2,
.section-title h3 {
  line-height: 1.1;
  letter-spacing: 0;
}

.section-title h2 {
  font-size: clamp(1.6rem, 3vw, 2.45rem);
}

.section-title h3 {
  font-size: 1.1rem;
}

.section-title p,
.subtle {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.code-box {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.room-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: var(--carbon);
  border-radius: var(--radius);
  color: var(--paper-strong);
}

.room-code strong {
  overflow: hidden;
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
}

.player-list {
  display: grid;
  gap: 9px;
}

.player-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 58px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  background: var(--avatar, var(--carbon));
  border-radius: var(--radius);
  font-weight: 900;
}

.player-meta {
  min-width: 0;
}

.player-meta strong,
.player-meta span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.presence-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(31, 143, 102, 0.12);
}

.player-row.is-offline {
  opacity: 0.62;
}

.player-row.is-offline .presence-dot {
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(112, 104, 93, 0.1);
}

.player-row.is-ready {
  border-color: rgba(31, 143, 102, 0.3);
  background: rgba(31, 143, 102, 0.08);
}

.player-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
}

.danger-icon {
  color: var(--red);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 27px;
  padding: 0 8px;
  color: var(--carbon);
  background: rgba(233, 180, 76, 0.22);
  border: 1px solid rgba(233, 180, 76, 0.4);
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge.good {
  color: #0f5f45;
  background: rgba(31, 143, 102, 0.14);
  border-color: rgba(31, 143, 102, 0.32);
}

.visibility-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 31px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
}

.visibility-chip.public {
  color: #0f5f45;
  background: rgba(31, 143, 102, 0.14);
  border: 1px solid rgba(31, 143, 102, 0.32);
}

.visibility-chip.private {
  color: #7a2430;
  background: rgba(200, 62, 77, 0.12);
  border: 1px solid rgba(200, 62, 77, 0.3);
}

.room-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.config-grid {
  display: grid;
  gap: 18px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 80px;
  padding: 13px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.theme-tile svg,
.theme-tile i {
  width: 24px;
  height: 24px;
  color: var(--theme-color, var(--mint));
}

.theme-tile strong,
.theme-tile small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-tile strong {
  font-size: 0.94rem;
}

.theme-tile small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.theme-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(23, 20, 17, 0.1);
}

.theme-tile.is-active {
  background: rgba(42, 157, 143, 0.12);
  border-color: rgba(42, 157, 143, 0.5);
  box-shadow: inset 0 0 0 1px rgba(42, 157, 143, 0.16);
}

.theme-tile[disabled] {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.segmented,
.timer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button,
.timer-options button {
  min-height: 42px;
  padding: 0 12px;
  color: var(--carbon);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 850;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.segmented button.is-active,
.timer-options button.is-active {
  color: #fff;
  background: var(--carbon);
  border-color: var(--carbon);
}

.segmented button:hover,
.timer-options button:hover {
  transform: translateY(-1px);
}

.counter {
  display: inline-grid;
  grid-template-columns: 44px minmax(60px, 1fr) 44px;
  align-items: center;
  max-width: 180px;
  min-height: 44px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.counter button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--carbon);
  background: transparent;
  cursor: pointer;
}

.counter span {
  text-align: center;
  font-size: 1.12rem;
  font-weight: 900;
}

.counter button[disabled] {
  cursor: not-allowed;
  opacity: 0.35;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.ready-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.ready-panel div:first-child {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.ready-panel strong {
  font-size: 1rem;
}

.ready-panel p {
  color: var(--muted);
  font-size: 0.86rem;
}

.ready-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ready-dots span {
  width: 12px;
  height: 12px;
  background: rgba(112, 104, 93, 0.22);
  border: 1px solid rgba(112, 104, 93, 0.2);
  border-radius: 50%;
}

.ready-dots span.is-ready {
  background: var(--green);
  border-color: rgba(31, 143, 102, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 143, 102, 0.12);
}

.tabletop {
  position: relative;
  display: grid;
  min-height: 320px;
  margin-bottom: 18px;
  overflow: hidden;
  color: var(--paper-strong);
  background:
    linear-gradient(135deg, rgba(33, 28, 24, 0.96), rgba(51, 43, 37, 0.98)),
    var(--carbon);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.tabletop::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052) 1px, transparent 1px);
  background-size: 38px 38px;
}

.table-core {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 20px;
}

.table-core-content {
  display: grid;
  gap: 8px;
  max-width: 420px;
  text-align: center;
}

.table-core-content strong {
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.table-core-content span {
  color: rgba(255, 250, 241, 0.68);
  font-weight: 750;
}

.player-cloud {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-content: end;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px 18px;
}

.player-token {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(210px, 100%);
  min-height: 42px;
  padding: 5px 10px 5px 6px;
  color: var(--paper-strong);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
}

.player-token.is-ready {
  background: rgba(31, 143, 102, 0.18);
  border-color: rgba(31, 143, 102, 0.3);
}

.player-token > i {
  width: 15px;
  height: 15px;
  color: #9ff0c8;
}

.player-token .avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  font-size: 0.75rem;
}

.player-token span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  font-weight: 850;
}

.game-stack {
  display: grid;
  gap: 14px;
}

.phase-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 16px;
  color: var(--paper-strong);
  background: var(--carbon);
  border-radius: var(--radius);
}

.phase-band h2 {
  overflow-wrap: normal;
  word-break: normal;
  font-size: clamp(1.65rem, 3vw, 2.2rem);
  line-height: 1;
}

.phase-band p {
  margin-top: 7px;
  color: rgba(255, 250, 241, 0.7);
}

.timer {
  --progress: 1;
  display: grid;
  width: clamp(108px, 13vw, 142px);
  aspect-ratio: 1;
  place-items: center;
  background:
    radial-gradient(circle at center, var(--carbon) 0 58%, transparent 59%),
    conic-gradient(var(--gold) calc(var(--progress) * 1turn), rgba(255, 255, 255, 0.14) 0);
  border-radius: 50%;
}

.timer-content {
  display: grid;
  width: 76%;
  aspect-ratio: 1;
  place-items: center;
  background: rgba(255, 250, 241, 0.08);
  border-radius: 50%;
}

.timer strong {
  font-size: clamp(1.45rem, 5vw, 2.35rem);
  letter-spacing: 0;
}

.timer small {
  color: rgba(255, 250, 241, 0.62);
  font-weight: 850;
  text-transform: uppercase;
}

.word-reveal {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  min-width: 0;
}

.secret-panel {
  display: grid;
  align-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 168px;
  padding: clamp(18px, 3vw, 28px);
  color: var(--paper-strong);
  background:
    linear-gradient(135deg, rgba(42, 157, 143, 0.9), rgba(33, 28, 24, 0.95)),
    var(--carbon);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  border: 0;
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.secret-panel:hover {
  transform: translateY(-1px);
  filter: saturate(1.04);
}

.secret-panel[disabled] {
  cursor: default;
  transform: none;
}

.secret-panel.impostor {
  background:
    linear-gradient(135deg, rgba(200, 62, 77, 0.9), rgba(33, 28, 24, 0.95)),
    var(--carbon);
}

.secret-panel.is-hidden {
  background:
    linear-gradient(135deg, rgba(107, 92, 165, 0.72), rgba(33, 28, 24, 0.97)),
    var(--carbon);
}

.secret-panel small {
  color: rgba(255, 250, 241, 0.68);
  font-weight: 850;
  text-transform: uppercase;
}

.secret-panel strong {
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  line-height: 1;
  letter-spacing: 0;
}

.secret-panel span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255, 250, 241, 0.76);
  font-weight: 850;
}

.secret-panel span svg,
.secret-panel span i {
  width: 18px;
  height: 18px;
}

.action-rail {
  display: flex;
  flex-direction: row;
  gap: 10px;
  min-width: 0;
}

.action-rail .btn {
  flex: 1 1 0;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(180px, 1fr) auto;
  min-height: min(560px, calc(100dvh - 140px));
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.chat-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.chat-live span {
  width: 8px;
  height: 8px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(31, 143, 102, 0.12);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  max-height: 55dvh;
  overflow: auto;
  padding: 16px;
}

.message {
  display: grid;
  gap: 5px;
  max-width: 86%;
  min-width: 0;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.message.mine {
  align-self: end;
  background: rgba(42, 157, 143, 0.13);
  border-color: rgba(42, 157, 143, 0.3);
}

.message strong,
.message span {
  overflow-wrap: anywhere;
}

.message strong {
  font-size: 0.82rem;
}

.message time {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
}

.vote-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.vote-status strong,
.vote-status span {
  display: block;
}

.vote-status strong {
  font-size: 1.15rem;
}

.vote-status span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.vote-progress {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: rgba(23, 20, 17, 0.1);
  border-radius: 999px;
}

.vote-progress::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--vote-progress) * 100%);
  content: "";
  background: var(--gold);
  border-radius: inherit;
  transition: width 180ms ease;
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.vote-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  min-width: 0;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.vote-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 20, 17, 0.09);
}

.vote-card.is-selected {
  background: rgba(233, 180, 76, 0.18);
  border-color: rgba(233, 180, 76, 0.58);
}

.vote-card strong,
.vote-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vote-card small {
  color: var(--muted);
}

.check-dot {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #fff;
  background: rgba(23, 20, 17, 0.18);
  border-radius: 50%;
}

.vote-card.is-selected .check-dot {
  background: var(--gold);
}

.results-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.bar {
  min-width: 0;
}

.bar strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}

.bar-track {
  height: 9px;
  margin-top: 8px;
  overflow: hidden;
  background: rgba(23, 20, 17, 0.1);
  border-radius: 999px;
}

.bar-fill {
  width: var(--width, 0%);
  height: 100%;
  background: var(--ember);
  border-radius: inherit;
  transition: width 420ms ease;
}

.vote-trace {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.trace-grid {
  display: grid;
  gap: 9px;
}

.trace-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto minmax(92px, auto);
  align-items: center;
  gap: 10px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.trace-row .avatar {
  width: 38px;
  height: 38px;
}

.trace-row strong,
.trace-row small,
.trace-row b {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-row small {
  color: var(--muted);
  font-size: 0.74rem;
}

.trace-row > i {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.outcome {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: clamp(18px, 3vw, 28px);
  color: var(--paper-strong);
  background: var(--carbon);
  border-radius: var(--radius);
}

.outcome.good {
  background:
    linear-gradient(135deg, rgba(31, 143, 102, 0.92), rgba(33, 28, 24, 0.96)),
    var(--carbon);
}

.outcome.bad {
  background:
    linear-gradient(135deg, rgba(200, 62, 77, 0.92), rgba(33, 28, 24, 0.96)),
    var(--carbon);
}

.outcome h2 {
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 0.95;
}

.outcome p {
  color: rgba(255, 250, 241, 0.72);
  line-height: 1.5;
}

.reveal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reveal-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 36px;
  padding: 0 10px;
  color: var(--paper-strong);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 850;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state.compact {
  min-height: 90px;
  padding: 14px;
}

.overview-panel {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.section-title.compact {
  align-items: center;
  margin-bottom: 0;
}

.overview-actions {
  display: inline-flex;
  gap: 8px;
}

.overview-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.overview-filters button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--carbon);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
}

.overview-filters button.is-active {
  color: var(--paper-strong);
  background: var(--carbon);
  border-color: var(--carbon);
}

.room-overview-list {
  display: grid;
  gap: 10px;
  max-height: min(420px, 46dvh);
  overflow: auto;
  padding-right: 2px;
}

.overview-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.overview-main,
.overview-meta {
  min-width: 0;
}

.overview-main strong,
.overview-main span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-main strong {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.overview-main span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.84rem;
}

.overview-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.overview-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 8px;
  color: var(--carbon);
  background: rgba(233, 180, 76, 0.18);
  border: 1px solid rgba(233, 180, 76, 0.32);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
}

.overview-meta svg,
.overview-meta i {
  width: 14px;
  height: 14px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 20, 17, 0.48);
  backdrop-filter: blur(10px);
  animation: fadeIn 180ms ease both;
}

.modal {
  display: grid;
  gap: 16px;
  width: min(100%, 460px);
  padding: 20px;
  background: var(--paper-strong);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: modalIn 220ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast {
  position: fixed;
  right: clamp(12px, 3vw, 24px);
  bottom: clamp(12px, 3vw, 24px);
  z-index: 80;
  max-width: min(380px, calc(100vw - 24px));
  padding: 13px 15px;
  color: var(--paper-strong);
  background: var(--carbon);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .welcome,
  .room-layout,
  .game-layout,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .welcome {
    min-height: 0;
  }

  .intro {
    padding: 20px 0 0;
  }

  h1 {
    max-width: 9ch;
  }

  .side-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  .shell {
    padding-inline: 12px;
    padding-bottom: 86px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-status {
    flex-wrap: wrap;
    font-size: 0.78rem;
  }

  .hero-board {
    min-height: 360px;
  }

  .board-players,
  .theme-grid,
  .vote-grid {
    grid-template-columns: 1fr;
  }

  .input-row,
  .word-reveal,
  .phase-band {
    grid-template-columns: 1fr;
  }

  .input-row {
    flex-direction: column;
  }

  .action-rail {
    min-width: 0;
  }

  .overview-card {
    grid-template-columns: 1fr;
  }

  .overview-card .btn {
    width: 100%;
  }

  .timer {
    width: 132px;
    justify-self: start;
  }

  .chat-panel {
    min-height: 430px;
  }

  .game-layout {
    gap: 12px;
  }

  .mobile-game-bar {
    position: sticky;
    top: 68px;
    z-index: 12;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
    background: rgba(255, 250, 241, 0.9);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(18px);
  }

  .mobile-game-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 38px;
    padding: 0 6px;
    color: var(--muted);
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 900;
  }

  .mobile-game-bar button.is-active {
    color: var(--paper-strong);
    background: var(--carbon);
  }

  .mobile-game-bar i,
  .mobile-game-bar svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
  }

  .game-layout.mobile-card .player-panel,
  .game-layout.mobile-card .chat-panel,
  .game-layout.mobile-players .main-panel,
  .game-layout.mobile-players .chat-panel,
  .game-layout.mobile-chat .main-panel,
  .game-layout.mobile-chat .player-panel {
    display: none;
  }

  .game-layout.mobile-players .player-panel,
  .game-layout.mobile-chat .chat-panel {
    display: grid;
  }
}

@media (max-width: 430px) {
  .brand small {
    display: none;
  }

  .room-chip,
  .mode-chip,
  .status-pill {
    font-size: 0.75rem;
  }

  .button-row,
  .lobby-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .btn.icon {
    width: 44px;
  }

  .action-rail {
    flex-direction: column;
  }

  .project-strip {
    border-radius: var(--radius);
  }

  .ready-panel,
  .vote-status,
  .trace-row {
    grid-template-columns: 1fr;
  }

  .ready-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .ready-dots {
    justify-content: flex-start;
  }
}

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