:root {
  --cream: #f6f0df;
  --paper: #fffdf6;
  --ink: #17233d;
  --muted: #677189;
  --cobalt: #19458f;
  --cobalt-deep: #102d61;
  --coral: #ef725e;
  --yellow: #f4bd3d;
  --mint: #bad9c4;
  --line: #d9d4c6;
  --shadow: 0 18px 48px rgba(19, 42, 82, .12);
  --radius: 22px;
  color-scheme: light;
  font-family: "Avenir Next", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { margin: 0; min-width: 320px; background: var(--cream); line-height: 1.6; overflow-x: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.page-shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 20; padding: 10px 14px; background: var(--cobalt); color: white; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.eyebrow { margin: 0; color: var(--cobalt); font-size: .72rem; font-weight: 800; letter-spacing: .16em; line-height: 1.2; }
.site-header { position: relative; z-index: 5; border-bottom: 1px solid rgba(25, 69, 143, .12); background: rgba(246, 240, 223, .9); backdrop-filter: blur(12px); }
.header-inner { min-height: 76px; display: flex; align-items: center; gap: 26px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: max-content; }
.brand-mark { display: grid; width: 35px; height: 35px; place-items: center; border-radius: 10px; color: white; background: var(--cobalt); font-size: 1.25rem; box-shadow: 4px 4px 0 var(--coral); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: .95rem; letter-spacing: .02em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: .58rem; letter-spacing: .13em; font-weight: 700; }
.site-nav { display: flex; align-items: center; gap: 24px; margin-left: auto; color: var(--muted); font-size: .86rem; font-weight: 700; }
.site-nav a { text-decoration: none; }
.site-nav a:hover, .site-nav a:focus-visible { color: var(--cobalt); }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 10px 17px; cursor: pointer; text-decoration: none; font-size: .9rem; font-weight: 800; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover:not(:disabled), .button:focus-visible { transform: translateY(-2px); }
.button:focus-visible, .text-button:focus-visible, .choice:focus-within, .drill-card:focus-visible, .key-button:focus-visible, .editor-surface:focus-visible { outline: 3px solid rgba(239, 114, 94, .55); outline-offset: 3px; }
.button-primary { color: white; background: var(--cobalt); box-shadow: 4px 4px 0 var(--coral); }
.button-primary:hover { box-shadow: 6px 6px 0 var(--coral); }
.button-secondary { color: var(--cobalt-deep); background: var(--yellow); box-shadow: 3px 3px 0 var(--cobalt); }
.button-outline { min-height: 40px; padding: 7px 13px; color: var(--cobalt); border-color: rgba(25, 69, 143, .35); background: transparent; }
.button-quiet { color: var(--cobalt); border-color: var(--line); background: var(--paper); }
.button:disabled { cursor: not-allowed; opacity: .58; transform: none; box-shadow: none; }
.hero { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(360px, .98fr); gap: 54px; align-items: center; padding-top: 68px; padding-bottom: 78px; }
.hero-copy { padding-block: 12px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.035em; }
h1 { max-width: 650px; margin-top: 14px; font-size: clamp(2.4rem, 5.5vw, 5rem); font-weight: 900; }
h1 em { position: relative; color: var(--coral); font-style: normal; white-space: nowrap; }
h1 em::after { content: ""; position: absolute; left: 1%; right: 0; bottom: -.1em; height: .18em; z-index: -1; background: var(--yellow); transform: rotate(-2deg); }
.hero-lead { max-width: 590px; margin: 26px 0 0; color: var(--muted); font-size: 1.04rem; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 30px; }
.hero-note { color: var(--muted); font-size: .79rem; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 42px; color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hero-facts span { display: inline-flex; align-items: baseline; gap: 6px; }
.hero-facts strong { color: var(--cobalt); font-size: 1.45rem; letter-spacing: -.05em; }
.hero-art { position: relative; margin: 0; min-width: 0; }
.hero-art::before { content: ""; position: absolute; inset: 18px -16px -16px 16px; border: 2px solid var(--cobalt); border-radius: 28px; transform: rotate(3deg); }
.hero-art picture { position: relative; display: block; overflow: hidden; border: 9px solid var(--paper); border-radius: 26px; box-shadow: var(--shadow); transform: rotate(-2deg); }
.hero-art img { display: block; width: 100%; height: auto; aspect-ratio: 1440 / 810; object-fit: cover; }
.hero-art figcaption { position: relative; max-width: 230px; margin: -10px 0 0 auto; padding: 9px 13px; color: var(--cobalt-deep); background: var(--yellow); font-size: .74rem; font-weight: 800; transform: rotate(2deg); }
.practice-section { padding-bottom: 94px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.section-heading h2, .progress-header h2, .howto-section h2 { margin-top: 9px; font-size: clamp(1.8rem, 3vw, 2.7rem); }
.section-heading > p { max-width: 450px; margin: 0; color: var(--muted); font-size: .9rem; }
.settings-card { display: grid; grid-template-columns: 1.35fr 1fr; gap: 28px; align-items: center; margin-bottom: 24px; padding: 20px 24px; border: 1px solid rgba(25, 69, 143, .16); border-radius: var(--radius); background: var(--paper); box-shadow: 0 9px 28px rgba(19, 42, 82, .06); }
.settings-intro { display: flex; align-items: center; gap: 12px; min-width: 0; }
.setting-dot { flex: 0 0 auto; width: 11px; height: 11px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 6px rgba(239, 114, 94, .12); }
.settings-intro h3 { margin-top: 4px; font-size: 1.15rem; }
.settings-caption { margin: 0 0 0 auto; color: var(--muted); font-size: .76rem; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 7px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.choice { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; margin: 0 12px 0 0; color: var(--cobalt-deep); font-size: .95rem; font-weight: 750; cursor: pointer; }
.choice input { width: 18px; height: 18px; accent-color: var(--cobalt); }
.practice-grid { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.65fr); gap: 24px; align-items: start; }
.practice-list-wrap { min-width: 0; }
.list-heading { display: flex; align-items: center; justify-content: space-between; margin: 8px 2px 12px; color: var(--muted); font-size: .76rem; font-weight: 800; }
.practice-list { display: grid; gap: 8px; }
.drill-card { display: grid; grid-template-columns: 34px minmax(0, 1fr) 18px; gap: 8px; width: 100%; min-height: 58px; align-items: center; padding: 9px 11px; border: 1px solid transparent; border-radius: 14px; color: var(--ink); background: transparent; text-align: left; cursor: pointer; }
.drill-card:hover { background: rgba(255, 253, 246, .78); }
.drill-card.is-active { border-color: var(--cobalt); background: var(--cobalt); color: white; box-shadow: 4px 4px 0 var(--coral); }
.drill-number { color: var(--coral); font-size: .77rem; font-weight: 900; }
.is-active .drill-number { color: var(--yellow); }
.drill-copy { min-width: 0; }
.drill-copy strong, .drill-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-copy strong { font-size: .86rem; }
.drill-copy small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.is-active .drill-copy small { color: rgba(255, 255, 255, .73); }
.drill-arrow { color: var(--muted); font-size: 1.15rem; }
.is-active .drill-arrow { color: var(--yellow); }
.list-note { display: flex; gap: 9px; margin-top: 20px; padding: 12px; border-top: 1px dashed rgba(25, 69, 143, .24); color: var(--muted); }
.list-note p { margin: 0; font-size: .73rem; line-height: 1.5; }
.note-symbol { color: var(--coral); }
.workspace { min-width: 0; padding: clamp(20px, 4vw, 38px); border: 1px solid rgba(25, 69, 143, .18); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.workspace-topline, .progress-header, .progress-bottom, .control-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.environment-pill { display: inline-flex; min-height: 30px; align-items: center; padding: 4px 10px; border-radius: 999px; color: var(--cobalt-deep); background: var(--mint); font-size: .72rem; font-weight: 850; }
.workspace h2 { margin-top: 16px; font-size: clamp(1.8rem, 4vw, 3rem); }
.workspace-prompt { margin: 9px 0 24px; color: var(--muted); }
.layout-note { margin: -15px 0 20px; color: var(--cobalt); font-size: .75rem; font-weight: 750; }
.practice-notice { margin: -8px 0 16px; padding: 10px 12px; border-left: 3px solid var(--yellow); color: var(--cobalt-deep); background: #fff7d8; font-size: .84rem; }
.editor-surface { min-height: 174px; padding: 24px; border: 2px dashed rgba(25, 69, 143, .45); border-radius: 16px; color: #eff5ff; background: var(--cobalt-deep); font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: clamp(1rem, 2vw, 1.18rem); line-height: 2; cursor: text; }
.editor-line { min-height: 91px; display: block; white-space: pre-wrap; }
.editor-caret { display: inline-block; color: var(--yellow); font-weight: 900; animation: blink 1.2s step-end infinite; }
.editor-footer { margin-top: 13px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .18); color: rgba(255, 255, 255, .65); font-family: inherit; font-size: .68rem; letter-spacing: .05em; }
@keyframes blink { 50% { opacity: 0; } }
.editor-help { margin: 9px 0 24px; color: var(--muted); font-size: .73rem; }
.editor-help span { color: var(--coral); }
.screen-controls { padding: 19px 0 0; border-top: 1px solid var(--line); }
.control-heading { align-items: baseline; }
.control-heading h3 { margin-top: 5px; font-size: 1rem; }
.control-hint { color: var(--muted); font-size: .72rem; }
.screen-key-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.key-button, .keycap { display: inline-flex; min-height: 44px; min-width: 44px; align-items: center; justify-content: center; padding: 8px 13px; border-radius: 10px; border: 1px solid rgba(25, 69, 143, .3); color: var(--cobalt-deep); background: #edf2f7; box-shadow: 0 3px 0 rgba(25, 69, 143, .2); font-family: "SFMono-Regular", Consolas, monospace; font-size: .81rem; font-weight: 800; cursor: pointer; }
.key-button:hover { color: white; background: var(--cobalt); }
.entered-keys { margin-top: 18px; }
.entered-key-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 44px; align-items: center; margin-top: 7px; padding: 7px 10px; border-radius: 10px; background: #f7f4eb; }
.keycap-entered { min-height: 30px; min-width: 30px; padding: 4px 8px; border: 0; color: white; background: var(--cobalt); box-shadow: none; font-size: .73rem; }
.input-placeholder { color: var(--muted); font-size: .78rem; }
.control-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.control-actions .button { min-height: 44px; }
.outcome-panel { display: flex; min-height: 78px; align-items: center; gap: 13px; margin-top: 20px; padding: 14px 16px; border-radius: 14px; background: #f5f5ee; }
.outcome-panel h3 { font-size: .95rem; letter-spacing: 0; }
.outcome-panel p { margin: 3px 0 0; color: var(--muted); font-size: .8rem; }
.outcome-empty { margin: 0 !important; }
.outcome-panel.is-success { background: #eaf4e9; }
.outcome-panel.is-error { background: #fff0eb; }
.outcome-icon { display: grid; flex: 0 0 auto; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: white; font-weight: 900; }
.outcome-icon.is-success { background: #34855d; }
.outcome-icon.is-error { background: var(--coral); }
.progress-section { margin-bottom: 94px; padding: 30px 34px; border-radius: var(--radius); color: white; background: var(--cobalt); box-shadow: 10px 12px 0 var(--yellow); }
.progress-header h2 { color: white; }
.progress-header .eyebrow { color: var(--yellow); }
.progress-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.progress-stat { display: grid; gap: 3px; padding: 17px; border: 1px solid rgba(255, 255, 255, .23); border-radius: 14px; background: rgba(255, 255, 255, .08); }
.progress-stat .eyebrow { color: rgba(255, 255, 255, .7); }
.progress-stat strong { font-size: 2rem; line-height: 1.1; }
.progress-stat strong small { color: rgba(255, 255, 255, .62); font-size: 1rem; }
.progress-stat > span:last-child { color: rgba(255, 255, 255, .72); font-size: .75rem; }
.progress-bottom { margin-top: 18px; }
.inline-alert { margin: 0; font-size: .78rem; }
.inline-alert.is-muted { color: rgba(255, 255, 255, .7); }
.inline-alert.is-error { color: #ffe2d8; }
.text-button { min-height: 40px; padding: 8px 0; border: 0; color: var(--yellow); background: transparent; cursor: pointer; font-size: .78rem; font-weight: 800; }
.history-note { margin: 16px 0 0; color: rgba(255, 255, 255, .63); font-size: .73rem; }
.howto-section { padding-bottom: 100px; }
.section-heading.compact { margin-bottom: 24px; }
.howto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.howto-grid article { position: relative; min-height: 174px; padding: 23px; border: 1px solid rgba(25, 69, 143, .15); border-radius: 18px; background: var(--paper); }
.step-number { color: var(--coral); font-size: .75rem; font-weight: 900; letter-spacing: .12em; }
.howto-grid h3 { margin-top: 20px; font-size: 1.05rem; }
.howto-grid p { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.boundary-note { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 22px; padding: 17px 19px; border-left: 4px solid var(--coral); color: var(--muted); background: rgba(255, 253, 246, .65); font-size: .79rem; }
.boundary-note strong { color: var(--cobalt-deep); }
.page-footer { border-top: 1px solid rgba(25, 69, 143, .15); background: #e9e1cf; }
.footer-inner { display: flex; justify-content: space-between; gap: 28px; padding-block: 28px; }
.footer-inner strong { color: var(--cobalt-deep); }
.footer-inner p { margin: 7px 0 0; color: var(--muted); font-size: .75rem; }
.footer-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: end; gap: 14px 20px; color: var(--muted); font-size: .72rem; }
.footer-meta a { color: var(--cobalt); font-weight: 800; text-decoration: none; }
.noscript { position: fixed; inset: auto 12px 12px; z-index: 10; padding: 13px; border-radius: 12px; color: var(--cobalt-deep); background: var(--yellow); }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero-copy { max-width: 720px; }
  .hero-art { width: min(680px, 100%); margin-left: auto; }
  .practice-grid { grid-template-columns: 1fr; }
  .practice-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .list-note { display: none; }
  .settings-card { grid-template-columns: 1fr; gap: 14px; }
  .settings-caption { margin-left: 0; }
}

@media (max-width: 680px) {
  .page-shell { width: min(100% - 28px, 1180px); }
  .header-inner { min-height: 66px; flex-wrap: wrap; gap: 8px 12px; padding-block: 10px; }
  .site-nav { order: 3; width: 100%; justify-content: space-between; gap: 8px; padding: 0 0 11px; font-size: .75rem; }
  .header-print { margin-left: auto; min-width: max-content; min-height: 38px; padding: 6px 9px; font-size: .72rem; white-space: nowrap; }
  .hero { padding-top: 42px; padding-bottom: 62px; }
  h1 { font-size: clamp(2.25rem, 12vw, 3.8rem); }
  .hero-lead { font-size: .95rem; }
  .hero-facts { gap: 10px 16px; margin-top: 30px; }
  .hero-facts strong { font-size: 1.2rem; }
  .section-heading, .progress-header { display: block; }
  .section-heading > p { margin-top: 13px; }
  .settings-card { padding: 17px; }
  .settings-grid { gap: 8px; }
  .choice { margin-right: 7px; font-size: .87rem; }
  .practice-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .drill-card { grid-template-columns: 27px minmax(0, 1fr); min-height: 61px; padding: 8px; }
  .drill-arrow { display: none; }
  .workspace { padding: 19px 15px; border-radius: 20px; }
  .workspace-topline { align-items: start; }
  .workspace h2 { font-size: 2rem; }
  .editor-surface { min-height: 160px; padding: 16px; font-size: .93rem; }
  .editor-help { font-size: .7rem; }
  .control-heading { align-items: start; }
  .control-hint { max-width: 110px; text-align: right; }
  .key-button { width: 100%; }
  .screen-key-row { display: grid; grid-template-columns: 1fr; }
  .control-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .control-actions .button-primary { grid-column: 1 / -1; }
  .progress-section { margin-bottom: 76px; padding: 23px 17px; box-shadow: 6px 7px 0 var(--yellow); }
  .progress-header .button { margin-top: 17px; width: 100%; }
  .progress-summary { gap: 8px; margin-top: 20px; }
  .progress-stat { padding: 13px 11px; }
  .progress-stat strong { font-size: 1.6rem; }
  .progress-bottom { align-items: start; }
  .howto-grid { grid-template-columns: 1fr; }
  .howto-grid article { min-height: auto; padding: 18px; }
  .howto-grid h3 { margin-top: 10px; }
  .footer-inner { display: block; }
  .footer-meta { justify-content: start; margin-top: 18px; }
}

@media (max-width: 360px) {
  .page-shell { width: calc(100% - 22px); }
  .brand strong { font-size: .82rem; }
  .brand small { font-size: .5rem; }
  .brand-mark { width: 30px; height: 30px; }
  .site-nav { font-size: .7rem; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .hero-actions .button { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .progress-summary { grid-template-columns: 1fr; }
  .progress-bottom { display: block; }
  .text-button { margin-top: 8px; }
}

@media print {
  :root { background: white; }
  body { background: white; color: black; }
  .site-header, .hero, .settings-card, .practice-list-wrap, .editor-help, .screen-controls, .progress-section, .howto-section, .page-footer, .skip-link { display: none !important; }
  .page-shell { width: 100%; }
  .practice-section { padding: 0; }
  .section-heading { margin-bottom: 18px; }
  .workspace { border: 1px solid #999; box-shadow: none; }
  .editor-surface { color: black; background: white; border-color: #999; }
  .editor-footer { color: #555; border-color: #ccc; }
  .outcome-panel { border: 1px solid #bbb; }
}
