/* Shared visual finish, loaded after the existing layout styles. Dimensions of
 * the timed mobile game/results stay owned by solo_mobile.css/solo_results.css.
 * Change --line-width in points_theme.css to adjust the heavy outline system. */
body { font-family:Inter,Arial,sans-serif; -webkit-font-smoothing:antialiased; }
/* Shared desktop column; ad rails use the same width to keep a clear gutter. */
html:has(.public-header) { scrollbar-gutter:stable; }
body:has(.public-header) {
  --public-content-width:800px; --public-header-height:77px;
  --header-logo-size:54px; --header-control-size:46px; --header-control-gap:12px;
}
::selection { color:var(--paper); background:var(--ink); }
:is(h1,h2,h3,button,a,span) { letter-spacing:0; }
h1,.community-heading h1,.solo-heading h1,.guide-heading h1 { font-weight:900; font-style:italic; }
h2,.game-guide h2 { font-weight:850; }
button,a,input,textarea,select { -webkit-tap-highlight-color:transparent; }
/* Every route and game state uses the same shell geometry. The first slot
 * becomes the animation control during play; the four shared icons never move. */
.public-header { border-bottom:var(--line-width) solid var(--ink); padding:0; height:var(--public-header-height); min-height:var(--public-header-height); max-width:1160px; margin:0 auto; display:flex; flex-wrap:nowrap; align-items:center; justify-content:space-between; gap:8px; }
.public-header .points-brand .brand-mark { width:var(--header-logo-size); height:var(--header-logo-size); }
.public-header .top-navigation { display:grid; flex:0 0 auto; grid-template-columns:repeat(5,var(--header-control-size)); align-items:center; gap:var(--header-control-gap); }
.public-header .top-navigation :is(a,button,.nav-current) { position:relative; grid-row:1; display:grid; place-items:center; padding:0; width:var(--header-control-size); height:var(--header-control-size); min-width:var(--header-control-size); min-height:var(--header-control-size); flex:none; }
.public-header [data-nav-slot=play] { grid-column:1; }
.public-header [data-nav-slot=leaderboard] { grid-column:2; }
.public-header [data-nav-slot=profile] { grid-column:3; }
.public-header [data-theme-toggle] { grid-column:4; }
.public-header [data-sound-toggle] { grid-column:5; }
.public-header .top-navigation:has(#motion-toggle:not([hidden])) .nav-current[aria-label=Play] { display:none; }
.public-header .top-navigation img { display:block; width:24px; height:24px; flex:none; object-fit:contain; filter:none; }
.public-header .top-navigation a:first-child img { filter:none; }
/* Hover/focus labels use the single viewport-clamped tooltip in public_ui.js. */
.page-return { max-width:1160px; padding:0; margin:12px auto 0; }
.page-return a { font-size:13px; color:var(--text); }
.page-return img,.game-rules-link img,.icon-button img,.invite-link-row img,.guide-xp-example img,.password-toggle img,.team-options .no-team img,#feedback-expand img,#share-copy img { filter:none; }
.icon-button { border:2px solid var(--ink); background:transparent; }
:is(.solo-page,.community-page,.result-dialog,.shell-dialog) button { border-width:2px; }
.solo-page input:not([type=radio]):not([type=checkbox]),.solo-page select,.solo-page textarea { border-width:2px; }
.solo-page button,.community-page button,.primary-link,.result-dialog button { font-weight:700; }
.solo-heading,.community-heading,.guide-heading { border-bottom:var(--line-width) solid var(--ink); padding-bottom:24px; }
.game-mode-tabs { border-bottom:2px solid var(--ink); }
.game-mode-tabs a { min-height:44px; display:inline-flex; align-items:center; }
.game-mode-tabs a[aria-current] { color:var(--ink); border-color:var(--ink); }
.difficulty-options { border:0!important; border-radius:0; overflow:visible; gap:8px; }
.difficulty-options label { position:relative; justify-content:center; text-align:center; }
.difficulty-options label small { color:inherit; }
.difficulty-options input { position:absolute; width:1px; height:1px; opacity:0; }
.difficulty-options label:has(:focus-visible) { outline:2px solid var(--ink); outline-offset:3px; }
.solo-choices button { font-weight:650; }
.ranking-table td { background:transparent; border-top:2px solid var(--ink); }
.ranking-table .own-rank td { background:var(--selection); }
.ranking-self { border:0; border-bottom:1px solid var(--ui-divider); border-radius:0; background:transparent; padding:0 0 16px; margin-bottom:16px; }
.ranking-self a,.ranking-self span { color:var(--ink); }
.profile-tabs,.friend-row,.guide-section,.guide-end,.guide-guest,.history-row,.public-result { border-width:2px; }
.guide-rewards th,.guide-rewards td { border-bottom-width:2px; }
.guide-scoreboard { border:var(--line-width) solid var(--ink); }
.guide-scene { border:var(--line-width) solid #111; margin-inline:auto; object-fit:contain; object-position:center; }
.guide-scoreboard { margin-inline:auto; }
.shell-dialog,.result-dialog,#delete-dialog,#feedback-dialog { border:var(--line-width) solid var(--ink); box-shadow:6px 6px 0 #1112; }
:is(.shell-dialog,.result-dialog,#delete-dialog,#feedback-dialog)::backdrop { background:#1116; backdrop-filter:blur(5px); }
#summary .metric strong,#summary .metric:nth-child(n+3) strong,#summary .metric:nth-child(2) strong { color:var(--ink); }
.shootout-finished .solo-questions { border-width:var(--line-width)!important; }
#stadium-controls { border-bottom:var(--line-width) solid var(--ink); }
#shootout-board { border:2px solid var(--ink); background:var(--paper); }
.shootout-kick.goal { color:var(--ink); }
.shootout-kick.miss { color:var(--coral); }
.shootout-kick.pending { border:2px solid var(--ink); opacity:1; }
.friend-waiting img { filter:none; opacity:1; }
/* One public control skin, including anchor commands and radio-based tabs.
 * Local page styles still own dimensions, keeping the timed mobile grid fixed.
 * The result IDs in this list also cover the older result-card styles.
 * Only controls share the bold weight; ordinary copy and headings keep theirs. */
body:has(.public-header) {
  --control-base:#e2e4de; --control-hover:#d4d8d0;
  --ui-divider:#11111126; --field-border:#86867b;
  --control-fill:var(--control-base); --control-text:var(--text);
  --control-icon:0; --control-width:2px; --control-radius:999px; --control-font-weight:700;
  --selected-fill:#111; --selected-text:#f6f3eb; --selected-icon:1;
}
html[data-theme=dark] body:has(.public-header) {
  --control-base:#343a35; --control-hover:#454d47;
  --ui-divider:#f6f3eb33; --field-border:#7b847d;
  --control-icon:1; --selected-fill:#f6f3eb; --selected-text:#111; --selected-icon:0;
}
body:has(.public-header) :is(
  button,summary,.primary-link,.play-button,.top-navigation a,.top-navigation .nav-current,.page-return>a,
  .home-modes a,.home-rules-bottom a,.home-progress a,.game-mode-tabs a,
  .guide-jump a,.guide-guest>a,.solo-heading>a,.daily-ranking-link,
  .community-actions>a,.site-footer a,#public-profile,.team-rules-link,
  .period-tabs span,.guide-scenarios span,.difficulty-options label,.auth-options label,.team-options label,
  #summary #share-result,#summary #guest-benefits a
) {
  background:var(--control-fill); color:var(--control-text);
  /* Reserve the old border space so timed-game controls do not resize. */
  border:var(--control-width) solid transparent; border-radius:var(--control-radius);
  box-shadow:none; text-decoration:none;
  font-family:inherit; font-weight:var(--control-font-weight);
}
body:has(.public-header) .difficulty-options label>span { font-weight:var(--control-font-weight); }
/* Default icon color follows the control, not the page's light/dark background. */
body:has(.public-header) :is(button,summary,.primary-link,.top-navigation a,.top-navigation .nav-current,.page-return>a,
  .home-modes a,.home-rules-bottom a,.home-progress a,.solo-heading>a,.daily-ranking-link,
  .team-options label,#summary #share-result) img[src*="/icons/"] { filter:invert(var(--control-icon)); }
body:has(.public-header) :where(button,summary,.primary-link,.play-button,.top-navigation a,
  .page-return>a,.home-modes a,.home-rules-bottom a,.home-progress a,.game-mode-tabs a,
  .guide-jump a,.guide-guest>a,.solo-heading>a,.daily-ranking-link,.community-actions>a,
  .site-footer a,#public-profile,.team-rules-link):hover:not(:disabled) { --control-fill:var(--control-hover); }
/* Selected controls invert with the theme; answer outcomes keep their colors. */
body:has(.public-header) :is([aria-selected=true],[aria-pressed=true],[aria-current],
  button.chosen,button:active:not(:disabled),a:active,summary:active,
  details[open]>summary,.difficulty-options label:has(:checked),.auth-options label:has(:checked),
  .team-options label:has(:checked),.period-tabs :checked+span,.guide-scenarios :checked+span) {
  --control-fill:var(--selected-fill); --control-text:var(--selected-text); --control-icon:var(--selected-icon);
}
.difficulty-options label,.solo-choices button { --control-radius:6px; }
/* Primary commands are distinct from the surrounding navigation. Only Play
 * uses the pitch green; selection and other commands keep the paper/ink skin. */
body:has(.public-header) :is(.account-form .primary,#summary #another,#friend-ready,#mode-intro button[value=play],#new-question,#question-form button[type=submit]) {
  --control-fill:var(--selected-fill); --control-text:var(--selected-text); --control-icon:var(--selected-icon);
}
body:has(.public-header) .solo-penalties #start {
  --control-fill:var(--brand-green); --control-text:#111; --control-icon:0;
  min-height:56px; margin:4px 0 0;
}
body:has(.public-header) .solo-penalties #start:hover:enabled { --control-fill:#99bd64; }
body:has(.public-header) #trial-note { margin:0; text-align:center; font-size:12px; line-height:1.5; }
body:has(.public-header) .game-mode-tabs { margin-bottom:24px; }
body:has(.public-header) .game-mode-tabs a { font-size:14px; }
.difficulty-options label { cursor:pointer; }
.difficulty-options label:not(:has(:checked)):hover { --control-fill:var(--control-hover); }
body:has(.public-header) :is(button,a,input,select,textarea):focus-visible,
body:has(.public-header) .auth-options label:has(:focus-visible) {
  outline:2px solid var(--ink); outline-offset:4px;
}
body:has(.public-header) .solo-choices button.correct {
  --control-fill:var(--brand-green); --control-text:#111; --control-icon:0;
}
body:has(.public-header) .solo-choices button.incorrect {
  --control-fill:var(--coral); --control-text:#f6f3eb; --control-icon:1;
}
html[data-theme=dark] body:has(.public-header) .solo-choices .incorrect { --control-text:#111; --control-icon:0; }
.solo-choices button { position:relative; text-align:center; }
/* Outcome color leaves all available space for long answer labels. */
.solo-choices .correct,.solo-choices .incorrect { opacity:1; }
.difficulty-options label:has(:checked) small { color:var(--selected-text); }
body:has(.public-header) .play-button { --control-width:4.8px; --control-fill:var(--brand-green); --control-text:#111; }
body:has(.public-header) a.play-button:is(:hover,:active) { --control-fill:#99bd64; --control-text:#111; }
/* Newly framed text links need comfortable inset space; game buttons keep
 * their existing heights and vertical padding from the mobile styles. */
:is(.page-return>a,.page-return>button:not(.icon-button),.home-modes a,.home-rules-bottom a,
  .home-progress a,.game-mode-tabs a,.guide-jump a,.guide-guest>a,.solo-heading>a,
  .daily-ranking-link,.community-actions>a,.site-footer a,:where(#public-profile),.team-rules-link,
  .profile-tabs button,.auth-options label) {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:44px; max-width:100%; padding:8px 16px; text-align:center;
}
body:has(.public-header) :is(.rule-tabs,.profile-tabs,.game-mode-tabs) {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border:0; padding:0; gap:8px;
}
body:has(.public-header) :is(.rule-tabs,.profile-tabs,.game-mode-tabs)>* { min-width:0; margin:0; text-align:center; }
.auth-options { flex-wrap:wrap; gap:8px; }
.home-modes { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); width:min(420px,100%); gap:8px; }
.home-rules-bottom { flex-wrap:wrap; gap:12px; }
.rule-tabs button { flex:1; }
.site-footer nav { flex-wrap:wrap; gap:8px; }
/* Icon-only commands use their full box as the centering area. Text+icon
 * commands stay in a single flex row, including the sharing dialogs. */
body:has(.public-header) .icon-button:not(:has(span)) { display:grid; place-items:center; padding:0; }
body:has(.public-header) :is(button,a,summary)>img[src*='/icons/'] { display:block; flex:none; object-fit:contain; }
#share-native,#share-copy,#summary #share-result { display:inline-flex; align-items:center; justify-content:center; gap:8px; }
.game-share-preview,#share-preview { display:block; margin-inline:auto; object-position:center; }
.mode-intro-scenes { align-items:center; }
.mode-intro-scenes img { display:block; width:100%; height:auto; aspect-ratio:3/2; object-fit:contain; object-position:center; margin:0 auto; }
#mode-intro-title:focus { outline:none; }
#mode-intro .actions,#team-edit .actions,#profile-edit .actions,#delete-account .actions,#friend-lobby .actions {
  display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:8px; align-items:stretch;
}
#mode-intro .actions button { min-width:0; min-height:44px; }
.guide-jump { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; }
.guide-jump a { min-width:0; padding:8px; }
.profile-record>summary,[data-profile-panel] details>summary { padding:10px 18px; list-style:none; }
.profile-record>summary::-webkit-details-marker,[data-profile-panel] details>summary::-webkit-details-marker { display:none; }
.profile-record>summary::after,[data-profile-panel] details>summary::after { content:' +'; float:right; }
.profile-record[open]>summary::after,[data-profile-panel] details[open]>summary::after { content:' -'; }
/* Do not add padding/height here: that would shift the fixed mobile answer grid. */
.stadium-playing:not(.stadium-ending) .solo-questions { border-color:var(--ink); }
.site-footer { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; max-width:1160px; padding:24px 0; border-top:2px solid var(--ink); text-align:left; }
@media(min-width:801px) {
  body:has(.public-header):not(.stadium-playing) :is(.public-header,.page-return,.site-footer,.home-page,.solo-page,.community-page,.game-guide,.public-result) {
    max-width:min(var(--public-content-width),calc(100% - 64px)); margin-left:auto; margin-right:auto;
  }
}
@media(max-width:1256px) {
  .public-header,.page-return,.site-footer { margin-left:32px; margin-right:32px; }
}
@media(max-width:700px) {
  .public-header,.page-return,.site-footer { margin-left:16px; margin-right:16px; }
  .public-header .top-navigation a { padding:0; }
  .public-header .top-navigation a::after { display:none; }
  .page-return { padding:0; gap:10px; }
  .site-footer { font-size:11px; }
}
@media(max-width:600px) {
  .difficulty-options label { padding:10px 8px; align-items:center; }
  .difficulty-options label>span { font-size:14px; line-height:1.25; }
  .difficulty-options small { font-size:10px; margin-top:4px; }
  .guide-jump { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .guide-jump a:last-child { grid-column:1/-1; }
  body:has(.public-header) .game-mode-tabs a { padding:8px 6px; font-size:12px; }
  .home-modes a { min-width:0; padding:8px; gap:6px; font-size:12px; }
  .home-modes a img { width:16px; height:16px; }
}
@media(max-width:450px) {
  .page-return { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
  .page-return > button:not(.icon-button) { margin:0; min-width:0; padding:8px; font-size:12px; gap:6px; white-space:nowrap; }
  .page-return > button:not(.icon-button) img { width:16px; height:16px; }
}

/* All public pages share the header's content edges, including tablet widths.
 * Gameplay's fixed vertical tracks remain owned by stadium_inline.css. */
body:has(.public-header) { --page-gutter:32px; }
body:has(.public-header):not(.stadium-playing) :is(.public-header,.page-return,.site-footer,.home-page,.solo-page,.community-page,.game-guide,.public-result) {
  width:min(var(--public-content-width),calc(100% - 2 * var(--page-gutter)));
  max-width:none; margin-inline:auto; padding-inline:0;
}
/* Page names remain available to screen readers. The toolbar is the only
 * visual heading row, matching the compact game screens. */
body:has(main:is([data-page=account],.community-page,.game-guide,.question-workspace)) .page-return {
  margin-top:0; padding-block:10px; border-bottom:var(--line-width) solid var(--ink); justify-content:space-between;
}
body:has(.public-header) :is(.solo-page[data-page=account],.community-page,.game-guide) { margin-top:0; padding-top:24px; }
.game-guide>.guide-intro { margin-top:0; }
.community-heading h1 { margin-bottom:0; }
.difficulty-options small { display:none!important; }
.difficulty-options label { min-height:56px; padding:14px 12px; }
.quiz-selection { max-width:none; gap:16px; }
.quiz-selection :is(#availability,#weekly-reset):empty { display:none; }
.drawer-heading { align-items:flex-start; }
.drawer-heading h2 { min-width:0; overflow-wrap:anywhere; }
.drawer-heading .icon-button { flex:none; }
.friend-row > a { min-width:0; }
.friend-row .actions { flex:none; }
.friend-row .actions > * { text-align:center; }
#profile .profile-links { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
#profile .profile-links a { min-width:0; text-align:center; }
.result-dialog .actions > * { min-width:0; overflow-wrap:anywhere; }
.result-dialog .actions { align-items:stretch; }
body:has(.public-header) #delete-dialog .actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
body:has(.public-header) .password-toggle { top:2px; bottom:2px; right:2px; min-height:0; height:auto; --control-fill:transparent; --control-radius:4px; }
.xp-heading > *, .xp-caption > * { min-width:0; overflow-wrap:anywhere; }
/* Keep the result actions on complete rows, including the fourth Home link.
 * Sharing and review remain secondary, with equal tap areas on small screens. */
#summary .result-actions { grid-template-columns:repeat(3,minmax(0,1fr)); }
#summary .result-actions #another { grid-column:1/-1; min-height:48px; }
#summary .result-actions > * { min-width:0; }
#summary #share-result span { max-width:none; }
#summary .metrics { border-color:var(--ui-divider); }
#summary #guest-benefits { border-color:var(--ui-divider); }
#summary .metric strong { font-variant-numeric:tabular-nums; }
@media(max-width:800px) {
  #summary { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #summary #share-result,#summary #result-review { min-height:44px; padding:8px; font-size:12px; }
}
.ui-tooltip {
  position:fixed; inset:auto; z-index:100; width:max-content; max-width:min(260px,calc(100vw - 24px));
  margin:0; padding:8px 12px; border:0; border-radius:6px;
  background:var(--text); color:var(--bg); font:500 12px/1.4 Inter,Arial,sans-serif;
  text-align:center; overflow-wrap:anywhere; white-space:normal; box-shadow:none;
}
@media(max-width:800px) {
  body:has(.public-header) { --page-gutter:12px; --public-header-height:67px; --header-logo-size:32px; --header-control-size:44px; --header-control-gap:4px; }
}
@media(max-width:599px) and (max-height:650px) {
  body:has(.public-header) { --public-header-height:59px; }
}
@media(min-width:600px) and (max-height:600px) {
  body:has(.public-header) { --public-header-height:57px; --header-logo-size:32px; }
}
@media(max-width:450px) {
  .difficulty-options label { min-height:48px; padding:10px 8px; }
  .friend-add > div { display:grid; grid-template-columns:minmax(0,1fr); }
  .friend-row .actions { display:grid; width:100%; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); align-items:stretch; }
}
