@font-face {
  font-family: "Geist";
  src: url("assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --rensora-midnight-ink: #101218;
  --rensora-graphite-blue: #1C202B;
  --rensora-signature-lavender: #A99AF5;
  --rensora-moonlight: #E9EAF2;
  --rensora-muted-slate: #747D91;
  --rensora-font-sans: "Geist", Arial, sans-serif;
  --rensora-font-mono: "Geist Mono", monospace;

  --page: var(--rensora-midnight-ink);
  --card: var(--rensora-graphite-blue);
  --elevated: #232836;
  --ink: var(--rensora-moonlight);
  --muted: #9AA3B5;
  --subtle: #8C95A8;
  --line: #2B3142;
  --line-strong: #3B4359;
  --accent: var(--rensora-signature-lavender);
  --accent-soft: rgba(169, 154, 245, 0.14);
  --accent-border: rgba(169, 154, 245, 0.45);
  --ok: #8EE2B8;
  --warn: #F4A6A6;
  --mono: var(--rensora-font-mono);
  --sans: var(--rensora-font-sans);

  font-family: var(--sans);
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, select, input, textarea { font: inherit; }
button, select { cursor: pointer; }
button { line-height: 1.2; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.topbar { background: var(--page); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1216px; min-height: 65px; margin: auto; padding-inline: 32px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.08rem; font-weight: 700; letter-spacing: -.03em; justify-self: start; white-space: nowrap; color: var(--ink); }
.brand-mark { display: block; width: 28px; height: 28px; flex: 0 0 auto; }
.brand-name { color: var(--ink); font-weight: 700; }
.main-nav { display: flex; gap: 5px; align-items: center; }
.main-nav a { padding: 9px 14px; border-radius: 8px; color: var(--muted); font-size: .9rem; font-weight: 560; white-space: nowrap; }
.main-nav a:hover { background: var(--card); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 680; }
.os-label { justify-self: end; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.os-label span { font-size: 1rem; margin-right: 4px; color: var(--accent); }

.shell { max-width: 1216px; margin: 0 auto; padding: 34px 32px 30px; }
.page-intro { display: flex; justify-content: space-between; align-items: end; gap: 22px; margin-bottom: 22px; }
h1 { font-size: clamp(2rem, 4.7vw, 3.1rem); line-height: 1.05; letter-spacing: -.045em; margin: 0 0 10px; font-weight: 700; color: var(--ink); }
h1 code { font-family: var(--mono); color: var(--accent); font-weight: 700; }
.page-intro p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }

.profile-bar { display: flex; align-items: end; gap: 10px; }
.profile-control { flex: 0 0 205px; display: grid; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.profile-control select { appearance: none; height: 42px; border: 1px solid var(--line-strong); border-radius: 9px; font-weight: 620; font-size: .95rem; color: var(--ink); padding: 0 36px 0 12px; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23E9EAF2' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; }
.profile-btn { height: 42px; white-space: nowrap; }

.profile-panel { margin-bottom: 18px; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--card); display: grid; gap: 12px; }
.profile-panel-head { display: flex; justify-content: space-between; align-items: start; gap: 16px; flex-wrap: wrap; }
.profile-panel h2 { margin: 0 0 4px; font-size: 1.02rem; color: var(--ink); }
.profile-panel p { margin: 0; font-size: .84rem; color: var(--muted); max-width: 66ch; }
.profile-panel textarea { width: 100%; padding: 10px 12px; background: var(--page); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; font: .82rem/1.45 var(--mono); resize: vertical; }
.profile-panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.profile-panel-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.import-status { font-size: .84rem; color: var(--muted); }
.import-status.ok { color: var(--ok); }
.import-status.error { color: var(--warn); }
.file-label { display: inline-flex; align-items: center; cursor: pointer; }
.file-label:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.outline.danger { border-color: rgba(244, 166, 166, 0.45); color: var(--warn); }

.modes { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.modes button { background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 9px 13px; min-height: 39px; display: flex; gap: 7px; align-items: center; font-size: .86rem; font-weight: 600; }
.modes button span { font: 700 .95rem var(--mono); color: var(--subtle); }
.modes button:hover, .layers button:hover, .outline:hover { background: var(--elevated); border-color: var(--line-strong); color: var(--ink); }
.modes button[aria-pressed="true"] { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.modes button[aria-pressed="true"] span { color: var(--accent); }

.practice-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 244px); gap: 15px; }
.exercise { min-height: 274px; padding: 21px 24px 17px; border-radius: 14px; border: 1px solid var(--line-strong); color: var(--ink); background: var(--card); display: flex; flex-direction: column; position: relative; isolation: isolate; overflow: hidden; }
.exercise-top, .exercise-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.exercise-instruction { font-size: .86rem; font-weight: 620; letter-spacing: .005em; color: var(--muted); }
.progress-label { white-space: nowrap; font: 600 .8rem var(--mono); color: var(--muted); }
.progress-track { height: 3px; background: var(--line); border-radius: 4px; margin-top: 13px; }
.progress-track > div { height: 100%; border-radius: inherit; background: var(--accent); width: 0; transition: width 180ms; }
.prompt { font-weight: 700; letter-spacing: -.04em; font-size: clamp(1.65rem, 4.6vw, 3.15rem); margin: 16px 0 7px; line-height: 1.14; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.prompt.text-prompt { font: 700 clamp(1.6rem, 4vw, 3.15rem)/1.15 var(--mono); letter-spacing: -.04em; }
.prompt .long { font-size: clamp(1rem, 2.1vw, 1.48rem); line-height: 1.5; }
.prompt .done { color: var(--accent); }
.prompt .pending { color: var(--subtle); }
.prompt .current { color: var(--ink); box-shadow: inset 0 -2px var(--accent); }

.session-summary { margin: 8px 0 12px; padding: 12px 14px; border-radius: 9px; background: var(--page); border: 1px solid var(--line); font-size: .88rem; color: var(--muted); display: grid; gap: 6px; }
.session-summary strong { color: var(--ink); }
.session-summary code { font-family: var(--mono); color: var(--accent); }

.capture-wrap, .fkey-wrap { max-width: 380px; margin: 2px 0 8px; display: grid; gap: 5px; }
.fkey-wrap label { font-size: .78rem; color: var(--muted); }
.capture-wrap input, .fkey-wrap input, .sandbox-wrap textarea { width: 100%; height: 37px; padding: 7px 10px; background: var(--page); border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); caret-color: var(--accent); }
.capture-wrap input::placeholder, .fkey-wrap input::placeholder { color: var(--subtle); font-size: .875rem; }
.capture-wrap input:focus, .fkey-wrap input:focus, .sandbox-wrap textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.exercise-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 29px; color: var(--muted); font-size: .875rem; margin-bottom: 10px; }
.exercise-hint kbd { border: 1px solid var(--line-strong); background: var(--page); color: var(--ink); border-radius: 4px; padding: 3px 6px; font: 700 .78rem var(--mono); }
.exercise-bottom { margin-top: auto; border-top: 1px solid var(--line); padding-top: 11px; flex-wrap: wrap; }
.exercise-actions { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.exercise-actions button, .start { border: 1px solid transparent; font-size: .85rem; font-weight: 650; border-radius: 7px; padding: 8px 11px; min-height: 35px; }
.quiet { background: transparent; color: var(--muted); }
.quiet:hover { background: var(--elevated); color: var(--ink); }
.start { background: var(--accent); color: var(--page); padding-inline: 13px; }
.start:hover { background: #BEB2F8; }
.exercise-actions button:disabled { opacity: .42; cursor: default; }

.feedback { font-size: .85rem; color: var(--muted); line-height: 1.35; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.feedback.correct { color: var(--ok); }
.feedback.wrong { color: var(--warn); }
.feedback code { font-family: var(--mono); background: var(--page); border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; color: var(--ink); }
.feedback-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

.sandbox-wrap { max-width: 440px; display: grid; gap: 5px; margin-bottom: 5px; }
.sandbox-wrap label, .caret-status { font-size: .77rem; color: var(--muted); }
.sandbox-wrap textarea { height: 56px; resize: none; font: .94rem/1.35 var(--mono); }
.sandbox-wrap textarea::selection { background: var(--accent); color: var(--page); }

.session { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 17px 18px 11px; display: flex; flex-direction: column; }
.session h2, .keymap h2 { margin: 0; font-size: 1.08rem; font-weight: 700; letter-spacing: -.025em; color: var(--ink); }
.stats { margin: 7px 0 0; }
.stats > div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1px 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.stats dt { font-size: .88rem; font-weight: 620; color: var(--ink); }
.stats dd { grid-column: 2; grid-row: 1 / span 2; margin: 0; font-size: 1.51rem; letter-spacing: -.045em; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats dd.stat-note { grid-column: 1; grid-row: 2; order: 0; font-size: .75rem; font-weight: 400; letter-spacing: normal; color: var(--muted); }
.session-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 10px; padding-top: 11px; color: var(--muted); font-size: .78rem; }
.session-foot strong { color: var(--ink); margin-left: 3px; font-variant-numeric: tabular-nums; }

.keymap { margin-top: 15px; padding: 16px 19px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); }
.keymap-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.keymap-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.search-control input { width: min(300px, 65vw); height: 34px; padding: 5px 10px; background: var(--page); border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); font-size: .84rem; }
.search-control input::placeholder { color: var(--subtle); }
.search-results { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.search-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--page); border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 9px; font-size: .8rem; color: var(--ink); }
.search-chip:hover, .search-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--elevated); }
.search-chip strong { font-family: var(--mono); color: var(--accent); }
.search-empty { font-size: .82rem; color: var(--muted); }

.profile-note { margin-top: 4px; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.switch-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .85rem; font-weight: 600; white-space: nowrap; cursor: pointer; position: relative; }
.switch-control input { position: absolute; width: 31px; height: 20px; left: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch-track { width: 31px; height: 18px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--page); display: flex; align-items: center; padding: 2px; }
.switch-track::before { content: ""; width: 12px; height: 12px; background: var(--subtle); border-radius: 50%; }
.switch-control input:checked + .switch-track { background: var(--accent); border-color: var(--accent); justify-content: end; }
.switch-control input:checked + .switch-track::before { background: var(--page); }
.switch-control input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }

.layers { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.layers button { display: flex; align-items: center; gap: 7px; background: var(--page); border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font: 700 .8rem var(--mono); padding: 6px 9px; }
.layers button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-border); }
.layer-number { font-weight: 600; opacity: .75; }
.board-frame { border-radius: 9px; background: var(--page); border: 1px solid var(--line); padding: 12px; overflow: auto; }
.board { --u: clamp(42px, 6.55vw, 69px); --v: 45px; position: relative; width: calc(var(--board-w) * var(--u)); height: calc(var(--board-h) * var(--v)); margin: auto; }
.key { position: absolute; left: calc(var(--x) * var(--u) + 2px); top: calc(var(--y) * var(--v) + 2px); width: calc(var(--w) * var(--u) - 4px); height: calc(var(--v) - 4px); display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 2px; border: 1px solid var(--line-strong); border-bottom: 3px solid #2A3042; border-radius: 6px; background: var(--card); color: var(--ink); font: 700 .81rem/1.07 var(--mono); padding: 3px 1px; white-space: nowrap; }
.key:hover, .key[aria-pressed="true"] { border-color: var(--accent); }
.key small { font: 600 .66rem/1.04 var(--mono); color: var(--muted); }
.key.inherited { background: #151822; color: var(--subtle); border-color: var(--line); }
.key.unmapped { background: #13161F; color: var(--subtle); border-color: var(--line); border-style: dashed; }
.key.control { background: #222738; border-color: #3D455E; color: #C9D0E0; }
.key.held { background: #2A2647; border-color: var(--accent); color: var(--ink); }
.key.target { background: var(--accent); border-color: var(--accent); border-bottom-color: #7D6DD6; color: var(--page); }
.key.target small { color: #1C202B; }

.map-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px 15px; margin-top: 9px; }
.inspector, .legend { margin: 0; font-size: .77rem; color: var(--muted); line-height: 1.4; }
.legend { display: flex; gap: 10px; white-space: nowrap; }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend-target { background: var(--accent); border: 1px solid var(--accent); }
.legend-layer { background: #2A2647; border: 1px solid var(--accent); }
.screen-note { margin: 11px 0 0; color: var(--muted); font-size: .8rem; }

.secondary .surface { background: var(--card); padding: 23px; border: 1px solid var(--line); border-radius: 14px; }
.secondary p { color: var(--muted); max-width: 64ch; line-height: 1.55; }
.tester label { display: block; font-weight: 650; margin-bottom: 7px; color: var(--ink); }
.tester input { display: block; width: min(100%, 410px); padding: 10px; background: var(--page); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; }
.tester input::placeholder { color: var(--subtle); }
.tester-data { display: flex; flex-wrap: wrap; gap: 10px; }
.tester-data > div { flex: 1 0 120px; background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.tester-data dt { color: var(--muted); font-size: .83rem; }
.tester-data dd { margin: 6px 0 0; font: 700 .9rem var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.tester-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.outline { display: inline-flex; align-items: center; justify-content: center; background: var(--page); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 7px; padding: 7px 11px; min-height: 34px; font-size: .85rem; font-weight: 620; }
.history-actions { margin-top: 15px; }
.history-entry { padding: 13px 0; border-bottom: 1px solid var(--line); }
.history-entry summary { cursor: pointer; font-weight: 650; color: var(--ink); }
.history-entry p { margin: 9px 0 0; }

@media (max-width: 950px) { .board { --u: clamp(39px, 6.7vw, 67px); } }
@media (max-width: 720px) {
  .topbar-inner { min-height: 56px; padding-inline: 16px; grid-template-columns: auto 1fr; gap: 9px; }
  .main-nav { justify-self: end; gap: 1px; }
  .main-nav a { padding: 7px 8px; font-size: .8rem; }
  .os-label { display: none; }
  .shell { padding: 24px 16px; }
  .page-intro { flex-direction: column; align-items: start; }
  .profile-bar { width: 100%; flex-wrap: wrap; }
  .practice-grid { grid-template-columns: 1fr; gap: 10px; }
  .session { padding: 12px 14px 9px; }
  .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
  .stats > div { display: flex; flex-direction: column; align-items: flex-start; padding: 5px 0 8px; }
  .stats dd { font-size: 1.32rem; order: -1; }
  .session-foot { padding-top: 7px; }
  .exercise { padding-inline: 16px; }
  .keymap { padding-inline: 12px; }
  .board-frame { padding: 7px; }
}
@media (max-width: 440px) {
  .profile-control { flex-basis: auto; width: 100%; }
  .modes { gap: 4px; }
  .modes button { padding: 7px; min-height: 34px; }
  .exercise-actions { margin-left: auto; }
  .keymap-head { align-items: start; }
  .map-footer { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .progress-track > div { transition: none; } }
