.lobby-page { padding-bottom: max(36px, env(safe-area-inset-bottom)); }
.lobby-header { max-width: 1280px; }
.lobby-header .brand { display: flex; color: var(--ink); text-decoration: none; }
.lobby-header nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }

.lobby-main { max-width: 1280px; margin: auto; }
.lobby-hero { display: flex; align-items: center; justify-content: space-between; gap: 28px; padding: 50px 0 28px; }
.lobby-hero h2 { font: 400 clamp(36px, 5vw, 58px)/1.15 var(--font-display); margin: 12px 0; }
.hero-detail { color: var(--muted); font-size: 15px; line-height: 1.65; }
.lobby-page .primary { background: var(--gold); border-color: var(--gold); color: var(--accent-ink); font-weight: 700; text-align: center; padding: 14px 22px; }
.lobby-status { display: block; min-height: 26px; margin-bottom: 24px; }
.lobby-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 34px; }
.lobby-section { margin-bottom: 38px; }
.lobby-section .section-heading { margin-bottom: 16px; }
.lobby-section h2 { font-size: 19px; display: flex; align-items: center; gap: 10px; }
.lobby-count { font: 12px ui-sans-serif, system-ui, sans-serif; color: var(--muted); border: 1px solid var(--line); padding: 3px 7px; border-radius: var(--radius-soft); }
.lobby-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.game-card { background: linear-gradient(145deg, color-mix(in srgb, var(--raised) 53%, transparent), transparent), var(--panel); border: 1px solid var(--line); border-radius: var(--radius-soft); padding: 20px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.game-card.mine { border-top: 2px solid var(--gold); }
.game-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.game-card h3 { margin: 0; font: 400 23px var(--font-display); }
:is(.game-card, .game-row) .status-tag { font-size: 11px; padding: 4px 8px; white-space: nowrap; }
:is(.game-card, .game-row) .status-tag.available { color: var(--ally); border-color: #5e8e73; }
.game-card .status-tag.your-turn { color: var(--accent-ink); background: var(--gold); border-color: var(--gold); font-weight: 700; }
.game-turn { font-size: 13px; color: var(--ink); }
.game-turn.mine { color: var(--gold); font-weight: 650; }
.game-id { overflow-wrap: anywhere; font-size: 11px; color: var(--muted); }
.game-players { font-size: 13px; color: var(--muted); line-height: 1.5; }
.versus { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; }
.versus .side { min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.versus .side.player2 { justify-content: flex-end; text-align: right; }
.versus .who { font-weight: 650; overflow-wrap: anywhere; }
.versus .player1 .who.person { color: var(--ally); }
.versus .player2 .who.person { color: var(--enemy); }
.versus .who.open { color: var(--muted); font-weight: 400; border: 1px dashed var(--line); border-radius: var(--radius-sharp); padding: 2px 8px; }
.versus .side.you .who::after { content: " (you)"; color: var(--muted); font-weight: 400; font-size: 12px; }
.versus .vs { font: italic 14px var(--font-display); color: var(--muted); }
.bot-tag { font-size: 9px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius-sharp); padding: 1px 4px; }
.game-card button { width: 100%; text-align: center; margin-top: auto; }
.game-card .status-tag.invited { color: var(--gold); border-color: var(--gold); }
.game-card.invitation { border-top: 2px solid var(--gold); }
.card-ways { display: flex; flex-direction: column; gap: 8px; } .card-ways button { margin-top: 0; }
.card-ways .danger { color: var(--enemy); }
.game-card a { color: var(--gold); }
.lobby-filters { display: flex; gap: 8px; margin: -2px 0 16px; padding: 0; border: 0; min-width: 0; }
.lobby-filters > legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lobby-filters button { border-radius: var(--radius-soft); font-size: 12px; padding: 8px 14px; }
.lobby-filters button[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 5.1%, transparent); }
.lobby-filters button span { color: var(--muted); }
/* Your games page six at a time; the pager stays one line, its buttons full-size targets. */
/* A list's entries as rows (Find an opponent, finished games): one line on a wide screen (what and its state, who,
   a detail, the action), three short lines on a phone, so a long list stays readable and pages instead of growing. */
.game-rows { display: grid; gap: 8px; }
.game-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.5fr) minmax(0, 1fr) auto; grid-template-areas: "top who detail action"; align-items: center; gap: 8px 16px; min-width: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-soft); background: var(--panel); }
.game-row-top { grid-area: top; display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.game-row-top h3 { margin: 0; font: 400 16px/1.25 var(--font-display); white-space: nowrap; }
.game-row-who { grid-area: who; display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; font-size: 13px; }
.game-row-who .who { font-weight: 650; overflow-wrap: anywhere; }
.game-row-who .who.you::after { content: " (you)"; color: var(--muted); font-weight: 400; font-size: 12px; }
.game-row-who .who.open { color: var(--muted); font-weight: 400; }
.game-row-who .vs { font: italic 13px var(--font-display); color: var(--muted); }
.game-row-detail { grid-area: detail; margin: 0; color: var(--muted); font-size: 12px; min-width: 0; }
.game-row > :is(button, a) { grid-area: action; justify-self: end; min-height: 40px; padding: 8px 14px; font-size: 13px; white-space: nowrap; }
.game-row > a.button-link { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-soft); color: var(--gold); text-decoration: none; }
@media (max-width: 760px) {
  .game-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top action" "who action" "detail action"; gap: 4px 12px; padding: 12px 14px; }
  .game-row-detail:empty { display: none; }
}
/* On the narrowest phones the action leaves too little width beside it for "who vs who" on one line under wide system
   fonts: what the row is takes the whole first line, and the action sits beside the players only. */
@media (max-width: 420px) {
  .game-row { grid-template-areas: "top top" "who action" "detail action"; }
}
.lobby-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.lobby-pages[hidden] { display: none; }
.lobby-pages button { min-height: 44px; border-radius: var(--radius-soft); font-size: 12px; padding: 8px 14px; }
.lobby-pages button:disabled { opacity: .45; cursor: default; }
#mine-page { font-size: 12px; color: var(--muted); }
.mine-groups { display: grid; gap: 26px; }
.mine-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mine-group-head h3 { margin: 0; font: 400 17px var(--font-display); color: var(--ink); }
.mine-group .lobby-count.full { color: var(--gold); border-color: var(--gold); }
.mine-limit { margin: 10px 0 0; color: var(--muted); font-size: 13px; }
:is(.game-card, .game-row) .status-tag.outcome.won { color: var(--ok); border-color: var(--ok); }
/* Recent opponents are one row that scrolls sideways, whatever their number: the section keeps one card's height,
   and on a phone the next card shows at the edge, which says there are more. Each card is the name and the score
   between you, the last game in small, and the one way to play again. */
.opponent-strip { display: flex; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px; padding: 2px 2px 8px; scrollbar-width: thin; }
.opponent-strip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: var(--radius-soft); }
.game-card.opponent { flex: 0 0 min(76%, 240px); scroll-snap-align: start; padding: 12px 14px; gap: 8px; }
.game-card.opponent h3 { margin: 0; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-card.opponent .status-tag.record { color: var(--ink); font-variant-numeric: tabular-nums; }
.game-card.opponent .game-turn { color: var(--muted); font-size: 12px; margin: 0; }
.game-card.practice .practice-goal { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.game-card.practice a.primary { text-decoration: none; }
.game-card.opponent button { width: 100%; min-height: 40px; margin-top: auto; }
:is(.game-card, .game-row) .status-tag.outcome.lost { color: var(--bad); border-color: var(--bad); }
/* A game the operator voided (ADR 0176) counts nowhere: its tag is quiet, neither a win nor a loss. */
:is(.game-card, .game-row) .status-tag.outcome.voided { color: var(--muted); border-color: var(--line); text-decoration: line-through; }
.game-card.finished .button-link { display: block; margin-top: auto; text-align: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-soft); text-decoration: none; }
.empty-state { grid-column: 1 / -1; padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius-soft); color: var(--muted); line-height: 1.7; }
.lobby-panel { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-soft); background: var(--paper-glass); margin-bottom: 18px; }
.lobby-panel h2 { font: 400 22px var(--font-display); margin: 10px 0 18px; }
.lobby-page label { display: block; color: var(--muted); font-size: 12px; margin: 18px 0 8px; }
.lobby-page input, .lobby-page select { min-width: 0; width: 100%; min-height: 46px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius-soft); padding: 10px; color: var(--ink); background: var(--paper); }
.lobby-page input:focus-visible, .lobby-page select:focus-visible, .lobby-page a:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.code-row { display: flex; gap: 8px; }
.code-row input { text-transform: uppercase; letter-spacing: 1px; }
.code-row button { white-space: nowrap; }
.lobby-page dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-soft); padding: 28px; }
.lobby-page dialog::backdrop { background: #030a10c9; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.dialog-heading h2 { font: 400 28px var(--font-display); margin-top: 8px; }
#create-help { margin-top: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.lobby-page .problem { margin: 12px 0; }
.account { position: relative; }
.account-chip { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: var(--radius-soft); background: var(--raised); list-style: none; font-weight: 650; }
.account-chip::-webkit-details-marker { display: none; }
.account-initial { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); color: var(--gold); border: 1px solid var(--brand-ember); font: 15px var(--font-display); }
.account-menu { position: absolute; right: 0; top: 48px; z-index: 10; display: grid; gap: 6px; padding: 8px; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-soft); box-shadow: 0 15px 40px #0008; }
.account-menu button { width: 100%; }
.google-button { min-height: 44px; }
.lobby-page button.danger { color: var(--refused); border-color: #8a4b45; }
.lobby-page button.danger:hover:not(:disabled) { border-color: var(--refused); }
.privacy-panel p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 10px; }
.friends-panel .code-row input { text-transform: none; letter-spacing: 0; }
.friend-subheading { font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--gold); margin: 14px 0 6px; }
.friend-list { list-style: none; padding: 0; margin: 0 0 14px; }
.friend-list .empty-state { padding: 14px; font-size: 13px; }
.friend-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.friend-name { font-weight: 600; }
.friend-actions { display: flex; gap: 6px; } .friend-actions button { min-height: 36px; padding: 0 12px; font-size: 13px; }
.friends-panel p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 10px; }
.device-panel p:not(.eyebrow), .device-panel output { color: var(--muted); font-size: 13px; line-height: 1.7; margin-bottom: 12px; display: block; }
.device-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; } .device-actions button { flex: 1; min-height: 44px; }
.name-title { font: 400 28px var(--font-display); margin: 8px 0 10px; }
.name-check { margin: 10px 0 0; font-size: 13px; }
.name-check.good { color: var(--ally); }
.name-check.bad { color: var(--refused); }
@media (max-width: 1040px) { .lobby-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 22px; } .lobby-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
  .lobby-page { padding-left: 18px; padding-right: 18px; }
  .lobby-header { min-height: 88px; gap: 12px; } .lobby-header h1 { font-size: 21px; }
  .lobby-header .brand-mark { width: 34px; height: 42px; font-size: 26px; }
  .lobby-header nav { gap: 10px; }
  .lobby-header .brand { gap: 10px; }
  .lobby-hero { align-items: stretch; flex-direction: column; padding-top: 32px; gap: 20px; }
  .lobby-hero .primary { width: 100%; }
  .lobby-layout { display: flex; flex-direction: column; gap: 0; }
  .lobby-section .section-heading { align-items: flex-start; gap: 10px; }
  .lobby-section .section-heading > .muted { font-size: 11px; }
  .lobby-panel { padding: 20px; }
  .game-card { padding: 18px; }
  .dialog-actions { flex-wrap: wrap; } .dialog-actions button { flex: 1; }
}


/* Copper supports the brand; gold remains the action/selection accent. */
.lobby-hero .eyebrow, .lobby-panel > .eyebrow { color: var(--brand-ember); }

/* Home: a restrained header, a game-focused dashboard and, for guests, a focused sign-in panel. */
.home-page { padding-top: 0; }
.home-header { position: relative; min-height: 100px; gap: 24px; z-index: 35; }
.home-header .brand { flex: none; }
.home-header .brand .eyebrow { font-size: 8px; letter-spacing: 1.6px; }
.home-header h1 { font-size: 23px; white-space: nowrap; }
.home-header .home-navigation { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.home-navigation > :is(a, button) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 11px; font-size: 12px; font-weight: 600; border: 1px solid transparent; border-radius: var(--radius-soft); background: transparent; color: var(--muted); text-decoration: none; white-space: nowrap; }
.home-navigation > :is(a, button):hover, .home-navigation > [aria-current="page"] { color: var(--gold); background: var(--accent-wash); }
.home-menu-toggle { display: none; }
.home-header .account { flex: none; }
.home-header #account-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.home-header .account-chip { font-size: 12px; }
.nav-badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; border-radius: 50%; padding: 0 4px; background: var(--gold); color: var(--accent-ink); font-size: 10px; }
/* The bell: what waits for the player (their turns, invitations, friend requests), counted on it in every page's
   header and listed in its window, each with its action. Outside the menu, so a phone sees it without opening it. */
.inbox-button { position: relative; flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); }
.inbox-button[hidden] { display: none; }
.inbox-button:hover, .inbox-button[aria-expanded="true"] { color: var(--gold); background: var(--accent-wash); }
.inbox-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.inbox-button:has(.inbox-badge:not([hidden])) { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
/* Inside the bell's own box: a header at the screen's top edge (the battle view on a phone) never cuts it off. */
.inbox-badge { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; font-size: 9px; font-weight: 700; box-shadow: 0 0 0 2px var(--paper); }
.inbox-list { display: grid; gap: 22px; }
.inbox-group h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.inbox-items { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.inbox-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-soft); background: var(--raised); }
.inbox-item.turn { border-color: color-mix(in srgb, var(--gold) 60%, var(--line)); }
.inbox-text { display: grid; gap: 3px; min-width: 0; }
.inbox-text strong { overflow-wrap: anywhere; }
.inbox-text small { color: var(--muted); font-size: 12px; }
.inbox-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }
.inbox-actions :is(button, a) { min-height: 44px; }
.inbox-actions .button-link { display: inline-flex; align-items: center; justify-content: center; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-soft); color: var(--gold); text-decoration: none; }
.inbox-empty { margin: 0; }
/* The narrowest phones fit the brand, the menu, the bell and the account in one row by giving up some air. */
@media (max-width: 360px) {
  header.home-header { gap: 4px; }
  .inbox-button { width: 40px; height: 40px; }
}
@media (max-width: 520px) {
  .inbox-item { flex-direction: column; align-items: stretch; }
  .inbox-actions { justify-content: stretch; }
  .inbox-actions > * { flex: 1; }
}
.home-page .lobby-hero { padding: 44px 0 30px; }
.home-page .lobby-hero h2 { font-size: clamp(34px, 4vw, 50px); }
.home-page .lobby-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.home-page .lobby-status { min-height: 20px; margin-bottom: 30px; font-size: 11px; }
.home-page .lobby-section { margin-bottom: 36px; }

.home-page .game-id { display: none; }
.home-page .lobby-games { padding-bottom: 10px; }
/* The player doorway sits beside a single painted silhouette. Only account hosts show it. */
.sign-in-panel { position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; min-height: clamp(360px, 48vw, 550px); margin-block: clamp(24px, 5vw, 72px); border-block: 1px solid var(--line); background: var(--soot); }
.sign-in-panel::before { content: ''; position: absolute; inset: 0; z-index: -2; background: linear-gradient(90deg, var(--soot) 4%, rgb(7 13 16 / .86) 41%, transparent 100%), url('battle-art/eclipse-battle.webp') center / cover; }
.sign-in-content { width: min(60%, 560px); min-width: 0; padding: clamp(24px, 5vw, 72px); }
.sign-in-content .eyebrow { color: var(--brand-ember); }
.sign-in-content h2 { font: 400 clamp(38px, 5vw, 76px)/1.06 var(--font-display); letter-spacing: -.04em; color: var(--bone); margin: 16px 0 12px; }
.sign-in-content .muted { font-size: 15px; line-height: 1.6; }
.sign-in-actions { display: grid; gap: 8px; margin-top: 26px; min-width: 0; }
.sign-in-art { position: absolute; z-index: -1; inset: 8% 2% 6% 52%; background: url('battle-art/evolutions/warped-stage3-revenant.webp') right bottom / contain no-repeat; filter: drop-shadow(0 12px 8px #000a); }
.sign-in-policy { display: inline-flex; align-items: center; min-height: 44px; margin-top: 8px; color: var(--muted); font-size: 13px; }
.sign-in-policy:hover { color: var(--gold); }
.home-footer a, .account-menu .site-link { color: var(--gold); }
.account-menu .site-link { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding-inline: 12px; text-decoration: none; }
.account-menu .site-link:hover { background: var(--raised); }
.home-footer { max-width: 1280px; margin: 32px auto 0; padding: 24px 0 0; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.home-footer span:first-child { color: var(--gold); letter-spacing: .8px; }
.home-footer-links { display: flex; align-items: center; gap: 18px; }
.home-page .home-dialog { width: min(640px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.home-page #friends-dialog { width: min(720px, calc(100vw - 24px)); }
.home-dialog[open] { display: flex; flex-direction: column; }
.home-dialog > .dialog-heading { flex: none; margin: 0; padding: 20px 24px; border-bottom: 1px solid var(--line); background: var(--raised); }
.home-dialog .dialog-heading h2 { margin: 5px 0 0; font-size: 28px; }
.home-dialog .dialog-heading > button { flex: none; width: 44px; height: 44px; padding: 0; text-align: center; font-size: 24px; }
.home-dialog-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px; }
.home-dialog .lobby-panel { padding: 0; margin: 0; border: 0; background: transparent; }
.home-dialog h3 { margin: 0 0 16px; font-size: 16px; }
.home-dialog .friend-subheading { font-size: 11px; line-height: 1.6; margin: 0 0 6px; }
.home-dialog .friend-row { align-items: flex-start; gap: 10px; }
.home-dialog .friend-name { min-width: 0; overflow-wrap: anywhere; align-self: center; }
.home-dialog .friend-actions { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.home-dialog .friend-actions button { min-height: 44px; }
.home-dialog .friend-actions .primary { padding: 8px 12px; }
.home-dialog :is(.privacy-panel, .device-panel) h2 { margin-top: 0; }
.home-dialog .privacy-panel p { font-size: 14px; line-height: 1.75; margin: 12px 0; }
.home-page #join-problem { margin-bottom: 0; }
.game-settings-panel fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.game-settings-panel fieldset:disabled { opacity: .6; }
.game-settings-panel label { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.game-settings-panel label > span { display: flex; flex-direction: column; gap: 3px; }
.game-settings-panel small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.game-settings-panel select { min-height: 44px; min-width: 96px; }
.game-settings-panel input[type="checkbox"] { width: 22px; height: 22px; flex: none; }
.game-settings-panel #game-settings-where { font-size: 13px; line-height: 1.6; margin: 14px 0 0; }
@media (max-width: 1240px) {
  .home-header { gap: 14px; }
  .home-menu-toggle { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; background: transparent; min-height: 44px; }
  .home-menu-toggle > span:first-child { font-size: 18px; }
  .home-header .home-navigation { display: none; position: absolute; top: calc(100% - 1px); right: 0; width: min(360px, 100%); padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 var(--radius-soft) var(--radius-soft); box-shadow: 0 20px 40px #0008; margin: 0; max-height: min(70dvh, 460px); overflow-y: auto; }
  .home-menu-toggle[aria-expanded="true"] + .home-navigation { display: grid; gap: 4px; }
  .home-navigation > :is(a, button) { justify-content: flex-start; padding: 12px; font-size: 14px; min-height: 48px; }
}
@media (max-width: 700px) {
  .home-header { min-height: 84px; gap: 8px; }
  .home-header .brand { gap: 8px; }
  .home-header h1 { font-size: 19px; }
  .home-header .brand .eyebrow { font-size: 6px; letter-spacing: 1.2px; }
  .home-header .brand-mark { width: 31px; height: 38px; font-size: 24px; }
  .home-menu-toggle { padding: 8px; }
  .home-menu-toggle > span:last-child, .home-header #account-name { display: none; }
  .home-header .account-chip { padding: 4px; min-width: 44px; min-height: 44px; justify-content: center; }
  .home-header .account-menu { position: fixed; top: 78px; right: 18px; max-width: calc(100vw - 36px); }
  .sign-in-panel { min-height: 0; margin-block: 20px; }
  .sign-in-content { width: 100%; padding: 26px 16px 28px; }
  .sign-in-content h2 { max-width: 70%; }
  .sign-in-content .muted { max-width: 61%; }
  .sign-in-panel::before { opacity: .5; }
  .sign-in-art { inset: 8px 0 auto 70%; height: 86px; }
  .sign-in-actions { margin-top: 22px; }
  .home-page .lobby-hero { padding: 28px 0 22px; }
  .home-page .hero-detail { font-size: 14px; }
  .home-dialog > .dialog-heading { padding: 16px; }
  .home-dialog-body { padding: 18px; }
  .home-dialog .friend-subheading { font-size: 11px; line-height: 1.6; margin: 0 0 6px; }
.home-dialog .friend-row { flex-wrap: wrap; }
  .home-dialog .friend-actions { margin-left: auto; }
  .home-footer { margin-top: 16px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .home-page { scroll-behavior: auto; } }

.navigation-panels, .feedback-panels { display: contents; }
#friend-count { color: var(--muted); font-size: .85em; }
#friend-count:not(:empty)::before { content: "("; }
#friend-count:not(:empty)::after { content: ")"; }
#friend-count:empty { display: none; }
.home-navigation > :is(a, button) { font-family: inherit; line-height: 1.25; }
#account-problem { color: var(--refused); }
:is(.classic-page, .battle-page) .home-header { min-height: 48px; padding: 0 12px; }
:is(.classic-page, .battle-page)[data-home="member"] :is(.hud-top, .masthead:not(.home-header)) > .brand,
.classic-page[data-home="member"] .session-state .admin-link { display: none; }
body.classic-page:has(#table:not([hidden])) .home-header .brand { display: flex; }
.classic-page[data-home="member"] .masthead:not(.home-header) { min-height: 44px; }
.home-header .account-menu { z-index: 2; }
@media (max-width: 700px) {
  .home-header .account-menu { position: absolute; top: calc(100% + 4px); right: 0; }
}

/* Settings: one window of tabs (Game, Notifications, Privacy, Account), opened from the menu or the account menu.
   The account's lasting actions sit at the bottom of its Account tab, apart from everyday settings. */
.app-settings-tabs { flex: none; display: flex; gap: 4px; padding: 10px 24px 0; border-bottom: 1px solid var(--line); background: var(--raised); overflow-x: auto; scrollbar-width: none; }
.app-settings-tabs [role="tab"] { flex: none; min-height: 44px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); font-weight: 650; }
.app-settings-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.app-settings-tabs [role="tab"]:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
.app-settings-pane > h3 { margin: 0 0 6px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.app-settings-identity { display: flex; align-items: center; gap: 14px; padding: 4px 0 20px; border-bottom: 1px solid var(--line); }
.app-settings-identity .account-initial { width: 48px; height: 48px; font-size: 22px; flex: none; }
.app-settings-identity strong { display: block; font-size: 18px; overflow-wrap: anywhere; }
.app-settings-identity small, .app-settings-row small { display: block; color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 3px; }
.app-settings-danger { margin-top: 28px; padding: 16px; border: 1px solid #6b3b32; border-radius: var(--radius-soft); background: #1f1614; }
.app-settings-danger h3 { margin: 0 0 4px; color: var(--refused); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.app-settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.app-settings-row + .app-settings-row { border-top: 1px solid #3d2a26; }
.app-settings-row button { flex: none; }
@media (max-width: 520px) {
  .app-settings-tabs { padding: 8px 12px 0; }
  .app-settings-row { flex-direction: column; align-items: stretch; }
}
.account-menu-who { margin: 0 0 4px; padding: 4px 6px 10px; border-bottom: 1px solid var(--line); }
.account-menu-who small { display: block; color: var(--muted); font-size: 11px; }
.account-menu-who strong { display: block; font-size: 15px; overflow-wrap: anywhere; }

/* A game opened unranked (ADR 0155): a quiet tag beside its title, and the switch in the create dialog. */
.casual-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 600 10px/1.6 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }
.ranked-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ranked-row[hidden] { display: none; }
.field-note { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.ranked-row > span { display: flex; flex-direction: column; gap: 3px; font-weight: 650; }
.ranked-row small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.5; }
.ranked-row input { width: 22px; height: 22px; flex: none; accent-color: var(--gold); }

/* The create dialog's two kinds of game: Solo against a bot, PvP against a player. Two tabs over the same form. */
.create-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 14px; }
.create-tabs button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; margin: 0; padding: 10px 14px; border-radius: var(--radius-soft); text-align: left; font-weight: 650; }
.create-tabs button small { color: var(--muted); font-size: 12px; font-weight: 400; }
.create-tabs button[aria-selected="true"] { color: var(--gold); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 5.1%, transparent); }
.create-panel[hidden] { display: none; }

/* Your turn (lobby): every game waiting for the player, both kinds, the most pressing first, above the groups. */
.your-turn-band { display: grid; gap: 10px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--gold); border-radius: var(--radius-soft); background: color-mix(in srgb, var(--gold) 8%, var(--panel)); }
.your-turn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.your-turn-head h3 { margin: 0; font: 400 18px/1.25 var(--font-display); color: var(--gold); }
.your-turn-head #play-next { min-height: 44px; }
.game-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; font-size: 12px; color: var(--muted); }
.game-meta .game-ranked.ranked { color: var(--gold); font-weight: 650; }
.game-row .status-tag.ranked { color: var(--gold); border-color: var(--gold); }
.casual-tag.ranked { color: var(--gold); border-color: var(--gold); }

/* Report or suggest (ADR 0189): one sheet, its two kinds asked first, then three questions. A muted player's
   entries are gone wherever they stand. */
html[data-feedback-muted] [data-feedback-open] { display: none; }
.feedback-kinds { display: grid; gap: 12px; }
.feedback-kinds button { display: grid; gap: 4px; width: 100%; min-height: 64px; padding: 14px 16px; text-align: left; }
.feedback-kinds small, .feedback-attach small, .feedback-dialog label small { color: var(--muted); font-size: 12px; font-weight: 400; }
.feedback-choices { display: grid; gap: 2px; min-width: 0; margin: 0; padding: 0; border: 0; }
.feedback-choices legend { margin: 0 0 6px; padding: 0; color: var(--muted); font-size: 12px; }
/* The battle view's settings lay a label out as a row with a rule under it; the sheet's labels are the lobby's. */
.feedback-dialog label { display: block; padding: 0; border-bottom: 0; }
.feedback-dialog label small { display: inline; margin: 0; }
.lobby-page .feedback-choice, .lobby-page .feedback-attach { display: flex; justify-content: flex-start; align-items: center; gap: 12px; min-height: 44px; margin: 0; color: var(--ink); font-size: 14px; }
.lobby-page .feedback-choice input, .lobby-page .feedback-attach input { flex: none; width: 22px; min-height: 22px; margin: 0; }
.lobby-page .feedback-attach { margin-top: 14px; }
.feedback-attach span { display: grid; gap: 2px; }
.feedback-dialog textarea { box-sizing: border-box; width: 100%; min-height: 88px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-soft); font: inherit; color: var(--ink); background: var(--paper); resize: vertical; }
.feedback-dialog textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.feedback-dialog .dialog-actions { margin-top: 18px; }
.feedback-dialog .dialog-actions button { min-height: 44px; }
.feedback-dialog #feedback-note { margin: 14px 0 0; font-size: 13px; }
.feedback-sent { margin: 0; color: var(--ink); font-size: 15px; line-height: 1.6; }
