:root {
  color-scheme: dark;
  --page: var(--ds-bg);
  --panel: #141824;
  --panel-soft: #191e2c;
  --line: rgba(221, 227, 255, .12);
  --text: var(--ds-text);
  --muted: var(--ds-text-muted);
  --accent: #ac98ff;
  --accent-strong: #7156e8;
  --mint: #78e1bd;
  --danger: #ff8c9d;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body.player-page {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }
.page-shell { padding: 42px 0 70px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: clamp(28px, 6vw, 72px); align-items: center; padding: 38px 0 62px; }
.eyebrow { margin: 0 0 9px; font-weight: 750; font-size: 11px; letter-spacing: .15em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 680px; font-size: clamp(42px, 7vw, 76px); line-height: .99; letter-spacing: -.065em; }
.hero h1 span { color: var(--accent); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
  .button:hover:not(:disabled) { transform: none; }
}
.button-primary { color: #130f22; background: linear-gradient(130deg, #c5b7ff, #9c88ff 65%, #8270ea); box-shadow: 0 10px 32px rgba(121, 97, 225, .2); }
.button-secondary { border-color: var(--line); background: rgba(255,255,255,.045); }
.button-secondary:hover:not(:disabled), .button-muted:hover:not(:disabled) { border-color: rgba(197,183,255,.52); background: rgba(172,152,255,.1); }
.button-muted { border-color: var(--line); background: transparent; }
.button-small { min-height: 36px; padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.button-full { width: 100%; }
button:disabled { opacity: .48; cursor: not-allowed; }
.small-copy { color: var(--muted); font-size: 13px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(150deg, rgba(25,30,44,.94), rgba(18,22,33,.96)); }
.back-link { color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.account-dialog { width: min(430px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--text); background: #171b29; box-shadow: 0 25px 90px rgba(0,0,0,.6); }
.account-dialog::backdrop { background: rgba(4,6,12,.72); backdrop-filter: blur(5px); }
.account-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dialog-heading h2 { margin: 0; font-size: 25px; }
.dialog-heading .eyebrow { margin-bottom: 4px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: transparent; font-size: 24px; cursor: pointer; }
.account-dialog label { display: block; margin: 15px 0 5px; color: #dfe2ee; font-size: 13px; font-weight: 700; }
.account-dialog input { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid rgba(221,227,255,.2); border-radius: 8px; color: var(--text); background: #0f121b; }
.account-dialog input:focus { border-color: var(--accent); outline: 3px solid var(--mint); outline-offset: 3px; }
.muted { color: var(--muted); }
.button-danger { min-height: 43px; padding: 9px 16px; border: 1px solid var(--danger); border-radius: 8px; color: #fff; background: #7d1f33; font-weight: 700; cursor: pointer; }
.button-danger:disabled { opacity: .55; cursor: not-allowed; }
.button-danger:focus-visible { outline: 3px solid var(--mint); outline-offset: 3px; }
.text-button { min-height: 40px; padding: 8px 0; border: 0; color: var(--accent); background: transparent; font-weight: 700; cursor: pointer; }
a.text-button { display: inline-block; margin-left: 16px; line-height: 24px; text-decoration: none; }
.error-message { min-height: 20px; margin: 8px 0; color: var(--danger); font-size: 13px; }
.back-link { display: inline-block; margin-bottom: 26px; font-size: 14px; }
.lobby-page-heading { margin-bottom: 26px; }
.lobby-page-heading h1 { margin: 0; font-size: clamp(34px, 5vw, 52px); line-height: 1.05; letter-spacing: -.05em; }
.lobby-page-heading p:last-child { margin: 12px 0 0; }
.auth-required { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 22px; }
.auth-required h2, .error-panel h2 { margin: 0 0 4px; font-size: 20px; }
.auth-required p, .error-panel p { margin: 0; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; justify-content: center; min-height: 29px; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; color: #c4c9d9; background: rgba(255,255,255,.04); font-size: 12px; font-weight: 800; text-transform: capitalize; }
.status-pill[data-status="playing"] { color: var(--mint); border-color: rgba(120,225,189,.32); background: rgba(120,225,189,.09); }
.status-pill[data-status="finished"] { color: #c5b7ff; border-color: rgba(197,183,255,.3); background: rgba(197,183,255,.08); }
.panel { padding: 21px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-heading h3, .panel h3 { margin: 0; font-size: 19px; }
.panel-heading .eyebrow, .panel > .eyebrow { margin-bottom: 4px; }
.seat-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.seat-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); }
.seat-name { color: var(--text); font-weight: 650; }
.seat-kind { color: var(--muted); font-size: 12px; text-transform: capitalize; }
.small-copy { margin: 10px 0 0; }
.code-row { display: flex; align-items: center; gap: 10px; }
.join-code { overflow: hidden; min-height: 46px; flex: 1; display: flex; align-items: center; padding: 8px 13px; border: 1px dashed rgba(172,152,255,.45); border-radius: 9px; color: #d6ccff; background: rgba(172,152,255,.08); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 17px; font-weight: 800; letter-spacing: .1em; text-overflow: ellipsis; white-space: nowrap; }
.prompt-panel { grid-column: 1 / -1; }
.first-time-hint { margin: 14px 0; padding: 11px 13px; border: 1px solid var(--ds-line-strong); border-radius: var(--ds-radius-md); color: var(--ds-text); background: color-mix(in srgb, var(--ds-cyan) 8%, transparent); font-size: 13px; }
.first-time-hint strong { color: var(--ds-cyan); }
.agent-prompt { max-height: 300px; overflow: auto; margin: 0; padding: 15px; border: 1px solid var(--line); border-radius: 9px; color: #dde2f0; background: #0d1018; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.match-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.match-note { min-height: 18px; }
.error-panel { border-color: rgba(255,140,157,.25); }
.lobby-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-top: 18px; }
.lobby-actions .back-link { margin: 0; }
.profile-page-heading { margin-bottom: 22px; }
.profile-page-heading h1 { margin: 0; font-size: clamp(34px, 5vw, 52px); line-height: 1.05; letter-spacing: -.05em; }
.profile-page-heading p:last-child { margin: 12px 0 0; }
#look-form, #password-change-form { display: grid; gap: 10px; max-width: 420px; }
#look-form label, #password-change-form label { margin-top: 4px; color: var(--muted); font-size: 14px; }
#look-form input, #look-form select, #password-change-form input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid rgba(221,227,255,.2); border-radius: 8px; color: var(--text); background: #0f121b; font: inherit; }
#look-form input:focus-visible, #look-form select:focus-visible { border-color: var(--accent); outline: 3px solid var(--mint); outline-offset: 3px; }
#password-change-form input:focus-visible { border-color: var(--accent); outline: 3px solid var(--mint); outline-offset: 3px; }
#look-form p, #password-change-form p { margin: 0; }
#look-preview { min-height: 52px; margin-block: 6px !important; }
#look-save, #password-change-submit { justify-self: start; margin-top: 4px; }
[hidden] { display: none !important; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding: 26px 0 42px; }
}
@media (max-width: 620px) {
  .page-shell { padding-top: 26px; }
  .hero h1 { font-size: clamp(40px, 12vw, 58px); }
  .prompt-panel { grid-column: auto; }
  .auth-required { align-items: flex-start; flex-direction: column; }
  .code-row { align-items: stretch; flex-direction: column; }
  .code-row .button { width: 100%; }
  .lobby-actions { align-items: flex-start; flex-direction: column; }
}

#practice-panel { margin-bottom: 32px; }
#practice-form { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#practice-form .small-copy { flex: 0 0 100%; margin: 0; }
#practice-mode, #practice-pickups { padding: 10px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
#practice-prompt { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow: auto; }
#setup-prompt-text { overflow-wrap: anywhere; }

/* Home and lobby layouts, including generated codes and long player names. */
.responsive-page .panel, .responsive-page .panel-heading > div { min-width: 0; overflow-wrap: anywhere; }
.responsive-page .code-row { flex-wrap: wrap; }
.responsive-page .join-code { min-width: 0; flex-basis: 100%; }
.responsive-page .seat-name { min-width: 0; overflow-wrap: anywhere; }
.responsive-page .seat-kind { flex-shrink: 0; }
.responsive-page .account-dialog { max-height: calc(100dvh - 28px); overflow: auto; }
@media (max-width: 820px) {
  .responsive-page .button-small, .responsive-page .text-button,
  .responsive-page .account-dialog input, .responsive-page select { min-height: 44px; }
  .responsive-page .icon-button { width: 44px; height: 44px; flex-shrink: 0; }
  .responsive-page .panel-heading { flex-wrap: wrap; }
}
.rating-chart-svg { width: 100%; max-width: 480px; height: auto; display: block; }
.rating-chart-line { stroke: #a99aed; stroke-width: 2; }
.rating-chart-dot { fill: #a99aed; }
.rating-chart .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Public lobby identifiers and occupied seats must shrink within their panels. */
.lobby-shell #lobby-title, .lobby-shell #invite-link { overflow-wrap: anywhere; min-width: 0; }
.lobby-shell .join-code { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .lobby-shell .seat-list li { flex-wrap: wrap; }
  .lobby-shell .seat-kind { flex-shrink: 1; overflow-wrap: anywhere; }
  .lobby-shell .seat-list .button { flex-basis: 100%; }
}
.profile-shell { overflow-wrap: anywhere; }
.profile-shell section { margin-bottom: 18px; }
.account-notice { min-height: 20px; margin: 8px 0; color: var(--muted); font-size: 13px; }
.account-notice.is-success { color: #8ee6a8; }
