@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@500;700;900&display=swap");
@import url("./games/styles.generated.css");

:root {
  --ink: #171515;
  --ink-2: #23201c;
  --paper: #f3ead8;
  --muted: #c2b7a3;
  --line: rgba(243, 234, 216, 0.16);
  --line-strong: rgba(243, 234, 216, 0.28);
  --amber: #edb83d;
  --amber-deep: #9d5d19;
  --teal: #1e9a86;
  --teal-deep: #0b4f55;
  --red: #d95a3d;
  --blue-board: #164e63;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--paper);
  font-family: "Noto Serif SC", "Microsoft YaHei", "PingFang SC", serif;
  background:
    linear-gradient(135deg, rgba(217, 90, 61, 0.2), transparent 32%),
    linear-gradient(315deg, rgba(30, 154, 134, 0.2), transparent 31%),
    repeating-linear-gradient(90deg, rgba(243, 234, 216, 0.045) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(0deg, rgba(243, 234, 216, 0.035) 0 1px, transparent 1px 72px),
    var(--ink);
}

button {
  font: inherit;
  touch-action: manipulation;
}

input {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(237, 184, 61, 0.62);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.profile-shell {
  display: grid;
  place-items: center;
  width: min(100vw - 32px, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
}

.profile-card {
  width: min(100%, 560px);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(35, 32, 28, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.profile-sigil {
  margin-bottom: 24px;
}

.profile-card p {
  margin-top: 14px;
  color: #dccfbd;
  line-height: 1.7;
}

.profile-invite {
  padding: 10px 12px;
  color: #171515 !important;
  border-radius: 8px;
  background: var(--amber);
  font-weight: 900;
}

.profile-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.profile-form label {
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 900;
}

.profile-form input {
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  color: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.7);
}

.profile-form input:focus {
  outline: 3px solid rgba(237, 184, 61, 0.28);
  border-color: rgba(237, 184, 61, 0.72);
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar,
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup,
.topbar-status,
.table-actions,
.ghost-command,
.icon-command,
.primary-command,
.game-meta,
.room-row,
.turn-strip,
.status-badge,
.notice-line {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 14px;
}

.brand-lockup strong {
  display: block;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.brand-lockup span span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-sigil,
.selected-token,
.room-mark {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
}

.brand-sigil {
  width: 46px;
  height: 46px;
  color: var(--amber);
  background: rgba(237, 184, 61, 0.08);
}

.topbar-status {
  gap: 9px;
  max-width: 42vw;
  color: var(--muted);
  font-size: 0.88rem;
}

.name-command {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.04);
  cursor: pointer;
}

.name-command:hover {
  color: var(--paper);
  border-color: var(--line-strong);
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(194, 183, 163, 0.1);
}

.topbar-status.online .sync-dot {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(30, 154, 134, 0.16);
}

.topbar-status.offline .sync-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(217, 90, 61, 0.16);
}

.lobby-grid {
  display: grid;
  grid-template-columns: minmax(560px, 1.45fr) minmax(340px, 0.8fr);
  align-items: start;
  gap: 18px;
  padding-top: 22px;
}

.room-panel {
  grid-column: 1 / -1;
}

.panel,
.play-surface,
.side-console {
  border: 1px solid var(--line);
  background: rgba(35, 32, 28, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel,
.side-console {
  border-radius: 8px;
}

.panel {
  position: relative;
  min-height: 220px;
  padding: 22px;
}

.panel-heading {
  margin-bottom: 17px;
}

.catalog-panel {
  min-height: 600px;
  overflow: visible;
  padding: 14px;
}

.room-pool::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(237, 184, 61, 0.08), transparent 34%),
    linear-gradient(135deg, rgba(30, 154, 134, 0.08), transparent 52%);
  border-radius: inherit;
  opacity: 0.85;
  pointer-events: none;
}

.room-pool > * {
  position: relative;
  z-index: 1;
}

.panel-tag {
  position: absolute;
  top: 0;
  left: 14px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  color: var(--muted);
  border: 1px solid rgba(243, 234, 216, 0.16);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.92);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
  transform: translateY(-50%);
  pointer-events: none;
}

.panel-tag.is-right {
  right: 14px;
  left: auto;
}

.panel-tag strong {
  color: var(--paper);
  font-size: 0.76rem;
  white-space: nowrap;
}

.room-pool {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  align-items: stretch;
  gap: 12px;
  min-height: 168px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(23, 21, 21, 0.7), rgba(23, 21, 21, 0.42)),
    rgba(23, 21, 21, 0.35);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: visible;
}

.room-pool .room-code-form {
  align-self: stretch;
  align-content: space-between;
  margin: 0;
  padding: 14px;
  border-color: rgba(243, 234, 216, 0.16);
  background:
    linear-gradient(180deg, rgba(243, 234, 216, 0.08), rgba(243, 234, 216, 0.035)),
    rgba(23, 21, 21, 0.36);
}

.room-pool .room-list {
  min-height: 114px;
  max-height: 168px;
  overflow: auto;
  padding-right: 4px;
}

.room-pool .empty-room {
  height: 100%;
  min-height: 106px;
  border: 0;
  background: transparent;
}

.room-pool .lobby-announcement {
  grid-column: 1 / -1;
  margin-top: 0;
}

.row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  display: block;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-top: 4px;
  font-size: clamp(1.45rem, 2.2vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.game-list,
.room-list,
.seat-list,
.event-list,
.stat-stack,
.detail-tag-grid {
  display: grid;
  gap: 10px;
}

.game-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.game-filter-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.78fr);
  align-items: center;
  gap: 10px 14px;
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(243, 234, 216, 0.13);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(237, 184, 61, 0.065), transparent 44%),
    rgba(23, 21, 21, 0.4);
}

.game-search-row {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
}

.game-search-field {
  position: relative;
  min-width: 0;
}

.game-search-field svg {
  position: absolute;
  top: 50%;
  left: 13px;
  color: rgba(243, 234, 216, 0.58);
  pointer-events: none;
  transform: translateY(-50%);
}

.game-search-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px 0 42px;
  color: var(--paper);
  border: 1px solid rgba(243, 234, 216, 0.18);
  border-radius: 8px;
  background: rgba(9, 8, 8, 0.48);
  font-weight: 800;
}

.game-search-field input::placeholder {
  color: rgba(194, 183, 163, 0.72);
}

.game-search-field input:focus {
  outline: 3px solid rgba(237, 184, 61, 0.2);
  border-color: rgba(237, 184, 61, 0.62);
}

.clear-game-filters {
  min-width: 88px;
  padding: 0 12px;
  background: rgba(243, 234, 216, 0.055);
}

.game-filter-groups {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1;
  grid-row: 1;
  justify-content: flex-start;
  gap: 10px 16px;
  min-width: 0;
}

.game-filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.game-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 9px;
  color: rgba(243, 234, 216, 0.82);
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.045);
  cursor: pointer;
}

.filter-chip:hover {
  color: var(--paper);
  border-color: rgba(237, 184, 61, 0.4);
}

.filter-chip.is-selected {
  color: #171515;
  border-color: rgba(237, 184, 61, 0.74);
  background: var(--amber);
  box-shadow: 0 10px 24px rgba(237, 184, 61, 0.16);
}

.filter-chip small {
  font-size: 0.68rem;
  font-weight: 900;
  opacity: 0.76;
}

.empty-game-results {
  grid-column: 1 / -1;
  display: grid;
  justify-items: start;
  gap: 8px;
  min-height: 214px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(237, 184, 61, 0.08), transparent 38%),
    rgba(23, 21, 21, 0.36);
}

.empty-game-results strong {
  font-size: clamp(1.22rem, 2vw, 1.7rem);
}

.empty-game-results p {
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.7;
}

.empty-game-results .ghost-command {
  margin-top: 6px;
  padding: 0 14px;
  background: rgba(243, 234, 216, 0.06);
}

.game-shelf-view {
  display: grid;
  gap: 16px;
  animation: shelf-view-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.game-card-shell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
}

.game-card,
.room-row,
.primary-command,
.ghost-command,
.icon-command {
  border: 1px solid var(--line);
  color: inherit;
  cursor: pointer;
}

.game-card {
  --game-accent: var(--amber);
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: rgba(9, 8, 8, 0.88);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 18px 32px rgba(0, 0, 0, 0.26);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.game-card::before {
  position: absolute;
  inset: 0;
  z-index: 3;
  content: "";
  border-left: 4px solid var(--game-accent);
  box-shadow: inset 0 0 0 1px rgba(243, 234, 216, 0.06);
  pointer-events: none;
}

.game-card.accent-teal {
  --game-accent: var(--teal);
}

.game-card.accent-red {
  --game-accent: var(--red);
}

.selected-token.accent-teal,
.room-mark.accent-teal {
  color: var(--teal);
  background-color: rgba(30, 154, 134, 0.12);
}

.selected-token.accent-red,
.room-mark.accent-red {
  color: var(--red);
  background-color: rgba(217, 90, 61, 0.12);
}

.game-card-cover {
  position: absolute;
  inset: 0;
  display: block;
}

.game-card-cover::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(7, 7, 8, 0.06) 0%, rgba(7, 7, 8, 0.2) 34%, rgba(9, 8, 8, 0.88) 100%),
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.13), transparent 36%);
}

.game-card-cover picture,
.detail-cover picture,
.game-card-cover img,
.detail-cover img {
  display: block;
  width: 100%;
  height: 100%;
}

.game-card-cover img,
.detail-cover img {
  object-fit: cover;
}

.game-card-cover img {
  filter: saturate(0.95) contrast(1.03) brightness(0.82);
  transform: scale(1.01);
  transition:
    filter 180ms ease,
    transform 220ms ease;
}

.game-card-content {
  position: absolute;
  inset: auto 0 0;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 56px 14px 14px;
  background: linear-gradient(180deg, transparent, rgba(12, 10, 9, 0.74) 26%, rgba(12, 10, 9, 0.96));
}

.game-card:hover,
.room-row:hover {
  border-color: rgba(237, 184, 61, 0.58);
  transform: translateY(-1px);
}

.game-card:hover {
  border-color: color-mix(in srgb, var(--game-accent) 72%, var(--paper));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--game-accent) 54%, transparent),
    0 0 0 1px color-mix(in srgb, var(--game-accent) 44%, transparent),
    0 22px 46px rgba(0, 0, 0, 0.38);
}

.game-card:hover .game-card-cover img {
  filter: saturate(1.08) contrast(1.08) brightness(0.95);
  transform: scale(1.055);
}

.game-info-command {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--paper);
  border: 1px solid rgba(243, 234, 216, 0.34);
  border-radius: 999px;
  background: rgba(12, 10, 9, 0.68);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24);
  cursor: pointer;
  backdrop-filter: blur(14px);
}

.game-info-command:hover {
  color: #171515;
  border-color: var(--amber);
  background: var(--amber);
}

.game-card-topline {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--paper) 66%, var(--game-accent));
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card strong {
  display: block;
  font-size: clamp(1.08rem, 1.4vw, 1.38rem);
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.72);
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: rgba(243, 234, 216, 0.84);
  font-size: 0.76rem;
}

.game-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.icon-command,
.primary-command,
.ghost-command {
  gap: 8px;
  min-height: 42px;
  justify-content: center;
  border-radius: 8px;
}

.icon-command {
  padding: 0 14px;
  background: rgba(243, 234, 216, 0.07);
}

.primary-command {
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  color: #171515;
  background: var(--amber);
  border-color: rgba(237, 184, 61, 0.78);
  font-weight: 900;
}

.primary-command:disabled,
.ghost-command:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.room-list {
  gap: 12px;
}

.room-code-form {
  display: grid;
  gap: 8px;
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.045);
}

.room-code-form label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.room-code-form div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.room-code-form input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.46);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room-code-form input:focus {
  outline: 3px solid rgba(237, 184, 61, 0.22);
  border-color: rgba(237, 184, 61, 0.64);
}

.empty-room {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  padding: 0 14px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.35);
}

.lobby-announcement {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  color: #171515;
  border: 1px solid rgba(237, 184, 61, 0.6);
  border-radius: 8px;
  background: var(--amber);
  line-height: 1.55;
}

.lobby-announcement.is-maintenance {
  color: var(--paper);
  border-color: rgba(217, 90, 61, 0.6);
  background: rgba(217, 90, 61, 0.18);
}

.lobby-social {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  align-content: stretch;
  gap: 12px;
  height: 600px;
  overflow: visible;
  margin-top: 0;
  padding: 14px;
}

.presence-dock {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.46);
}

.presence-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  max-height: 116px;
  overflow: auto;
  padding-right: 4px;
}

.presence-pill {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-content: start;
  gap: 3px 7px;
  min-width: min(100%, 154px);
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid rgba(243, 234, 216, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.presence-pill.is-you {
  border-color: rgba(237, 184, 61, 0.44);
  background: rgba(237, 184, 61, 0.08);
}

.presence-dot {
  width: 9px;
  height: 9px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(194, 183, 163, 0.09);
}

.presence-dot.player {
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(237, 184, 61, 0.12);
}

.presence-dot.spectator {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(30, 154, 134, 0.12);
}

.presence-name {
  min-width: 0;
  overflow: hidden;
  color: var(--paper);
  font-size: 0.86rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-pill small {
  grid-column: 2;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-chat-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.lobby-chat-message {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid rgba(243, 234, 216, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.lobby-chat-message.is-you {
  border-color: rgba(237, 184, 61, 0.34);
}

.lobby-chat-message div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.lobby-chat-message strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-chat-message time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
}

.lobby-chat-message p {
  color: #eadfcd;
  font-size: 0.86rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.lobby-chat-form {
  display: grid;
  gap: 7px;
}

.lobby-chat-input-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.lobby-chat-form input {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.06);
}

.lobby-chat-form input:focus {
  outline: 3px solid rgba(237, 184, 61, 0.22);
  border-color: rgba(237, 184, 61, 0.64);
}

.empty-social {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.room-row {
  width: 100%;
  min-height: 74px;
  gap: 14px;
  padding: 12px;
  text-align: left;
  background: rgba(23, 21, 21, 0.62);
  border-radius: 8px;
}

.room-mark {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  color: var(--amber);
  background: rgba(237, 184, 61, 0.1);
  border-radius: 8px;
}

.room-main {
  display: grid;
  min-width: 0;
  gap: 4px;
  flex: 1;
}

.room-main strong,
.room-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-main span,
.room-side small,
.empty-event {
  color: var(--muted);
  font-size: 0.82rem;
}

.room-side {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--paper);
}

.game-focus-detail {
  --detail-accent: var(--amber);
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(300px, 1.05fr);
  align-content: start;
  align-items: start;
  gap: 16px;
  overflow: hidden;
  animation: game-detail-in 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.game-focus-detail.accent-teal {
  --detail-accent: var(--teal);
}

.game-focus-detail.accent-red {
  --detail-accent: var(--red);
}

.game-focus-detail::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(35, 32, 28, 0.06), rgba(35, 32, 28, 0.92) 46%),
    var(--detail-cover) center top / cover no-repeat;
  background:
    linear-gradient(180deg, rgba(35, 32, 28, 0.06), rgba(35, 32, 28, 0.92) 46%),
    var(--detail-cover-set, var(--detail-cover)) center top / cover no-repeat;
  filter: blur(20px) saturate(1.08);
  opacity: 0.2;
  transform: scale(1.12);
  pointer-events: none;
}

.game-focus-detail > * {
  position: relative;
  z-index: 1;
}

.game-focus-topbar {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: -6px -6px 0;
  overflow: hidden;
  border: 1px solid rgba(243, 234, 216, 0.14);
  border-radius: 8px;
  background: rgba(12, 10, 9, 0.72);
}

.game-focus-detail .detail-cover {
  grid-column: 1;
  grid-row: 2 / span 4;
  width: 100%;
  height: clamp(320px, 34vw, 440px);
  aspect-ratio: auto;
  min-height: 0;
  margin: 0;
}

.game-focus-detail .detail-copy,
.game-focus-detail .detail-facts,
.game-focus-detail .detail-tag-grid,
.game-focus-detail .detail-action-stack {
  grid-column: 2;
}

.detail-cover::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(9, 8, 8, 0.02), rgba(9, 8, 8, 0.28) 72%, rgba(9, 8, 8, 0.7)),
    linear-gradient(90deg, color-mix(in srgb, var(--detail-accent) 22%, transparent), transparent 48%);
  pointer-events: none;
}

.detail-cover img {
  filter: saturate(1.02) contrast(1.04);
}

.detail-copy {
  display: grid;
  gap: 8px;
}

.game-focus-detail p {
  color: #dccfbd;
  line-height: 1.65;
}

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

.detail-facts span {
  min-width: 0;
  padding: 10px 8px;
  color: color-mix(in srgb, var(--paper) 76%, var(--detail-accent));
  border: 1px solid rgba(243, 234, 216, 0.13);
  border-radius: 8px;
  background: rgba(12, 10, 9, 0.42);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.selected-token {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-bottom: 0;
  color: var(--amber);
  background: rgba(12, 10, 9, 0.62);
  border-radius: 8px;
  backdrop-filter: blur(14px);
}

.detail-tag-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 0;
}

.game-focus-detail .primary-command {
  margin-top: 0;
}

.detail-action-stack {
  display: grid;
  gap: 10px;
}

.ai-match-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.72fr);
  gap: 10px;
  align-items: stretch;
}

.ai-level-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(243, 234, 216, 0.13);
  border-radius: 8px;
  background: rgba(12, 10, 9, 0.38);
}

.ai-level-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 8px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
}

.ai-level-button.is-selected {
  color: #171515;
  border-color: color-mix(in srgb, var(--detail-accent) 74%, #fff 8%);
  background: color-mix(in srgb, var(--detail-accent) 88%, #f5ead8 12%);
}

.ai-command {
  width: 100%;
  min-height: 52px;
  color: color-mix(in srgb, var(--paper) 84%, var(--detail-accent));
  border-color: color-mix(in srgb, var(--detail-accent) 42%, transparent);
  background: rgba(243, 234, 216, 0.055);
}

.detail-tag-grid span {
  min-width: 0;
  padding: 9px 5px;
  color: #eadfcd;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.rules-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 6, 6, 0.72);
  backdrop-filter: blur(12px);
}

.rules-modal {
  --rules-accent: var(--amber);
  display: grid;
  gap: 16px;
  width: min(720px, 100%);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: auto;
  padding: clamp(18px, 3vw, 26px);
  border: 1px solid color-mix(in srgb, var(--rules-accent) 48%, rgba(243, 234, 216, 0.18));
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--rules-accent) 13%, transparent), transparent 52%),
    rgba(35, 32, 28, 0.96);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.46);
}

.rules-modal.accent-teal {
  --rules-accent: var(--teal);
}

.rules-modal.accent-red {
  --rules-accent: var(--red);
}

.rules-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.rules-header h2 {
  margin-top: 4px;
}

.rules-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.06);
  cursor: pointer;
}

.rules-close:hover {
  color: #171515;
  border-color: var(--rules-accent);
  background: var(--rules-accent);
}

.rules-summary {
  color: #dccfbd;
  line-height: 1.65;
}

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

.rules-section {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(243, 234, 216, 0.12);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.52);
}

.rules-section h3 {
  margin: 0 0 8px;
  color: color-mix(in srgb, var(--paper) 72%, var(--rules-accent));
  font-size: 0.96rem;
}

.rules-section ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: #eadfcd;
  line-height: 1.5;
}

.rules-section li::marker {
  color: var(--rules-accent);
}

.leave-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 6, 6, 0.72);
  backdrop-filter: blur(12px);
}

.leave-confirm-modal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: min(470px, 100%);
  padding: clamp(18px, 3vw, 24px);
  border: 1px solid rgba(217, 90, 61, 0.5);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(217, 90, 61, 0.16), transparent 56%),
    rgba(35, 32, 28, 0.96);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.46);
}

.leave-confirm-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--red);
  border: 1px solid rgba(217, 90, 61, 0.38);
  border-radius: 8px;
  background: rgba(217, 90, 61, 0.1);
}

.leave-confirm-copy {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.leave-confirm-copy h2,
.leave-confirm-copy p {
  margin: 0;
}

.leave-confirm-copy h2 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}

.leave-confirm-copy p {
  color: #dccfbd;
  line-height: 1.65;
}

.leave-confirm-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.leave-confirm-actions .ghost-command,
.leave-confirm-button {
  min-height: 46px;
}

.leave-confirm-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: #171515;
  border: 1px solid rgba(217, 90, 61, 0.72);
  border-radius: 8px;
  background: var(--red);
  font-weight: 900;
  cursor: pointer;
}

.leave-confirm-button:hover {
  filter: brightness(1.06);
}

.table-shell {
  width: min(1520px, calc(100vw - 32px));
}

.table-header h1 {
  font-size: clamp(1.8rem, 3.5vw, 3.8rem);
}

.table-title {
  min-width: 0;
}

.table-title h1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions {
  gap: 10px;
}

.ghost-command {
  min-width: 42px;
  padding: 0 13px;
  background: rgba(243, 234, 216, 0.06);
}

.table-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(300px, 360px);
  gap: 18px;
  padding-top: 22px;
}

.play-surface {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: clamp(14px, 2vw, 24px);
  border-radius: 8px;
}

.turn-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
}

.turn-strip-seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px;
  min-width: 0;
}

.player-badge,
.status-badge {
  min-height: 64px;
  border: 1px solid var(--line);
  background: rgba(23, 21, 21, 0.62);
  border-radius: 8px;
}

.player-badge {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 14px;
}

.player-badge > div {
  min-width: 0;
}

.player-badge strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 52px;
  z-index: 10;
  max-width: min(260px, 32vw);
  padding: 8px 11px;
  color: #171515;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  animation: bubble-rise 180ms ease-out both;
}

.chat-bubble::after {
  position: absolute;
  bottom: -6px;
  left: 17px;
  width: 10px;
  height: 10px;
  content: "";
  border-right: 1px solid rgba(255, 255, 255, 0.42);
  border-bottom: 1px solid rgba(255, 255, 255, 0.42);
  background: var(--paper);
  transform: rotate(45deg);
}

.player-badge.teal .chat-bubble,
.player-badge.o .chat-bubble {
  right: 52px;
  left: auto;
}

.player-badge.teal .chat-bubble::after,
.player-badge.o .chat-bubble::after {
  right: 17px;
  left: auto;
}

.chat-bubble.is-emote {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 42px;
  padding: 6px 10px;
  color: var(--paper);
  border-color: rgba(237, 184, 61, 0.54);
  background: rgba(23, 21, 21, 0.92);
  font-size: 1.35rem;
}

.chat-bubble.is-emote::after {
  border-color: rgba(237, 184, 61, 0.54);
  background: rgba(23, 21, 21, 0.92);
}

.player-badge.is-active {
  border-color: rgba(237, 184, 61, 0.7);
  box-shadow: inset 0 0 0 1px rgba(237, 184, 61, 0.18);
}

.player-badge.teal.is-active {
  border-color: rgba(30, 154, 134, 0.7);
  box-shadow: inset 0 0 0 1px rgba(30, 154, 134, 0.2);
}

.player-badge.is-you {
  background: rgba(243, 234, 216, 0.08);
}

.player-badge.is-empty {
  color: var(--muted);
}

.player-badge.is-empty .player-chip {
  background: rgba(243, 234, 216, 0.12);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.player-chip,
.seat-token {
  border-radius: 999px;
  box-shadow: inset 0 3px 8px rgba(255, 255, 255, 0.35), inset 0 -7px 12px rgba(0, 0, 0, 0.28);
}

.player-chip {
  width: 34px;
  height: 34px;
}

.player-badge.amber .player-chip,
.seat-token.amber {
  background: radial-gradient(circle at 35% 25%, #fff3a8, var(--amber) 42%, var(--amber-deep) 100%);
}

.player-badge.teal .player-chip,
.seat-token.teal {
  background: radial-gradient(circle at 35% 25%, #9bf4dd, var(--teal) 44%, var(--teal-deep) 100%);
}

.player-badge.x .player-chip,
.seat-token.x {
  background: radial-gradient(circle at 35% 25%, #ffd7bd, var(--red) 48%, #782f2a 100%);
}

.player-badge.o .player-chip,
.seat-token.o {
  background: radial-gradient(circle at 35% 25%, #b9f5ff, #3a9db7 44%, #14536f 100%);
}

.player-badge strong,
.player-badge span {
  display: block;
}

.player-badge span {
  color: var(--muted);
  font-size: 0.78rem;
}

.status-badge {
  justify-content: center;
  gap: 8px;
  min-width: 150px;
  padding: 0 18px;
  color: var(--amber);
  font-weight: 900;
}

.status-badge.won {
  color: #0d211e;
  background: var(--amber);
}

.status-badge.is-pending {
  color: var(--paper);
  border-color: rgba(243, 234, 216, 0.34);
}

.table-chat-dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 21, 21, 0.48);
}

.quick-reactions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.reaction-button,
.chat-send {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.07);
  cursor: pointer;
}

.reaction-button {
  font-size: 1.05rem;
}

.reaction-button:not(:disabled):hover,
.chat-send:not(:disabled):hover {
  color: #171515;
  border-color: var(--amber);
  background: var(--amber);
}

.reaction-button:disabled,
.chat-send:disabled,
.chat-form input:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.chat-form {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: min(320px, 42%);
}

.chat-form input {
  width: 100%;
  min-width: 90px;
  height: 36px;
  padding: 0 10px;
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(243, 234, 216, 0.06);
}

.chat-form input:focus {
  outline: 3px solid rgba(237, 184, 61, 0.22);
  border-color: rgba(237, 184, 61, 0.64);
}

.endgame-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr) minmax(150px, auto);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(237, 184, 61, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(237, 184, 61, 0.14), transparent 54%),
    rgba(23, 21, 21, 0.62);
}

.endgame-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.endgame-copy h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.endgame-copy p {
  color: #dccfbd;
  line-height: 1.5;
}

.recap-list {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.recap-list span {
  min-width: 0;
  overflow: hidden;
  padding: 7px 9px;
  color: #eadfcd;
  border: 1px solid rgba(243, 234, 216, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recap-list strong {
  color: var(--amber);
}

.rematch-command {
  width: auto;
  min-width: 142px;
  margin-top: 0;
}

.side-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 18px;
}

.console-block {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.console-block:last-of-type {
  border-bottom: 0;
}

.stat-stack {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.metric {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.metric span {
  color: var(--muted);
  font-size: 0.76rem;
}

.metric strong {
  font-size: 1.18rem;
}

.seat-list,
.event-list {
  margin-top: 10px;
}

.seat-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.seat-token {
  width: 18px;
  height: 18px;
}

.seat-row small {
  color: var(--muted);
}

.seat-row.is-you strong {
  color: var(--amber);
}

.seat-row.is-bot strong {
  color: var(--paper);
}

.seat-row.is-bot small {
  color: color-mix(in srgb, var(--teal) 68%, var(--paper));
}

.seat-row.is-empty {
  color: var(--muted);
}

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

.event-block {
  min-height: 220px;
}

.event-list {
  max-height: 240px;
  overflow: auto;
  padding-right: 4px;
}

.event-row {
  display: grid;
  grid-template-columns: 48px 56px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  color: #eadfcd;
  border-bottom: 1px solid rgba(243, 234, 216, 0.08);
}

.event-row span,
.event-row small {
  color: var(--muted);
}

.empty-event {
  margin-top: 12px;
}

.notice-line {
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  color: #171515;
  background: var(--paper);
  border-radius: 8px;
}

@keyframes bubble-rise {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shelf-view-in {
  from {
    opacity: 0;
    transform: translateX(-18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes game-detail-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-shelf-view,
  .game-focus-detail {
    animation: none;
  }
}

@media (max-width: 1120px) {
  .lobby-grid,
  .table-grid,
  .lobby-social {
    grid-template-columns: minmax(0, 1fr);
  }

  .room-pool,
  .room-pool .lobby-announcement {
    grid-column: 1;
    grid-row: auto;
  }

  .room-pool {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    min-height: 0;
  }

  .room-pool .room-list {
    min-height: 0;
    max-height: none;
    padding-right: 0;
  }

  .room-pool .room-code-form {
    grid-column: auto;
    min-height: 0;
  }

  .room-pool .empty-room {
    min-height: 64px;
  }

  .game-focus-detail {
    min-height: 0;
  }

  .game-filter-bar {
    grid-template-columns: 1fr;
  }

  .game-search-row,
  .game-filter-groups {
    grid-column: auto;
    grid-row: auto;
  }

  .game-filter-groups {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .table-shell {
    width: 100%;
    padding: 8px 8px calc(14px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    min-height: 0;
    padding-bottom: 10px;
  }

  .brand-lockup {
    min-width: 0;
    gap: 10px;
  }

  .brand-sigil {
    width: 38px;
    height: 38px;
  }

  .brand-lockup strong {
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-lockup span span {
    display: none;
  }

  .topbar-status {
    grid-column: 1 / -1;
    min-height: 34px;
    max-width: none;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(23, 21, 21, 0.48);
  }

  .topbar-status span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .name-command {
    min-height: 38px;
  }

  .lobby-grid {
    gap: 12px;
    padding-top: 12px;
  }

  .panel-tag {
    left: 10px;
    top: 0;
    right: auto;
    display: inline-flex;
    min-width: 0;
    max-width: calc(100% - 20px);
    min-height: 22px;
    padding: 2px 7px;
    transform: translateY(-50%);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
  }

  .panel-tag.is-right {
    right: 10px;
    left: auto;
    transform: translateY(-50%);
  }

  .panel-tag strong {
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .room-pool {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }

  .room-pool .room-code-form,
  .room-pool .room-list {
    grid-column: 1;
    grid-row: auto;
  }

  .panel {
    min-height: 0;
  }

  .catalog-panel {
    min-height: 0;
    overflow: visible;
  }

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

  .game-filter-bar {
    padding: 10px;
  }

  .game-search-row {
    grid-template-columns: 1fr;
  }

  .clear-game-filters {
    width: 100%;
  }

  .game-filter-groups,
  .game-filter-group {
    gap: 8px;
  }

  .game-filter-label {
    width: 100%;
  }

  .filter-chip {
    flex: 1 1 auto;
    justify-content: center;
    min-width: 64px;
  }

  .empty-game-results {
    min-height: 180px;
    padding: 18px;
  }

  .game-card {
    aspect-ratio: 1;
    min-height: 0;
    padding: 0;
  }

  .game-info-command {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
  }

  .game-card-content {
    gap: 6px;
    padding: 46px 10px 10px;
  }

  .game-card strong {
    font-size: clamp(1.04rem, 4.6vw, 1.35rem);
    line-height: 1.08;
  }

  .game-meta {
    gap: 6px;
    font-size: 0.7rem;
  }

  .quick-reactions::-webkit-scrollbar {
    display: none;
  }

  .game-focus-detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .game-focus-topbar {
    flex-wrap: wrap;
  }

  .game-focus-detail .eyebrow,
  .game-focus-detail h2,
  .game-focus-detail p {
    grid-column: auto;
  }

  .game-focus-detail .detail-cover,
  .detail-cover {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 0;
    margin: 0;
  }

  .detail-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .selected-token {
    width: 44px;
    height: 44px;
    margin-bottom: 0;
  }

  .detail-tag-grid,
  .game-focus-detail .detail-copy,
  .game-focus-detail .detail-facts,
  .game-focus-detail .detail-tag-grid,
  .game-focus-detail .detail-action-stack {
    grid-column: auto;
  }

  .detail-tag-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
  }

  .ai-match-control {
    grid-template-columns: 1fr;
  }

  .detail-tag-grid span {
    min-width: 0;
    font-size: 0.76rem;
    white-space: normal;
  }

  .rules-backdrop {
    align-items: end;
    padding: 10px;
  }

  .leave-confirm-backdrop {
    align-items: end;
    padding: 10px;
  }

  .leave-confirm-modal {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 16px;
  }

  .leave-confirm-mark {
    width: 42px;
    height: 42px;
  }

  .leave-confirm-actions {
    grid-template-columns: 1fr;
  }

  .rules-modal {
    max-height: calc(100dvh - 20px);
    padding: 16px;
  }

  .rules-header h2 {
    font-size: 1.34rem;
  }

  .rules-section-list {
    grid-template-columns: 1fr;
  }

  .presence-pill {
    flex: 1 1 140px;
  }

  .lobby-social {
    height: 460px;
  }

  .lobby-social .lobby-chat-list {
    min-height: 0;
  }

  .presence-list {
    max-height: 112px;
  }

  .table-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 0 8px;
    background:
      linear-gradient(180deg, rgba(23, 21, 21, 0.98), rgba(23, 21, 21, 0.9)),
      var(--ink);
    backdrop-filter: blur(16px);
  }

  .table-title .eyebrow {
    font-size: 0.6rem;
  }

  .table-title h1 {
    margin-top: 2px;
    font-size: 1.08rem;
    line-height: 1.18;
  }

  .table-actions {
    display: grid;
    grid-template-columns: repeat(2, 42px);
    gap: 6px;
  }

  .table-header > .ghost-command,
  .table-actions .ghost-command {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
  }

  .table-header > .ghost-command span,
  .table-actions .ghost-command span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    clip-path: inset(50%);
  }

  .table-grid {
    gap: 10px;
    padding-top: 10px;
  }

  .panel,
  .play-surface,
  .side-console {
    padding: 10px;
  }

  .play-surface {
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
    min-height: calc(100dvh - 76px);
    border-radius: 8px;
    box-shadow: none;
  }

  .turn-strip {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 6px;
  }

  .turn-strip-seats {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .player-badge,
  .status-badge {
    width: 100%;
    min-width: 0;
    min-height: 46px;
  }

  .player-badge {
    gap: 7px;
    padding: 6px 7px;
  }

  .player-chip {
    width: 24px;
    height: 24px;
  }

  .player-badge strong {
    max-width: 100%;
    font-size: 0.82rem;
  }

  .player-badge span {
    font-size: 0.66rem;
  }

  .status-badge {
    gap: 4px;
    padding: 0 7px;
    font-size: 0.76rem;
    text-align: center;
  }

  .status-badge svg {
    width: 15px;
    height: 15px;
  }

  .chat-bubble {
    top: calc(100% + 7px);
    bottom: auto;
    left: 0;
    max-width: min(260px, calc(100vw - 64px));
    font-size: 0.8rem;
  }

  .chat-bubble::after {
    top: -6px;
    bottom: auto;
    transform: rotate(225deg);
  }

  .player-badge.teal .chat-bubble,
  .player-badge.o .chat-bubble {
    right: 0;
    left: auto;
  }

  .player-badge.teal .chat-bubble::after,
  .player-badge.o .chat-bubble::after {
    right: 17px;
    left: auto;
  }

  .table-chat-dock {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 36%);
    gap: 6px;
    padding: 6px;
  }

  .quick-reactions {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .reaction-button {
    flex: 0 0 34px;
    min-width: 34px;
    height: 34px;
  }

  .chat-form {
    min-width: 0;
    width: 100%;
  }

  .chat-form input {
    min-width: 0;
    height: 34px;
  }

  .chat-send {
    min-width: 34px;
    height: 34px;
  }

  .endgame-panel {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .endgame-copy h2 {
    font-size: 1.28rem;
  }

  .rematch-command {
    width: 100%;
  }

  .side-console {
    gap: 10px;
    box-shadow: none;
  }

  .stat-stack {
    grid-template-columns: repeat(5, minmax(72px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .stat-stack::-webkit-scrollbar {
    display: none;
  }

  .metric {
    min-width: 72px;
    padding: 9px;
  }

  .metric strong {
    font-size: 1rem;
  }

  .event-block {
    min-height: 0;
  }

  .event-list {
    max-height: 150px;
  }

  .event-row {
    grid-template-columns: 38px 44px 1fr;
    gap: 7px;
  }

  .room-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .room-side {
    grid-column: 2;
    justify-items: start;
  }
}

@media (max-width: 420px) {
  .app-shell,
  .table-shell {
    padding-right: 6px;
    padding-left: 6px;
  }

  .turn-strip {
    grid-template-columns: 1fr;
  }

  .player-badge {
    padding-right: 6px;
    padding-left: 6px;
  }

  .player-chip {
    width: 20px;
    height: 20px;
  }

  .status-badge {
    font-size: 0.7rem;
  }

  .status-badge svg {
    display: none;
  }

  .table-chat-dock {
    grid-template-columns: minmax(0, 1fr) minmax(104px, 34%);
  }
}

@media (max-height: 520px) and (max-width: 900px) {
  .table-header {
    position: relative;
  }

  .play-surface {
    min-height: 0;
  }

}

/* Seating phase for variable-player games (UNO, etc.). The match has not
   started yet, so we show a lobby panel inside the table shell. */
.seating-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(23, 21, 21, 0.62);
}

.seating-copy h2 {
  margin: 4px 0 6px;
}

.seating-copy p {
  margin: 0 0 4px;
  color: rgba(243, 234, 216, 0.78);
}

.seating-invite strong {
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(237, 184, 61, 0.16);
  color: #f3ead8;
  letter-spacing: 0.04em;
}

.seating-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.seating-slot {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 13, 12, 0.5);
}

.seating-slot.is-empty {
  border-style: dashed;
  color: rgba(243, 234, 216, 0.5);
}

.seating-slot.is-occupied {
  border-color: rgba(30, 154, 134, 0.5);
}

.seating-slot.is-offline {
  border-color: rgba(184, 60, 46, 0.6);
}

.seating-slot.is-you {
  box-shadow: 0 0 0 1px rgba(237, 184, 61, 0.4);
}

.seating-token {
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: rgba(243, 234, 216, 0.6);
}

.seating-slot strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seating-slot small {
  color: rgba(243, 234, 216, 0.6);
}

.seating-actions {
  display: grid;
  gap: 8px;
}

.seating-wait {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  color: rgba(243, 234, 216, 0.7);
}
