:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --surface: #131720;
  --surface-2: #191e29;
  --surface-3: #202633;
  --line: #2b3342;
  --text: #f4f1ea;
  --muted: #9aa4b5;
  --gold: #d6b25e;
  --teal: #5bc7bd;
  --coral: #e66f5c;
  --violet: #9b8cff;
  --green: #73d383;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background:
    linear-gradient(115deg, rgba(91, 199, 189, .1), transparent 28%),
    linear-gradient(250deg, rgba(214, 178, 94, .09), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.in-game {
  height: 100vh;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--teal);
}

button:disabled {
  cursor: not-allowed;
  opacity: .48;
}

.primary {
  background: var(--gold);
  color: #11110f;
  border-color: transparent;
}

.app {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 26px 0;
}

.in-game .app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 14px 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  max-width: 590px;
  font-size: clamp(36px, 4.8vw, 58px);
  line-height: 1.02;
  font-weight: 900;
}

.home-lead {
  max-width: 520px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.05;
}

h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.home-shell {
  min-height: calc(100vh - 118px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
}

.in-game .home-shell,
.in-game .home-footer {
  display: none;
}

.home-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(214, 178, 94, .38);
  border-radius: 12px;
  background: rgba(214, 178, 94, .12);
  color: var(--gold);
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .05em;
}

.brand strong {
  font-size: 15px;
  letter-spacing: .02em;
}

.nav-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.nav-pills span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .025);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(420px, 1fr);
  align-items: center;
  gap: 30px;
  padding: 28px 0 10px;
}

.hero-copy {
  padding: 22px 0;
}

.entry-board {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 12px;
  align-items: stretch;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent), var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.create-card,
.join-card {
  min-height: 342px;
}

.create-card {
  display: flex;
  flex-direction: column;
  border-color: rgba(214, 178, 94, .32);
}

.join-card {
  display: flex;
  flex-direction: column;
}

.join-card button {
  width: 100%;
  margin-top: auto;
}

.create-card input,
.join-card input {
  min-height: 48px;
}

.create-card button.primary {
  width: 100%;
  margin-top: auto;
}

.home-mode-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 4px 0 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1118;
}

.home-mode-picker label {
  min-width: 0;
  margin: 0;
  cursor: pointer;
}

.home-mode-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.home-mode-picker span {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.home-mode-picker input:checked + span {
  border-color: rgba(214, 178, 94, .46);
  background: rgba(214, 178, 94, .14);
  color: var(--gold);
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.home-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-details article {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .025);
  padding: 14px;
}

.home-details article span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(91, 199, 189, .12);
  color: var(--teal);
  font-size: 11px;
  font-weight: 950;
}

.home-details article strong {
  display: block;
  margin-top: 0;
  font-size: 15px;
}

.home-details article p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.home-footer {
  width: min(1120px, calc(100% - 28px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 16px 0 22px;
  color: var(--muted);
  font-size: 12px;
}

.home-footer p {
  margin: 0;
}

.home-footer a {
  color: var(--gold);
  font-weight: 900;
  text-decoration: none;
}

.panel-head span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(214, 178, 94, .16);
  color: var(--gold);
  font-weight: 900;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e1118;
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}

select {
  height: 40px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 13px) 50% / 6px 6px no-repeat,
    #0e1118;
  padding-right: 38px;
}

textarea {
  min-height: 210px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(91, 199, 189, .12);
}

.hint,
.quiet {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.roombar {
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 12px;
}

.roombar h2 {
  font-size: 30px;
  letter-spacing: .06em;
}

.timer {
  min-width: 124px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--gold);
  padding: 10px 14px;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.close-room {
  min-height: 44px;
  border-color: rgba(230, 111, 92, .42);
  background: rgba(230, 111, 92, .1);
  color: var(--coral);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  white-space: nowrap;
}

.grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 14px;
}

.room-panel {
  align-self: start;
  padding: 12px;
}

.players {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.player {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, .025);
}

.player[draggable="true"] {
  cursor: grab;
}

.player[draggable="true"]:active {
  cursor: grabbing;
}

.player.drag-over {
  border-color: var(--gold);
  background: rgba(214, 178, 94, .1);
}

.player.host {
  border-left: 3px solid var(--gold);
}

.player.guesser {
  border-left: 3px solid var(--teal);
}

.player.team-a {
  border-color: rgba(91, 199, 189, .32);
  border-left-color: var(--teal);
}

.player.team-b {
  border-color: rgba(230, 111, 92, .32);
  border-left-color: var(--coral);
}

.player.team-c {
  border-color: rgba(155, 140, 255, .38);
  border-left-color: var(--violet);
}

.player.team-a.guesser {
  background: rgba(91, 199, 189, .08);
}

.player.team-b.guesser {
  background: rgba(230, 111, 92, .08);
}

.player.team-c.guesser {
  background: rgba(155, 140, 255, .08);
}

.player.waiting {
  border-left: 3px solid var(--line);
}

.player.owner {
  border-left: 3px solid var(--coral);
  background: rgba(230, 111, 92, .055);
}

.player strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.player i {
  display: block;
  min-width: 64px;
  border-radius: 999px;
  background: rgba(91, 199, 189, .16);
  color: var(--teal);
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
  padding: 6px 8px;
  text-align: center;
  text-transform: uppercase;
}

.player-action {
  min-width: 86px;
  min-height: 30px;
  border-color: rgba(214, 178, 94, .4);
  background: rgba(214, 178, 94, .12);
  color: var(--gold);
  border-radius: 9px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.player.host i {
  background: rgba(214, 178, 94, .16);
  color: var(--gold);
}

.player.owner i {
  background: rgba(230, 111, 92, .16);
  color: var(--coral);
}

.player.team-b i {
  background: rgba(230, 111, 92, .16);
  color: var(--coral);
}

.player.team-c i {
  background: rgba(155, 140, 255, .16);
  color: var(--violet);
}

.player.guesser i {
  background: var(--green);
  color: #0d140f;
}

.team-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.team-title strong {
  color: var(--gold);
}

.team-title.team-a span {
  color: var(--teal);
}

.team-title.team-b span {
  color: var(--coral);
}

.team-title.team-c span {
  color: var(--violet);
}

.queue {
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.queue strong {
  color: var(--text);
}

.invite-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 8px;
  margin-top: 2px;
}

#copyCodeButton,
#copyLinkButton {
  min-height: 44px;
  background: var(--surface-3);
}

#copyCodeButton {
  color: var(--gold);
  font-size: 19px;
  font-weight: 950;
  letter-spacing: .08em;
}

#copyLinkButton {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--teal);
  padding: 5px 6px;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

#copyLinkButton svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage {
  min-height: 0;
  height: calc(100vh - 108px);
  display: flex;
  flex-direction: column;
  padding: 14px;
}

.stage-top {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 10px;
}

.state-label,
.turn-chip {
  border-radius: 999px;
  background: rgba(91, 199, 189, .14);
  color: var(--teal);
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.turn-chip.host {
  background: rgba(214, 178, 94, .14);
  color: var(--gold);
}

.word-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #0f131b;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.word-card.revealed {
  border-color: rgba(214, 178, 94, .58);
  background: linear-gradient(135deg, rgba(214, 178, 94, .24), rgba(35, 27, 16, .86));
}

.word-card.masked {
  border-color: rgba(91, 199, 189, .32);
}

.word-card span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.word-card span b {
  color: var(--gold);
  font-weight: 900;
}

.word-card strong {
  display: block;
  margin-top: 3px;
  color: #fff3c8;
  font-size: clamp(26px, 3.6vw, 48px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.word-card.masked strong {
  color: var(--teal);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
}

.mask-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px;
}

.mask-slots span {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(91, 199, 189, .34);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(91, 199, 189, .12), rgba(91, 199, 189, .035)),
    #101722;
  position: relative;
}

.mask-slots span::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  height: 2px;
  border-radius: 999px;
  background: var(--teal);
  opacity: .8;
}

.mask-slots .revealed-letter {
  display: grid;
  place-items: center;
  border-color: rgba(214, 178, 94, .62);
  background: linear-gradient(180deg, rgba(214, 178, 94, .22), rgba(214, 178, 94, .08));
  color: #ffe2a0;
  font-size: 18px;
  font-weight: 950;
  text-transform: uppercase;
}

.mask-slots .revealed-letter::after {
  display: none;
}

.mask-slots .mask-gap {
  width: 12px;
  border: 0;
  background: transparent;
}

.mask-slots .mask-hyphen {
  display: grid;
  place-items: center;
  width: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.mask-slots .mask-gap::after {
  display: none;
}

.feed {
  flex: 1;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
  padding-right: 6px;
  overflow-y: auto;
}

.feed::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
  width: 8px;
}

.feed::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
  background: #343d4e;
  border-radius: 999px;
}

.bubble {
  width: min(72%, 520px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #111722;
  padding: 10px 12px;
}

.bubble.host {
  align-self: flex-start;
  border-color: rgba(214, 178, 94, .35);
  background: linear-gradient(135deg, rgba(214, 178, 94, .12), #111722 60%);
}

.bubble.guesser {
  align-self: flex-end;
  border-color: rgba(91, 199, 189, .32);
  background: linear-gradient(135deg, rgba(91, 199, 189, .12), #111722 62%);
}

.bubble.guesser.team-a {
  border-color: rgba(91, 199, 189, .48);
  border-left: 4px solid var(--teal);
  background: linear-gradient(135deg, rgba(91, 199, 189, .16), #111722 58%);
}

.bubble.guesser.team-b {
  border-color: rgba(230, 111, 92, .48);
  border-left: 4px solid var(--coral);
  background: linear-gradient(135deg, rgba(230, 111, 92, .15), #111722 58%);
}

.bubble.guesser.team-c {
  border-color: rgba(155, 140, 255, .5);
  border-left: 4px solid var(--violet);
  background: linear-gradient(135deg, rgba(155, 140, 255, .14), #111722 58%);
}

.bubble.guesser.team-a header span {
  color: var(--teal);
}

.bubble.guesser.team-b header span {
  color: var(--coral);
}

.bubble.guesser.team-c header span {
  color: var(--violet);
}

.bubble.good {
  border-color: rgba(115, 211, 131, .55);
  border-left-color: var(--green);
}

.bubble.close {
  border-color: rgba(214, 178, 94, .55);
  border-left-color: var(--gold);
}

.bubble.close header b {
  color: var(--gold);
}

.bubble header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.bubble p {
  margin: 0;
  color: #fffaf0;
  font-size: 15px;
  font-weight: 750;
}

.accept-close {
  width: auto;
  min-height: 26px;
  margin-top: 7px;
  border-color: rgba(115, 211, 131, .62);
  background: rgba(115, 211, 131, .18);
  box-shadow: none;
  color: var(--green);
  font-size: 10px;
  font-weight: 950;
  padding: 0 12px;
  text-transform: uppercase;
}

.turn-wait,
.waiting-board {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, .025);
  padding: 18px;
}

.waiting-board {
  max-width: 520px;
  margin: auto;
  text-align: center;
}

.waiting-board h2 {
  margin-bottom: 14px;
}

.waiting-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.waiting-steps span {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  padding: 8px 10px;
}

.actions,
.setup-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.host-actions {
  grid-template-columns: minmax(0, 1fr) 108px 90px;
}

.guess-input-wrap {
  position: relative;
  min-width: 0;
}

.guess-input-wrap input {
  width: 100%;
  padding-right: 54px;
}

#guessLetterCount {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: rgba(91, 199, 189, .14);
  color: var(--teal);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 950;
  pointer-events: none;
}

.danger {
  border-color: rgba(230, 111, 92, .45);
  background: rgba(230, 111, 92, .12);
  color: var(--coral);
}

.big-action {
  width: 100%;
}

.word-setup {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.word-builder {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr);
  gap: 10px;
  margin-bottom: 10px;
}

.word-builder label {
  margin-bottom: 0;
}

.word-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: end;
  gap: 8px;
}

.word-tools label {
  margin: 0;
}

.word-tools button {
  min-height: 38px;
  border-color: rgba(230, 111, 92, .32);
  background: rgba(230, 111, 92, .09);
  color: var(--coral);
  font-size: 11px;
  font-weight: 950;
}

.word-list {
  min-height: 220px;
  max-height: none;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1118;
  padding: 9px;
}

.word-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 7px;
}

.word-row input {
  min-height: 36px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .035);
}

.word-row button {
  min-height: 36px;
  border-color: rgba(230, 111, 92, .35);
  background: rgba(230, 111, 92, .09);
  color: var(--coral);
  padding: 0;
}

.empty-words {
  margin: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.lobby-control {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.lobby-summary,
.settings-card,
.generate-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .018);
  padding: 12px;
}

.section-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

.generate-row {
  margin-bottom: 12px;
}

.generate-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  align-items: end;
  gap: 8px;
}

.generate-fields label {
  margin: 0;
}

.generate-fields input {
  height: 38px;
  min-height: 38px;
}

.generate-fields button {
  height: 38px;
  min-height: 38px;
  align-self: end;
  border-color: rgba(214, 178, 94, .35);
  background: rgba(214, 178, 94, .1);
  color: var(--gold);
  border-radius: 10px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 950;
}

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  padding: 9px 10px;
}

.summary-grid strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 18px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.team-lobby {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}

.team-lobby-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.team-lobby-head .summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-settings {
  padding: 9px;
}

.compact-settings .lobby-settings {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-settings .setting-duo {
  display: none;
}

.team-word-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.team-word-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .018);
  padding: 10px;
  overflow: hidden;
}

.team-word-column.team-a {
  border-color: rgba(91, 199, 189, .28);
}

.team-word-column.team-b {
  border-color: rgba(230, 111, 92, .28);
}

.team-word-column.team-c {
  border-color: rgba(155, 140, 255, .32);
}

.team-word-column.team-a .team-word-title strong {
  color: var(--teal);
}

.team-word-column.team-b .team-word-title strong {
  color: var(--coral);
}

.team-word-column.team-c .team-word-title strong {
  color: var(--violet);
}

.team-word-title,
.team-word-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team-word-title strong {
  font-size: 14px;
}

.team-word-title span,
.team-word-player-head span {
  border-radius: 999px;
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 950;
}

.team-word-player-head span.ready {
  background: rgba(115, 211, 131, .14);
  color: var(--green);
}

.team-word-player {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0f131b;
  padding: 10px;
}

.team-word-player.mine {
  border-color: rgba(214, 178, 94, .42);
  background: rgba(214, 178, 94, .045);
}

.team-word-player strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-word-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  margin-top: 9px;
}

.mini-word-builder input {
  min-height: 36px;
}

.mini-word-builder > button {
  min-height: 36px;
  border-color: rgba(230, 111, 92, .32);
  background: rgba(230, 111, 92, .09);
  color: var(--coral);
  border-radius: 10px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 950;
}

.mini-word-list {
  grid-column: 1 / -1;
  max-height: 210px;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow-y: auto;
}

.word-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  margin-top: 10px;
}

.word-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.lobby-settings {
  display: grid;
  grid-template-columns: minmax(120px, .9fr) minmax(150px, 1.05fr) repeat(2, minmax(120px, .9fr));
  gap: 10px;
}

.lobby-settings .setting-duo {
  grid-column: 1 / -1;
}

.setting-select,
.setting-toggle,
.setting-duo label {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .032), rgba(255, 255, 255, .012)),
    #151a24;
}

.setting-select {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 7px;
  margin: 0;
  padding: 9px;
  overflow: visible;
}

.setting-select span,
.setting-toggle span,
.setting-duo span {
  color: var(--text);
  font-size: 11px;
  font-weight: 900;
}

.setting-select > span {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 9px;
  line-height: 1;
}

.custom-select {
  position: relative;
  z-index: 2;
}

.custom-select.open {
  z-index: 20;
}

.custom-select-trigger {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  border-color: rgba(214, 178, 94, .28);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(214, 178, 94, .1), rgba(255, 255, 255, .02)),
    #0b0f17;
  color: #fff5dc;
  padding: 0 9px 0 11px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.custom-select-trigger:hover,
.custom-select.open .custom-select-trigger {
  border-color: rgba(214, 178, 94, .55);
}

.custom-select-trigger strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-trigger i {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-right: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: translateY(-2px) rotate(45deg);
  opacity: .9;
  transition: transform .15s ease;
}

.custom-select.open .custom-select-trigger i {
  transform: translateY(2px) rotate(225deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 7px);
  left: 0;
  right: 0;
  display: none;
  overflow: hidden;
  border: 1px solid rgba(214, 178, 94, .26);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018)),
    #0d121b;
  box-shadow: 0 18px 34px rgba(0, 0, 0, .34);
  padding: 5px;
}

.custom-select.open .custom-select-menu {
  display: grid;
  gap: 3px;
}

.custom-select-option {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 900;
}

.custom-select-option:hover {
  background: rgba(91, 199, 189, .1);
  color: var(--teal);
}

.custom-select-option.active {
  background: rgba(214, 178, 94, .16);
  color: var(--gold);
}

.setting-toggle,
.setting-duo label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 11px 12px;
  cursor: pointer;
}

.setting-toggle input,
.setting-duo input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  appearance: none;
  border: 1px solid #6d7480;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  margin: 0;
  padding: 0;
}

.setting-toggle input:checked,
.setting-duo input:checked {
  border-color: var(--gold);
  background:
    radial-gradient(circle at center, var(--gold) 0 42%, transparent 45%),
    rgba(214, 178, 94, .12);
}

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

.word-setup.compact {
  margin-top: 10px;
}

.word-setup.compact textarea {
  min-height: 86px;
}

.round-result {
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(115, 211, 131, .1), transparent 42%),
    rgba(255, 255, 255, .035);
  padding: 18px;
}

.round-result.failed {
  background:
    linear-gradient(135deg, rgba(230, 111, 92, .12), transparent 42%),
    rgba(255, 255, 255, .035);
}

.round-result.failed .result-head span {
  border-color: rgba(230, 111, 92, .38);
  background: rgba(230, 111, 92, .1);
  color: var(--coral);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
  margin-bottom: 16px;
}

.result-head h2 {
  margin: 0;
  font-size: clamp(26px, 3.5vw, 42px);
}

.result-head span {
  min-width: 128px;
  border: 1px solid rgba(115, 211, 131, .38);
  border-radius: 14px;
  background: rgba(115, 211, 131, .1);
  color: var(--green);
  padding: 10px 12px;
  text-align: center;
  font-size: clamp(24px, 3vw, 38px);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.result-word {
  border: 1px solid rgba(214, 178, 94, .35);
  border-radius: 14px;
  background: rgba(214, 178, 94, .08);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.result-word small,
.result-meta span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.result-word strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: clamp(24px, 3.4vw, 40px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.result-word p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.result-meta div,
.round-wait {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  padding: 10px;
}

.result-meta strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.next-round-action {
  margin-top: 12px;
  min-height: 44px;
}

.round-wait {
  margin-top: 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.score-final {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.score-final div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
  padding: 10px;
}

.score-final div.winner {
  border-color: rgba(115, 211, 131, .5);
}

.score-final span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.score-final strong {
  display: block;
  color: var(--gold);
  font-size: 20px;
}

.score-final small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.stats-row div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .03);
  padding: 10px;
}

.stats-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-row span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-list {
  flex: 1;
  min-height: 130px;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow-y: auto;
  padding-right: 6px;
}

.history-list article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 82px 120px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .025);
}

.history-list article.skipped {
  border-color: rgba(230, 111, 92, .35);
  opacity: .82;
}

.history-list article.skipped em {
  color: var(--coral);
}

.history-list span,
.history-list small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.history-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list em {
  color: var(--gold);
  font-style: normal;
  font-weight: 900;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: min(420px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  padding: 10px 14px;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.site-banner {
  position: sticky;
  top: 0;
  z-index: 30;
  width: min(1120px, calc(100% - 28px));
  margin: 10px auto 0;
  border: 1px solid rgba(214, 178, 94, .34);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(214, 178, 94, .16), rgba(91, 199, 189, .08)), #10141d;
  color: var(--text);
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 850;
}

.site-banner strong {
  color: var(--gold);
  margin-right: 8px;
}

.maintenance-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 10, 15, .86);
  backdrop-filter: blur(10px);
}

.maintenance-card {
  width: min(520px, 100%);
  border: 1px solid rgba(214, 178, 94, .32);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), transparent), var(--surface);
  padding: 26px;
  text-align: center;
}

.maintenance-card h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(34px, 6vw, 56px);
}

.maintenance-card p {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}

.maintenance-card span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

@media (max-width: 860px) {
  body.in-game {
    height: auto;
    overflow: auto;
  }

  .in-game .app {
    height: auto;
  }

  .home-shell {
    min-height: auto;
    gap: 16px;
  }

  .home-nav,
  .home-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-pills {
    justify-content: start;
  }

  .home-hero,
  .entry-board,
  .home-details,
  .grid,
  .roombar {
    grid-template-columns: 1fr;
  }

  .home-hero {
    gap: 16px;
    padding-top: 10px;
  }

  .hero-copy {
    padding: 8px 0;
  }

  .create-card,
  .join-card {
    min-height: auto;
  }

  .stage {
    height: auto;
    min-height: 560px;
  }

  .actions,
  .setup-actions,
  .host-actions,
  .lobby-control,
  .lobby-summary,
  .summary-grid,
  .lobby-settings,
  .setting-select,
  .setting-duo,
  .generate-row,
  .generate-fields,
  .word-tools,
  .result-meta,
  .stats-row,
  .history-list article {
    grid-template-columns: 1fr;
  }

  .result-head {
    display: grid;
  }

  .result-head span {
    width: 100%;
  }

  .bubble {
    width: 92%;
  }
}
