:root {
  --bg0: #0a0806;
  --bg1: #1a1410;
  --ink: #f3ebe2;
  --muted: #b5a898;
  --accent: #d4a04a;
  --accent-ink: #1a1410;
  --line: rgba(243, 235, 226, 0.12);
  --danger: #e07a5f;
  --ok: #7cb88a;
  --wood-light: #c49a62;
  --wood-mid: #8b5a2b;
  --wood-dark: #5c3218;
  --wood-deep: #3d2110;
  --point-light: #d2a86a;
  --point-dark: #6b2e1a;
  --checker-you: #e8d2a8;
  --checker-you-edge: #b8956a;
  --checker-opp: #3a2418;
  --checker-opp-edge: #1a100c;
  --brass: #c9a24a;
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font);
}

body {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  background: #000;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: calc(0.75rem + var(--safe-top)) 0.75rem calc(0.75rem + var(--safe-bottom));
  gap: 0.6rem;
  overflow: hidden;
}

/* iOS standalone PWA: pin to viewport edges to avoid WebKit's stale 100dvh bug on rotation */
@media (display-mode: standalone) {
  html,
  body {
    height: 100%;
    max-height: none;
  }

  body {
    position: fixed;
    inset: 0;
    width: 100%;
  }

  .app {
    max-height: none;
  }
}

html.standalone-mode,
html.standalone-mode body {
  height: 100%;
  max-height: none;
}

html.standalone-mode body {
  position: fixed;
  inset: 0;
  width: 100%;
}

html.standalone-mode .app {
  max-height: none;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.top > .top-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: 65%;
  min-width: 0;
}

.top-fullscreen-btn {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.22rem;
  border-radius: 0.4rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  line-height: 0;
  cursor: pointer;
}

.top-fullscreen-btn[hidden] {
  display: none;
}

.top-fullscreen-btn:hover,
.top-fullscreen-btn:focus-visible {
  color: var(--ink);
  border-color: var(--accent);
  background: rgba(243, 235, 226, 0.06);
}

.top-fullscreen-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

.top-fullscreen-btn .icon-fs-exit {
  display: none;
}

.top-fullscreen-btn[aria-pressed="true"] .icon-fs-enter {
  display: none;
}

.top-fullscreen-btn[aria-pressed="true"] .icon-fs-exit {
  display: block;
}

.top-fullscreen-btn[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(212, 160, 74, 0.5);
}

.board-fullscreen-btn {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #f0d9a8, var(--accent) 55%, #8a5a20);
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  min-width: 0;
  font-size: 0.72rem;
  font-family: var(--mono);
  font-weight: 500;
  line-height: 1.25;
  text-align: right;
  color: var(--muted);
}

.status-dot {
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 2px rgba(181, 168, 152, 0.2);
}

.status[data-state="authenticated"] {
  color: var(--ok);
}

.status[data-state="authenticated"] .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 2px rgba(124, 184, 138, 0.28);
}

.status[data-state="failed"],
.status[data-state="disconnected"],
.status[data-state="bridge-down"] {
  color: var(--danger);
}

.status[data-state="failed"] .status-dot,
.status[data-state="disconnected"] .status-dot,
.status[data-state="bridge-down"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 2px rgba(224, 122, 95, 0.3);
}

.status[data-state="connecting"],
.status[data-state="reconnecting"],
.status[data-state="loggingIn"],
.status[data-state="awaitingLoginPrompt"] {
  color: var(--accent);
}

.status[data-state="connecting"] .status-dot,
.status[data-state="reconnecting"] .status-dot,
.status[data-state="loggingIn"] .status-dot,
.status[data-state="awaitingLoginPrompt"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(212, 160, 74, 0.3);
  animation: status-pulse 1.2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.login-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.1rem;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0 1.25rem;
}

.login-panel > * {
  width: 100%;
  max-width: 24rem;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.connection-lost-banner,
.login-error {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid rgba(224, 122, 95, 0.45);
  background: rgba(224, 122, 95, 0.14);
  color: var(--danger);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

#login-form,
#signup-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.signup-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-switch {
  margin: 0;
  text-align: center;
}

.auth-switch button {
  background: none;
  color: var(--accent);
  padding: 0.35rem 0.2rem;
  font-weight: 600;
}

.auth-switch button:hover {
  color: var(--ink);
}

.login-support {
  margin: 0.25rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.login-support a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 0.25rem;
}

.login-support a:hover,
.login-support a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
  outline: none;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font: 400 1.05rem/1.3 var(--font);
  padding: 0.8rem 0.9rem;
}

select {
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 0.95rem) calc(50% - 0.12rem),
    calc(100% - 0.65rem) calc(50% - 0.12rem);
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

input:focus,
select:focus {
  outline: 2px solid rgba(212, 160, 74, 0.5);
  outline-offset: 1px;
}

button {
  font: 600 0.95rem/1.2 var(--font);
  border-radius: 0.6rem;
  border: none;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(180deg, #e0b45e, var(--accent));
  color: var(--accent-ink);
}

button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input[type="password"],
.password-field input[type="text"] {
  width: 100%;
  padding-right: 3rem;
}

.password-field input::-ms-reveal,
.password-field input::-ms-clear {
  display: none;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(243, 235, 226, 0.08);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.65);
  outline-offset: 1px;
  color: var(--ink);
}

.password-toggle[aria-pressed="true"] {
  color: var(--accent);
}

.password-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
  pointer-events: none;
}

.password-toggle .icon-eye-off,
.password-toggle[aria-pressed="true"] .icon-eye {
  display: none;
}

.password-toggle[aria-pressed="true"] .icon-eye-off {
  display: block;
}

.hidden {
  display: none !important;
}

.session-panel {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.55rem;
  overflow: hidden;
}

.session-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.view-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.55rem;
  overflow: hidden;
}

#view-terminal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#view-settings {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.15rem 0;
}

.terminal-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  flex-shrink: 0;
  padding: 0.2rem 0.15rem 0.35rem;
  border-bottom: 1px solid var(--line);
}

.terminal-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.terminal-filter input {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  accent-color: var(--accent);
}

#view-terminal.hide-logins .transcript .term-login {
  display: none;
}

/* —— Bottom navigation tabs (icon-only on small screens, icon + word on larger screens) —— */
.bottom-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.25rem;
  align-items: stretch;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: var(--bg1);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.bottom-tabs.terminal-hidden {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.bottom-tab[hidden],
.bottom-tab.hidden,
.bottom-tabs.terminal-hidden #tab-terminal,
.session-panel.terminal-hidden #tab-terminal,
.session-panel.terminal-hidden #view-terminal {
  display: none !important;
}

.bottom-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.45rem 0.35rem;
  border-radius: 0.55rem;
  background: transparent;
  color: var(--muted);
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.bottom-tab:hover {
  color: var(--ink);
  background: rgba(243, 235, 226, 0.06);
}

.bottom-tab:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.65);
  outline-offset: 1px;
}

.bottom-tab.active {
  background: linear-gradient(180deg, #e0b45e, var(--accent));
  color: var(--accent-ink);
}

.bottom-tab.active:hover {
  color: var(--accent-ink);
  background: linear-gradient(180deg, #e6bc69, var(--accent));
}

.bottom-tab .tab-icon {
  width: 1.3rem;
  height: 1.3rem;
  flex-shrink: 0;
  display: block;
}

/* Small interfaces: show icon only */
.bottom-tab .tab-label {
  display: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

.bottom-tab.active .tab-badge {
  background: var(--accent-ink);
  color: var(--accent);
}

.bottom-tab .tab-badge.hidden {
  display: none;
}

/* Larger interfaces: show icon and word */
@media (min-width: 640px) {
  .bottom-tabs {
    gap: 0.35rem;
    padding: 0.3rem;
  }

  .bottom-tab {
    padding: 0.55rem 0.65rem;
  }

  .bottom-tab .tab-icon {
    width: 1.15rem;
    height: 1.15rem;
  }

  .bottom-tab .tab-label {
    display: inline;
  }
}

@media (min-width: 720px) {
  .app {
    max-width: 56rem;
  }
}

@media (min-width: 960px) {
  .app {
    max-width: min(74rem, 100%);
    padding: 0.85rem 1rem calc(0.85rem + var(--safe-bottom));
  }
}

/* Short landscape: slim chrome so the board keeps maximum height */
@media (max-height: 520px) {
  .app {
    padding: 0.4rem 0.55rem calc(0.35rem + var(--safe-bottom));
    gap: 0.35rem;
  }

  .top {
    padding-bottom: 0.3rem;
  }

  .session-panel {
    gap: 0.35rem;
  }

  .view-panel {
    gap: 0.3rem;
  }

  .bottom-tabs {
    padding: 0.16rem;
  }

  .bottom-tab {
    min-height: 2.1rem;
    padding: 0.3rem 0.4rem;
    font-size: 0.8rem;
  }

  .bottom-tab .tab-icon {
    width: 1.1rem;
    height: 1.1rem;
  }

  .board-wrap {
    min-height: 6.5rem;
  }

  .bar-actions {
    gap: 6px;
  }

  .bar-undo,
  .bar-resign,
  .bar-kibitz,
  .bar-settings,
  .bar-reset {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 9px;
  }
}

/* Mobile landscape: vertical tab rail on the left across all views, match info stack on the right of board */
@media (orientation: landscape) and (max-height: 560px) {
  .app:has(#session-panel:not(.hidden)) {
    max-width: 100%;
    padding: max(0.2rem, var(--safe-top)) max(0.35rem, env(safe-area-inset-right))
      max(0.2rem, var(--safe-bottom)) max(0.35rem, env(safe-area-inset-left));
    gap: 0.2rem;
  }

  .app:has(#session-panel[data-view="board"]:not(.hidden)) > .top {
    display: none;
  }

  .session-panel {
    flex-direction: row;
    align-items: stretch;
    gap: 0.35rem;
  }

  .bottom-tabs {
    order: -1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
    width: 2.65rem;
    padding: 0.2rem;
    gap: 0.2rem;
    flex-shrink: 0;
  }

  .bottom-tab {
    flex: 1 1 0;
    width: 100%;
    min-height: 0;
    padding: 0.25rem;
    gap: 0;
  }

  .bottom-tab .tab-label {
    display: none;
  }

  .bottom-tab .tab-icon {
    width: 1.15rem;
    height: 1.15rem;
  }

  .bottom-tab .tab-badge {
    position: absolute;
    top: 0.16rem;
    right: 0.16rem;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.22rem;
    font-size: 0.6rem;
  }

  #view-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(7rem, 20vw, 10.5rem);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    gap: 0.35rem;
  }

  #view-board > #board-wrap {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
    min-height: 0;
  }

  #view-board .board {
    --board-ar: 1.5;
    --tray-w: clamp(1.45rem, 3.2vw, 1.85rem);
    --hinge-w: 44px;
    padding: 4px;
  }

  #view-board .side-tray {
    padding: 0.18rem 0.08rem;
  }

  #view-board .tray-cube .cube {
    width: clamp(1.15rem, 2.6vw, 1.45rem);
    height: clamp(1.15rem, 2.6vw, 1.45rem);
    font-size: clamp(0.64rem, 1.6vw, 0.8rem);
  }

  #view-board .bar-actions {
    gap: 6px;
  }

  #view-board .bar-undo,
  #view-board .bar-resign,
  #view-board .bar-kibitz,
  #view-board .bar-settings,
  #view-board .bar-reset {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 9px;
  }

  #view-board > #match-bar {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    border-radius: 0.65rem;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    overflow-y: auto;
    min-height: 0;
  }

  #view-board > #match-bar:has(.board-fullscreen-btn:not([hidden])) {
    padding-top: 2.25rem;
  }

  #view-board .board-fullscreen-btn:not([hidden]) {
    display: inline-grid;
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    z-index: 2;
    background: rgba(15, 11, 8, 0.65);
  }

  #view-board #scoreline {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    font-size: 0.82rem;
  }

  #view-board .score-name,
  #view-board .score-name.you,
  #view-board .score-name.opp {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.08rem 0.22rem;
  }

  #view-board .score-name-text {
    max-width: calc(100% - 1.35em);
  }

  #view-board .score-pips {
    flex-basis: 100%;
    font-size: 0.72rem;
  }

  #view-board .score-center {
    text-align: center;
    padding: 0.2rem 0.35rem;
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    font-size: 0.8rem;
  }

  #view-board .prompt-line {
    padding-top: 0.4rem;
    border-top: 1px solid var(--line);
    font-size: 0.74rem;
    line-height: 1.3;
    min-height: 0;
    word-break: break-word;
  }
}

.match-bar {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.scoreline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
}

.score-name {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  min-width: 0;
}

.score-name.you {
  justify-content: flex-start;
  color: var(--checker-you);
}

.score-name.opp {
  justify-content: flex-end;
  color: #d8c4a8;
}

.score-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-pips {
  flex-shrink: 0;
  font-weight: 500;
  font-size: 0.82em;
  opacity: 0.88;
  white-space: nowrap;
}

.score-center {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
}

.prompt-line {
  font-size: 0.82rem;
  color: var(--accent);
  min-height: 1.15em;
}

.board-wrap {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: grid;
  place-items: center;
  position: relative;
  /* Size queries so the board can fit width OR height without stretching */
  container-type: size;
}

.board-wrap:focus,
.board-wrap:focus-visible {
  outline: none;
}

/* Undo and resign sit on the board's center bar. */
.bar-actions {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar-actions[hidden] {
  display: none;
}

.bar-undo,
.bar-resign,
.bar-kibitz,
.bar-settings,
.bar-reset {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 9px;
  border-radius: 0.45rem;
  border: 1px solid rgba(224, 192, 106, 0.55);
  background: rgba(20, 12, 6, 0.82);
  color: #e0c06a;
  display: grid;
  place-items: center;
  line-height: 0;
}

.bar-resign {
  color: #f4f1ea;
  border-color: rgba(244, 241, 234, 0.45);
}

.bar-undo svg,
.bar-resign svg,
.bar-kibitz svg,
.bar-settings svg,
.bar-reset svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bar-reset.spinning svg {
  animation: bar-reset-spin 0.45s ease-out;
}

@keyframes bar-reset-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.bar-undo:not(:disabled),
.bar-resign:not(:disabled),
.bar-kibitz:not(:disabled),
.bar-settings:not(:disabled),
.bar-reset:not(:disabled) {
  background: rgba(42, 22, 12, 0.92);
  box-shadow: 0 0 0 1px rgba(212, 160, 74, 0.55);
}

.bar-undo:not(:disabled),
.bar-kibitz:not(:disabled),
.bar-reset:not(:disabled) {
  color: #f3e2b0;
}

.bar-resign:not(:disabled) {
  color: #fff;
}

.bar-kibitz[aria-pressed="true"],
.bar-settings[aria-pressed="true"] {
  color: #fff6df;
  background: rgba(90, 58, 22, 0.96);
}

.bar-undo:not(:disabled):hover,
.bar-undo:not(:disabled):focus-visible,
.bar-resign:not(:disabled):hover,
.bar-resign:not(:disabled):focus-visible,
.bar-kibitz:not(:disabled):hover,
.bar-kibitz:not(:disabled):focus-visible,
.bar-settings:not(:disabled):hover,
.bar-settings:not(:disabled):focus-visible,
.bar-reset:not(:disabled):hover,
.bar-reset:not(:disabled):focus-visible {
  background: rgba(74, 42, 16, 0.95);
}

.bar-undo:not(:disabled):hover,
.bar-undo:not(:disabled):focus-visible,
.bar-kibitz:not(:disabled):hover,
.bar-kibitz:not(:disabled):focus-visible,
.bar-reset:not(:disabled):hover,
.bar-reset:not(:disabled):focus-visible {
  color: #fff6df;
}

.bar-resign:not(:disabled):hover,
.bar-resign:not(:disabled):focus-visible {
  color: #fff;
}

/* —— In-match kibitz overlay (centered on board) —— */
.kibitz-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.45);
  pointer-events: auto;
}

.kibitz-modal.hidden,
.tell-modal.hidden {
  display: none !important;
}

.tell-modal {
  position: absolute;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.5);
  pointer-events: auto;
}

.kibitz-dialog,
.tell-dialog {
  position: relative;
  width: min(22rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem 0.95rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
}

.kibitz-close {
  position: absolute;
  top: 0.35rem;
  right: 0.4rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.kibitz-close:hover {
  color: var(--ink);
  background: rgba(243, 235, 226, 0.08);
}

.kibitz-from {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.kibitz-from strong {
  color: var(--ink);
  font-weight: 600;
}

.kibitz-mode-select {
  width: auto;
  max-width: calc(100% - 2.25rem);
  padding: 0.22rem 1.65rem 0.22rem 0.45rem;
  margin-left: -0.45rem;
  border-color: transparent;
  border-radius: 0.4rem;
  background-color: transparent;
  background-position: calc(100% - 0.72rem) calc(50% - 0.1rem),
    calc(100% - 0.45rem) calc(50% - 0.1rem);
  background-size: 0.3rem 0.3rem, 0.3rem 0.3rem;
  color: var(--ink);
  font: 600 0.88rem/1.25 var(--font);
  cursor: pointer;
}

.kibitz-mode-select:hover {
  background-color: rgba(243, 235, 226, 0.08);
  border-color: var(--line);
}

.kibitz-mode-select option {
  background: var(--bg1);
  color: var(--ink);
}

.kibitz-message {
  margin: 0;
  max-height: min(28vh, 10rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.kibitz-reply-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
}

.kibitz-reply-form input {
  min-width: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
}

/* —— In-match game/match win overlay —— */
.win-modal {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.45);
  pointer-events: auto;
}

.win-modal.hidden {
  display: none !important;
}

.win-dialog {
  position: relative;
  width: min(22rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem 0.95rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
}

.win-dialog h2 {
  margin: 0;
  padding-right: 1.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.win-message {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

/* —— Match-end overlay (must dismiss with OK) —— */
.match-end-modal {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.55);
  pointer-events: auto;
}

.match-end-modal.hidden {
  display: none !important;
}

.match-end-dialog {
  width: min(24rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
}

.match-end-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.match-end-dialog h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.match-end-countdown {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.match-end-message {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-size: 0.95rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.match-end-actions {
  display: flex;
  justify-content: flex-end;
}

/* —— Resign type picker —— */
.resign-modal {
  position: fixed;
  inset: 0;
  z-index: 23;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.55);
  pointer-events: auto;
}

.resign-modal.hidden {
  display: none !important;
}

.resign-dialog {
  width: min(28rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
}

.resign-dialog h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.resign-lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.resign-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.resign-type-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.resign-type-row button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.55rem 0.35rem;
  line-height: 1.2;
  white-space: nowrap;
}

.resign-type-name {
  font-size: 0.82rem;
  font-weight: 700;
}

.resign-type-pts {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.75;
}

.resign-actions #resign-cancel {
  width: 100%;
}

/* —— Opponent resign offer (Accept / Reject) —— */
.resign-offer-modal {
  position: absolute;
  inset: 0;
  z-index: 21;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.5);
  pointer-events: auto;
}

.resign-offer-modal.hidden {
  display: none !important;
}

.resign-offer-modal.watch-only {
  background: transparent;
  pointer-events: none;
}

.resign-offer-modal.watch-only .resign-offer-actions {
  display: none;
}

.resign-offer-dialog {
  position: relative;
  width: min(22rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
}

.resign-offer-dialog h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.resign-offer-message {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.resign-offer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

/* —— Match invite overlay (waits for Accept / Reject) —— */
.invite-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.5);
  pointer-events: auto;
}

.invite-modal.hidden {
  display: none !important;
}

.invite-dialog {
  position: relative;
  width: min(22rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.55);
}

.invite-dialog h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
}

.invite-message {
  margin: 0;
  padding: 0.55rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.invite-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.invite-actions .primary,
.invite-actions .ghost {
  width: 100%;
}

.win-progress {
  height: 0.28rem;
  border-radius: 999px;
  background: rgba(243, 235, 226, 0.12);
  overflow: hidden;
}

.win-progress-bar {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(1);
}

.win-progress-bar.running {
  transition: transform 3s linear;
  transform: scaleX(0);
}

.kibitz-progress-bar.running {
  transition: transform var(--kibitz-duration, 5s) linear;
  transform: scaleX(0);
}

.match-end-progress-bar.running {
  transition: transform 15s linear;
  transform: scaleX(0);
}

/* —— Wooden folding board —— */
.board {
  /* Classic board ≈ 1.4:1 (wider than tall), including side trays */
  --board-ar: 1.4;
  --tray-w: clamp(2.1rem, 9vw, 3.4rem);
  --hinge-w: clamp(44px, 7vw, 48px);
  container-type: size;
  container-name: board;
  flex: none;
  display: grid;
  grid-template-columns: var(--tray-w) 1fr var(--hinge-w) 1fr var(--tray-w);
  grid-template-rows: 1fr minmax(2.6rem, 0.32fr) 1fr;
  gap: 0;
  padding: clamp(5px, 1.4vw, 10px);
  border-radius: 0.55rem;
  background:
    repeating-linear-gradient(
      98deg,
      rgba(40, 20, 8, 0.14) 0 1px,
      transparent 1px 3px,
      rgba(180, 120, 60, 0.07) 3px 4px,
      transparent 4px 7px
    ),
    linear-gradient(165deg, #a67c45 0%, #8b5a2b 38%, #6b3f1f 72%, #4a2a12 100%);
  border: 2px solid #2a160c;
  box-shadow:
    inset 0 0 0 1px rgba(230, 190, 130, 0.22),
    inset 0 0 28px rgba(0, 0, 0, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.55);
  user-select: none;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  aspect-ratio: var(--board-ar);
  /* Grow until the play pane edge, then letterbox/pillarbox */
  width: min(100cqw, calc(100cqh * var(--board-ar)));
  height: auto;
  max-width: 100%;
  max-height: 100%;
}

/* Fallback when container size queries are unavailable */
@supports not (width: 1cqw) {
  .board {
    width: min(100%, 52rem);
    max-height: min(100%, 70vh);
  }
}

.board-waiting {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: grid;
  place-items: center;
  color: rgba(243, 235, 226, 0.7);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.side-tray {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0.3rem 0.12rem;
  min-height: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.18) 40%, rgba(0, 0, 0, 0.35)),
    linear-gradient(180deg, #5a3218, #3d2110);
  box-shadow:
    inset 2px 0 5px rgba(0, 0, 0, 0.4),
    inset -2px 0 5px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  border-radius: 3px;
  z-index: 2;
}

.side-tray.left {
  grid-column: 1;
  grid-row: 1 / 4;
}

.side-tray.right {
  position: relative;
  grid-column: 5;
  grid-row: 1 / 4;
  container-type: size;
}

.tray-recess {
  width: 72%;
  flex: 1 1 0;
  min-height: 1.5rem;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tray-recess .owned-cube {
  width: clamp(1.15rem, 6.2vw, 1.65rem);
  height: clamp(1.15rem, 6.2vw, 1.65rem);
  font-size: clamp(0.62rem, 2.4vw, 0.85rem);
}

.tray-collection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
}

.tray-collection.opp {
  justify-content: flex-start;
}

.tray-collection.you {
  justify-content: flex-end;
}

.tray-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-height: 2rem;
  padding: 0.15rem 0;
}

.tray-stack.opp {
  justify-content: flex-start;
}

.tray-stack.you {
  justify-content: flex-end;
  flex-direction: column-reverse;
}

.tray-stack .tray-count {
  font-size: 0.5rem;
  font-family: var(--mono);
  color: rgba(243, 235, 226, 0.45);
  line-height: 1;
}

.tray-park {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  width: 100%;
  flex: 0 0 auto;
  padding: 0.2rem 0;
  min-height: 0.5rem;
}

.tray-dice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.1rem;
  border-radius: 0.3rem;
}

.tray-dice .die {
  width: clamp(1.05rem, 4.2vw, 1.45rem);
  height: clamp(1.05rem, 4.2vw, 1.45rem);
  font-size: clamp(0.65rem, 2.6vw, 0.85rem);
  border-radius: 0.22rem;
}

.tray-dice.rollable {
  cursor: pointer;
  background: rgba(212, 160, 74, 0.14);
  box-shadow: 0 0 0 1px rgba(212, 160, 74, 0.4);
}

.tray-dice.rollable:hover,
.tray-dice.rollable:focus-visible {
  background: rgba(212, 160, 74, 0.26);
  outline: none;
}

/* Parked cube: true vertical midpoint of the right tray */
.tray-cube {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}

/* The parked cube sits in a non-interactive tray; the cube itself stays clickable. */
.tray-cube .cube {
  pointer-events: auto;
  width: clamp(1.35rem, 5vw, 1.85rem);
  height: clamp(1.35rem, 5vw, 1.85rem);
  font-size: clamp(0.7rem, 2.8vw, 0.95rem);
}

.hinge-bar {
  grid-column: 3;
  grid-row: 1 / 4;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.1rem;
  background:
    linear-gradient(90deg, #2a160c 0%, #4a2a14 18%, #3a1e10 50%, #4a2a14 82%, #2a160c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    2px 0 6px rgba(0, 0, 0, 0.25),
    -2px 0 6px rgba(0, 0, 0, 0.25);
  z-index: 3;
}

.bar-stack {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 100%;
  min-height: 2.2rem;
}

.bar-stack.opp {
  justify-content: flex-start;
}

.bar-stack.you {
  justify-content: flex-end;
  flex-direction: column-reverse;
}

.bar-stack.playable {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 3px;
  cursor: pointer;
}

.hinge-cube-slot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hinge-cube-slot.top {
  top: 10%;
}

.hinge-cube-slot.bottom {
  bottom: 10%;
}

.hinge-cube-slot .cube {
  width: clamp(1.4rem, 5.2vw, 2rem);
  height: clamp(1.4rem, 5.2vw, 2rem);
  font-size: clamp(0.75rem, 3vw, 1.05rem);
}

.quad {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  min-height: 0;
  padding: 0 2px;
  background: rgba(0, 0, 0, 0.12);
}

.quad.top {
  align-items: start;
  grid-row: 1;
}

.quad.bottom {
  align-items: end;
  grid-row: 3;
}

.quad.top-left,
.quad.bottom-left {
  grid-column: 2;
}

.quad.top-right,
.quad.bottom-right {
  grid-column: 4;
}

.point {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  height: 100%;
  cursor: pointer;
  /* Size checkers from the point box (≈ point/pip width) */
  container-type: size;
  container-name: point;
}

.point.top {
  justify-content: flex-start;
}

.point.bottom {
  justify-content: flex-end;
}

.point::before {
  content: "";
  position: absolute;
  left: 6%;
  right: 6%;
  width: auto;
  height: 92%;
  pointer-events: none;
  opacity: 0.95;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.point.top.light::before {
  top: 0;
  background: linear-gradient(180deg, #e0b878 0%, var(--point-light) 55%, rgba(180, 130, 70, 0.15) 100%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.point.top.dark::before {
  top: 0;
  background: linear-gradient(180deg, #8a3a22 0%, var(--point-dark) 55%, rgba(60, 24, 12, 0.2) 100%);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.point.bottom.light::before {
  bottom: 0;
  background: linear-gradient(0deg, #e0b878 0%, var(--point-light) 55%, rgba(180, 130, 70, 0.15) 100%);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.point.bottom.dark::before {
  bottom: 0;
  background: linear-gradient(0deg, #8a3a22 0%, var(--point-dark) 55%, rgba(60, 24, 12, 0.2) 100%);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.point .stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  width: 92%;
  padding: 1px 0;
  max-height: 100%;
}

.point.bottom .stack {
  flex-direction: column-reverse;
}

.checker {
  /*
   * Fit up to 5 checkers in a point with no overlap:
   * diameter ≤ point width and ≤ ~1/5.4 of point height (room for gaps + pip #).
   */
  --checker-size: min(88cqw, 17.5cqh);
  width: var(--checker-size);
  height: var(--checker-size);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.45);
}

/* Bar / borne-off trays: match point-scale checkers via board width */
.bar-stack,
.tray-stack {
  gap: 1px;
}

.bar-stack .checker,
.tray-stack .checker {
  /* ≈ one point width: playable half / 6 */
  --checker-size: clamp(16px, 5.6cqw, 40px);
  width: var(--checker-size);
  height: var(--checker-size);
}

/* Borne-off checkers stand on edge and pile up in the tray. */
.tray-stack {
  gap: 1px;
}

.tray-stack .checker.off-edge {
  width: 78%;
  height: clamp(3px, 2.15cqh, 0.42rem);
  min-height: 3px;
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(0, 0, 0, 0.28);
}

.tray-stack .checker.off-edge.you,
.checker.opp-fly.off-edge.you {
  background: linear-gradient(180deg, #fff8ec 0%, var(--checker-you) 46%, var(--checker-you-edge) 100%);
}

.tray-stack .checker.off-edge.opp,
.checker.opp-fly.off-edge.opp {
  background: linear-gradient(180deg, #6a4530 0%, var(--checker-opp) 48%, #140e0a 100%);
}

@supports not (width: 1cqw) {
  .checker {
    width: clamp(18px, 5.5vw, 36px);
    height: clamp(18px, 5.5vw, 36px);
  }
}

.checker.you {
  background: radial-gradient(circle at 35% 30%, #fff4e0, var(--checker-you) 55%, var(--checker-you-edge));
}

.checker.opp {
  background: radial-gradient(circle at 35% 30%, #5a3a28, var(--checker-opp) 55%, var(--checker-opp-edge));
}

.checker.has-count {
  display: grid;
  place-items: center;
}

.checker-count {
  font-family: var(--mono);
  font-size: clamp(10px, calc(var(--checker-size) * 0.5), 18px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  user-select: none;
}

.checker.you .checker-count {
  color: #24160c;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.checker.opp .checker-count {
  color: #f8efe2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
}

.checker.playable {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.point.playable,
.bar-stack.playable {
  touch-action: none;
}

.board.dragging-checker {
  user-select: none;
  -webkit-user-select: none;
}

.drag-origin .checker.playable {
  opacity: 0.35;
}

.board.animating-opp {
  pointer-events: none;
  user-select: none;
}

.checker.opp-lift {
  opacity: 0;
  transform: scale(0.85);
}

.checker.you-in-flight {
  opacity: 0;
}

.point.opp-land .stack,
.bar-stack.opp-land,
.tray-stack.opp-land {
  outline: 2px solid rgba(232, 210, 168, 0.55);
  outline-offset: 2px;
  border-radius: 4px;
  transition: outline-color 0.15s ease;
}

.checker.opp-fly {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1100;
  pointer-events: none;
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35),
    0 8px 20px rgba(0, 0, 0, 0.5);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.checker.drag-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  width: clamp(28px, 7vw, 48px);
  height: clamp(28px, 7vw, 48px);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.4),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35),
    0 4px 12px rgba(0, 0, 0, 0.55);
}

.point.drop-target,
.tray-stack.drop-target {
  outline: 2px dashed rgba(212, 160, 74, 0.75);
  outline-offset: -2px;
  border-radius: 3px;
  background: rgba(212, 160, 74, 0.12);
}

.point.drop-target-hover,
.tray-stack.drop-target-hover {
  outline: 2px solid var(--accent);
  background: rgba(212, 160, 74, 0.28);
}

.point-num {
  position: absolute;
  z-index: 2;
  font-size: clamp(0.45rem, 1.8vw, 0.58rem);
  font-family: var(--mono);
  color: rgba(255, 240, 210, 0.42);
  pointer-events: none;
}

.point.top .point-num {
  bottom: 1px;
}

.point.bottom .point-num {
  top: 1px;
}

.play-band {
  grid-column: 2 / 5;
  grid-row: 2;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.25rem;
  z-index: 4;
  pointer-events: none;
  min-height: 2.4rem;
}

.play-band.offer-active {
  grid-template-columns: 1fr;
  justify-items: center;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 0.4rem;
  box-shadow: 0 0 0 1px rgba(212, 160, 74, 0.4);
}

.board-dice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-height: 2.2rem;
  padding: 0.2rem 0.3rem;
  border-radius: 0.4rem;
  pointer-events: auto;
}

.board-dice.opp {
  grid-column: 1;
  justify-self: center;
}

.board-dice.you {
  grid-column: 3;
  justify-self: center;
}

.dice-cube-host {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  justify-self: center;
}

.dice-cube-host.opp {
  grid-column: 1;
}

.dice-cube-host.you {
  grid-column: 3;
}

.dice-cube-host .board-dice {
  grid-column: auto;
}

.dice-cube-host .cube,
.tray-collection > .cube.owned-cube {
  width: clamp(1.15rem, 4.2vw, 1.55rem);
  height: clamp(1.15rem, 4.2vw, 1.55rem);
  font-size: clamp(0.65rem, 2.4vw, 0.88rem);
}

.board-dice.rollable,
.board-dice.swappable,
.board-dice.committable {
  cursor: pointer;
  background: rgba(212, 160, 74, 0.18);
  box-shadow: 0 0 0 1px rgba(212, 160, 74, 0.55);
}

.board-dice.committable {
  animation: dice-commit-pulse 1.35s ease-in-out infinite;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  row-gap: 0.22rem;
  min-width: 12.5rem;
  padding: 0.28rem 0.55rem 0.35rem;
}

.dice-commit-hint {
  flex: 0 0 100%;
  width: 100%;
  max-width: none;
  text-align: center;
  white-space: nowrap;
  font-family: var(--font);
  font-size: clamp(0.55rem, 1.35vw, 0.68rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: rgba(243, 235, 226, 0.58);
  pointer-events: none;
  user-select: none;
}

.board-dice.rollable:hover,
.board-dice.rollable:focus-visible,
.board-dice.swappable:hover,
.board-dice.swappable:focus-visible,
.board-dice.committable:hover,
.board-dice.committable:focus-visible {
  background: rgba(212, 160, 74, 0.3);
  outline: none;
}

@keyframes dice-commit-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(212, 160, 74, 0.45);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(212, 160, 74, 0.85);
    transform: translateY(-2px);
  }
}

.board-roll-btn {
  appearance: none;
  margin: 0;
  border: 1px solid rgba(212, 160, 74, 0.32);
  background: rgba(0, 0, 0, 0.22);
  color: rgba(243, 235, 226, 0.72);
  font-family: var(--font);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.32rem 0.7rem;
  border-radius: 0.28rem;
  cursor: pointer;
  line-height: 1.2;
}

.board-roll-btn:hover,
.board-roll-btn:focus-visible {
  border-color: rgba(212, 160, 74, 0.55);
  color: var(--accent);
  background: rgba(212, 160, 74, 0.1);
  outline: none;
}

.offer-status {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  text-align: center;
  pointer-events: none;
}

.cube-decision-box {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  width: min(16rem, calc(100% - 1.5rem));
  padding: 0.75rem 0.85rem 0.8rem;
  border-radius: 0.75rem;
  background: rgba(16, 11, 8, 0.94);
  border: 1px solid rgba(212, 160, 74, 0.5);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.cube-decision-box .offer-actions {
  display: flex;
  gap: 0.45rem;
  width: 100%;
}

.cube-decision-box .offer-actions button {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.5rem 0.4rem;
  font-size: 0.92rem;
}

.cube-decision-box.waiting {
  width: min(18.5rem, calc(100% - 1.2rem));
}

.cube-wait-label {
  margin: 0;
  max-width: 15rem;
  text-align: center;
  text-wrap: balance;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}

.board-center-cube {
  width: clamp(2.4rem, 8vw, 3rem);
  height: clamp(2.4rem, 8vw, 3rem);
  font-size: clamp(1.1rem, 3.5vw, 1.35rem);
  border-radius: 0.35rem;
  pointer-events: none;
}

.board-cube-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.die {
  width: clamp(1.55rem, 5.5vw, 2.15rem);
  height: clamp(1.55rem, 5.5vw, 2.15rem);
  border-radius: 0.3rem;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: clamp(0.85rem, 3vw, 1.05rem);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    0 2px 4px rgba(0, 0, 0, 0.4);
}

.die.you {
  background: radial-gradient(circle at 35% 30%, #fff8ee, #e8d4b0 55%, #b8956a);
  color: #1a1410;
}

.die.opp {
  background: radial-gradient(circle at 35% 30%, #6a4a38, #3a2418 55%, #1a100c);
  color: #f3ebe2;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    0 2px 4px rgba(0, 0, 0, 0.45);
}

.die.dim {
  opacity: 0.35;
}

.die.empty {
  box-shadow: none;
  font-size: 0.8rem;
  opacity: 0.55;
}

.die.you.empty {
  background: rgba(232, 210, 168, 0.2);
  color: rgba(232, 210, 168, 0.7);
  box-shadow: inset 0 0 0 1px rgba(232, 210, 168, 0.3);
}

.die.opp.empty {
  background: rgba(28, 22, 18, 0.45);
  color: rgba(243, 235, 226, 0.4);
  box-shadow: inset 0 0 0 1px rgba(74, 64, 56, 0.55);
}

.die.placeholder {
  opacity: 0.85;
}

.cube {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.3rem;
  background: linear-gradient(160deg, #c43a2e, #8b1e1e 55%, #5c1212);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: var(--mono);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.18),
    0 2px 5px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cube.actionable {
  cursor: pointer;
}

.cube.actionable:hover {
  transform: scale(1.06);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.28),
    0 0 0 2px rgba(212, 160, 74, 0.45),
    0 3px 8px rgba(0, 0, 0, 0.5);
}

.cube.offering,
.board-center-cube.offering {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.25),
    0 0 0 2px rgba(212, 160, 74, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.45);
  animation: cube-pulse 1.4s ease-in-out infinite;
}

@keyframes cube-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@media (max-width: 420px) {
  .scoreline {
    grid-template-columns: 1fr auto 1fr;
  }
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.action-bar button {
  flex: 1 1 auto;
  min-width: 4.5rem;
  padding: 0.65rem 0.5rem;
}

.play-settings-modal {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: rgba(10, 8, 6, 0.45);
}

.play-settings-modal.hidden {
  display: none !important;
}

.play-settings-dialog {
  position: relative;
  width: min(18.5rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 0.75rem;
  background: var(--bg1);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.play-settings-dialog h2 {
  margin: 0;
  padding-right: 1.6rem;
  font-size: 1rem;
}

/* —— Settings tab —— */
.settings-container {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 0.95rem 1rem 1rem;
  border-radius: 0.75rem;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--line);
}

.settings-card h2 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.settings-card-note {
  margin: -0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
}

.settings-card-note code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.08rem 0.32rem;
  border-radius: 0.3rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.homescreen-card.hidden {
  display: none;
}

.homescreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.homescreen-device-badge {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--muted);
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.homescreen-device-badge:empty {
  display: none;
}

.homescreen-steps {
  margin: 0;
  padding-left: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--ink);
}

.homescreen-steps li::marker {
  color: var(--accent);
  font-weight: 700;
}

.homescreen-steps strong {
  color: #f6e3ba;
  font-weight: 600;
}

.homescreen-install-row {
  display: flex;
  justify-content: flex-end;
}

.homescreen-install-row.hidden {
  display: none;
}

.auto-messages-fields {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.auto-msg-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.88rem;
  color: var(--ink);
}

.auto-msg-field input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
}

.auto-messages-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.auto-messages-status {
  font-size: 0.8rem;
  color: var(--ok);
  min-height: 1.1em;
}

.switch-row,
.speed-row,
.settings-account-row,
.settings-support-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.9rem;
  color: var(--ink);
}

.support-card {
  border-color: rgba(212, 160, 74, 0.28);
  background: linear-gradient(180deg, rgba(212, 160, 74, 0.08), rgba(0, 0, 0, 0.24));
}

.settings-support-row {
  flex-wrap: wrap;
}

.settings-support-row .switch-copy {
  flex: 1 1 13rem;
}

.support-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  padding: 0.65rem 0.95rem;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, #e0b45e, var(--accent));
  color: var(--accent-ink);
  font: 600 0.9rem/1.2 var(--font);
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.support-btn:hover {
  filter: brightness(1.06);
}

.support-btn:active {
  transform: translateY(1px);
}

.support-btn:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.75);
  outline-offset: 2px;
}

.support-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.switch-row,
.speed-row {
  cursor: pointer;
}

.switch-copy,
.speed-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.switch-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.switch-desc {
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--muted);
}

.switch-state {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.switch-state::after {
  content: "Off";
}

.switch-row:has(input:checked) .switch-state::after {
  content: "On";
  color: var(--accent);
}

.danger-btn {
  flex-shrink: 0;
  color: var(--danger);
  border-color: rgba(224, 122, 95, 0.45);
}

.danger-btn:hover {
  background: rgba(224, 122, 95, 0.14);
  border-color: rgba(224, 122, 95, 0.7);
}

.switch {
  position: relative;
  width: 2.55rem;
  height: 1.4rem;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.switch::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #3a322c;
  border: 1px solid rgba(243, 235, 226, 0.22);
}

.switch::after {
  content: "";
  position: absolute;
  top: 0.14rem;
  left: 0.14rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: #f3ebe2;
  transition: transform 0.15s ease;
}

.switch:has(input:checked)::before {
  background: var(--accent);
  border-color: var(--accent);
}

.switch:has(input:checked)::after {
  transform: translateX(1.08rem);
  background: var(--accent-ink);
}

.speed-row select {
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.action-bar.cube-pending #btn-accept:not(:disabled) {
  box-shadow: 0 0 0 2px rgba(124, 184, 138, 0.55);
  outline: none;
}

.action-bar.cube-pending #btn-reject:not(:disabled) {
  color: var(--ink);
  border-color: rgba(224, 122, 95, 0.65);
  box-shadow: 0 0 0 1px rgba(224, 122, 95, 0.35);
}

.action-bar.cube-pending #btn-roll,
.action-bar.cube-pending #btn-double {
  opacity: 0.35;
}

.lobby {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.22);
  padding: 0.65rem;
}

.lobby-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 0;
  overflow: hidden;
}

.lobby-body > .invite-banner {
  flex-shrink: 0;
}

.games-categories-view,
.games-list-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
  overflow: hidden;
}

.games-self-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.7rem;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.games-self-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.games-self-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.games-self-controls .games-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.5rem;
  color: var(--muted);
  flex-shrink: 0;
}

.games-self-controls .games-edit-btn:hover,
.games-self-controls .games-edit-btn:focus-visible {
  color: var(--ink);
}

.games-self-controls .games-edit-icon {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
}

.games-self-controls .games-edit-done-label {
  display: none;
}

.games-self-controls .games-edit-btn[aria-pressed="true"] {
  width: auto;
  padding: 0 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.games-self-controls .games-edit-btn[aria-pressed="true"] .games-edit-icon {
  display: none;
}

.games-self-controls .games-edit-btn[aria-pressed="true"] .games-edit-done-label {
  display: inline;
}

.games-self-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.games-self-stats {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.ready-switch-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.ready-switch-label {
  white-space: nowrap;
  transition: color 0.15s ease;
}

.ready-switch-row:has(input:checked) .ready-switch-label {
  color: var(--ok);
}

.ready-switch:has(input:checked)::before {
  background: var(--ok);
  border-color: var(--ok);
}

.games-top-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.games-top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.games-top-row #btn-join,
.games-top-row .games-edit-btn {
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
}

.games-edit-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #e0b45e, var(--accent));
  color: var(--accent-ink);
  border-color: transparent;
}

.ready-row,
.remember-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95rem;
  color: var(--ink);
}

.ready-row input[type="checkbox"],
.remember-row input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.invite-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  flex-shrink: 0;
}

.invite-name-field {
  min-width: 0;
}

.invite-name-field input,
.invite-name-field select {
  width: 100%;
}

.invite-form:not(.names-collapsed) #invite-name-select,
.invite-form.names-collapsed #invite-name {
  display: none;
}

.games-category-list {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.1rem;
}

.games-category-list.is-dragging {
  user-select: none;
  -webkit-user-select: none;
}

.games-category-row {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.games-category-list:not(.editing) .games-category-row:hover {
  background: rgba(212, 160, 74, 0.1);
  border-color: rgba(212, 160, 74, 0.35);
}

.games-category-list:not(.editing) .games-category-row.is-hidden {
  display: none;
}

.games-category-list.editing .games-category-row {
  cursor: grab;
  padding: 0 0.45rem;
  gap: 0.2rem;
}

.games-category-list.editing .games-category-row:hover {
  border-color: rgba(212, 160, 74, 0.35);
}

.games-category-list.editing .games-category-row.is-hidden {
  opacity: 0.5;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.015);
}

.games-category-row.dragging {
  z-index: 10;
  cursor: grabbing;
  background: rgba(34, 26, 20, 0.96);
  border-color: var(--accent);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55);
  transition: none;
}

.games-category-item {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.85rem;
  border-radius: inherit;
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.games-category-list.editing .games-category-item {
  padding: 0.72rem 0.35rem;
  cursor: inherit;
}

.games-category-item:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.65);
  outline-offset: -2px;
}

.games-cat-drag-handle,
.games-cat-vis-toggle {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.games-category-list.editing .games-cat-drag-handle,
.games-category-list.editing .games-cat-vis-toggle {
  display: inline-flex;
}

.games-category-list.editing .games-cat-chevron {
  display: none;
}

.games-cat-drag-handle {
  cursor: grab;
  touch-action: none;
}

.games-cat-drag-handle:active,
.games-category-row.dragging .games-cat-drag-handle {
  cursor: grabbing;
  color: var(--accent);
}

.games-cat-drag-handle:hover,
.games-cat-drag-handle:focus-visible,
.games-cat-vis-toggle:hover,
.games-cat-vis-toggle:focus-visible {
  color: var(--ink);
  background: rgba(243, 235, 226, 0.08);
  outline: none;
}

.games-cat-drag-handle:focus-visible,
.games-cat-vis-toggle:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.65);
  outline-offset: 1px;
}

.games-cat-drag-handle svg,
.games-cat-vis-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  pointer-events: none;
}

.games-cat-vis-toggle[aria-pressed="true"] {
  color: var(--accent);
}

.games-cat-vis-toggle .icon-vis-hide,
.games-cat-vis-toggle[aria-pressed="false"] .icon-vis-show {
  display: none;
}

.games-cat-vis-toggle[aria-pressed="false"] .icon-vis-hide {
  display: block;
}

.games-categories-empty {
  margin: 0.5rem 0 0;
  padding: 0.9rem 1rem;
  border-radius: 0.65rem;
  border: 1px dashed var(--line);
  text-align: center;
  font-size: 0.86rem;
  color: var(--muted);
}

.games-cat-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--muted);
}

.games-cat-dot.ready {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(124, 184, 138, 0.22);
}

.games-cat-dot.away {
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(181, 168, 152, 0.18);
}

.games-cat-dot.playing {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 160, 74, 0.24);
}

.games-cat-dot.bots {
  background: #7ab8bf;
  box-shadow: 0 0 0 3px rgba(122, 184, 191, 0.22);
}

.games-cat-dot.friends {
  background: #e8c77b;
  box-shadow: 0 0 0 3px rgba(232, 199, 123, 0.22);
}

.games-cat-dot.saved {
  background: #7aa8d8;
  box-shadow: 0 0 0 3px rgba(122, 168, 216, 0.22);
}

.games-cat-dot.blocked {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.24);
}

.games-cat-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.games-cat-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--ink);
}

.games-cat-desc {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
}

.games-cat-count {
  flex-shrink: 0;
  min-width: 1.85rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
}

.games-cat-chevron {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--muted);
}

.games-list-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.games-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #e0b45e, var(--accent));
  color: var(--accent-ink);
  flex-shrink: 0;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.games-back-btn:hover,
.games-back-btn:focus-visible {
  filter: brightness(1.07);
}

.games-back-btn:active {
  transform: scale(0.95);
}

.games-back-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
}

.games-list-heading {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.games-list-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.games-list-count {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}

.games-list-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.games-show-bots-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.games-show-bots-row.hidden {
  display: none;
}

.games-show-bots-label {
  white-space: nowrap;
  transition: color 0.15s ease;
}

.games-show-bots-row:has(input:checked) .games-show-bots-label {
  color: var(--ink);
}

.games-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0.35rem;
}

.games-refresh-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ready-list {
  list-style: none;
  margin: 0;
  padding: 0 0.15rem 0 0;
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 160, 74, 0.65) rgba(0, 0, 0, 0.35);
  font-size: 0.88rem;
}

.ready-list::-webkit-scrollbar {
  width: 0.55rem;
}

.ready-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.28);
  border-radius: 0.35rem;
}

.ready-list::-webkit-scrollbar-thumb {
  background: rgba(212, 160, 74, 0.55);
  border-radius: 0.35rem;
}

.ready-list::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 160, 74, 0.8);
}

.ready-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.ready-list li.ready-empty {
  color: var(--muted);
  justify-content: center;
  padding: 1.5rem 0.5rem;
  border-bottom: none;
  text-align: center;
}

.player-row-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.player-row-name {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-left: 0.28em;
  vertical-align: -0.14em;
  color: currentColor;
  opacity: 0.68;
  line-height: 1;
}

.bot-icon {
  width: 0.95em;
  height: 0.95em;
  display: block;
}

.score-name .bot-badge {
  margin-left: -0.05rem;
  align-self: center;
}

.user-context-header {
  display: flex;
  align-items: center;
}

.user-context-header-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ready-list button.player-row-name {
  appearance: none;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  margin: 0;
  padding: 0.12rem 0;
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  font: 600 0.9rem/1.3 var(--font);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  align-self: flex-start;
  transition: color 0.12s ease;
}

.ready-list button.player-row-name:hover,
.ready-list button.player-row-name:focus-visible,
.ready-list button.player-row-name[aria-expanded="true"] {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ready-list button.player-row-name:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.6);
  outline-offset: 2px;
}

.player-row-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-row-stats {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
}

.player-row-meta {
  font-size: 0.76rem;
  color: var(--muted);
}

.player-row-meta.status-ready {
  color: var(--ok);
}

.player-row-meta.status-playing {
  color: var(--accent);
}

.player-row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.ready-list button {
  padding: 0.38rem 0.65rem;
  font-size: 0.8rem;
}

.invite-banner {
  margin: 0;
  padding: 0.5rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(212, 160, 74, 0.15);
  color: var(--accent);
  font-size: 0.9rem;
}

.transcript {
  max-height: 10rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem;
  margin: 0.35rem 0;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Must follow .transcript so max-height: none wins over 10rem */
.transcript.transcript-full {
  flex: 1 1 0;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  overflow-y: auto;
}

.transcript .sys {
  color: var(--accent);
}

.transcript .err {
  color: var(--danger);
}

.command-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  padding: 3px;
  flex-shrink: 0;
}

.command-bar input {
  min-width: 0;
  padding: 0.65rem 0.75rem;
  font-size: 0.95rem;
}

/* —— Chat tab —— */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: rgba(0, 0, 0, 0.22);
  padding: 0.65rem;
}

.chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 0;
  overflow: hidden;
}

.chat-body > .chat-form {
  flex-shrink: 0;
}

.chat-log {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.45rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  word-break: break-word;
}

.chat-log:empty::before {
  content: "No messages yet";
  color: var(--muted);
  font-style: italic;
}

.chat-entry {
  margin: 0 0 0.35rem;
}

.chat-entry:last-child {
  margin-bottom: 0;
}

.chat-entry .chat-meta {
  color: var(--muted);
  font-size: 0.68rem;
  margin-right: 0.35rem;
}

.chat-entry.chat-in .chat-meta {
  color: var(--accent);
}

.chat-entry.chat-out .chat-meta {
  color: var(--ok);
}

.chat-entry.chat-shout .chat-meta {
  color: #e0b45e;
}

.chat-entry.chat-system {
  color: var(--muted);
  font-style: italic;
}

.chat-user,
button.chat-user {
  appearance: none;
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.2rem;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(243, 235, 226, 0.28);
  text-underline-offset: 0.14em;
}

.chat-user:hover,
.chat-user:focus-visible,
.chat-user[aria-expanded="true"] {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.chat-user:focus-visible {
  outline: 2px solid rgba(212, 160, 74, 0.6);
  outline-offset: 2px;
}

.user-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 10.5rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--bg1);
  box-shadow: 0 0.65rem 1.5rem rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.user-context-menu.hidden {
  display: none;
}

.user-context-header {
  padding: 0.35rem 0.7rem 0.4rem;
  margin-bottom: 0.1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 14rem;
}

.user-context-item {
  appearance: none;
  margin: 0;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--ink);
  font: 600 0.88rem/1.3 var(--font);
  text-align: left;
  padding: 0.55rem 0.75rem;
  min-height: 2.35rem;
  cursor: pointer;
}

.user-context-item.danger {
  color: var(--danger);
}

.user-context-item.danger:hover,
.user-context-item.danger:focus-visible {
  background: rgba(224, 122, 95, 0.16);
}

.user-context-item:hover,
.user-context-item:focus-visible {
  background: rgba(212, 160, 74, 0.16);
  outline: none;
}

.user-context-item:disabled {
  opacity: 0.55;
  cursor: default;
}

.user-context-item:disabled:hover {
  background: transparent;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem;
  align-items: center;
  padding: 3px;
  flex-shrink: 0;
}

.chat-form input {
  min-width: 0;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
}

.chat-home-view,
.chat-room-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 0;
  overflow: hidden;
}

.games-cat-dot.chat-public {
  background: #7aa8d8;
  box-shadow: 0 0 0 3px rgba(122, 168, 216, 0.22);
}

.games-cat-dot.chat-dm {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(124, 184, 138, 0.22);
}

.games-cat-dot.chat-game {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 160, 74, 0.24);
}

.chat-empty {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 0.5rem 0.25rem;
}

.chat-room-item .games-cat-name {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-room-item .games-cat-desc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.games-cat-count.chat-unread {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.chat-remove-spacer {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  margin-right: 0.35rem;
}

.chat-remove-btn {
  appearance: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  margin-right: 0.35rem;
  padding: 0;
  border: none;
  border-radius: 0.45rem;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.chat-remove-btn:hover,
.chat-remove-btn:focus-visible {
  color: var(--danger);
  background: rgba(224, 122, 95, 0.14);
}

.chat-remove-btn:focus-visible {
  outline: 2px solid rgba(224, 122, 95, 0.55);
  outline-offset: -2px;
}

/* —— MOTD modal —— */
.motd-modal {
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0;
  max-width: min(34rem, calc(100vw - 1.5rem));
  width: 100%;
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.55);
}

.motd-modal::backdrop {
  background: rgba(10, 8, 6, 0.72);
}

.motd-dialog {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.1rem 1.1rem;
  margin: 0;
}

.motd-dialog h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.motd-text {
  margin: 0;
  max-height: min(50vh, 22rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.motd-dismiss-opt {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
}

.motd-dismiss-opt input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.motd-dialog .primary {
  align-self: flex-end;
  min-width: 5.5rem;
}

/* —— Custom invite length dialog —— */
.invite-length-modal {
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0;
  max-width: min(22rem, calc(100vw - 1.5rem));
  width: 100%;
  background: var(--bg1);
  color: var(--ink);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.55);
}

.invite-length-modal::backdrop {
  background: rgba(10, 8, 6, 0.72);
}

.invite-length-dialog {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem 1.1rem 1.1rem;
  margin: 0;
}

.invite-length-dialog h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}

.invite-length-lede {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--muted);
}

.invite-length-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.invite-length-field input {
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
}

.invite-length-error {
  margin: 0;
  font-size: 0.8rem;
  color: var(--danger);
}

.invite-length-error.hidden {
  display: none;
}

.invite-length-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-top: 0.15rem;
}

.invite-length-actions .primary,
.invite-length-actions .ghost {
  min-width: 5rem;
}

/* —— Weekly TPR Top 5 congratulations —— */
.top5-congrats {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 6, 4, 0.55);
  pointer-events: auto;
}

.top5-congrats.hidden {
  display: none !important;
}

.top5-fireworks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.top5-congrats-card {
  position: relative;
  z-index: 1;
  width: min(22rem, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1.15rem 1.2rem 1.1rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(232, 210, 168, 0.45);
  background:
    radial-gradient(ellipse at 30% 0%, rgba(232, 210, 168, 0.18), transparent 55%),
    linear-gradient(165deg, #2a2118 0%, #16110c 100%);
  color: #f4ebe0;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 1rem 2.5rem rgba(0, 0, 0, 0.55);
  text-align: center;
  animation: top5-card-in 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

@keyframes top5-card-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.top5-congrats-eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 210, 168, 0.75);
}

.top5-congrats-card h2 {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #f0d9a8;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.top5-congrats-message {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  line-height: 1.4;
  color: rgba(244, 235, 224, 0.92);
}

.top5-congrats-card .primary {
  align-self: center;
  min-width: 7rem;
  margin-top: 0.15rem;
}
