:root {
  color-scheme: light;
  --paper: #f6f7fb;
  --ink: #171a2e;
  --muted: #575e74;
  --line: #dce0eb;
  --accent: #503ab0;
  --violet: #cebcff;
  --dark: #15162a;
  --mono: "SF Mono", Monaco, Consolas, monospace;
  --sans: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.7 var(--sans); }
a { color: inherit; }
button, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #8e70ed; outline-offset: 4px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.frame { width: min(1160px, calc(100% - 80px)); margin-inline: auto; }
.skip { position: absolute; left: 1rem; top: -5rem; z-index: 5; padding: .5rem 1rem; background: white; }
.skip:focus { top: 1rem; }
.site-header { background: #fcfcff; border-bottom: 1px solid var(--line); }
.header-inner { min-height: 70px; display: flex; gap: 36px; align-items: center; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; font-size: 19px; font-weight: 760; letter-spacing: -.035em; white-space: nowrap; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; background: #23213d; color: #e0d4ff; border-radius: 8px; font: 700 17px var(--mono); letter-spacing: -.1em; }
.header-inner nav { display: flex; gap: 26px; align-items: center; }
.header-inner nav a { color: #454a61; text-decoration: none; font-size: 13px; font-weight: 700; }
.header-inner nav a:hover, .site-footer a:hover { text-decoration: underline; }
.header-progress { margin-left: auto; display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.progress-track { display: block; width: 68px; height: 5px; border-radius: 9px; background: #e6e1f2; overflow: hidden; }
.progress-track span { display: block; background: #6f54c0; width: 0; height: 100%; }
.hero { background: var(--dark); color: #faf9ff; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#a89bf114 1px, transparent 1px), linear-gradient(90deg, #a89bf114 1px, transparent 1px);
  background-size: 38px 38px; background-position: center;
  mask-image: linear-gradient(90deg, transparent 15%, #000 85%);
}
.hero-inner { position: relative; display: grid; grid-template-columns: 1fr 1.04fr; gap: 70px; align-items: center; min-height: 534px; padding-block: 58px 64px; }
.language-list { display: flex; flex-wrap: wrap; gap: 8px 14px; font: 500 12px var(--mono); color: #dfdcf3; }
.language-list span, .setup h3 { display: flex; gap: 8px; align-items: center; }
.ts, .js, .rs { display: inline-grid; place-items: center; width: 25px; height: 23px; border-radius: 5px; font: 700 12px var(--mono); background: #d3e8ff; color: #174983; }
.js { background: #fff0a8; color: #634c00; }
.rs { background: #ffdfcb; color: #78381e; }
.hero h1 { font-size: clamp(38px, 4.3vw, 64px); line-height: 1.17; font-weight: 850; letter-spacing: -.055em; margin-top: 22px; }
.hero-copy > p { color: #c8c9df; max-width: 445px; line-height: 1.95; margin-top: 21px; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: 27px; }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; font-weight: 750; font-size: 13px; line-height: 1.4; text-decoration: none; }
.primary { background: var(--violet); color: #201639; padding-inline: 17px; min-height: 46px; }
.primary:hover { background: #e1d5ff; }
.hero-link { font-size: 13px; color: #e6e2f8; font-weight: 700; text-underline-offset: 5px; }
.hero-link span { margin-left: 3px; }
.lab { padding: 24px; background: #212137; border: 1px solid #494463; border-radius: 17px; box-shadow: 0 16px 50px #09081755; }
.lab-title { display: flex; gap: 13px; align-items: center; }
.lab-icon { background: #393151; color: var(--violet); border-radius: 10px; width: 43px; height: 43px; display: grid; place-items: center; font: 28px var(--mono); }
.lab h2 { font-size: 21px; line-height: 1.26; }
.lab-title p { color: #aaa6c2; font: 11px/1.6 var(--mono); }
.lab-tag { margin-left: auto; color: #d5c7fb; border: 1px solid #5b4e78; border-radius: 5px; padding: 3px 8px; font-size: 11px; white-space: nowrap; }
.lab-input { display: flex; align-items: center; gap: 12px; margin-top: 27px; font-size: 13px; }
.lab-input label { color: #c9c4dc; }
.lab select { color: #f0e8ff; border: 1px solid #62597d; background: #2a2741; border-radius: 6px; padding: 4px 7px; min-height: 36px; max-width: 100%; }
.cells { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; margin-top: 18px; }
.cell { text-align: center; font: 600 16px var(--mono); color: #e2def4; }
.cell strong { display: grid; place-items: center; min-height: 47px; border: 1px solid #5a5277; background: #302a48; border-radius: 5px; }
.cell small { display: block; font-size: 10px; color: #b3aec8; margin-top: 6px; }
.cell.mid strong { background: #d2bcff; border-color: #d2bcff; color: #251945; }
.cell.outside strong { background: #232237; border-color: #414059; color: #a49fba; }
.cell.found strong { background: #b3e9c9; border-color: #b3e9c9; color: #113727; }
.legend { display: flex; gap: 15px; margin-top: 13px; color: #c3bfd5; font-size: 11px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border: 1px solid #8d7fab; border-radius: 2px; background: #302a48; }
.legend span:nth-child(2) i { background: #d2bcff; }
.lab-status { font-size: 13px; min-height: 66px; margin-top: 14px; padding: 10px 12px; border-left: 2px solid #aa91ed; background: #292640; color: #e7e1fa; border-radius: 0 5px 5px 0; }
.lab-footer, .lab-buttons { display: flex; align-items: center; gap: 8px; }
.lab-footer { margin-top: 15px; justify-content: space-between; }
.next-step { background: #e6d8ff; color: #25183e; }
.next-step:enabled:hover { background: #f2eaff; }
.next-step:disabled { background: #4a4560; color: #ded9ed; }
.reset-step { background: transparent; border-color: #5e537a; color: #e5dff5; }
.reset-step:hover { background: #35304b; }
.step-count { color: #bcb6d1; font-size: 11px; white-space: nowrap; }
.curriculum, .setup { padding-block: 51px 0; scroll-margin-top: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 20px; }
.section-head h2 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.035em; line-height: 1.35; }
.section-head p { color: var(--muted); margin-top: 7px; font-size: 14px; }
.course-count { font: 700 12px var(--sans); color: var(--muted); white-space: nowrap; padding-bottom: 4px; }
.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.course { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.course-top { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 13px; padding: 16px 16px 15px; background: var(--course-bg); color: var(--course-ink); }
.course:nth-child(1) { --course-bg: #eeecff; --course-ink: #402894; }
.course:nth-child(2) { --course-bg: #e6f4f1; --course-ink: #185850; }
.course:nth-child(3) { --course-bg: #f9eee6; --course-ink: #753f21; }
.course-icon { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid currentColor; border-radius: 8px; font: 600 17px var(--mono); }
.course-top p { font-size: 11px; margin-bottom: 1px; font-weight: 700; }
.course-top h3 { font-size: 16px; line-height: 1.5; }
.course ol { list-style: none; margin: 0; padding: 5px 14px 9px; }
.course li + li { border-top: 1px solid #ecedf3; }
.course li a { min-height: 44px; display: grid; grid-template-columns: 2ch 1fr auto; align-items: center; gap: 10px; padding: 8px 4px; text-decoration: none; font-size: 13px; font-weight: 700; }
.course li a:hover { color: var(--accent); }
.lesson-index, .lesson-state { color: var(--muted); font: 500 11px var(--mono); }
.lesson-state.done { color: #167047; }
.setup { padding-bottom: 57px; }
.setup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.advanced-teaser { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 18px; margin-top: 17px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #f0ecff; color: #322660; }
.advanced-teaser h3 { font-size: 17px; }
.advanced-teaser p { color: var(--muted); font-size: 13px; }
.setup article { padding: 17px 19px; border: 1px solid var(--line); background: white; border-radius: 10px; }
.setup article p { font-size: 14px; color: var(--muted); margin-block: 10px; }
.setup article a, .lesson-content a:not(.button) { color: var(--accent); text-underline-offset: 4px; }
.site-footer { border-top: 1px solid var(--line); background: #fdfdff; color: var(--muted); font-size: 12px; }
.site-footer .frame { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; padding-block: 19px; }
.no-script { padding-block: 10px; }
.lesson-layout { display: grid; grid-template-columns: 235px minmax(0, 1fr); gap: 36px; align-items: start; padding-block: 38px 56px; }
.sidebar { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.sidebar summary { cursor: pointer; font-size: 14px; font-weight: 750; }
.sidebar h2 { color: var(--muted); font-size: 11px; letter-spacing: .02em; margin: 15px 7px 4px; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: grid; grid-template-columns: 2ch 1fr 1ch; align-items: baseline; gap: 8px; padding: 7px; font-size: 12px; text-decoration: none; border-radius: 6px; }
.sidebar a:hover, .sidebar [aria-current="page"] { background: #eee9fe; color: #3f288f; }
.lesson-content { max-width: 810px; min-width: 0; }
.lesson-meta { color: var(--accent); font-size: 13px; font-weight: 750; margin-bottom: 8px; }
.lesson-content h1 { font-size: clamp(28px, 4.5vw, 48px); line-height: 1.24; letter-spacing: -.045em; }
.lesson-intro { color: var(--muted); font-size: 17px; margin-top: 12px; max-width: 42em; }
.lesson-section { margin-top: 31px; }
.lesson-section h2 { font-size: 22px; line-height: 1.5; letter-spacing: -.025em; margin-bottom: 10px; }
.lesson-section p + p { margin-top: 10px; }
.code-workspace { background: #202039; border: 1px solid #34344f; border-radius: 11px; color: #eeeaff; overflow: hidden; }
.code-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 13px; background: #2c2a45; }
.lang-options { display: flex; gap: 4px; padding: 0; margin: 0; border: 0; min-width: 0; }
.lang-options input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); }
.lang-options input:focus-visible + label { outline: 3px solid #bdabff; outline-offset: 2px; }
.lang-options label, .copy-code { display: inline-block; color: #eeeaff; background: transparent; padding: 7px 10px; font-size: 12px; font-weight: 700; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.lang-options input:checked + label { color: #271a42; background: #dbcaff; }
.copy-code { border-color: #777087; }
.copy-code:hover { background: #454059; }
code { font-family: var(--mono); }
.code-editor, .output-pane pre, .expected-output pre { margin: 0; font: 13px/1.7 var(--mono); tab-size: 2; }
.code-editor { display: block; width: 100%; border: 0; border-radius: 0; padding: 17px; background: #191a30; color: #eeeaff; resize: vertical; overflow: auto; min-height: 8rem; }
.code-editor:focus-visible { outline-offset: -3px; }
.editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 13px; border-top: 1px solid #403d58; }
.editor-actions .button { min-height: 38px; }
.editor-actions .primary { min-width: 82px; }
.reset-code { background: transparent; border-color: #777087; color: #eeeaff; }
.reset-code:enabled:hover { background: #454059; }
.editor-actions .button:disabled { opacity: .55; }
.output-pane { padding: 11px 17px; border-top: 1px solid #403d58; color: #c1efd3; font: 13px/1.6 var(--mono); overflow-wrap: anywhere; }
.output-pane b, [data-run-status] { color: #d9d2ef; margin-right: 9px; font: 12px/1.6 var(--sans); }
.output-pane [data-run-status].has-error, .output-pane [data-stderr] { color: #ffd1bb; }
.output-pane pre { white-space: pre-wrap; max-height: 18rem; overflow: auto; }
.output-pane > pre, .output-pane [data-stderr] { margin-top: 8px; }
.expected-output { margin-top: 9px; font-size: 13px; color: var(--muted); }
.expected-output summary { cursor: pointer; }
.expected-output pre { padding: 7px 12px; white-space: pre-wrap; }
.code-notes { margin-top: 11px; color: var(--muted); font-size: 14px; }
.run-link { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; }
.exercise-answer { margin-top: 12px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.exercise-answer summary { cursor: pointer; color: var(--accent); font-weight: 700; }
.exercise-answer p { margin-top: 8px; }
.quiz { margin: 0; padding: 0; border: 0; }
.quiz legend { font-weight: 700; margin-bottom: 9px; }
.quiz label { display: flex; align-items: baseline; gap: 8px; cursor: pointer; padding: 5px 0; }
.quiz label input { accent-color: var(--accent); }
.quiz-result { margin-top: 7px; min-height: 1.7em; font-size: 14px; }
.quiz-result.correct { color: #176347; }
.quiz-result.incorrect { color: #943b30; }
.light-button { background: #fff; border-color: #c9c2df; color: #48329a; }
.light-button:hover { background: #f0ebff; }
.finish { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 28px; padding-block: 17px; border-top: 1px solid var(--line); }
.finish .complete[aria-pressed="true"] { color: #175a40; background: #e7f6ee; border-color: #a6d4bf; }
.finish .complete-status { flex: 1 1 100%; color: var(--muted); font-size: 13px; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; margin: -1px; padding: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
@media (max-width: 1000px) {
  .frame { width: calc(100% - 48px); }
  .hero-inner { gap: 30px; }
  .lab { padding: 19px; }
  .header-inner { gap: 24px; }
}
@media (max-width: 740px) {
  .frame { width: calc(100% - 36px); }
  .hero-inner { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 33px; }
  .hero h1 { font-size: clamp(37px, 8.5vw, 56px); }
  .hero-copy > p { margin-top: 15px; }
  .hero-actions { margin-top: 18px; }
  .course-grid, .setup-grid { grid-template-columns: minmax(0, 1fr); }
  .curriculum, .setup { padding-top: 32px; }
  .lesson-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; padding-top: 17px; }
  .header-inner { flex-wrap: wrap; gap: 4px 13px; padding-block: 9px; }
  .header-inner nav { order: 1; width: 100%; gap: 20px; }
}
@media (max-width: 380px) {
  .frame { width: calc(100% - 26px); }
  .progress-track { display: none; }
  .lab { padding: 12px; }
  .cells { gap: 3px; }
  .cell { font-size: 14px; }
  .section-head { flex-wrap: wrap; }
}
