:root {
  color-scheme: light;
  --ink: #000;
  --muted: #6b7280;
  --line: #e5e7eb;
  --sidebar: #fafafa;
  --sidebar-width: 288px;
  --secondary: #4b5563;
  --hover: #e5e7eb;
  --canvas: #fff;
  --surface: #f3f4f6;
  --selected: #000;
  --selected-ink: #fff;
  --selected-muted: #374151;
  --selected-muted-line: #4b5563;
  --selected-muted-ink: #e5e7eb;
  --hover-line: #d1d5db;
  --underline: #c8c8cb;
  --arrow: #a1a1aa;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f3f4f6;
  --muted: #9299a3;
  --line: #34383d;
  --sidebar: #191b1e;
  --secondary: #c3c8ce;
  --hover: #2b2e33;
  --canvas: #111315;
  --surface: #222529;
  --selected: #f3f4f6;
  --selected-ink: #111315;
  --selected-muted: #34383d;
  --selected-muted-line: #50565d;
  --selected-muted-ink: #e5e7eb;
  --hover-line: #50565d;
  --underline: #626a73;
  --arrow: #78818c;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: "General Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-weight: 400; font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--muted); outline-offset: 5px; }
svg { flex-shrink: 0; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; overflow-y: auto; padding: 12px; background: var(--sidebar); border-right: 1px solid var(--line); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mobile-header-trigger { display: flex; align-items: center; gap: 4px; min-width: 0; }
.sidebar-menu { display: flex; flex: 1; flex-direction: column; }
.identity.sheet-identity, .mobile-menu { display: none; }
.menu-toggle { display: none; width: 44px; height: 44px; flex-shrink: 0; align-items: center; justify-content: center; padding: 10px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; transition: background-color .15s; }
.menu-toggle:hover { background-color: var(--hover); }
.menu-toggle[aria-expanded="true"]:focus { outline: none; }
.menu-toggle .icon { width: 22px; height: 22px; }
.menu-close-icon, .menu-toggle[aria-expanded="true"] .menu-open-icon { display: none; }
.menu-toggle[aria-expanded="true"] .menu-close-icon { display: block; }
.identity { display: flex; align-items: center; gap: 8px; padding: 8px; width: fit-content; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 23px; letter-spacing: -2px; padding-right: 3px; }
.avatar > span { color: var(--muted); }
.identity-copy { display: flex; flex-direction: column; }
.identity-copy strong { font-size: 16px; font-weight: 600; letter-spacing: -.4px; }
.identity-copy > span { color: var(--secondary); font-size: 12px; line-height: 16px; }
.navigation { display: grid; gap: 4px; margin-top: 16px; }
.nav-link { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; font-size: 14px; line-height: 20px; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--hover); }
.nav-link[aria-current="page"] { background: var(--selected); color: var(--selected-ink); }
kbd { margin-left: auto; width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); background: var(--surface); font-family: inherit; font-size: 12px; line-height: 16px; }
.nav-link[aria-current="page"] kbd { background: var(--selected-muted); border-color: var(--selected-muted-line); color: var(--selected-muted-ink); }
.social-navigation { display: grid; gap: 4px; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 24px; }
.social-label { padding: 0 8px; margin-bottom: 4px; font-size: 12px; line-height: 20px; color: var(--secondary); }
.social-link { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; font-size: 14px; line-height: 20px; transition: background .15s; }
.social-link[href]:hover { background: var(--hover); }
.social-link[aria-disabled="true"] { color: var(--muted); }
.external-icon { margin-left: auto; }
.sidebar-footer { margin-top: auto; padding: 8px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.mobile-game-trigger { display: none; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 0 4px 8px; border: 0; background: transparent; color: var(--secondary); font: inherit; font-size: 12px; cursor: pointer; }
.theme-switch { display: inline-flex; align-items: center; width: 32px; height: 18px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--hover); transition: background-color .15s, border-color .15s; }
.theme-switch-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--canvas); box-shadow: 0 1px 2px rgb(0 0 0 / 20%); transition: transform .15s; }
.theme-toggle[aria-checked="true"] .theme-switch { background: var(--ink); border-color: var(--ink); }
.theme-toggle[aria-checked="true"] .theme-switch-thumb { transform: translateX(14px); }
main { margin-left: var(--sidebar-width); padding: clamp(20px, calc((100svh - 640px) / 6), 64px) 32px 20px; min-height: 100svh; }
main:focus { outline: none; }
.content { max-width: 768px; margin: 0 auto; }
.page { min-height: 0; }
[hidden] { display: none !important; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 24px; line-height: 32px; letter-spacing: -.6px; font-weight: 600; margin-bottom: 0; }
.page-title-trigger { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: inherit; cursor: pointer; }
.page-title-trigger:disabled { opacity: 1; cursor: inherit; }
:root[data-input-method="pointer"] :is(.menu-toggle, .page-title-trigger):focus { outline: none; }
h2 { font-size: 20px; letter-spacing: -.5px; line-height: 24px; font-weight: 600; margin-bottom: 16px; }
.intro { font-size: 16px; line-height: 24px; }
.intro p { margin-bottom: 24px; }
#home .intro p { color: var(--secondary); }
.content :not(pre) > code { padding: .15em .35em; border-radius: 4px; background: var(--surface); font-family: inherit; font-size: .875em; font-weight: inherit; white-space: nowrap; }
.intro a, .muted-copy a { text-decoration: underline; text-decoration-color: var(--underline); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.intro a:hover, .muted-copy a:hover { text-decoration-color: var(--ink); }
.section { margin-top: 32px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; }
.quiet-label { font-size: 12px; color: var(--muted); }
.project-preview { display: flex; align-items: flex-start; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, background .15s; }
.project-preview:hover { background: var(--sidebar); border-color: var(--hover-line); }
.project-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--sidebar); flex-shrink: 0; }
.project-icon img { display: block; width: 32px; height: 32px; object-fit: contain; }
:root[data-theme="dark"] .project-icon img[src$="pyf1n_logo.svg"] { filter: brightness(0) invert(1); }
.project-copy { display: flex; flex-direction: column; gap: 7px; }
.project-copy strong { font-size: 14px; font-weight: 500; }
.project-copy > span { color: var(--muted); font-size: 14px; line-height: 20px; }
.project-copy .project-tags { margin-top: 8px; font-size: 12px; }
.project-tags { font-size: .75rem; line-height: 1rem; color: var(--muted); }
.project-tag { display: inline-block; padding: .15em .35em; border-radius: 4px; background: var(--surface); font-size: .75rem; line-height: 1rem; }
.project-tags > span:not(.project-tag) { padding: 0 8px; color: #a1a1aa; }
.arrow { color: var(--arrow); width: 16px; height: 16px; margin-left: auto; transition: transform .15s; }
.project-preview > .arrow { margin-top: 3px; }
a:hover > .arrow { transform: translateX(3px); }
.page-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding: 16px 0 0; margin-top: 24px; font-size: 12px; color: var(--muted); }
.copyright-game-trigger { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; touch-action: manipulation; }
.copyright-game-trigger:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 4px; }
.page-intro, .muted-copy { color: var(--secondary); font-size: 16px; line-height: 24px; }
#projects { --secondary: #374151; --muted: #4b5563; }
:root[data-theme="dark"] #projects { --secondary: #c3c8ce; --muted: #9299a3; }
#projects .tag { font-size: .75rem; line-height: 1rem; }
.project-detail { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 32px; }
.project-title { display: flex; align-items: center; gap: 13px; }
.project-title h2 { margin-bottom: 2px; font-size: 16px; }
.tag { margin-left: auto; border: 1px solid var(--line); padding: 4px 8px; border-radius: 4px; font-size: 12px; color: var(--secondary); white-space: nowrap; }
.project-detail > p { line-height: 24px; color: var(--secondary); font-size: 16px; margin: 24px 0; }
.project-bottom { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.text-link { display: inline-flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; font-size: 14px; transition: background-color .15s; }
.text-link:hover, .text-link:focus-visible { background-color: var(--surface); }
.text-link .icon { width: 14px; height: 14px; }
.resume-list { border-top: 1px solid var(--line); }
#experience .resume-list { border-top: 0; }
#experience .resume-entry:first-child { padding-top: 0; }
.resume-entry { padding: 24px 0; border-bottom: 1px solid var(--line); }
.resume-entry:last-child { padding-bottom: 0; border-bottom: 0; }
.resume-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.resume-heading h2, .resume-heading h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 24px; letter-spacing: 0; }
#education .resume-heading h3 { flex: 1 1 0; min-width: 0; }
.job-separator { margin-inline-start: 2px; }
.company-link { display: inline-block; white-space: nowrap; padding: 2px; border-radius: 4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: color .15s, background-color .15s; }
.company-link-icon { width: 14px; height: 14px; margin-inline-start: 4px; vertical-align: -2px; }
.company-link-sita { --company-color: #2B3E2B; --company-hover-text: #fff; }
.company-link-blink { --company-color: #f94e00; --company-hover-text: #111315; }
.company-link:hover, .company-link:focus-visible { background-color: var(--company-color); color: var(--company-hover-text); }
.resume-entry p { margin: 12px 0 0; color: var(--secondary); font-size: 15px; line-height: 24px; }
.resume-entry .resume-meta { margin-top: 4px; color: var(--muted); font-size: 13px; }
.resume-date-inline { white-space: nowrap; }
.resume-details { margin: 16px 0 0; padding-left: 20px; color: var(--secondary); font-size: 15px; line-height: 24px; }
.resume-details li + li { margin-top: 12px; }
.resume-details li::marker { color: var(--muted); }

@media (max-width: 1279px) { :root { --sidebar-width: 240px; } }
/* Keep page widths and alignment stable when only Experience needs a scrollbar. */
@media (min-width: 1024px) { html { scrollbar-gutter: stable; } }
/* Reduce spacing on shorter desktop screens to keep Home in view. */
@media (min-width: 1024px) and (max-height: 850px) {
  .page-heading { margin-bottom: 16px; }
  .intro p { margin-bottom: 16px; }
  .intro p:last-child { margin-bottom: 0; }
  .section { margin-top: 24px; }
  h2 { margin-bottom: 12px; }
  .project-preview { gap: 12px; padding: 12px; }
  .project-copy { min-width: 0; }
  .project-copy .project-tags { margin-top: 0; }
}
@media (min-width: 1024px) and (max-height: 650px) {
  main { padding-block: 12px; }
  .section { margin-top: 16px; }
  .page-footer { margin-top: 16px; }
}
@media (max-width: 1023px) {
  .sidebar-footer .site-name { display: none; }
  .mobile-game-trigger { display: inline-flex; align-items: center; min-height: 44px; }
  #education > .section:first-of-type { margin-top: 8px; }
  body { padding-top: calc(49px + env(safe-area-inset-top)); }
  .sidebar { position: fixed; inset: 0 0 auto; z-index: 10; width: 100%; padding: calc(2px + env(safe-area-inset-top)) 8px 2px; border-right: 0; border-bottom: 1px solid var(--line); background: var(--sidebar); }
  .sidebar-header { justify-content: flex-start; gap: 4px; }
  .mobile-header-trigger { cursor: pointer; }
  .sidebar-header h1 { min-width: 0; font-size: 14px; line-height: 20px; letter-spacing: 0; }
  .page-heading > .identity { padding: 0; }
  .page-heading:empty { display: none; }
  .menu-toggle { display: inline-flex; }
  .menu-toggle:hover, .menu-toggle:active { background-color: transparent; }
  .menu-toggle .icon { width: 16px; height: 16px; }
  html.menu-open, .menu-open body { overflow: hidden; }
  .mobile-menu[open] { display: block; position: fixed; inset: auto 0 0; width: 100%; max-width: none; max-height: 85dvh; margin: 0; padding: 0 16px max(20px, env(safe-area-inset-bottom)); border: 0; border-radius: 16px 16px 0 0; background: var(--canvas); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; animation: sheet-in .22s ease-out; }
  .mobile-menu:focus { outline: none; }
  .mobile-menu[open].is-closing { animation: sheet-out .22s ease-in both; }
  .mobile-menu::backdrop { background: rgb(0 0 0 / 12%); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: backdrop-in .22s ease-out; }
  .mobile-menu[open].is-closing::backdrop { animation: backdrop-out .22s ease-in both; }
  .sheet-close { display: flex; align-items: center; justify-content: center; width: 100px; height: 44px; margin: 0 auto 4px; padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
  .sheet-close span { width: 64px; height: 4px; border-radius: 4px; background: var(--line); }
  .sheet-close:hover span { background: var(--muted); }
  .sheet-close:focus-visible { outline: none; }
  .sheet-close:focus-visible span { outline: 2px solid var(--muted); outline-offset: 4px; }
  .identity.sheet-identity { display: flex; margin-bottom: 4px; }
  .sidebar-menu { padding-bottom: 0; }
  .navigation { gap: 2px; margin-top: 8px; }
  .nav-link, .social-link { min-height: 44px; }
  .social-navigation { gap: 2px; margin-top: 12px; padding-top: 8px; }
  kbd { display: none; }
  .sidebar-footer { display: flex; margin-top: 12px; border-top: 1px solid var(--line); padding: 8px; }
  .theme-toggle { min-height: 44px; }
  main { margin-left: 0; padding: 32px 24px 20px; min-height: 0; }
  .page { min-height: 0; }
  .project-title { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 12px; }
  .project-title > .tag { grid-column: 1 / -1; justify-self: start; margin-left: 0; }
  .project-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
  .project-tags > span:not(.project-tag) { padding: 0; }
  #experience .resume-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
}
@media (max-width: 540px) {
  .page-heading > .tag { margin-left: 0; }
}
@media (max-width: 360px) { main { padding-inline: 16px; } .tag { margin-left: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
html.game-open { overflow: hidden; scrollbar-gutter: stable; }
.game-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: clamp(20px, 5vw, 32px); border: 1px solid var(--line); border-radius: 20px; background: var(--canvas); color: var(--ink); }
.game-dialog::backdrop { background: rgb(0 0 0 / 55%); backdrop-filter: blur(8px); }
/* Performance mode keeps the dimming while disabling the subtle golf blur. */
.golf-game::backdrop, .reaction-game::backdrop { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.golf-game[data-performance-mode="true"]::backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; }
.game-dialog button { touch-action: manipulation; }
.game-dialog summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.reaction-header, .game-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.reaction-eyebrow, .game-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.reaction-close, .game-close { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: var(--surface); color: var(--secondary); font: inherit; font-size: 24px; cursor: pointer; }
.game-header-actions { display: flex; flex-shrink: 0; gap: 8px; }
.game-sound { display: grid; place-items: center; width: 36px; height: 36px; padding: 8px; border: 0; border-radius: 8px; background: var(--surface); color: var(--secondary); cursor: pointer; }
.game-sound svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.game-sound[aria-pressed="true"] { color: var(--ink); }
.game-sound .sound-on, .game-sound[aria-pressed="true"] .sound-off { display: none; }
.game-sound[aria-pressed="true"] .sound-on { display: initial; }
.game-sound:disabled { opacity: 0.4; cursor: default; }
.game-dialog button:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; text-decoration: none; }
.game-dialog a:focus-visible { outline: none; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.game-dialog :is(.game-sound, .game-close, .reaction-close):focus-visible { background: var(--hover); color: var(--ink); }
.game-dialog h2 { margin-bottom: 12px; font-size: 36px; line-height: 1.1; letter-spacing: -1.2px; }
#reaction-instructions { color: var(--secondary); font-size: 14px; line-height: 1.6; margin-bottom: 24px; }
.reaction-pad { display: grid; gap: 24px; width: 100%; padding: 24px 16px 18px; border: 0; border-radius: 14px; background: var(--sidebar); color: var(--ink); font: inherit; cursor: pointer; touch-action: manipulation; user-select: none; }
.reaction-pad:focus-visible { outline: none; }
.reaction-pad:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.reaction-game:is([data-state="result"], [data-state="false-start"]) .reaction-pad { border-color: transparent; }
.reaction-game:is([data-state="result"], [data-state="false-start"]) .reaction-action { text-decoration: none; }
.reaction-lights { display: flex; justify-content: center; gap: clamp(8px, 2vw, 14px); }
.reaction-lights > span { width: clamp(32px, 8vw, 56px); aspect-ratio: 1; border: 3px solid #2b2e33; border-radius: 50%; background: #17191c; box-shadow: inset 0 2px 5px rgb(0 0 0 / 40%); }
.reaction-lights > .is-lit { background: #ff3038; border-color: #a91d24; box-shadow: none; }
.reaction-action { font-size: 14px; font-weight: 500; }
.reaction-status { min-height: 48px; margin: 20px 0; text-align: center; font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.reaction-game[data-state="result"] .reaction-status { font-size: 28px; letter-spacing: -.6px; }
.reaction-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.reaction-save { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 12px; color: var(--secondary); font-size: 13px; cursor: pointer; }
.reaction-save input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
.reaction-save input:focus-visible { outline: 2px solid var(--muted); outline-offset: 3px; }
#reaction-storage-note { margin: 0; color: var(--muted); font-size: 12px; line-height: 18px; }
.game-choices { display: grid; gap: 12px; margin-top: 24px; }
.game-choices button { display: grid; gap: 6px; min-height: 80px; padding: 16px; border: 0; border-radius: 12px; background: var(--sidebar); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.game-choices button:hover { background: var(--surface); }
.game-choices span { color: var(--secondary); font-size: 13px; }
.golf-game:not([data-view="menu"]) { width: min(720px, calc(100% - 24px)); height: min(940px, calc(100dvh - 32px)); }
.golf-game[open] { display: flex; flex-direction: column; }
.golf-game > * { flex-shrink: 0; }
.golf-game [hidden] { display: none !important; }
.golf-game[data-view="menu"] > :not(.game-header):not(.golf-heading):not(#golf-menu),
.golf-game[data-view="results"] > :not(.game-header):not(.golf-heading):not(#golf-results),
.golf-game:not([data-view="menu"]) > #golf-menu,
.golf-game:not([data-view="results"]) > #golf-results { display: none; }
.golf-game:not([data-view="play"]) .golf-strokes { display: none; }
.golf-game:not([data-view="play"]) .game-header { position: static; }
.golf-game:not([data-view="play"]) .golf-heading { padding-right: 0; min-height: 0; }
#golf-menu, #golf-results { flex: 1; min-height: 0; overflow-y: auto; }
#golf-menu { flex: 0 1 auto; width: 100%; }
#golf-menu > p { margin: 0; }
#golf-menu #golf-menu-best { margin-top: 16px; }
#golf-menu #golf-end-round { margin-top: 8px; }
#golf-menu .game-choices { margin-top: 16px; gap: 10px; }
#golf-menu .game-choices button { min-height: 70px; padding: 14px; font-size: 14px; }
#golf-menu .golf-menu-help { margin-top: 12px; font-size: 12px; }
#golf-start-round:focus-visible { text-decoration: none; background: var(--surface); }
#golf-menu > p, #golf-result-detail, #golf-best { color: var(--secondary); font-size: 13px; }
.golf-difficulty { margin-top: 16px; font-size: 14px; }
.golf-handicap { position: relative; display: flex; align-items: center; gap: 2px; min-width: 0; min-height: 48px; padding-inline: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
/* Retain the native picker and its keyboard/touch behaviour underneath the
   visible value, so the separate info target can sit directly after its text. */
.golf-handicap select { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; font: inherit; cursor: pointer; }
.golf-handicap-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.golf-handicap::after { content: ''; flex: 0 0 6px; width: 6px; height: 6px; margin-left: auto; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); pointer-events: none; }
.golf-handicap:focus-within { outline: 2px solid var(--muted); outline-offset: 2px; }
.golf-handicap select option { background: var(--surface); color: var(--ink); }
.golf-handicap select:focus-visible, .golf-handicap-info summary:focus-visible { outline: 2px solid var(--muted); outline-offset: -2px; }
.golf-handicap-info { display: flex; flex: 0 0 24px; }
.golf-handicap-info summary { position: relative; z-index: 2; display: grid; place-items: center; width: 24px; min-height: 42px; border-radius: 6px; color: var(--secondary); cursor: pointer; list-style: none; }
.golf-handicap-info summary::-webkit-details-marker { display: none; }
.golf-handicap-info summary span { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid currentColor; border-radius: 50%; font: 12px Georgia, serif; }
.golf-handicap-info summary:hover, .golf-handicap-info[open] summary { background: var(--hover); color: var(--ink); }
.golf-handicap-info p { position: absolute; z-index: 4; bottom: calc(100% + 8px); right: 0; width: min(260px, calc(100vw - 48px)); margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--secondary); box-shadow: 0 4px 16px rgb(0 0 0 / 20%); font-size: 12px; line-height: 1.5; }
.golf-difficulty .golf-handicap-info p { top: calc(100% + 8px); bottom: auto; }
#golf-menu .game-choices button:disabled { opacity: .45; cursor: default; }
.golf-text-button { min-height: 28px; padding: 0; border: 0; background: none; color: var(--secondary); font: inherit; font-size: 12px; cursor: pointer; }
.golf-text-button:hover { color: var(--ink); }
.golf-round-bar { display: flex; align-items: stretch; gap: 12px; margin-bottom: 12px; color: var(--secondary); font-size: 12px; }
.golf-score-strip { display: flex; flex: 1; min-width: 0; align-items: center; gap: 20px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--sidebar); }
#golf-round-progress { min-width: 0; }
.golf-score-strip .golf-strokes { display: inline-flex; flex-shrink: 0; align-items: center; gap: 10px; padding-left: 20px; border-left: 1px solid var(--line); }
#golf-practice-level { font-size: 12px; }
#golf-result-total { margin: 16px 0 4px; font-size: 28px; outline: none; }
.golf-scorecard { width: 100%; margin: 16px 0; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.golf-scorecard caption { text-align: left; margin-bottom: 8px; color: var(--muted); }
.golf-scorecard :is(th, td) { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--line); }
.golf-scorecard :is(th, td):first-child { text-align: left; }
.golf-score { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: -7px; border: 1px solid transparent; }
.golf-score--birdie, .golf-score--eagle { border-color: currentColor; border-radius: 50%; }
.golf-score--bogey, .golf-score--double-bogey { border-color: currentColor; }
.golf-score--eagle::after, .golf-score--double-bogey::after { content: ''; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: inherit; }
.golf-score sup { position: absolute; top: -5px; right: -7px; font-size: 12px; }
.golf-score-key { margin: 8px 0 12px; color: var(--muted); font-size: 11px; line-height: 1.6; }
#golf-storage-note { color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.golf-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.golf-strokes { color: var(--muted); font-size: 13px; }
.golf-strokes strong { color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; }
#golf-instructions { margin-bottom: 20px; color: var(--secondary); font-size: 14px; line-height: 22px; }
/* Keep canvas sizing independent of the observed board so scrollbars cannot
   alternate its width and retrigger layout on every resize notification. */
.golf-game .golf-board { position: relative; width: 100%; min-width: 0; flex: 1 1 0; min-height: 140px; contain: paint; isolation: isolate; }
/* A native image cursor keeps the putter without a moving DOM/compositor layer. */
#golf-canvas { position: absolute; inset: 0; margin: auto; display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; border-radius: 12px; touch-action: none; user-select: none; cursor: crosshair; }
#golf-canvas[data-putter="true"] { cursor: url('assets/putter-cursor.svg') 16 10, crosshair; }
#golf-canvas:focus { outline: none; }
#golf-ball-layer { position: absolute; top: 50%; left: 50%; z-index: 1; pointer-events: none; will-change: transform; }
#golf-chirp { position: absolute; z-index: 2; margin: 0; padding: 0; transform: translate(-50%, -100%); color: #fff5d9; font: 600 17px system-ui, sans-serif; line-height: 1.3; text-align: center; pointer-events: none; }
.golf-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.golf-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.golf-height-scale { width: 32px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #47664f, #7d996c); }
.golf-power { display: grid; grid-template-columns: auto minmax(24px, 1fr) 40px; align-items: center; gap: 6px 12px; margin: 12px 0; }
.golf-power-copy { display: contents; }
.golf-power-copy > span { grid-column: 1; grid-row: 1; color: var(--ink); font-size: 12px; font-weight: 500; }
.golf-power output { grid-column: 3; grid-row: 1; text-align: right; color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.golf-power-meter { grid-column: 2; grid-row: 1; height: 4px; border-radius: 3px; overflow: hidden; background: var(--surface); }
#golf-power-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: #7d996c; }
.game-button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.game-button:hover { background: var(--hover); }
#golf-menu-button:focus-visible { text-decoration: none; background: var(--hover); }
.golf-more { position: relative; display: none; }
.golf-more > summary { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; background: var(--surface); color: var(--secondary); font-size: 24px; line-height: 1; cursor: pointer; list-style: none; }
.golf-more > summary::-webkit-details-marker { display: none; }
.golf-more > summary svg { width: 20px; height: 20px; fill: currentColor; }
.golf-more > summary:focus-visible { outline: 2px solid var(--muted); outline-offset: 2px; }
.golf-more-panel { position: absolute; z-index: 5; top: calc(100% + 8px); right: 0; width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 4px 16px rgb(0 0 0 / 25%); }
.golf-more-panel :is(button, a) { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.golf-more-panel :is(button, a):hover { background: var(--hover); }
.game-button:disabled { opacity: .5; cursor: default; }
#golf-status { grid-column: 1 / -1; grid-row: 2; min-height: 16px; margin: 0; color: var(--secondary); font-size: 12px; line-height: 16px; }
.golf-actions { display: flex; gap: 10px; }
.golf-actions button { flex: 1; }
.golf-hole-prompt { width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--canvas); color: var(--ink); }
.golf-hole-prompt::backdrop { background: rgb(0 0 0 / 45%); }
.golf-hole-prompt h3 { margin: 0 0 12px; font-size: 24px; line-height: 1.2; }
.golf-hole-prompt p { margin: 0 0 20px; color: var(--secondary); font-size: 14px; line-height: 1.6; }
.golf-hole-prompt .golf-actions { flex-wrap: wrap; }
.golf-hole-prompt .game-button { flex: 1 1 140px; }
#golf-hole-primary { background: #42654b; color: #fff; }
#golf-hole-primary:hover { background: #507b5b; }
.golf-play-actions { align-items: stretch; gap: 16px; }
.golf-play-actions .game-button { min-height: 48px; }
.golf-play-actions #golf-practice-level { flex: 0 1 190px; }
#golf-new { background: #42654b; color: #fff; border-color: transparent; }
#golf-new:hover { background: #507b5b; }
.golf-play-actions .game-button:focus-visible { text-decoration: none; background: var(--hover); }
#golf-new:focus-visible { background: #507b5b; }
#golf-results .golf-actions { flex-direction: row; }
.golf-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; column-gap: 16px; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 11px; line-height: 18px; }
.golf-hint > span { display: block; flex-basis: 100%; }
.golf-performance { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; cursor: pointer; }
.golf-performance input { margin: 0; accent-color: #7d996c; }
@media (min-width: 601px) and (min-height: 501px), (min-width: 601px) and (pointer: fine) {
  /* Reserve the full-width landscape board; compact controls on shorter
     windows instead of leaving empty columns beside a shrunken canvas. */
  .golf-game[data-view="play"] { height: fit-content; }
  .golf-game[data-view="play"] .golf-board { flex: 0 0 auto; aspect-ratio: 8 / 5; min-height: 0; }
}
@media (min-width: 601px) and (min-height: 501px) and (max-height: 1000px) {
  .golf-game[data-view="play"] { width: min(720px, calc(100% - 24px), calc((100dvh - 386px) * 1.6 + 42px)); padding: 20px; }
  .golf-game[data-view="play"] .game-header { position: absolute; top: 20px; right: 20px; margin: 0; }
  .golf-game[data-view="play"] .game-eyebrow { display: none; }
  .golf-game[data-view="play"] .golf-heading { min-height: 36px; padding-right: 88px; }
  .golf-game[data-view="play"] h2 { margin-bottom: 8px; font-size: 28px; }
  .golf-game[data-view="play"] #golf-instructions { margin-bottom: 10px; }
  .golf-game[data-view="play"] .golf-round-bar { margin-bottom: 8px; }
  .golf-game[data-view="play"] .golf-score-strip { padding-block: 8px; }
  .golf-game[data-view="play"] .golf-power { margin-block: 8px; }
  .golf-game[data-view="play"] .golf-hint { margin-top: 8px; padding-top: 8px; }
  .golf-game[data-view="play"] .golf-hint > span { display: none; }
}
@media (max-width: 600px), (max-height: 500px) and (pointer: coarse) {
  .golf-game:not([data-view="menu"]) { width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); border: 0; border-radius: 0; }
  .golf-game[open] { display: flex; flex-direction: column; }
  .golf-game > * { flex-shrink: 0; }
  .golf-game:not([data-view="menu"]) .game-header { margin-bottom: 4px; }
  .golf-game :is(.game-sound, .game-close) { width: 44px; height: 44px; }
  .golf-game:not([data-view="menu"]) h2 { margin-bottom: 4px; font-size: 28px; }
  .golf-game[data-view="menu"] h2 { font-size: 30px; }
  #golf-instructions { margin-bottom: 10px; font-size: 12px; line-height: 18px; }
  .golf-legend { margin-top: 6px; font-size: 10px; }
  .golf-round-bar { gap: 8px; margin-bottom: 8px; }
  .golf-score-strip { gap: 10px; padding: 8px 10px; }
  .golf-score-strip .golf-strokes { gap: 6px; padding-left: 10px; font-size: 11px; }
  .golf-strokes strong { font-size: 18px; }
  .golf-power { grid-template-columns: auto minmax(24px, 1fr) 36px; gap: 2px 10px; margin: 8px 0; padding: 0; border: 0; border-radius: 0; background: none; }
  .golf-power-copy { display: contents; }
  .golf-power-copy > span { grid-column: 1; grid-row: 1; font-size: 12px; }
  .golf-power-meter { grid-column: 2; grid-row: 1; height: 4px; }
  #golf-status { grid-column: 1 / -1; grid-row: 2; min-height: 16px; margin: 0; font-size: 11px; }
  .golf-power output { grid-column: 3; grid-row: 1; min-width: 0; padding: 0; background: none; text-align: right; font-size: 12px; }
  .golf-hint { display: none; }
  .golf-hint > span { display: none; }
  .golf-performance { display: none; }
  .golf-play-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: 6px; }
  .golf-handicap { min-height: 44px; padding-inline: 6px; }
  .golf-game[data-view="play"] .golf-more { display: block; }
  .golf-game[data-view="play"] .game-close, .golf-game[data-view="play"] #golf-menu-button { display: none; }
  #golf-practice-difficulty { font-size: 12px; padding-inline: 6px 0; }
  #golf-mulligan { grid-column: 1 / -1; }
  .golf-play-actions .game-button { min-width: 0; min-height: 44px; padding-inline: 6px; font-size: 12px; }
}
@media (max-height: 500px) and (pointer: coarse) and (orientation: landscape), (min-width: 601px) and (max-height: 650px) and (pointer: fine) {
  .golf-game[data-view="play"][open] { display: grid; grid-template-columns: minmax(0, 1fr) 180px; grid-template-rows: 44px auto auto auto 1fr auto auto; column-gap: 16px; }
  .golf-game[data-view="play"] > * { grid-column: 2; }
  .golf-game:not([data-view="menu"]) .game-header { justify-content: flex-end; }
  .golf-game:not([data-view="menu"]) .game-eyebrow, .golf-game .golf-legend, .golf-game .golf-hint { display: none; }
  .golf-game .golf-board { grid-column: 1; grid-row: 1 / 8; min-height: 0; height: 100%; }
  .golf-heading { display: block; }
  .golf-game:not([data-view="menu"]) h2 { font-size: 22px; }
  .golf-game[data-view="play"] #golf-instructions { display: none; }
  .golf-round-bar { flex-wrap: wrap; gap: 6px; margin-bottom: 0; }
  .golf-score-strip { flex-basis: 100%; gap: 8px; padding: 6px 8px; }
  .golf-score-strip .golf-strokes { gap: 4px; padding-left: 8px; font-size: 10px; }
  #golf-menu-button { width: 100%; }
  .golf-power { grid-row: 6; align-self: end; margin: 6px 0; }
  .golf-power-copy > span { font-size: 12px; }
  .golf-play-actions { display: grid; grid-row: 7; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .golf-play-actions #golf-practice-level { grid-column: 1 / -1; grid-row: 2; }
  .golf-actions { flex-direction: row; gap: 6px; }
  .golf-actions .game-button { padding-inline: 6px; font-size: 12px; }
}
@media (min-width: 601px) and (max-height: 650px) and (pointer: fine) {
  .golf-game[data-view="play"] { width: min(calc(100% - 24px), calc((100dvh - 58px) * 1.6 + 222px)); height: calc(100dvh - 32px); padding: 12px; }
  .golf-game[data-view="play"] .game-header { position: static; margin: 0; }
  .golf-game[data-view="play"] .golf-heading { padding: 0; min-height: 0; }
  .golf-game[data-view="play"] .golf-board { grid-row: 1 / 9; aspect-ratio: auto; }
  .golf-game[data-view="play"] .golf-hint { display: flex; grid-row: 8; gap: 0 8px; padding: 0; margin-top: 6px; border: 0; }
  .golf-game[data-view="play"] .golf-hint > span { display: none; }
}
@media (max-width: 600px) and (orientation: portrait) {
  #golf-practice-level .golf-handicap-info p { left: 50%; right: auto; transform: translateX(-50%); }
  .golf-game[data-view="play"] .game-header { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); }
  .golf-game[data-view="play"] .game-eyebrow { display: none; }
  .golf-game[data-view="play"] :is(.golf-heading, #golf-instructions, #golf-status) { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .golf-game[data-view="play"] .golf-round-bar { min-height: 44px; margin-bottom: 6px; padding-right: 100px; }
  .golf-game[data-view="play"] .golf-board { flex: 0 1 auto; aspect-ratio: 5 / 8; min-height: 0; }
  .golf-game[data-view="play"] .golf-score-strip { gap: 8px; padding: 0; border: 0; border-radius: 0; background: none; font-size: 11px; }
  .golf-game[data-view="play"] .golf-score-strip .golf-strokes { gap: 4px; padding-left: 8px; }
  .golf-game[data-view="play"] .golf-score-strip .golf-strokes { border: 0; padding-left: 0; }
  .golf-game .golf-strokes strong { font-size: 16px; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .golf-game[data-view="play"] h2 { font-size: 20px; }
  .golf-game[data-view="play"] .golf-score-strip { gap: 5px; font-size: 10px; }
  .golf-game[data-view="play"] .golf-score-strip .golf-strokes { padding-left: 5px; font-size: 10px; }
  #golf-practice-difficulty { font-size: 11px; }
}
@keyframes sheet-out { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, *::backdrop { transition: none !important; animation: none !important; } }
