:root {
  color-scheme: light;
  --ink: #10233f;
  --muted: #5c6b7f;
  --line: #d7e0ea;
  --line-strong: #b9c8d8;
  --surface: #ffffff;
  --soft: #edf6ff;
  --accent: #0a66c2;
  --accent-dark: #084d91;
  --focus: #f59e0b;
  --danger: #b42318;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f8fb;
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 0; font-size: 1rem; line-height: 1.65; }
a { color: var(--accent-dark); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.site-header { background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(16,35,63,.02); }
.header-inner, main, .site-footer-inner { width: min(100% - 2rem, 68rem); margin-inline: auto; }
.header-inner { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.site-name { color: var(--ink); font-size: 1.05rem; font-weight: 790; text-decoration: none; letter-spacing: -.025em; }
.language-link { min-height: 2.75rem; display: inline-flex; align-items: center; padding: .35rem .65rem; font-weight: 650; }
main { padding-block: clamp(1.75rem, 4.5vw, 4rem); }
.tool-heading { max-width: 48rem; margin-bottom: 1.75rem; }
.eyebrow { margin: 0 0 .35rem; color: var(--accent-dark); font-size: .875rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 7vw, 3.55rem); line-height: 1.12; letter-spacing: -.045em; }
.lede { max-width: 44rem; margin: .9rem 0 0; color: var(--muted); font-size: clamp(1rem, 2.2vw, 1.18rem); }

.calculator-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 10px 28px rgba(16,35,63,.065); }
.calculator-form { padding: clamp(1.1rem, 4vw, 2rem); }
.form-grid { display: grid; gap: 1rem; }
.form-grid fieldset { min-width: 0; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .75rem; display: grid; gap: .8rem; }
.form-grid legend { padding-inline: .35rem; font-weight: 780; }
.form-note { margin: 0; padding: .75rem; border-radius: .65rem; background: var(--soft); color: var(--ink); }
.field label { display: block; margin-bottom: .35rem; font-weight: 720; }
.field input, .field select { width: 100%; min-height: 3.25rem; padding: .7rem .8rem; border: 1px solid #8fa2b6; border-radius: .65rem; background: #fff; color: var(--ink); font: inherit; font-size: 1.05rem; transition: border-color .15s ease, box-shadow .15s ease; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(10,102,194,.12); }
.field input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.hint { min-height: 1.45rem; margin: .25rem 0 0; color: var(--muted); font-size: .875rem; }
.field-error { min-height: 1.45rem; margin: .2rem 0 0; color: var(--danger); font-size: .9rem; font-weight: 650; }
.form-error { margin: 0 0 .8rem; padding: .75rem; border-left: .28rem solid var(--danger); background: #fff1f0; color: #821b13; font-weight: 700; }
.primary-button { width: 100%; min-height: 3.5rem; margin-top: .25rem; border: 0; border-radius: .7rem; background: var(--accent); color: white; font: inherit; font-weight: 790; cursor: pointer; box-shadow: 0 6px 16px rgba(10,102,194,.18); }
.primary-button:hover { background: var(--accent-dark); }

.result { overflow: hidden; border-color: var(--line-strong); }
.result-answer { position: relative; padding: clamp(1.4rem, 4vw, 2.35rem); background: var(--ink); color: white; }
.result-answer::before { position: absolute; inset: 0 auto 0 0; width: .3rem; background: var(--accent); content: ""; }
.result-label { display: inline-flex; margin: 0 0 .75rem; padding: .2rem .55rem; border: 1px solid rgba(184,217,250,.45); border-radius: 999px; color: #d7ebff; font-size: .78rem; font-weight: 780; letter-spacing: .09em; text-transform: uppercase; }
.result-answer h2 { max-width: 18ch; margin: 0; font-size: clamp(1.8rem, 5.3vw, 3rem); line-height: 1.18; letter-spacing: -.035em; font-variant-numeric: tabular-nums; text-wrap: balance; }
.result-body { padding: clamp(1.1rem, 4vw, 1.85rem); }
.result-body h3 { margin: 0 0 .45rem; color: var(--muted); font-size: .78rem; font-weight: 780; letter-spacing: .08em; text-transform: uppercase; }
.breakdown { display: grid; gap: 0; margin: 0; }
.breakdown div { display: flex; justify-content: space-between; gap: 1rem; padding: .58rem 0; border-bottom: 1px solid var(--line); }
.breakdown dt { color: var(--muted); }
.breakdown dd { margin: 0; font-weight: 760; text-align: right; font-variant-numeric: tabular-nums; }
.guidance { margin: 1rem 0 0; padding: .85rem 1rem; border-left: .25rem solid var(--accent); border-radius: .25rem .7rem .7rem .25rem; background: var(--soft); font-weight: 640; }

.content { max-width: 48rem; margin-top: clamp(3rem, 8vw, 6rem); }
.content section { padding-block: 1.5rem; border-top: 1px solid var(--line); }
.content h2 { margin: 0 0 .65rem; font-size: clamp(1.35rem, 4vw, 1.8rem); }
.content h3 { margin: 1.2rem 0 .4rem; }
.content p, .content ul { margin: .55rem 0; }
.formula { overflow-x: auto; padding: 1rem; border-radius: .7rem; background: #e8eef5; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .92rem; }
.faq details { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; font-weight: 720; }

.home-hero { max-width: 52rem; padding-block: clamp(.25rem, 2vw, 1.25rem); }
.home-section { margin-top: clamp(2.5rem, 6vw, 4rem); }
.section-heading { max-width: 42rem; }
.section-heading .eyebrow { margin-bottom: .15rem; }
.section-heading h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); letter-spacing: -.025em; }
.section-heading > p:last-child { margin: .35rem 0 0; color: var(--muted); }
.tool-grid { display: grid; gap: .9rem; margin-top: 1.35rem; }
.tool-card { min-width: 0; min-height: 9rem; display: grid; grid-template-columns: 3rem minmax(0,1fr) auto; align-items: start; gap: .9rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 8px 24px rgba(16,35,63,.055); transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.tool-card:hover { border-color: var(--accent); box-shadow: 0 12px 28px rgba(16,35,63,.09); transform: translateY(-2px); }
.card-icon { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: .8rem; background: var(--soft); color: var(--accent-dark); }
.card-icon svg { width: 1.65rem; height: 1.65rem; }
.card-copy { min-width: 0; }
.card-copy strong { display: block; font-size: 1.08rem; line-height: 1.35; }
.card-copy > span { display: block; margin-top: .4rem; color: var(--muted); line-height: 1.55; }
.card-arrow { align-self: center; color: var(--accent-dark); font-size: 1.25rem; font-weight: 800; }
.related-links { display: grid; gap: .65rem; }
.related-links a { display: block; min-height: 2.75rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--surface); font-weight: 680; text-decoration: none; }
[data-conditional] { display: grid; gap: 1rem; }
.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); color: var(--muted); }
.site-footer-inner { padding-block: 1.5rem; font-size: .9rem; }
.site-footer-inner p { margin: 1rem 0 0; }
.footer-nav { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.footer-nav a { min-height: 2.75rem; display: inline-flex; align-items: center; }
.footer-settings { min-height: 2.75rem; padding: 0; border: 0; background: transparent; color: var(--accent-dark); font: inherit; text-decoration: underline; text-underline-offset: .18em; cursor: pointer; }
.footer-settings:hover { text-decoration-thickness: .14em; }
.static-content { max-width: 44rem; margin-top: 2rem; }
.static-content section { padding-block: clamp(1.25rem, 3vw, 1.75rem); }
.static-content p, .static-content li { line-height: 1.78; }
.contact-link { display: inline-block; overflow-wrap: anywhere; font-size: clamp(1.05rem,4vw,1.3rem); font-weight: 720; }
.root-tagline { margin: .35rem 0 1.4rem; color: var(--muted); font-size: clamp(1.15rem,3vw,1.4rem); font-weight: 700; }

.game-shell { max-width: 48rem; overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 1rem; box-shadow: 0 12px 30px rgba(16,35,63,.08); }
.game-mode { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem clamp(1rem,4vw,1.5rem); border-bottom: 1px solid var(--line); background: var(--soft); }
.game-mode span { padding: .2rem .6rem; border: 1px solid #a7c8e9; border-radius: 999px; background: #fff; font-size: .85rem; font-weight: 800; color: var(--accent-dark); letter-spacing: .04em; }
.game-mode p { margin: 0; color: var(--muted); text-align: right; }
.game-face { min-height: 21rem; padding: clamp(1.5rem,6vw,3rem); display: grid; place-items: center; align-content: center; background: var(--ink); color: #fff; text-align: center; }
.timer-target { margin: 0; padding: .25rem .7rem; border: 1px solid rgba(184,217,250,.38); border-radius: 999px; color: #d7ebff; font-size: .85rem; font-weight: 780; letter-spacing: .13em; }
.timer-value { min-height: 5.5rem; margin: .4rem 0 1.4rem; font-size: clamp(3.2rem,14vw,6.5rem); line-height: 1; font-weight: 780; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.timer-value span:last-child { font-size: .22em; letter-spacing: 0; }
.timer-note { min-height: 5.5rem; max-width: 28rem; margin: .4rem 0 1.4rem; display: grid; place-items: center; font-size: 1.1rem; font-weight: 650; }
.game-button { width: min(100%,24rem); min-height: 5rem; border: 2px solid #fff; border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 1.25rem; font-weight: 850; letter-spacing: .04em; cursor: pointer; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.game-button:hover { background: #dcebfa; }
.game-result { padding: clamp(1.3rem,5vw,2rem); border-top: .3rem solid var(--accent); background: var(--soft); text-align: center; }
.game-result h2 { margin: .2rem 0 0; font-size: clamp(1.5rem,5vw,2.3rem); }
.game-elapsed { margin: 0; font-size: clamp(2.6rem,10vw,4.5rem); line-height: 1.1; font-weight: 820; font-variant-numeric: tabular-nums; }
.record-grid { display: grid; grid-template-columns: 1fr; }
.record-grid div { padding: 1rem 1.2rem; border-top: 1px solid var(--line); background: #fff; }
.record-grid span,.record-grid strong { display: block; }
.record-grid span { color: var(--muted); font-size: .9rem; }
.record-grid strong { margin-top: .15rem; font-size: 1.05rem; }
.share-area { padding: 1rem 1.2rem 1.35rem; border-top: 1px solid var(--line); }
.secondary-button { min-height: 3rem; padding: .65rem 1rem; border: 1px solid var(--accent); border-radius: .65rem; background: #fff; color: var(--accent-dark); font: inherit; font-weight: 760; cursor: pointer; }
.share-area p { min-height: 1.5rem; margin: .4rem 0 0; color: var(--muted); }
.game-content ol { padding-left: 1.4rem; }
.play-section { padding: clamp(1rem,3vw,1.5rem); border: 1px solid var(--line); border-radius: 1rem; background: #edf4fa; }
.play-section .tool-card { min-height: 0; margin-top: 1.1rem; }
.language-choice { min-height: 100vh; width: min(100% - 2rem, 48rem); display: grid; align-content: center; }
.language-choice > p:not(.eyebrow) { color: var(--muted); font-size: 1.08rem; }
.language-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; margin-top: 1.25rem; }
.language-options a { min-height: 4rem; display: grid; place-items: center; padding: .75rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); font-size: 1.15rem; font-weight: 760; text-decoration: none; box-shadow: 0 12px 32px rgba(16,35,63,.07); }

.consent-panel { position: fixed; z-index: 20; inset: auto 0 0; padding: .75rem; background: rgba(16,35,63,.16); }
.consent-inner { width: min(100%, 46rem); margin-inline: auto; padding: 1rem; border: 1px solid var(--line-strong); border-radius: .85rem; background: var(--surface); box-shadow: 0 -8px 28px rgba(16,35,63,.14); }
.consent-inner h2 { margin: 0; font-size: 1.1rem; }
.consent-inner p { margin: .45rem 0; }
.consent-inner [data-consent-status]:empty { display: none; }
.consent-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: .85rem 0 .55rem; }
.consent-button { min-height: 3rem; padding: .6rem .75rem; border: 1px solid var(--accent); border-radius: .65rem; background: #fff; color: var(--accent-dark); font: inherit; font-weight: 750; cursor: pointer; }
.consent-button:hover { background: var(--soft); }

[hidden] { display: none !important; }
@media (min-width: 52rem) {
  .calculator-shell { grid-template-columns: minmax(20rem, .82fr) minmax(25rem, 1.18fr); gap: 1.5rem; }
  .result[hidden] + * { display: none; }
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .related-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .record-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .record-grid div + div { border-left: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .tool-card, .field input, .field select { transition: none; } .tool-card:hover { transform: none; } }
@media (min-width: 36rem) and (max-width: 51.99rem) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 30rem) { .header-inner, main, .site-footer-inner { width: min(100% - 1.25rem, 68rem); } .tool-card { grid-template-columns: 2.75rem minmax(0,1fr) auto; padding: 1rem; } .card-icon { width: 2.75rem; height: 2.75rem; } .result-answer h2 { max-width: none; } .game-mode { align-items: flex-start; flex-direction: column; gap: .35rem; } .game-mode p { text-align: left; } }
@media (max-width: 24rem) { .language-options, .consent-actions { grid-template-columns: 1fr; } }
