:root {
  color-scheme: light;
  --background: #f9f7f0;
  --card: #fffefa;
  --ink: #211e17;
  --muted: #625b4c;
  --line: #e3ddd0;
  --yellow: #f6cf53;
  --yellow-deep: #edc23b;
  --warm: #f4ebd1;
  --green: #205c47;
  --green-light: #e8f4ec;
  --rust: #80372b;
  --rust-light: #faece5;
  font-family: 'OpenAI Sans', Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 18px; }
body { margin: 0; min-width: 300px; }
a { color: inherit; }
button, select, textarea { font: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 3px solid #86540d; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.wrap { width: min(calc(100% - 64px), 1150px); margin: 0 auto; }
.skip { position: fixed; z-index: 4; top: 10px; left: 10px; background: var(--yellow); font-weight: 700; padding: 10px 14px; border-radius: 7px; transform: translateY(-160%); }
.skip:focus { transform: translateY(0); }
.top { background: #fdfbf6; border-bottom: 1px solid var(--line); }
.navigation { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; font-size: 1.5rem; font-weight: 820; letter-spacing: -.065em; }
.brand-icon { display: inline-flex; flex: 0 0 35px; width: 35px; height: 35px; margin-right: 8px; background: url('icon.png') center / 37px no-repeat; }
.brand-end { color: #a46c13; }
.navigation nav { display: flex; align-items: center; gap: 4px; }
.navigation nav a { padding: 8px 11px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: .89rem; font-weight: 630; white-space: nowrap; }
.navigation nav a:hover { background: #f3ecdc; }
.navigation nav a[aria-current="page"] { color: var(--ink); background: #f4ead0; }
#mistake-count { display: inline-block; margin-left: 5px; padding: 1px 4px; min-width: 17px; text-align: center; border-radius: 5px; color: var(--rust); background: #f8e6dc; font-size: .71rem; }
.streak { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: .84rem; font-weight: 680; white-space: nowrap; }
.streak > span:first-child { color: #8b5a13; font-size: 1.15rem; line-height: 1; }
.hero { display: grid; grid-template-columns: 1fr .86fr; overflow: hidden; min-height: 318px; border-radius: 19px; border: 1px solid #e7dcc3; background: #f3e9d2; margin-top: 27px; }
.hero-copy { padding: 31px 0 31px 35px; position: relative; z-index: 1; }
.kicker { font: 650 .77rem/1.35 ui-monospace, 'SFMono-Regular', Consolas, monospace; letter-spacing: .09em; color: #705719; text-transform: uppercase; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 4.85rem); letter-spacing: -.076em; line-height: .98; margin-top: 11px; font-weight: 815; }
.hero h1 span { color: #97651b; }
.hero-summary { color: #554c3a; max-width: 385px; font-size: 1rem; line-height: 1.55; margin-top: 14px; }
.hero-image { border-left: 1px solid #efe4cb; background: #eee4d0 url('gyroscope.webp') center 53% / cover no-repeat; }
.button { display: inline-flex; min-height: 41px; align-items: center; justify-content: center; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; line-height: 1.15; text-decoration: none; color: var(--ink); font-weight: 740; font-size: .89rem; text-align: center; transition: background-color .16s, border-color .16s; }
.button.primary { background: var(--yellow); border-color: #d4ac39; }
.button.primary:hover:enabled, a.button.primary:hover { background: var(--yellow-deep); }
.button.outline { border-color: #d5cdbc; background: var(--card); }
.button.outline:hover { background: #f6efe1; }
.button:disabled { background: #eeeadf; border-color: #e6e1d5; color: #6f695b; cursor: default; }
.hero-action { margin-top: 19px; }
.section-view { margin-top: 28px; }
.section-header { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 13px; }
.section-header h2, .section-header h1 { font-weight: 785; letter-spacing: -.045em; font-size: clamp(1.65rem, 4vw, 2.04rem); line-height: 1.16; }
.section-header .kicker { margin-bottom: 4px; }
.section-header p:not(.kicker) { color: var(--muted); margin-top: 6px; line-height: 1.45; }
.challenge-grid { display: grid; grid-template-columns: minmax(0, 2.35fr) minmax(235px, 1fr); gap: 17px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 4px #47350e07; }
.puzzle { padding: 20px; }
.puzzle-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 9px; }
.tag { display: inline-flex; width: fit-content; padding: 4px 7px; border: 1px solid #e6dabc; border-radius: 5px; background: #faf2dc; color: #664e19; font-size: .76rem; font-weight: 700; }
.quiet { color: var(--muted); font-size: .86rem; font-weight: 550; }
.puzzle h2, .score-card h2 { margin-top: 10px; font-size: clamp(1.43rem, 4vw, 1.85rem); line-height: 1.15; font-weight: 765; letter-spacing: -.035em; }
.problem { margin-top: 9px; max-width: 660px; color: #4c4537; font-size: 1rem; line-height: 1.53; }
.puzzle fieldset { border: 0; margin: 17px 0 0; padding: 0; min-width: 0; }
.puzzle legend { font-size: .93rem; font-weight: 720; margin-bottom: 8px; padding: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.step label { display: grid; grid-template-columns: 17px 23px minmax(0, 1fr) auto; align-items: center; gap: 8px; position: relative; min-height: 43px; padding: 8px 9px; border: 1px solid #e5dfd1; border-radius: 7px; background: #fcfaf4; cursor: pointer; }
.step label:has(input:enabled):hover { border-color: #ba9c53; }
.step label:has(input:enabled:checked) { background: #fbf1d3; border-color: #ba952e; }
.step label:has(input:disabled) { cursor: default; }
.step label:has(input:focus-visible) { outline: 2px solid #86540d; outline-offset: 2px; }
.step input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.step-marker { display: grid; place-items: center; width: 15px; height: 15px; border: 1px solid #8e8167; border-radius: 50%; }
.step input:checked + .step-marker::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.step-number { color: #74684f; font: 650 .77rem/1 ui-monospace, Consolas, monospace; }
.step-text { font-size: .94rem; line-height: 1.34; }
.step-flag { font-size: .72rem; font-weight: 720; }
.step.right label, .score-tiles .right { background: var(--green-light); color: var(--green); border-color: #abd0ba; }
.step.wrong label, .score-tiles .wrong { background: var(--rust-light); color: var(--rust); border-color: #e8beae; }
.puzzle-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.feedback { margin-top: 15px; padding: 13px; border-radius: 8px; border: 1px solid #e3cf94; background: #fbf3db; }
.feedback.solved { background: var(--green-light); border-color: #abd0ba; }
.feedback h3 { font-size: 1.07rem; }
.feedback p { line-height: 1.52; margin-top: 5px; }
.feedback .answer { font-weight: 720; }
.rail { display: grid; gap: 11px; }
.rail section { padding: 15px; }
.rail h2, .empty-state h2 { font-size: 1.13rem; font-weight: 730; letter-spacing: -.02em; }
.progress-card > p { margin-top: 4px; }
.run-list { display: grid; gap: 3px; list-style: none; margin: 9px 0 0; padding: 0; }
.run-list button { display: grid; width: 100%; align-items: center; grid-template-columns: 23px minmax(0, 1fr) auto; gap: 7px; border: 1px solid transparent; padding: 5px; border-radius: 6px; background: transparent; color: var(--ink); text-align: left; min-height: 33px; font-size: .84rem; }
.run-list button[aria-current="step"] { background: #f8efd9; border-color: #eadbb6; }
.run-list button:enabled:hover { background: #f3ebd7; }
.run-list button:disabled { color: var(--muted); cursor: default; }
.run-list small { color: var(--muted); font-size: .72rem; }
.run-dot { display: grid; width: 21px; height: 21px; place-items: center; border-radius: 50%; background: #eee7d8; border: 1px solid #e3dac6; color: #66593c; font-weight: 700; font-size: .73rem; }
.run-dot.correct { background: var(--green-light); color: var(--green); border-color: #abd0ba; }
.run-dot.incorrect { background: var(--rust-light); color: var(--rust); border-color: #e8beae; }
.method { background: #f7efd8; border-color: #eadbb6; }
.method p { color: #5c5341; font-size: .89rem; line-height: 1.48; margin-top: 5px; }
.method a, .text-button, .day-nav a { display: inline-block; color: #765316; font-size: .85rem; font-weight: 720; text-decoration: underline; text-underline-offset: 3px; }
.method a { margin-top: 8px; }
.text-button { background: transparent; border: 0; padding: 3px 0; }
.progress-card > .text-button { margin-top: 7px; }
.day-nav { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 2px 4px; }
.score-card, .empty-state { padding: 22px; }
.score-card p, .empty-state p { margin-top: 10px; color: var(--muted); line-height: 1.55; }
.score-tiles { display: flex; gap: 7px; margin-top: 13px; }
.score-tiles span { display: grid; place-items: center; width: 35px; height: 35px; border: 1px solid; border-radius: 7px; font-size: 1.13rem; font-weight: 750; }
.puzzle-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.archive-item { display: grid; align-content: start; gap: 8px; height: 100%; min-height: 105px; text-decoration: none; padding: 13px; }
.archive-item:hover { border-color: #b59b58; }
.archive-item strong { font-size: 1.06rem; letter-spacing: -.02em; }
.inner-view > .puzzle { max-width: 784px; }
.inner-view > .text-button { margin-bottom: 8px; }
.topic-select { display: grid; gap: 4px; color: var(--muted); font-size: .82rem; font-weight: 650; }
.topic-select select { border: 1px solid #d5cdbc; border-radius: 7px; background: var(--card); color: var(--ink); padding: 7px 26px 7px 8px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, #725d34 50%), linear-gradient(135deg, #725d34 50%, transparent 50%); background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%; background-size: 4px 4px; background-repeat: no-repeat; }
.empty-state .button { margin-top: 13px; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; margin-top: 34px; padding: 14px 0 23px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
#share-dialog { width: min(calc(100% - 30px), 440px); padding: 20px; border-radius: 12px; border: 1px solid #c6b48b; color: var(--ink); background: var(--card); }
#share-dialog::backdrop { background: #2722137d; }
#share-dialog p { color: var(--muted); margin: 5px 0 10px; }
#share-dialog textarea { display: block; width: 100%; margin-bottom: 10px; border: 1px solid #d5cdbc; border-radius: 6px; padding: 7px; }
#notice { position: fixed; z-index: 3; right: 15px; bottom: 15px; padding: 9px 14px; background: #352d1e; color: #fffaeb; border-radius: 8px; font-size: .88rem; }
@media (max-width: 850px) {
  .wrap { width: calc(100% - 40px); }
  .hero-copy { padding: 25px 0 25px 24px; }
  .hero { min-height: 282px; }
  .challenge-grid { grid-template-columns: minmax(0, 1.75fr) minmax(200px, 1fr); gap: 11px; }
}
@media (max-width: 650px) {
  .wrap { width: calc(100% - 28px); }
  .navigation { display: grid; grid-template-columns: 1fr auto; gap: 7px; min-height: 0; padding: 8px 0 6px; }
  .navigation nav { grid-column: 1 / -1; grid-row: 2; }
  .brand { font-size: 1.42rem; }
  .streak { grid-column: 2; grid-row: 1; }
  .hero { margin-top: 15px; min-height: 218px; grid-template-columns: minmax(0, 1fr) minmax(0, .54fr); }
  .hero-copy { padding: 18px 0 18px 15px; }
  .hero h1 { font-size: clamp(1.92rem, 7vw, 2.72rem); }
  .hero-summary { margin-top: 9px; font-size: .88rem; }
  .hero-action { margin-top: 11px; }
  .hero-image { background-position: 58% 51%; }
  .kicker { font-size: .68rem; }
  .challenge-grid { grid-template-columns: 1fr; }
  .section-view { margin-top: 20px; }
  .puzzle { padding: 13px; }
  .step label { gap: 6px; grid-template-columns: 16px 20px minmax(0, 1fr); }
  .step-flag { grid-column: 3; }
  .puzzle-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
}
@media (max-width: 360px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding-right: 15px; }
  .hero-image { display: none; }
  .section-header:has(.topic-select) { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
