:root {
  --bg: #f2f6f4;
  --bg-accent: #dcebe6;
  --panel: rgba(251, 254, 252, 0.9);
  --panel-strong: #fbfefc;
  --text: #244046;
  --muted: #68827a;
  --line: rgba(89, 118, 114, 0.14);
  --brand: #6fa8a1;
  --brand-dark: #3b6a6f;
  --brand-soft: #e4f2ef;
  --banana: #d8ebe7;
  --banana-deep: #c7e0db;
  --danger: #b16178;
  --danger-dark: #97384b;
  --tile: #f8fcfb;
  --tile-edge: #bfd4d0;
  --shadow: 0 22px 54px rgba(74, 104, 102, 0.16);
  --radius: 28px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.78), transparent 22%),
    radial-gradient(circle at 85% 12%, rgba(216, 235, 231, 0.76), transparent 18%),
    radial-gradient(circle at bottom right, rgba(199, 224, 219, 0.44), transparent 26%),
    linear-gradient(140deg, var(--bg), var(--bg-accent));
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 999px;
  min-height: 48px;
  padding: 0.85rem 1.2rem;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
  touch-action: manipulation;
}

button:hover {
  transform: translateY(-1px);
  background: var(--brand-dark);
}

button.secondary {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: var(--danger-dark);
}

button.selected {
  box-shadow: inset 0 0 0 2px rgba(31, 28, 23, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

input,
select {
  width: 100%;
  min-height: 54px;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  font-size: 16px;
}

select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 3rem;
  border-color: var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 251, 0.98)),
    linear-gradient(135deg, transparent 50%, rgba(59, 106, 111, 0.9) 50%),
    linear-gradient(45deg, rgba(59, 106, 111, 0.9) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-size: auto, 10px 10px, 10px 10px;
  background-position: 0 0, calc(100% - 1.1rem) 50%, calc(100% - 0.75rem) 50%;
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: inset 0 -1px 0 rgba(59, 106, 111, 0.04);
}

select:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(244, 250, 248, 1)),
    linear-gradient(135deg, transparent 50%, rgba(59, 106, 111, 0.96) 50%),
    linear-gradient(45deg, rgba(59, 106, 111, 0.96) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-size: auto, 10px 10px, 10px 10px;
  background-position: 0 0, calc(100% - 1.1rem) 50%, calc(100% - 0.75rem) 50%;
}

select:focus {
  outline: none;
  border-color: rgba(111, 168, 161, 0.58);
  box-shadow:
    0 0 0 4px rgba(111, 168, 161, 0.14),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

select option {
  background: #31595d;
  color: rgba(255, 255, 255, 0.96);
}

.native-select-hidden {
  display: none;
}

.custom-select {
  position: relative;
}

.lobby-code-field.select-open {
  z-index: 18;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  position: relative;
  min-height: 54px;
  padding: 0.9rem 3rem 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 -1px 0 rgba(59, 106, 111, 0.04);
}

.custom-select-trigger::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(59, 106, 111, 0.9);
  border-bottom: 2px solid rgba(59, 106, 111, 0.9);
  transform: translateY(-60%) rotate(45deg);
}

.custom-select-trigger:hover {
  background: rgba(244, 250, 248, 1);
  color: var(--text);
  transform: none;
}

.custom-select.open .custom-select-trigger,
.custom-select-trigger:focus-visible {
  outline: none;
  border-color: rgba(111, 168, 161, 0.58);
  box-shadow: 0 0 0 4px rgba(111, 168, 161, 0.14);
}

.custom-select.disabled .custom-select-trigger {
  opacity: 0.45;
  cursor: not-allowed;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  display: grid;
  gap: 0;
  padding: 0.35rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(111, 168, 161, 0.2);
  box-shadow: 0 18px 34px rgba(74, 104, 102, 0.16);
  z-index: 30;
}

.custom-select-option {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  min-height: 48px;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.custom-select-option:hover,
.custom-select-option.selected {
  background: rgba(111, 168, 161, 0.12);
  color: var(--brand-dark);
  transform: none;
}

label {
  display: grid;
  gap: 0.35rem;
}

label span,
.label,
.eyebrow,
.hint {
  color: var(--muted);
}

.page-shell {
  width: min(1180px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
  max-width: 100%;
  overflow-x: hidden;
}

.hero {
  margin-bottom: 2rem;
  padding: 1.4rem 0 0.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
  gap: 2rem;
  align-items: center;
}

.hero-home {
  display: inline-block;
  min-height: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 0;
  font-size: clamp(2.8rem, 5vw, 5rem);
  font-weight: 800;
  line-height: 0.88;
  letter-spacing: -0.04em;
  margin: 0 0 0.7rem;
  text-align: left;
}

.hero-heading-row {
  display: flex;
  align-items: start;
  justify-content: flex-start;
  gap: 1rem;
}

.hero-help-button {
  flex-shrink: 0;
  align-self: start;
  position: relative;
  z-index: 2;
  margin-top: 0.35rem;
  margin-left: clamp(2.5rem, 9vw, 7rem);
  padding: 0.8rem 1.2rem;
  border: 1px solid rgba(36, 49, 65, 0.14);
  background: rgba(36, 49, 65, 0.96);
  color: #fff;
  box-shadow: 0 10px 24px rgba(36, 49, 65, 0.18);
}

.hero-help-button:hover {
  background: #1a2431;
  color: #fff;
}

.hero-home:hover {
  background: transparent;
  color: var(--brand-dark);
  transform: none;
}

.hero-home:focus-visible {
  outline: 2px solid rgba(111, 168, 161, 0.35);
  outline-offset: 6px;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

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

h2,
h3 {
  text-wrap: balance;
}

.lede {
  max-width: 24rem;
  margin-bottom: 0;
  font-size: 1.08rem;
  line-height: 1.4;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel.inset {
  padding: 1.25rem;
  background: var(--panel-strong);
  box-shadow: none;
}

#lobby-panel,
#game-panel {
  padding: 1.5rem;
}

.panel-header,
.section-header,
.top-bar,
.status-strip,
.final-panel,
.vote-actions {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

.panel-header {
  align-items: start;
}

.top-bar-actions,
.inline-form,
.split-form {
  display: flex;
  gap: 0.75rem;
}

.top-bar-select {
  width: auto;
  min-width: 150px;
}

.stacked-form {
  display: grid;
  gap: 1rem;
}

.stacked-form.compact {
  gap: 0.8rem;
}

.hero-copy {
  position: relative;
  z-index: 1;
}

.hero-banana {
  position: relative;
  min-height: 180px;
}

.banana-arc {
  position: absolute;
  border-radius: 999px;
  border: 18px solid transparent;
  border-top-color: var(--banana);
  border-right-color: var(--banana);
  background: transparent;
  transform: rotate(26deg);
  filter: drop-shadow(0 18px 24px rgba(121, 147, 175, 0.18));
}

.banana-arc-one {
  width: 190px;
  height: 190px;
  right: 70px;
  top: 8px;
}

.banana-arc-two {
  width: 150px;
  height: 150px;
  right: 0;
  top: 64px;
  border-width: 14px;
  border-top-color: var(--banana-deep);
  border-right-color: var(--banana-deep);
  opacity: 0.92;
  transform: rotate(-18deg);
}

.banana-spot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(111, 123, 136, 0.18);
}

.banana-spot-one {
  right: 88px;
  top: 60px;
}

.banana-spot-two {
  right: 126px;
  top: 122px;
}

.banana-spot-three {
  right: 44px;
  top: 144px;
}

.lobby-shell {
  overflow: visible;
  padding: 2rem;
  background:
    linear-gradient(180deg, rgba(251, 254, 252, 0.98), rgba(244, 249, 247, 0.96)),
    radial-gradient(circle at top right, rgba(216, 235, 231, 0.46), transparent 28%);
}

.lobby-header {
  margin-bottom: 1.5rem;
  align-items: end;
}

.lobby-header h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: -0.03em;
}

.lobby-header p {
  max-width: 18rem;
  line-height: 1.35;
}

.lobby-form {
  display: grid;
  gap: 1.25rem;
  max-width: 760px;
}

.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(89, 118, 114, 0.08);
}

.mode-slider {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  width: calc((100% - 0.7rem) / 3);
  height: calc(100% - 0.7rem);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(111, 168, 161, 0.96), rgba(59, 106, 111, 0.94));
  box-shadow: 0 12px 22px rgba(59, 106, 111, 0.18);
  transition: transform 180ms ease;
}

.mode-switch[data-mode="join"] .mode-slider {
  transform: translateX(calc(100% + 0.35rem));
}

.mode-switch[data-mode="practice"] .mode-slider {
  transform: translateX(calc(200% + 0.7rem));
}

.mode-option {
  position: relative;
  z-index: 1;
  min-height: 52px;
  padding: 0.9rem 0.8rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.mode-option:hover,
.mode-option.active {
  background: transparent;
  color: var(--text);
  transform: none;
}

.mode-option.active {
  color: #f7fffd;
}

.lobby-shell.invite-only .mode-switch {
  display: none;
}

.lobby-hint {
  margin: 0;
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.98rem;
}

.lobby-fields {
  display: grid;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.lobby-name-field,
.lobby-code-field {
  padding: 1.05rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(77, 61, 21, 0.08);
  position: relative;
  z-index: 1;
}

#bot-enabled-field:not(.hidden) {
  display: grid;
}

.lobby-submit {
  min-height: 58px;
  padding-inline: 1.6rem;
  justify-self: start;
}

.status-strip {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: rgba(111, 168, 161, 0.1);
}

.mode-option,
.lobby-submit {
  width: 100%;
}

.chat-panel {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
}

.turn-order-panel {
  margin-top: 1rem;
}

.turn-order-panel .section-header {
  align-items: baseline;
}

.turn-order-panel h3,
.turn-order-panel .hint {
  margin-bottom: 0;
}

.turn-order-track {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.turn-order-chip {
  min-width: 110px;
  padding: 0.7rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(31, 28, 23, 0.08);
}

.turn-order-chip.owner-tint {
  background: linear-gradient(180deg, var(--owner-card), var(--owner-card));
  border-color: var(--owner-border);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    0 10px 18px rgba(255, 255, 255, 0.24);
}

.turn-order-chip.current {
  background: rgba(111, 168, 161, 0.12);
  border-color: rgba(111, 168, 161, 0.34);
}

.turn-order-chip.owner-tint.current {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, var(--owner-card), var(--owner-card));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.38),
    0 0 0 2px rgba(111, 168, 161, 0.16);
}

.turn-order-chip.you {
  box-shadow: inset 0 0 0 1px rgba(147, 173, 201, 0.4);
}

.turn-order-chip.paused {
  background: rgba(121, 112, 94, 0.08);
  border-color: rgba(121, 112, 94, 0.16);
  color: var(--muted);
}

.turn-order-chip.paused strong {
  color: var(--muted);
}

.turn-order-chip.paused .turn-order-owner-dot {
  opacity: 0.55;
}

.turn-order-chip strong,
.turn-order-slot {
  display: block;
}

.turn-order-name {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.turn-order-name.owner-tint {
  color: var(--owner-text, var(--text));
}

.turn-order-owner-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--owner-dot, rgba(111, 168, 161, 0.7));
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.82),
    0 1px 6px var(--owner-shadow, rgba(0, 0, 0, 0.12));
  flex: 0 0 auto;
}

.turn-order-slot {
  margin-bottom: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.turn-order-chip.owner-tint .turn-order-slot {
  color: var(--owner-muted, var(--muted));
}

.chat-form {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.chat-form input {
  flex: 1 1 auto;
}

.chat-form button {
  flex: 0 0 auto;
}

.status-strip > div {
  min-width: 0;
}

.status-strip strong {
  display: block;
}

#last-action {
  max-width: 56ch;
}

.vote-panel {
  display: grid;
  gap: 1rem;
  border: 1px solid rgba(111, 168, 161, 0.2);
  background: linear-gradient(180deg, rgba(243, 250, 248, 0.98), rgba(251, 254, 252, 0.98));
}

.vote-modal {
  z-index: 35;
}

.vote-modal-card {
  width: min(100%, 520px);
  padding: 1.35rem;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.vote-copy p,
.vote-copy h3 {
  margin-bottom: 0.35rem;
}

.vote-timer {
  margin: 0;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--danger-dark);
}

.vote-list {
  display: grid;
  gap: 0.5rem;
}

.vote-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 28, 23, 0.08);
}

.vote-row.pending strong {
  color: var(--muted);
}

.vote-row.voted strong {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.board {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

.play-panel {
  align-self: start;
}

.middle-panel {
  overflow: hidden;
}

.middle-panel-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 1rem;
  margin: 0 0 0.75rem;
}

.middle-panel-topbar > button {
  justify-self: end;
}

.middle-panel-header {
  justify-content: flex-start;
}

.compact-word-strip {
  margin: 0.75rem 0 0.9rem;
}

.middle-panel-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.steal-receipt {
  display: grid;
  gap: 0.2rem;
  margin: 0.25rem 0 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: 16px;
  background: rgba(228, 242, 239, 0.92);
  border: 1px solid rgba(111, 168, 161, 0.2);
}

.steal-receipt-copy,
.steal-receipt-words {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.steal-receipt-label {
  margin-right: 0.2rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.steal-receipt-arrow {
  color: var(--muted);
}

.steal-receipt-old {
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.steal-receipt-new {
  color: var(--brand-dark);
  font-weight: 700;
}

.compact-words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-start;
}

.compact-word-group {
  display: grid;
  gap: 0.6rem;
  padding: 0.8rem 0.85rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(31, 28, 23, 0.08);
}

.compact-word-group.owner-tint {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.74)),
    linear-gradient(180deg, var(--owner-soft), var(--owner-soft));
  border-color: var(--owner-border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.compact-word-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(31, 28, 23, 0.08);
}

.compact-word-group.owner-tint .compact-word-group-header {
  border-bottom-color: var(--owner-border);
}

.compact-word-group-identity {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.compact-word-group-title-block {
  min-width: 0;
}

.compact-word-group-kicker,
.compact-word-group-name {
  margin: 0;
}

.compact-word-group-kicker {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.compact-word-group.owner-tint .compact-word-group-kicker {
  color: var(--owner-muted);
}

.compact-word-group-name {
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.15;
  text-wrap: balance;
}

.compact-word-group.owner-tint .compact-word-group-name {
  color: var(--owner-text);
}

.compact-word-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  min-height: 1.9rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(31, 28, 23, 0.06);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.compact-word-group.owner-tint .compact-word-group-count {
  background: rgba(255, 255, 255, 0.42);
  color: var(--owner-text);
}

.compact-word-owner-run {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding-right: 0.4rem;
  margin-right: 0.2rem;
  border-right: 1px solid rgba(31, 28, 23, 0.08);
}

.compact-word-owner-run:last-child {
  padding-right: 0;
  margin-right: 0;
  border-right: 0;
}

.compact-word-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.52rem;
  min-height: 0;
  padding: 0.34rem 0.68rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border: 1px solid rgba(31, 28, 23, 0.1);
  font-size: 0.68rem;
  font-weight: 600;
}

.compact-word-chip.owner-tint {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.86)),
    linear-gradient(180deg, var(--owner-soft), var(--owner-soft));
  border-color: var(--owner-border);
  box-shadow: inset 0 0 0 1px var(--owner-shadow);
}

.compact-word-owner-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 999px;
  background: var(--owner-dot, rgba(111, 168, 161, 0.7));
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.78),
    0 1px 6px var(--owner-shadow, rgba(0, 0, 0, 0.1));
  flex: 0 0 auto;
}

.compact-word-owner-dot-label {
  width: 0.82rem;
  height: 0.82rem;
}

.compact-word-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.compact-word-chip.challengeable {
  cursor: pointer;
}

.compact-word-chip.challengeable:hover {
  background: rgba(111, 168, 161, 0.08);
  border-color: rgba(111, 168, 161, 0.24);
}

.compact-word-chip.challengeable.owner-tint:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.88)),
    linear-gradient(180deg, var(--owner-soft), var(--owner-soft));
  border-color: var(--owner-border);
  box-shadow:
    inset 0 0 0 1px var(--owner-shadow),
    0 0 0 3px rgba(111, 168, 161, 0.08);
}

.compact-word-chip.selected,
.selectable-word.selected {
  background: rgba(111, 168, 161, 0.15);
  border-color: rgba(111, 168, 161, 0.38);
  box-shadow: inset 0 0 0 1px rgba(111, 168, 161, 0.16);
}

.compact-word-chip.fresh {
  animation: chip-flash 900ms ease-out;
}

.steal-reveal {
  position: relative;
  overflow: hidden;
}

.steal-text {
  position: relative;
  display: inline-grid;
  min-width: 0;
}

.steal-old,
.steal-new {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.steal-old {
  color: var(--danger);
  animation: steal-old-fade 1200ms ease forwards;
}

.steal-new {
  opacity: 0;
  animation: steal-new-rise 1200ms ease forwards;
}

.added-letter {
  display: inline-block;
  color: #4f8a85;
  text-shadow: 0 0 18px rgba(111, 168, 161, 0.22);
  animation: added-letter-pop 1100ms ease forwards;
}

@keyframes steal-old-fade {
  0%, 42% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-50%);
  }
}

@keyframes steal-new-rise {
  0%, 42% {
    opacity: 0;
    transform: translateY(45%);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chip-flash {
  0% {
    background: #dff0ec;
    border-color: rgba(111, 168, 161, 0.46);
    transform: translateY(-1px) scale(1.03);
  }
  100% {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(31, 28, 23, 0.1);
    transform: translateY(0) scale(1);
  }
}

@keyframes added-letter-pop {
  0%, 35% {
    transform: translateY(12%) scale(0.88);
    background: rgba(184, 216, 239, 0.9);
    box-shadow: 0 0 0 0 rgba(184, 216, 239, 0.34);
  }

  60% {
    transform: translateY(0) scale(1.08);
    background: rgba(184, 216, 239, 0.34);
    box-shadow: 0 0 0 8px rgba(184, 216, 239, 0);
  }

  100% {
    transform: translateY(0) scale(1);
    background: transparent;
    box-shadow: none;
  }
}

.tile-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  min-height: 96px;
  align-items: center;
}

.tile-rack.empty {
  color: var(--muted);
}

.tile {
  width: 56px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, var(--tile));
  border: 2px solid var(--tile-edge);
  box-shadow: 0 10px 18px rgba(103, 117, 139, 0.16);
  font-size: 1.7rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.player-card {
  padding: 1.1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.player-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.player-head h3 {
  margin-bottom: 0.2rem;
}

.player-name-row {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.player-name-row.owner-tint {
  width: fit-content;
  padding: 0.24rem 0.58rem;
  border-radius: 999px;
  background: var(--owner-soft);
  border: 1px solid var(--owner-border);
  color: var(--owner-text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.player-owner-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: var(--owner-dot, rgba(111, 168, 161, 0.7));
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.82),
    0 1px 6px var(--owner-shadow, rgba(0, 0, 0, 0.12));
  flex: 0 0 auto;
}

.player-score {
  font-size: 1.9rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.word-pill {
  border-radius: 18px;
  background: #edf1f5;
  display: flex;
  gap: 0.55rem;
  align-items: stretch;
  flex-wrap: wrap;
  padding: 0.4rem;
}

.word-pick {
  min-height: 0;
  flex: 1 1 160px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
}

.word-pick strong {
  letter-spacing: 0.04em;
}

.pill-action {
  min-height: 36px;
  padding: 0.32rem 0.7rem;
  background: #f6dfd7;
  color: #9d4836;
  font-size: 0.8rem;
}

.pill-action:hover {
  background: #efcfc3;
}

.final-panel {
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  flex-wrap: wrap;
  align-items: start;
}

.final-copy-block {
  min-width: 0;
}

.final-actions {
  margin-top: 0.9rem;
}

.final-timer {
  margin: 0.45rem 0 0;
  font-size: 0.84rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.final-visual {
  flex: 1 1 100%;
  margin-top: 1rem;
  padding: 1rem 1rem 0.2rem;
  border-radius: 20px;
  background:
    radial-gradient(circle at top center, rgba(216, 235, 231, 0.56), transparent 35%),
    linear-gradient(180deg, rgba(251, 254, 252, 0.96), rgba(239, 247, 244, 0.92));
  border: 1px solid rgba(147, 173, 201, 0.18);
}

.podium-burst {
  text-align: center;
  color: var(--brand);
  letter-spacing: 0.35rem;
  margin-bottom: 0.55rem;
}

.podium {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 0.75rem;
  position: relative;
}

.podium-slot {
  min-width: 92px;
  text-align: center;
  color: var(--text);
  position: relative;
  transition: transform 420ms ease, opacity 420ms ease, filter 420ms ease;
}

.podium-rank {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.podium-name {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.podium-score {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.podium-step {
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, #dfeeea, #a9c9c1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.podium-slot.top .podium-step {
  height: 132px;
}

.podium-slot.mid .podium-step {
  height: 104px;
}

.podium-slot.low .podium-step {
  height: 82px;
}

.podium-slot.winner .podium-rank,
.podium-slot.winner .podium-name {
  color: var(--brand-dark);
}

.animated-burst {
  opacity: 0.35;
  transform: scale(0.96);
}

.animated-podium {
  padding-top: 0.5rem;
}

.podium-slot-hidden {
  opacity: 0;
  transform: translateY(36px) scale(0.88);
  filter: blur(3px);
}

.podium-slot.revealed {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.podium-slot.winner-celebration {
  animation: winner-bounce 900ms ease 1;
}

.podium-sparks {
  position: absolute;
  inset: -26px -12px auto;
  height: 88px;
  pointer-events: none;
}

.podium-sparks span,
.podium-fireworks span {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #ffd764;
  opacity: 0;
  transform: scale(0.2);
}

.podium-sparks span:nth-child(1) {
  left: 12%;
  top: 54%;
  background: #ffd764;
}

.podium-sparks span:nth-child(2) {
  left: 28%;
  top: 16%;
  background: #ff9f5a;
}

.podium-sparks span:nth-child(3) {
  left: 50%;
  top: 6%;
  background: #fff0a5;
}

.podium-sparks span:nth-child(4) {
  right: 28%;
  top: 18%;
  background: #74d9b1;
}

.podium-sparks span:nth-child(5) {
  right: 12%;
  top: 48%;
  background: #ffd764;
}

.podium-sparks span:nth-child(6) {
  left: 46%;
  top: 34%;
  background: #ffffff;
}

.podium-slot.revealed .podium-sparks span {
  animation: podium-spark 700ms ease forwards;
}

.podium-slot.revealed .podium-sparks span:nth-child(2) {
  animation-delay: 40ms;
}

.podium-slot.revealed .podium-sparks span:nth-child(3) {
  animation-delay: 90ms;
}

.podium-slot.revealed .podium-sparks span:nth-child(4) {
  animation-delay: 130ms;
}

.podium-slot.revealed .podium-sparks span:nth-child(5) {
  animation-delay: 170ms;
}

.podium-slot.revealed .podium-sparks span:nth-child(6) {
  animation-delay: 210ms;
}

.podium-fireworks {
  position: absolute;
  inset: -6px 0 auto;
  height: 180px;
  pointer-events: none;
  opacity: 0;
}

.podium-fireworks.is-live {
  opacity: 1;
}

.podium-fireworks span:nth-child(1) {
  left: 14%;
  top: 28%;
  background: #ffd764;
}

.podium-fireworks span:nth-child(2) {
  left: 26%;
  top: 8%;
  background: #ff8d52;
}

.podium-fireworks span:nth-child(3) {
  left: 50%;
  top: 18%;
  background: #fff4b0;
}

.podium-fireworks span:nth-child(4) {
  right: 26%;
  top: 12%;
  background: #74d9b1;
}

.podium-fireworks span:nth-child(5) {
  right: 15%;
  top: 30%;
  background: #ffd764;
}

.podium-fireworks span:nth-child(6) {
  left: 50%;
  top: 0;
  background: #ffffff;
}

.podium-fireworks.is-live span {
  animation: podium-firework 1150ms ease-out forwards;
}

.podium-fireworks.is-live span:nth-child(2) {
  animation-delay: 70ms;
}

.podium-fireworks.is-live span:nth-child(3) {
  animation-delay: 120ms;
}

.podium-fireworks.is-live span:nth-child(4) {
  animation-delay: 170ms;
}

.podium-fireworks.is-live span:nth-child(5) {
  animation-delay: 220ms;
}

.podium-fireworks.is-live span:nth-child(6) {
  animation-delay: 260ms;
}

@keyframes podium-spark {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.2);
  }

  35% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-22px) scale(0.4);
  }
}

@keyframes podium-firework {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.2);
  }

  18% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(var(--fx, 0), var(--fy, -54px)) scale(0.35);
  }
}

.podium-fireworks span:nth-child(1) { --fx: -22px; --fy: -42px; }
.podium-fireworks span:nth-child(2) { --fx: -38px; --fy: -60px; }
.podium-fireworks span:nth-child(3) { --fx: 0; --fy: -72px; }
.podium-fireworks span:nth-child(4) { --fx: 38px; --fy: -62px; }
.podium-fireworks span:nth-child(5) { --fx: 24px; --fy: -44px; }
.podium-fireworks span:nth-child(6) { --fx: 0; --fy: -86px; }

@keyframes winner-bounce {
  0% {
    transform: translateY(0) scale(1);
  }

  28% {
    transform: translateY(-10px) scale(1.03);
  }

  55% {
    transform: translateY(0) scale(1);
  }

  72% {
    transform: translateY(-4px) scale(1.015);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

.hidden {
  display: none;
}


.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(31, 28, 23, 0.58);
  backdrop-filter: blur(10px);
  z-index: 120;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-backdrop.hidden {
  display: none;
}

.message-modal-card {
  width: min(100%, 420px);
  padding: 1.35rem;
  border-radius: 26px;
  background:
    radial-gradient(circle at top right, rgba(255, 186, 204, 0.55), transparent 30%),
    radial-gradient(circle at bottom left, rgba(219, 232, 244, 0.72), transparent 34%),
    linear-gradient(180deg, #fff9fb, #f8f5f7);
  border: 1px solid rgba(111, 168, 161, 0.14);
  box-shadow: var(--shadow);
  text-align: center;
}

.message-modal-card,
.vote-modal-card,
.end-modal-card,
.how-to-play-modal-card {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.end-modal-card {
  width: min(100%, 560px);
  padding: 1.5rem;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(219, 232, 244, 0.56), transparent 30%),
    linear-gradient(180deg, #fffdfa, #f7f3ee);
  border: 1px solid rgba(147, 173, 201, 0.18);
  box-shadow: var(--shadow);
  text-align: center;
}

.switch-device-modal-card {
  width: min(100%, 560px);
  padding: 1.5rem;
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(219, 232, 244, 0.48), transparent 32%),
    linear-gradient(180deg, #fffdfa, #f1f5f8);
  border: 1px solid rgba(147, 173, 201, 0.2);
  box-shadow: var(--shadow);
  text-align: left;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.how-to-play-modal-card {
  position: relative;
  width: min(100%, 920px);
  padding: 1.5rem;
  border-radius: 32px;
  background:
    radial-gradient(circle at top right, rgba(219, 232, 244, 0.34), transparent 28%),
    radial-gradient(circle at bottom left, rgba(199, 224, 219, 0.2), transparent 30%),
    linear-gradient(180deg, rgba(251, 254, 252, 0.99), rgba(244, 249, 247, 0.99));
  border: 1px solid rgba(147, 173, 201, 0.18);
  box-shadow: 0 28px 80px rgba(31, 28, 23, 0.28);
  text-align: left;
}

.how-to-play-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

.how-to-play-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 999px;
  background: rgba(31, 28, 23, 0.08);
  color: var(--text);
  border: 1px solid rgba(31, 28, 23, 0.1);
  box-shadow: none;
}

.how-to-play-x span {
  font-size: 1.7rem;
  line-height: 1;
}

.how-to-play-x:hover {
  background: rgba(31, 28, 23, 0.14);
  color: var(--text);
  transform: translateY(-1px);
}

.how-to-play-header {
  display: flex;
  gap: 1.25rem;
  justify-content: flex-start;
  align-items: start;
  margin-bottom: 1.25rem;
}

.how-to-play-header h3 {
  margin-bottom: 0.35rem;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.04em;
}

.how-to-play-intro {
  max-width: 44rem;
  margin-bottom: 0;
  color: rgba(36, 64, 70, 0.82);
  font-size: 1.05rem;
  line-height: 1.55;
}

.how-to-play-hero-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.how-to-play-overview {
  height: 100%;
  padding: 1rem;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(216, 235, 231, 0.34), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(241, 248, 246, 0.96));
  border: 1px solid rgba(147, 173, 201, 0.14);
}

.how-to-play-demo {
  display: grid;
  gap: 0.95rem;
}

.demo-status-card {
  padding: 1rem 1.05rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(147, 173, 201, 0.14);
}

.demo-status-card h4 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.28rem;
}

.demo-step-copy {
  margin: 0;
  color: rgba(36, 64, 70, 0.82);
  line-height: 1.55;
}

.how-to-play-rules-panel {
  padding: 1rem 1.05rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(89, 118, 114, 0.08);
}

.how-to-play-rules-title {
  margin: 0 0 0.75rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
}

.how-to-play-rule-list {
  margin: 0;
  padding-left: 1.15rem;
  display: grid;
  gap: 0.65rem;
}

.how-to-play-rule-list li {
  line-height: 1.48;
}

.how-to-play-example-stack {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.how-to-play-example-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.7rem 0.8rem;
  border-radius: 18px;
  background: rgba(247, 252, 250, 0.92);
  border: 1px solid rgba(147, 173, 201, 0.12);
}

.how-to-play-example-line strong {
  text-align: right;
}

.how-to-play-example-line-good {
  background: rgba(236, 247, 244, 0.96);
  border-color: rgba(147, 173, 201, 0.16);
}

.how-to-play-example-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  min-height: 28px;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: rgba(31, 28, 23, 0.08);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.demo-board {
  display: grid;
  gap: 0.85rem;
  padding: 0.15rem;
}

.tutorial-word-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.overview-middle {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(246, 252, 250, 0.95);
  border: 1px dashed rgba(147, 173, 201, 0.28);
}

.demo-middle {
  min-height: 160px;
}

.overview-player-label {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.overview-action-row,
.overview-steal-flow {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.overview-action-row {
  margin-top: 0.2rem;
}

.overview-action-arrow,
.overview-steal-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(111, 168, 161, 0.08);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mini-action-pill-strong {
  background: rgba(111, 168, 161, 0.18);
}

.mini-middle-label,
.mini-caption,
.how-to-play-number {
  display: block;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.mini-middle-label {
  margin-bottom: 0.55rem;
}

.mini-tile-rack {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.mini-tile-rack-tight {
  margin-bottom: 0;
}

.mini-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(180deg, #edf7f5, var(--tile));
  border: 1px solid rgba(147, 173, 201, 0.44);
  box-shadow: inset 0 -3px 0 rgba(147, 173, 201, 0.2);
  color: var(--text);
  font-weight: 800;
}

.mini-tile-fresh {
  background: linear-gradient(180deg, #d6ebe7, #eef8f5);
  border-color: rgba(111, 168, 161, 0.36);
  box-shadow:
    inset 0 -3px 0 rgba(111, 168, 161, 0.18),
    0 0 0 4px rgba(111, 168, 161, 0.08);
}

.mini-action-pill,
.mini-word-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 40px;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(111, 168, 161, 0.12);
  color: var(--brand-dark);
  font-weight: 700;
}

.mini-word-pill {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(147, 173, 201, 0.14);
}

.mini-word-pill strong {
  font-size: 0.78rem;
  color: var(--muted);
}

.mini-word-pill-muted {
  background: rgba(104, 130, 122, 0.12);
  color: var(--text);
}

.mini-word-pill-highlight {
  background: rgba(111, 168, 161, 0.16);
}

.mini-word-pill-warning {
  background: rgba(177, 97, 120, 0.12);
  border: 1px solid rgba(177, 97, 120, 0.16);
  color: var(--danger-dark);
}

.mini-caption {
  margin-top: 0.7rem;
  line-height: 1.4;
}

.tutorial-middle-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 0.9rem;
  border-radius: 999px;
  background: rgba(111, 168, 161, 0.12);
  color: var(--muted);
  font-size: 0.95rem;
}

.tutorial-action {
  min-width: 150px;
  width: fit-content;
}

.tutorial-action.is-next {
  background: linear-gradient(180deg, rgba(111, 168, 161, 0.98), rgba(59, 106, 111, 0.98));
  border-color: rgba(59, 106, 111, 0.98);
  color: #f7fffd;
  box-shadow: 0 14px 28px rgba(59, 106, 111, 0.2);
}

.tutorial-action.is-next:hover {
  background: linear-gradient(180deg, rgba(100, 154, 148, 1), rgba(47, 88, 93, 1));
}

.tutorial-action.is-next:disabled {
  opacity: 1;
}

.tutorial-action:disabled {
  cursor: default;
}

.tutorial-form {
  display: grid;
  gap: 0.75rem;
}

.tutorial-input-wrap {
  gap: 0.5rem;
}

.tutorial-input-wrap span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tutorial-input-wrap input {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tutorial-input-wrap input.tutorial-input-ready {
  border-color: rgba(111, 168, 161, 0.42);
  box-shadow: 0 0 0 4px rgba(111, 168, 161, 0.08);
}

.tutorial-feedback {
  margin: 0;
  color: var(--brand-dark);
  font-weight: 700;
  line-height: 1.4;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(111, 168, 161, 0.12);
  border: 1px solid rgba(111, 168, 161, 0.18);
}

.tutorial-feedback-pop {
  animation: tutorial-nudge-pop 380ms ease-out;
}

@keyframes tutorial-nudge-pop {
  0% {
    transform: scale(0.97);
    background: rgba(111, 168, 161, 0.2);
  }
  100% {
    transform: scale(1);
    background: rgba(111, 168, 161, 0.12);
  }
}

.mini-steal-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.mini-arrow {
  color: var(--muted);
  font-weight: 800;
}

.how-to-play-note {
  margin-bottom: 0;
}

.how-to-play-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(77, 61, 21, 0.08);
}

.how-to-play-note {
  margin-top: 0;
  max-width: 38rem;
}

.how-to-play-done {
  min-width: 132px;
}

.switch-device-copy {
  margin-bottom: 1rem;
}

.switch-device-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.switch-device-link {
  min-width: 0;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(31, 28, 23, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
}

.switch-device-steps {
  margin: 0 0 0.85rem;
  padding-left: 1.25rem;
  color: var(--text);
}

.switch-device-steps li + li {
  margin-top: 0.35rem;
}

.switch-device-note {
  margin-bottom: 1rem;
}

.end-modal-copy {
  margin-bottom: 1rem;
  font-size: 1.02rem;
}

.end-modal-podium {
  margin-bottom: 1rem;
}

.end-modal-card .podium-slot {
  min-width: 100px;
}

.end-modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.end-modal-global {
  margin-bottom: 1rem;
}

.round-stat-card {
  padding: 0.9rem 0.95rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(147, 173, 201, 0.16);
  text-align: left;
}

.round-stat-card .eyebrow {
  margin-bottom: 0.35rem;
}

.round-stat-card strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.round-stat-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.35;
}

.end-share-card {
  margin-bottom: 0.9rem;
  padding: 1rem;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(216, 235, 231, 0.56), transparent 34%),
    radial-gradient(circle at bottom left, rgba(199, 224, 219, 0.26), transparent 36%),
    linear-gradient(180deg, rgba(251, 254, 252, 0.98), rgba(243, 249, 247, 0.96));
  border: 1px solid rgba(147, 173, 201, 0.22);
  text-align: left;
}

.end-share-card .eyebrow {
  margin-bottom: 0.2rem;
}

.share-card-burst {
  margin-bottom: 0.35rem;
  letter-spacing: 0.18rem;
}

.end-share-card h4 {
  margin: 0 0 0.45rem;
  font-size: 1.25rem;
}

.share-card-copy {
  margin: 0 0 0.8rem;
  color: var(--text);
  line-height: 1.4;
}

.share-card-leaders {
  display: grid;
  gap: 0.45rem;
}

.share-card-row {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  gap: 0.6rem;
  align-items: center;
}

.share-card-cta {
  margin-top: 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: 16px;
  background: rgba(111, 168, 161, 0.1);
  color: var(--brand-dark);
  font-weight: 700;
}

.share-card-link {
  margin: 0.85rem 0 0;
  color: var(--brand-dark);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.end-modal-rematch {
  margin-bottom: 1rem;
}

.end-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.heart-row,
.heart-burst {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  color: #c65378;
}

.heart-row {
  margin-bottom: 0.55rem;
  font-size: 1.1rem;
}

.heart-burst {
  margin: 0.95rem 0 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.heart-row span:nth-child(2),
.heart-burst span:nth-child(3),
.heart-burst span:nth-child(5) {
  color: #e7a2b7;
}

.message-modal-card h3 {
  margin-bottom: 0.4rem;
}

.message-modal-card p:last-of-type {
  margin-bottom: 0;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100vw - 1.5rem), 520px);
  padding: 0.9rem 1.15rem;
  border-radius: 18px;
  background: rgba(31, 28, 23, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
  text-align: center;
  z-index: 10;
}

.chat-flash {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 1.5rem), 560px);
  padding: 0.85rem 1.05rem;
  border-radius: 18px;
  background: rgba(36, 49, 65, 0.94);
  color: #fff;
  box-shadow: var(--shadow);
  text-align: center;
  z-index: 20;
  pointer-events: none;
}

@media (max-width: 900px) {
  .hero,
  .board {
    grid-template-columns: 1fr;
  }

  .top-bar,
  .panel-header,
  .status-strip,
  .turn-order-panel .section-header,
  .final-panel,
  .vote-actions,
  .split-form,
  .top-bar-actions,
  .player-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell {
    width: min(100vw - 1rem, 1120px);
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  .hero {
    gap: 0.45rem;
  }

  .hero-heading-row,
  .how-to-play-header,
  .how-to-play-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-banana {
    min-height: 86px;
  }

  .banana-arc-one {
    right: 42px;
    top: 6px;
    width: 148px;
    height: 148px;
  }

  .banana-arc-two {
    right: 0;
    top: 48px;
    width: 118px;
    height: 118px;
  }

  #lobby-panel,
  #game-panel {
    padding: 1rem;
  }

  .panel.inset {
    padding: 1rem;
  }

  .lobby-name-field,
  .lobby-code-field {
    border-radius: 20px;
  }

  .top-bar-actions button,
  .top-bar-select,
  .vote-actions button,
  .final-panel button,
  .end-modal-actions button,
  .stacked-form button,
  .chat-form button,
  .switch-device-link-row button {
    width: 100%;
  }

  .chat-form {
    flex-direction: column;
    align-items: stretch;
  }

  .end-modal-actions {
    flex-direction: column;
  }

  .mode-switch {
    gap: 0.25rem;
    padding: 0.25rem;
  }

  .mode-slider {
    top: 0.25rem;
    left: 0.25rem;
    width: calc((100% - 0.5rem) / 3);
    height: calc(100% - 0.5rem);
  }

  .mode-switch[data-mode="join"] .mode-slider {
    transform: translateX(calc(100% + 0.25rem));
  }

  .mode-switch[data-mode="practice"] .mode-slider {
    transform: translateX(calc(200% + 0.5rem));
  }

  .lobby-submit {
    justify-self: stretch;
  }

  .section-header {
    align-items: stretch;
  }

  .switch-device-link-row {
    grid-template-columns: 1fr;
  }

  .how-to-play-hero-panel {
    grid-template-columns: 1fr;
  }

  .tile-rack {
    justify-content: center;
    min-height: 78px;
  }

  .tile {
    width: 48px;
    height: 56px;
    font-size: 1.4rem;
  }

  .players-grid {
    grid-template-columns: 1fr;
  }

  .word-pill {
    width: 100%;
    border-radius: 16px;
  }

  .word-pick {
    width: 100%;
  }

  .pill-action {
    width: 100%;
  }

  .player-score {
    font-size: 1.6rem;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: calc(100vw - 0.75rem);
  }

  .compact-words {
    gap: 0.65rem;
  }

  .compact-word-owner-run {
    gap: 0.42rem;
    padding-right: 0.3rem;
  }

  .compact-word-chip {
    padding: 0.32rem 0.6rem;
    font-size: 0.66rem;
  }

  .modal-backdrop {
    align-items: start;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(0.75rem, env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 2.2rem;
  }

  .lede {
    font-size: 0.98rem;
  }

  .hero {
    margin-bottom: 0.45rem;
  }

  .hero-copy {
    text-align: center;
  }

  .hero-heading-row {
    align-items: center;
  }

  .hero-home {
    width: 100%;
    max-width: 100%;
    font-size: clamp(2rem, 10vw, 2.85rem);
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .lede {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
  }

  .hero-help-button {
    width: auto;
    min-width: min(100%, 260px);
    margin-left: auto;
    margin-right: auto;
  }

  .hero-banana {
    display: none;
  }

  .how-to-play-done {
    width: 100%;
  }

  .how-to-play-x {
    align-self: flex-end;
  }

  .status-strip,
  .player-card,
  .final-panel,
  .panel.inset,
  .vote-panel {
    border-radius: 18px;
  }

  .podium {
    gap: 0.45rem;
  }

  .podium-slot {
    min-width: 72px;
  }

  .podium-slot.top .podium-step {
    height: 110px;
  }

  .podium-slot.mid .podium-step {
    height: 86px;
  }

  .podium-slot.low .podium-step {
    height: 66px;
  }

  .compact-word-strip {
    margin-top: 0.45rem;
    margin-bottom: 0.7rem;
  }

  .middle-panel-topbar {
    grid-template-columns: 1fr;
  }

  .middle-panel-topbar > button {
    justify-self: stretch;
  }

  .middle-panel-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .end-modal-card,
  .how-to-play-modal-card,
  .switch-device-modal-card,
  .vote-modal-card,
  .message-modal-card {
    width: 100%;
    max-height: calc(100vh - 1.5rem);
  }

  .how-to-play-modal-card {
    padding: 1.1rem;
    border-radius: 26px;
  }

  .how-to-play-hero-panel {
    grid-template-columns: 1fr;
  }

  .demo-middle,
  .overview-middle,
  .how-to-play-example-line strong {
    width: 100%;
  }

  .tutorial-word-row,
  .how-to-play-example-line {
    align-items: start;
  }

  .how-to-play-example-line {
    flex-direction: column;
  }

  .tutorial-action {
    width: 100%;
  }

  .compact-words {
    gap: 0.3rem;
  }

  .compact-word-chip {
    padding: 0.22rem 0.42rem;
    font-size: 0.6rem;
  }

  .word-pick {
    padding: 0.48rem 0.6rem;
    font-size: 0.88rem;
  }

  .tile-rack {
    gap: 0.45rem;
  }

  .tile {
    width: min(13.5vw, 46px);
    height: min(16vw, 54px);
    font-size: min(6vw, 1.3rem);
    border-radius: 14px;
  }

  .toast {
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
}


@media (max-width: 400px) {
  .compact-words {
    gap: 0.22rem;
  }

  .compact-word-chip {
    padding: 0.18rem 0.34rem;
    font-size: 0.54rem;
  }

  .word-pick {
    padding: 0.42rem 0.5rem;
    font-size: 0.8rem;
  }

  .word-pick span:last-child {
    font-size: 0.74rem;
  }
}
