:root {
  color-scheme: dark;
  --ink: #eef1e8;
  --muted: #a9b4aa;
  --gold: #e4bd69;
  --gold-bright: #f6d98e;
  --deep: #071410;
  --panel: rgba(7, 20, 16, 0.9);
  --panel-soft: rgba(12, 29, 24, 0.78);
  --line: rgba(222, 190, 111, 0.28);
  --success: #78c695;
  --danger: #cf7768;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; background: var(--deep); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: #071410; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }
.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }

.topbar, .statusbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(1rem, 3vw, 2.4rem);
  border-color: var(--line);
  background: rgba(5, 15, 12, 0.94);
  backdrop-filter: blur(18px);
}
.topbar { border-bottom: 1px solid var(--line); }
.statusbar { min-height: 42px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; }
.brand-lockup, .topbar-actions, .formula-strip, .control-hint, .avatar-choice-row, .stage-actions { display: flex; align-items: center; }
.brand-lockup { gap: 0.8rem; }
.brand-rune {
  display: grid; place-items: center; width: 42px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%;
  color: var(--gold-bright); font-family: Georgia, serif; letter-spacing: -0.18em; text-indent: -0.18em;
  box-shadow: inset 0 0 20px rgba(228, 189, 105, 0.12);
}
.eyebrow { margin: 0 0 0.25rem; color: var(--gold); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.brand-name { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1rem, 2vw, 1.25rem); letter-spacing: 0.04em; }
.topbar-actions { gap: clamp(0.8rem, 3vw, 2rem); }
.energy-meter { display: flex; align-items: center; gap: 0.5rem; min-height: 36px; padding: 0.35rem 0.55rem; border: 1px solid rgba(228, 189, 105, 0.22); border-radius: 8px; background: rgba(228, 189, 105, 0.035); transition: border-color 180ms ease, box-shadow 180ms ease; }
.energy-meter > span { color: var(--muted); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.energy-meter strong { min-width: 2.2rem; color: var(--gold-bright); font-size: 0.68rem; text-align: right; }
.energy-segments { display: flex; gap: 3px; }
.energy-segments i { width: 7px; height: 17px; border: 1px solid rgba(228, 189, 105, 0.38); border-radius: 2px; background: rgba(8, 26, 20, 0.82); transform: skewX(-8deg); transition: background 180ms ease, box-shadow 180ms ease, opacity 180ms ease; }
.energy-segments i.is-full { border-color: var(--gold); background: linear-gradient(180deg, var(--gold-bright), #bf8733); box-shadow: 0 0 9px rgba(228, 189, 105, 0.48); }
.energy-meter.is-low { border-color: rgba(207, 119, 104, 0.55); }
.energy-meter.is-losing { animation: energy-loss 480ms ease; }
.energy-meter.is-gaining { animation: energy-gain 480ms ease; }
@keyframes energy-loss { 35% { border-color: var(--danger); box-shadow: 0 0 22px rgba(207, 119, 104, 0.44); transform: translateX(-2px); } 55% { transform: translateX(2px); } }
@keyframes energy-gain { 45% { border-color: var(--gold-bright); box-shadow: 0 0 25px rgba(228, 189, 105, 0.52); } }
.chapter-progress { display: flex; align-items: center; }
.progress-knot { width: 10px; height: 10px; border: 1px solid rgba(246, 217, 142, 0.5); border-radius: 50%; background: #10271f; }
.progress-knot.is-current, .progress-knot.is-done { background: var(--gold); box-shadow: 0 0 14px rgba(228, 189, 105, 0.6); }
.progress-line { width: clamp(18px, 4vw, 48px); height: 1px; background: var(--line); }
.icon-button, .text-button { border: 0; background: transparent; cursor: pointer; }
.icon-button { min-height: 40px; padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 0.8rem; }
.icon-button:hover, .text-button:hover { color: var(--gold-bright); }
.teacher-button { border-color: rgba(120, 198, 149, 0.34); color: #c9ead5; }
.teacher-button:hover, .teacher-button.is-active { border-color: rgba(120, 198, 149, 0.78); color: #effff5; background: rgba(66, 132, 91, 0.2); }

.game-frame { position: relative; isolation: isolate; min-height: min(780px, calc(100vh - 120px)); overflow: hidden; background: linear-gradient(145deg, #102f29 0%, #0b1d19 45%, #111714 100%); }
.world-backdrop, .world-shade { position: absolute; inset: 0; }
.world-backdrop {
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(3, 12, 9, 0.25), rgba(3, 12, 9, 0.04) 58%, rgba(3, 12, 9, 0.22)),
    url("./assets/ekomarken-stig.png") center / cover no-repeat,
    linear-gradient(130deg, #163f34 0%, #071711 64%, #151b17 100%);
  background-position: center; background-size: cover; transform: scale(1.02); transition: opacity 220ms ease, filter 220ms ease;
}
.game-frame[data-area="hub"] .world-backdrop { background-image: linear-gradient(90deg, rgba(3, 12, 9, 0.38), rgba(3, 12, 9, 0.06) 58%, rgba(3, 12, 9, 0.26)), url("./assets/ekomarken-stig.png"), linear-gradient(130deg, #163f34, #071711 64%, #151b17); }
.game-frame[data-area="tones"] .world-backdrop { background-image: linear-gradient(90deg, rgba(3, 10, 11, 0.48), rgba(3, 10, 11, 0.09) 62%, rgba(3, 10, 11, 0.28)), url("./assets/tonstigen-plats.png"), linear-gradient(130deg, #112c2d, #071711 64%, #151b17); }
.game-frame[data-area="chords"] .world-backdrop { background-image: linear-gradient(90deg, rgba(8, 10, 8, 0.48), rgba(8, 10, 8, 0.08) 60%, rgba(8, 10, 8, 0.24)), url("./assets/ackordsmedjan-plats.png"), linear-gradient(130deg, #312216, #071711 64%, #151b17); }
.game-frame[data-area="pulse"] .world-backdrop { background-image: linear-gradient(90deg, rgba(3, 12, 9, 0.48), rgba(3, 12, 9, 0.08) 58%, rgba(3, 12, 9, 0.27)), url("./assets/ekomarken-stig.png"), linear-gradient(130deg, #163f34, #071711 64%, #151b17); }
.game-frame[data-area="boss"] .world-backdrop { background-image: linear-gradient(90deg, rgba(10, 7, 7, 0.55), rgba(10, 7, 7, 0.12) 58%, rgba(10, 7, 7, 0.38)), url("./assets/ekomarken.png"), linear-gradient(130deg, #2b1919, #090d0b 64%, #151b17); }
.game-frame[data-area="teacher"] .world-backdrop { background-image: linear-gradient(120deg, rgba(3, 13, 10, 0.88), rgba(10, 27, 21, 0.7)), url("./assets/ackordsmedjan-plats.png"), linear-gradient(130deg, #132a22, #071711 64%, #151b17); filter: saturate(0.55) brightness(0.55); }
.world-shade { z-index: 1; background: linear-gradient(90deg, rgba(3, 12, 9, 0.72), rgba(3, 12, 9, 0.08) 48%, rgba(3, 12, 9, 0.42)), linear-gradient(0deg, rgba(3, 12, 9, 0.62), transparent 42%); pointer-events: none; }

.quest-panel {
  position: absolute; z-index: 4; top: clamp(1rem, 3vw, 2.3rem); left: clamp(1rem, 3vw, 2.5rem); width: min(310px, calc(100% - 2rem));
  padding: 1.2rem 1.25rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); box-shadow: var(--shadow); backdrop-filter: blur(15px);
}
.quest-panel h2 { margin: 0 0 0.55rem; font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; line-height: 1.15; }
.quest-panel > p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.formula-strip { justify-content: space-between; gap: 0.6rem; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); color: var(--gold-bright); font-size: 0.8rem; }
.formula-strip i { width: 1px; height: 18px; background: var(--line); }

.stage { position: relative; z-index: 2; min-height: inherit; display: grid; place-items: center; padding: clamp(8rem, 18vh, 11rem) clamp(1rem, 4vw, 3rem) 5rem; }
.stage:not(.world-mode) { max-height: calc(100vh - 120px); overflow-y: auto; }
.start-card, .dialogue-card, .challenge-card, .result-card, .song-preview-card { width: min(760px, 100%); border: 1px solid var(--line); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.start-card { padding: clamp(1.4rem, 4vw, 2.5rem); }
.start-card h1, .dialogue-card h2, .challenge-card h2, .result-card h2, .song-preview-card h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
.start-card h1 { max-width: 620px; font-size: clamp(2.2rem, 6vw, 4.5rem); line-height: 0.98; letter-spacing: -0.04em; }
.lede { max-width: 620px; margin: 1rem 0 1.6rem; color: #c2cbc2; font-size: clamp(1rem, 2vw, 1.12rem); line-height: 1.55; }
.mechanic-note { margin: -0.65rem 0 1.45rem; padding: 0.75rem 0.9rem; border-left: 2px solid var(--gold); color: #c5cec5; background: rgba(228, 189, 105, 0.055); font-size: 0.84rem; line-height: 1.45; }
.mechanic-note strong { color: var(--gold-bright); }
.classroom-pass { margin: -0.35rem 0 1.35rem; padding: 1rem; border: 1px solid rgba(120, 198, 149, 0.25); border-radius: 11px; background: rgba(32, 81, 57, 0.12); }
.classroom-pass-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.classroom-pass-heading span, .classroom-pass-heading small { display: block; }
.classroom-pass-heading span { color: #d9ebdf; font-weight: 850; letter-spacing: 0.04em; }
.classroom-pass-heading small { margin-top: 0.2rem; color: var(--muted); font-size: 0.74rem; }
.classroom-code-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.classroom-pass .field input[readonly] { color: #cbd5cd; background: rgba(255, 255, 255, 0.025); cursor: default; }
.session-match { display: grid; gap: 0.2rem; margin-top: 0.8rem; padding: 0.65rem 0.75rem; border-left: 2px solid rgba(238, 241, 232, 0.2); color: var(--muted); background: rgba(255, 255, 255, 0.025); font-size: 0.75rem; line-height: 1.4; }
.session-match strong { color: #d8e0d9; font-size: 0.8rem; }
.session-match.is-found { border-color: var(--success); background: rgba(120, 198, 149, 0.07); }
.session-match.is-found strong { color: #c9ead5; }
.session-match.is-closed { border-color: var(--danger); background: rgba(112, 49, 42, 0.11); }
.session-match.is-closed strong { color: #f0c0b6; }
.classroom-privacy { margin: 0.75rem 0 0; color: #aebbb1; font-size: 0.73rem; line-height: 1.45; }
.choice-label { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.86rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.avatar-choice-row { align-items: stretch; gap: 0.8rem; margin-bottom: 1.4rem; }
.avatar-card {
  position: relative; flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.85rem; min-height: 84px; padding: 0.9rem;
  border: 1px solid rgba(238, 241, 232, 0.16); border-radius: 10px; background: rgba(255, 255, 255, 0.035); text-align: left; cursor: pointer;
}
.avatar-card:hover { border-color: rgba(228, 189, 105, 0.55); background: rgba(228, 189, 105, 0.06); }
.avatar-card.is-selected { border-color: var(--gold); background: rgba(228, 189, 105, 0.1); box-shadow: inset 0 0 0 1px rgba(228, 189, 105, 0.22); }
.avatar-monogram { display: grid; place-items: center; width: 50px; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 50%; color: var(--gold-bright); background: #132c25; font-family: Georgia, serif; font-size: 1.45rem; }
.avatar-card strong, .avatar-card small { display: block; }
.avatar-card strong { font-size: 1rem; }
.avatar-card small { margin-top: 0.2rem; color: var(--muted); font-size: 0.78rem; }

.primary-button, .secondary-button { min-height: 46px; padding: 0.7rem 1.1rem; border-radius: 8px; font-weight: 750; cursor: pointer; }
.primary-button { border: 1px solid var(--gold-bright); color: #172017; background: linear-gradient(180deg, #f0cf83, #d5a951); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.32); }
.primary-button:hover { filter: brightness(1.08); }
.primary-button:disabled { cursor: not-allowed; filter: grayscale(0.65) brightness(0.65); }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.control-hint { position: absolute; right: clamp(1rem, 3vw, 2.5rem); bottom: 1.2rem; z-index: 4; gap: 0.42rem; color: var(--muted); font-size: 0.75rem; }
kbd { min-width: 28px; padding: 0.28rem 0.45rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--ink); background: rgba(4, 13, 10, 0.82); font: 700 0.7rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
.text-button { padding: 0.25rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.panel-padding { padding: clamp(1.35rem, 4vw, 2.35rem); }
.stage-actions { flex-wrap: wrap; gap: 0.75rem; }
.instruction { margin: 0.9rem 0 1.1rem; color: #c5cec5; line-height: 1.55; }
.challenge-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.2rem; }
.task-mark, .formula-badge {
  flex: 0 0 auto; display: grid; place-items: center; min-width: 66px; min-height: 50px; padding: 0.55rem 0.75rem;
  border: 1px solid var(--line); border-radius: 10px; color: var(--gold-bright); background: rgba(228, 189, 105, 0.07); font: 700 1rem/1 Georgia, serif;
}

.stage.world-mode { min-height: calc(100vh - 120px); align-items: stretch; padding: 0; }
.is-world .quest-panel, .is-travel .quest-panel { display: none; }

.scene-hub { --scene-image: url("./assets/ekomarken-stig.png"); --scene-accent: #8fc2ae; }
.scene-trail { --scene-image: url("./assets/ekomarken.png"); --scene-accent: #a5bcae; }
.scene-tones { --scene-image: url("./assets/tonstigen-plats.png"); --scene-accent: #78d4c7; }
.scene-chords { --scene-image: url("./assets/ackordsmedjan-plats.png"); --scene-accent: #e7a85c; }
.scene-pulse { --scene-image: url("./assets/ekomarken-stig.png"); --scene-accent: #e4bd69; }
.scene-boss { --scene-image: url("./assets/ekomarken.png"); --scene-accent: #d98270; }

.destination-hub {
  position: relative; isolation: isolate; width: 100%; min-height: calc(100vh - 120px); max-height: calc(100vh - 120px); overflow: auto;
  display: grid; grid-template-rows: auto 1fr auto; gap: clamp(1rem, 2.2vh, 1.6rem); padding: clamp(1.8rem, 5vh, 3.5rem) clamp(1rem, 4vw, 3.5rem) 5.7rem;
  background: linear-gradient(180deg, rgba(3, 11, 8, 0.14), rgba(3, 11, 8, 0.62) 88%); user-select: none;
}
.hub-intro { width: min(690px, 100%); margin: 0 auto; text-align: center; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.78); }
.hub-kicker { margin: 0 0 0.45rem; color: var(--gold); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; }
.hub-title { margin: 0; font: 500 clamp(2rem, 4vw, 3.5rem)/0.98 Georgia, "Times New Roman", serif; letter-spacing: -0.035em; }
.hub-copy { margin: 0.65rem 0 0; color: #cbd4cc; font-size: clamp(0.94rem, 1.5vw, 1.08rem); }
.hub-progress { display: inline-flex; align-items: center; gap: 0.75rem; margin-top: 0.95rem; padding: 0.45rem 0.7rem; border: 1px solid rgba(228, 189, 105, 0.28); border-radius: 999px; background: rgba(4, 14, 10, 0.62); backdrop-filter: blur(10px); }
.hub-progress > span { color: #d5ddd6; font-size: 0.78rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.hub-progress > div { display: flex; gap: 0.38rem; }
.hub-progress i { width: 10px; aspect-ratio: 1; transform: rotate(45deg); border: 1px solid rgba(228, 189, 105, 0.48); background: rgba(10, 31, 24, 0.82); }
.hub-progress i.is-restored { border-color: var(--gold-bright); background: var(--gold); box-shadow: 0 0 10px rgba(228, 189, 105, 0.65); }

.destination-grid { align-self: end; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(0.65rem, 1.3vw, 1rem); width: min(1240px, 100%); margin: 0 auto; }
.destination-card {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; min-height: 222px; padding: 1rem;
  border: 1px solid rgba(238, 241, 232, 0.2); border-radius: 14px; color: var(--ink); background: #0a1814; box-shadow: 0 12px 35px rgba(0, 0, 0, 0.34);
  text-align: left; cursor: pointer; transition: border-color 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}
.destination-card::before { content: ""; position: absolute; z-index: -2; inset: 0; background: linear-gradient(180deg, rgba(4, 12, 10, 0.03) 0%, rgba(4, 12, 10, 0.52) 52%, rgba(4, 12, 10, 0.97) 100%), var(--scene-image) center / cover no-repeat; transition: filter 180ms ease, transform 260ms ease; }
.destination-card::after { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(110deg, color-mix(in srgb, var(--scene-accent) 14%, transparent), transparent 46%); pointer-events: none; }
.destination-card:hover::before, .destination-card:focus-visible::before { transform: scale(1.035); filter: brightness(1.08); }
.destination-card:hover, .destination-card:focus-visible { border-color: color-mix(in srgb, var(--scene-accent) 70%, white 10%); box-shadow: 0 16px 46px rgba(0, 0, 0, 0.48); }
.destination-card.is-selected { border-color: var(--scene-accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--scene-accent) 45%, transparent), 0 0 0 3px rgba(6, 17, 13, 0.76), 0 0 0 4px color-mix(in srgb, var(--scene-accent) 42%, transparent), 0 16px 45px rgba(0, 0, 0, 0.48); }
.destination-card.is-complete { border-color: rgba(120, 198, 149, 0.58); }
.destination-card.is-locked { filter: saturate(0.25) brightness(0.68); }
.destination-card.is-locked.is-selected { filter: saturate(0.35) brightness(0.8); }
.destination-card.is-denied { animation: denied-flash 380ms ease; }
.destination-index { position: absolute; top: 0.9rem; right: 0.9rem; color: rgba(238, 241, 232, 0.48); font: 600 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.12em; }
.destination-status { display: inline-flex; min-height: 25px; align-items: center; padding: 0.25rem 0.5rem; border: 1px solid color-mix(in srgb, var(--scene-accent) 52%, transparent); border-radius: 999px; color: #eff4ef; background: rgba(4, 14, 10, 0.68); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; backdrop-filter: blur(8px); }
.destination-card.is-complete .destination-status { border-color: rgba(120, 198, 149, 0.58); color: #ccebd7; }
.destination-name { display: block; margin-top: auto; font: 500 clamp(1.35rem, 2.2vw, 1.75rem)/1 Georgia, "Times New Roman", serif; text-shadow: 0 2px 12px #000; }
.destination-subtitle { display: block; margin-top: 0.4rem; color: var(--scene-accent); font-size: 0.76rem; font-weight: 800; letter-spacing: 0.04em; }
.destination-detail { display: block; min-height: 2.5em; margin-top: 0.42rem; color: #c1cbc2; font-size: 0.82rem; line-height: 1.35; }
.destination-call { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 0.7rem; padding-top: 0.65rem; border-top: 1px solid rgba(238, 241, 232, 0.14); color: #eef1e8; font-size: 0.77rem; font-weight: 750; }
.destination-call b { color: var(--scene-accent); font-size: 1rem; }

.hub-action { align-self: end; width: min(720px, 100%); margin: 0 auto; text-align: center; }
.hub-nav { display: flex; justify-content: center; gap: 0.55rem; }
.hub-nav .secondary-button { min-width: 48px; padding-inline: 0.75rem; background: rgba(4, 14, 10, 0.82); backdrop-filter: blur(12px); }
.hub-nav .primary-button { min-width: min(340px, calc(100% - 110px)); }
.hub-nav .primary-button[aria-disabled="true"] { color: #b7bcb7; border-color: #6c746f; background: rgba(33, 41, 37, 0.9); box-shadow: none; }
.hub-message { min-height: 1.4em; margin: 0.65rem 0 0; color: #c9d2ca; font-size: 0.82rem; text-shadow: 0 2px 8px #000; }

.app-shell.is-journey .topbar, .app-shell.is-journey .statusbar { visibility: hidden; }
.game-frame.is-travel { position: fixed; inset: 0; z-index: 100; width: 100vw; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: #050d0a; }
.game-frame.is-travel > .world-backdrop, .game-frame.is-travel > .world-shade { display: none; }
.game-frame.is-travel .stage.world-mode { width: 100%; min-height: 100vh; min-height: 100dvh; height: 100vh; height: 100dvh; }

.travel-view {
  --route-pan: 0%; --route-pan-opposite: 0%; --arrival-position: center; position: relative; isolation: isolate; width: 100%; min-height: 100vh; min-height: 100dvh; overflow: hidden;
  color: var(--ink); background: #050d0a; user-select: none;
}
.route-tones { --route-pan: -1.4%; --route-pan-opposite: 0.7%; --arrival-position: center 58%; --route-accent: #78d4c7; }
.route-chords { --route-pan: 1.3%; --route-pan-opposite: -0.65%; --arrival-position: center 50%; --route-accent: #e7a85c; }
.route-pulse { --route-pan: 0.4%; --route-pan-opposite: -0.2%; --arrival-position: center 46%; --route-accent: #e4bd69; }
.route-boss { --route-pan: -0.7%; --route-pan-opposite: 0.35%; --arrival-position: center 44%; --route-accent: #d98270; }
.travel-camera { position: absolute; z-index: 0; inset: -2.5%; overflow: hidden; animation: travel-camera-walk 400ms linear infinite; will-change: transform; }
.travel-scene { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 10, 8, 0.04), rgba(3, 10, 8, 0.28)), var(--scene-image) center / cover no-repeat; transform-origin: 50% 48%; will-change: transform, opacity; }
.travel-from { z-index: 0; animation: travel-depart var(--travel-duration) cubic-bezier(0.32, 0.02, 0.25, 1) both; }
.travel-mid { z-index: 1; opacity: 0; animation: travel-middle var(--travel-duration) cubic-bezier(0.28, 0.05, 0.3, 1) both; }
.travel-to { z-index: 2; opacity: 0; background-position: var(--arrival-position); animation: travel-arrive var(--travel-duration) cubic-bezier(0.22, 0.05, 0.28, 1) both; }
.travel-foreground { position: absolute; z-index: 3; inset: 0; background: radial-gradient(ellipse at 50% 118%, rgba(2, 8, 6, 0.86) 0 12%, transparent 40%), radial-gradient(ellipse at -7% 62%, rgba(2, 8, 6, 0.76) 0 8%, transparent 31%), radial-gradient(ellipse at 107% 58%, rgba(2, 8, 6, 0.72) 0 8%, transparent 30%); pointer-events: none; animation: travel-parallax 400ms linear infinite; }
.travel-vignette { position: absolute; inset: 0; z-index: 4; background: radial-gradient(circle at 50% 45%, transparent 24%, rgba(2, 8, 6, 0.19) 62%, rgba(2, 8, 6, 0.73) 112%), linear-gradient(180deg, rgba(2, 8, 6, 0.24), transparent 23%, transparent 68%, rgba(2, 8, 6, 0.58)); pointer-events: none; }
.travel-route { position: absolute; z-index: 7; top: clamp(1.2rem, 4vh, 2.4rem); left: clamp(1rem, 4vw, 3rem); max-width: min(520px, calc(100% - 2rem)); text-shadow: 0 2px 14px #000; animation: travel-route-label var(--travel-duration) ease both; }
.travel-route span, .travel-route strong { display: block; }
.travel-route span { color: var(--route-accent, var(--gold)); font-size: 0.76rem; font-weight: 850; letter-spacing: 0.17em; text-transform: uppercase; }
.travel-route strong { margin-top: 0.35rem; font: 500 clamp(1.05rem, 2vw, 1.35rem)/1.2 Georgia, "Times New Roman", serif; }
.travel-marker { position: absolute; z-index: 6; left: 50%; top: 45%; display: grid; justify-items: center; gap: 0.65rem; color: #eef1e8; text-shadow: 0 2px 10px #000; animation: travel-marker-approach var(--travel-duration) ease-out both; pointer-events: none; }
.travel-marker i { width: 22px; aspect-ratio: 1; transform: rotate(45deg); border: 2px solid var(--route-accent, var(--gold)); background: rgba(4, 14, 10, 0.5); box-shadow: 0 0 0 7px rgba(228, 189, 105, 0.06), 0 0 28px color-mix(in srgb, var(--route-accent, var(--gold)) 55%, transparent); }
.travel-marker span { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.travel-arrival { position: absolute; z-index: 7; left: 50%; bottom: clamp(4.5rem, 12vh, 7rem); width: min(720px, calc(100% - 2rem)); transform: translateX(-50%); text-align: center; text-shadow: 0 4px 24px #000; animation: travel-arrival-title var(--travel-duration) ease both; pointer-events: none; }
.travel-arrival p { margin: 0 0 0.35rem; color: var(--route-accent, var(--gold)); font-size: 0.76rem; font-weight: 850; letter-spacing: 0.18em; text-transform: uppercase; }
.travel-arrival h2 { margin: 0; font: 500 clamp(2.6rem, 8vw, 5.5rem)/0.95 Georgia, "Times New Roman", serif; letter-spacing: -0.035em; }
.travel-skip { position: absolute; z-index: 9; right: clamp(0.9rem, 3vw, 2rem); bottom: clamp(0.8rem, 3vh, 1.5rem); display: flex; align-items: center; gap: 0.55rem; min-height: 42px; padding: 0.45rem 0.7rem; border: 1px solid rgba(228, 189, 105, 0.24); border-radius: 8px; color: #d1d8d2; background: rgba(3, 11, 8, 0.66); cursor: pointer; backdrop-filter: blur(8px); }
.travel-skip:hover, .travel-skip:focus-visible { border-color: var(--route-accent, var(--gold)); color: #fff; background: rgba(9, 27, 20, 0.88); }
.travel-skip span { font-size: 0.82rem; font-weight: 700; }
.travel-stride { position: absolute; z-index: 5; inset: 0; overflow: hidden; pointer-events: none; }
.travel-stride i { position: absolute; top: 46%; left: 50%; width: 5px; aspect-ratio: 1; opacity: 0; transform: translate(-50%, 0) rotate(45deg) scale(0.25); background: var(--route-accent, var(--gold)); box-shadow: 0 0 10px color-mix(in srgb, var(--route-accent, var(--gold)) 45%, transparent); animation: travel-path-mote 1s linear infinite; }
.travel-stride i:nth-child(2) { animation-delay: 180ms; }
.travel-stride i:nth-child(3) { animation-delay: 360ms; }
.travel-stride i:nth-child(4) { animation-delay: 540ms; }
.travel-stride i:nth-child(5) { animation-delay: 720ms; }

@keyframes denied-flash { 45% { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(207, 119, 104, 0.16), 0 0 36px rgba(207, 119, 104, 0.28); } }
@keyframes travel-camera-walk { 0%, 100% { transform: translate3d(0, 0, 0) rotate(0); } 24% { transform: translate3d(-0.12%, -0.5%, 0) rotate(-0.08deg); } 52% { transform: translate3d(0.08%, 0.25%, 0) rotate(0.05deg); } 76% { transform: translate3d(0.14%, -0.38%, 0) rotate(0.08deg); } }
@keyframes travel-parallax { 0%, 100% { transform: translate3d(0, 0, 0) scale(1.02); } 50% { transform: translate3d(var(--route-pan-opposite), 0.55%, 0) scale(1.045); } }
@keyframes travel-depart { 0% { opacity: 1; transform: translate3d(0, 0, 0) scale(1.025); } 39% { opacity: 1; transform: translate3d(var(--route-pan), -0.8%, 0) scale(1.115); } 58%, 100% { opacity: 0; transform: translate3d(var(--route-pan), -1.1%, 0) scale(1.14); } }
@keyframes travel-middle { 0%, 20% { opacity: 0; transform: translate3d(var(--route-pan-opposite), 0.6%, 0) scale(1.07); } 34%, 63% { opacity: 1; } 72% { opacity: 0; transform: translate3d(var(--route-pan), -0.8%, 0) scale(1.14); } 100% { opacity: 0; } }
@keyframes travel-arrive { 0%, 53% { opacity: 0; transform: translate3d(var(--route-pan-opposite), 0.7%, 0) scale(1.1); } 68% { opacity: 1; } 100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1.01); } }
@keyframes travel-route-label { 0%, 42% { opacity: 1; transform: translateY(0); } 58%, 100% { opacity: 0; transform: translateY(-8px); } }
@keyframes travel-marker-approach { 0% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.58); } 55% { opacity: 1; } 76% { opacity: 0.78; transform: translate(-50%, -50%) scale(1.08); } 88%, 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.32); } }
@keyframes travel-arrival-title { 0%, 69% { opacity: 0; transform: translate(-50%, 14px); } 84%, 100% { opacity: 1; transform: translate(-50%, 0); } }
@keyframes travel-path-mote { 0% { top: 46%; opacity: 0; transform: translate(-50%, 0) rotate(45deg) scale(0.25); } 20% { opacity: 0.42; } 100% { top: 104%; opacity: 0; transform: translate(calc(-50% + var(--route-pan)), 0) rotate(45deg) scale(1.35); } }

.note-grid { display: grid; grid-template-columns: repeat(12, minmax(42px, 1fr)); gap: 0.35rem; margin: 1rem 0; }
.note-stone {
  min-height: 74px; padding: 0.55rem 0.2rem; border: 1px solid rgba(238, 241, 232, 0.18); border-radius: 7px;
  color: var(--ink); background: linear-gradient(180deg, rgba(37, 61, 51, 0.95), rgba(13, 29, 24, 0.96)); cursor: pointer;
}
.note-stone span, .note-stone small { display: block; }
.note-stone span { font: 600 1rem/1 Georgia, serif; }
.note-stone small { min-height: 1em; margin-top: 0.4rem; color: var(--muted); font-size: 0.64rem; }
.note-stone:hover { border-color: rgba(228, 189, 105, 0.75); background: #24483a; }
.note-stone.is-selected, .note-stone.is-fixed { border-color: var(--gold); color: var(--gold-bright); background: rgba(126, 93, 39, 0.42); box-shadow: inset 0 0 18px rgba(228, 189, 105, 0.12); }
.note-stone.is-fixed { cursor: default; }
.note-stone.is-correct, .answer-button.is-correct { border-color: var(--success); background: rgba(38, 111, 74, 0.6); }
.note-stone.is-wrong, .answer-button.is-wrong { border-color: var(--danger); background: rgba(112, 49, 42, 0.54); }
.selection-readout { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.9rem; }
.selection-readout strong { color: var(--gold-bright); }
.feedback { min-height: 48px; margin: 1rem 0; padding: 0.75rem 0.9rem; border-left: 3px solid var(--line); color: #c8d0c9; background: rgba(255, 255, 255, 0.035); line-height: 1.45; }
.feedback.is-success { border-color: var(--success); color: #c9ead5; background: rgba(41, 105, 70, 0.18); }
.feedback.is-error { border-color: var(--danger); color: #f0c0b6; background: rgba(112, 49, 42, 0.16); }

.pulse-countdown {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: clamp(0.8rem, 3vw, 1.6rem); width: min(540px, 100%); min-height: 118px;
  margin: 1rem auto 0; padding: 0.8rem 1rem; border: 1px solid rgba(228, 189, 105, 0.48); border-radius: 14px; color: var(--gold-bright);
  background: radial-gradient(circle at 50% 50%, rgba(228, 189, 105, 0.13), transparent 38%), rgba(4, 14, 10, 0.9); box-shadow: inset 0 0 26px rgba(228, 189, 105, 0.06), 0 14px 35px rgba(0, 0, 0, 0.32); text-align: center;
}
.countdown-label { justify-self: end; color: #d1d9d1; font-size: 0.88rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.pulse-countdown > strong { min-width: 1.25em; font: 500 clamp(3.8rem, 8vw, 5.6rem)/0.9 Georgia, "Times New Roman", serif; text-shadow: 0 0 28px rgba(228, 189, 105, 0.5); }
.countdown-beats { justify-self: start; display: grid; grid-template-columns: repeat(4, 12px); gap: 0.4rem; }
.countdown-beats i { width: 12px; aspect-ratio: 1; transform: rotate(45deg); border: 1px solid rgba(228, 189, 105, 0.48); background: rgba(16, 39, 31, 0.9); }
.countdown-beats i.is-live { border-color: var(--gold-bright); background: var(--gold); box-shadow: 0 0 12px rgba(228, 189, 105, 0.62); }
.pulse-countdown.is-ticking { animation: countdown-strike 260ms ease-out; }
.pulse-countdown.is-go { border-color: var(--success); color: #c9ead5; background: radial-gradient(circle at 50% 50%, rgba(120, 198, 149, 0.17), transparent 42%), rgba(4, 18, 12, 0.92); box-shadow: inset 0 0 28px rgba(120, 198, 149, 0.08), 0 0 35px rgba(120, 198, 149, 0.18); }
.pulse-countdown.is-go > strong { min-width: 2.2em; font-size: clamp(2.8rem, 7vw, 4.5rem); text-shadow: 0 0 28px rgba(120, 198, 149, 0.48); }
.pulse-zone { display: grid; justify-items: center; gap: 1.1rem; margin: 1.1rem 0 1.3rem; transition: opacity 180ms ease, filter 180ms ease; }
.pulse-zone.is-counting { opacity: 0.42; filter: saturate(0.55); }
.pulse-orb {
  display: grid; place-items: center; width: 138px; aspect-ratio: 1; border: 2px solid rgba(228, 189, 105, 0.62); border-radius: 50%;
  color: var(--gold-bright); background: radial-gradient(circle, rgba(228, 189, 105, 0.15), rgba(11, 30, 24, 0.96) 66%);
  box-shadow: 0 0 0 12px rgba(228, 189, 105, 0.035), inset 0 0 35px rgba(228, 189, 105, 0.09); cursor: pointer;
}
.pulse-orb span, .pulse-orb small { display: block; }
.pulse-orb span { font: 500 2.2rem/1 Georgia, serif; }
.pulse-orb small { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; }
.pulse-orb.is-beat { box-shadow: 0 0 0 18px rgba(228, 189, 105, 0.14), 0 0 54px rgba(228, 189, 105, 0.42), inset 0 0 35px rgba(228, 189, 105, 0.17); transform: scale(1.04); }
.pulse-orb.is-tap { animation: tap-ring 220ms ease-out; }
.pulse-orb:disabled { opacity: 0.68; cursor: default; }
.beat-track { display: flex; gap: 0.55rem; }
.beat-track i { width: 11px; height: 11px; border: 1px solid var(--line); border-radius: 50%; background: #10271f; }
.beat-track i.is-live { background: var(--gold); box-shadow: 0 0 12px rgba(228, 189, 105, 0.5); }
@keyframes tap-ring { 50% { transform: scale(0.94); } }
@keyframes countdown-strike { 45% { border-color: var(--gold-bright); box-shadow: inset 0 0 32px rgba(228, 189, 105, 0.14), 0 0 35px rgba(228, 189, 105, 0.28); transform: scale(1.015); } }

.boss-card { border-color: rgba(217, 129, 111, 0.46); background: rgba(17, 17, 15, 0.94); }
.boss-health { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 1rem; margin: -0.2rem 0 1.4rem; padding-bottom: 0.85rem; border-bottom: 1px solid rgba(217, 129, 111, 0.26); }
.boss-health ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.boss-health li { display: flex; align-items: center; gap: 0.45rem; min-height: 38px; padding: 0.4rem 0.55rem; border: 1px solid rgba(217, 129, 111, 0.24); border-radius: 7px; color: #d2aaa3; background: rgba(185, 87, 71, 0.07); }
.boss-health li span { display: grid; place-items: center; width: 24px; aspect-ratio: 1; border: 1px solid rgba(217, 129, 111, 0.38); border-radius: 50%; font-size: 0.63rem; font-weight: 850; }
.boss-health li b { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
.boss-health li.is-active { border-color: rgba(228, 189, 105, 0.72); color: var(--gold-bright); background: rgba(228, 189, 105, 0.1); box-shadow: inset 0 0 18px rgba(228, 189, 105, 0.05), 0 0 16px rgba(228, 189, 105, 0.09); }
.boss-health li.is-active span { border-color: var(--gold); box-shadow: 0 0 10px rgba(228, 189, 105, 0.25); }
.boss-health li.is-broken { border-color: rgba(120, 198, 149, 0.24); color: #acd3ba; background: rgba(41, 105, 70, 0.11); opacity: 0.78; }
.boss-health li.is-broken span { border-color: rgba(120, 198, 149, 0.42); }
.boss-name { color: #e4b4aa; font-size: 0.82rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.boss-briefing { display: grid; gap: 0.55rem; margin: 1.3rem 0; padding: 0; list-style: none; }
.boss-briefing li { display: grid; grid-template-columns: 38px 1fr; gap: 0.8rem; align-items: center; padding: 0.75rem 0.8rem; border: 1px solid rgba(238, 241, 232, 0.11); border-radius: 8px; background: rgba(255, 255, 255, 0.025); }
.boss-briefing li > span { color: #d99080; font: 700 0.78rem/1 Georgia, serif; letter-spacing: 0.08em; }
.boss-briefing b, .boss-briefing small { display: block; }
.boss-briefing b { color: #f0ece5; font-size: 0.9rem; }
.boss-briefing small { margin-top: 0.18rem; color: var(--muted); line-height: 1.4; }
.boss-resume-note { margin: 0.8rem 0; padding: 0.65rem 0.8rem; border-left: 3px solid var(--gold); color: #d9d0bd; background: rgba(228, 189, 105, 0.06); }
.boss-keyboard-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 1.1rem 0 0.35rem; }
.boss-keyboard-heading span { color: #edf3ed; font-size: 0.82rem; font-weight: 850; letter-spacing: 0.07em; text-transform: uppercase; }
.boss-keyboard-heading small { color: var(--muted); font-size: 0.74rem; }
.boss-formula[hidden] { display: none; }
.boss-listen-cue { position: relative; display: flex; align-items: end; justify-content: center; gap: 0.4rem; min-height: 92px; margin: 1rem 0; padding: 1rem; border: 1px solid rgba(217, 129, 111, 0.22); border-radius: 10px; background: radial-gradient(circle at 50% 100%, rgba(185, 87, 71, 0.13), transparent 56%), rgba(0, 0, 0, 0.18); overflow: hidden; }
.boss-listen-cue > span { width: 8px; height: 32px; border-radius: 999px; background: linear-gradient(180deg, #e2b56b, #934e43); box-shadow: 0 0 16px rgba(217, 129, 111, 0.34); animation: listen-pulse 900ms ease-in-out infinite alternate; }
.boss-listen-cue > span:nth-child(2) { height: 54px; animation-delay: -300ms; }
.boss-listen-cue > span:nth-child(3) { height: 40px; animation-delay: -600ms; }
.boss-listen-cue strong { position: absolute; top: 0.65rem; color: #cfa49b; font-size: 0.65rem; letter-spacing: 0.18em; }
.identify-hint { margin: 0.8rem 0; padding: 0.7rem 0.8rem; border: 1px solid rgba(228, 189, 105, 0.28); border-radius: 8px; color: #ead8aa; background: rgba(228, 189, 105, 0.06); }
.answer-button.is-wrong { border-color: rgba(217, 129, 111, 0.52); opacity: 0.48; }
.answer-button.is-correct { border-color: rgba(120, 198, 149, 0.72); color: #d9f2e2; background: rgba(41, 105, 70, 0.2); }
@keyframes listen-pulse { to { transform: scaleY(0.46); opacity: 0.52; } }
.answer-grid, .choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.65rem; margin: 1.25rem 0; }
.choice-grid { grid-template-columns: repeat(2, 1fr); }
.answer-button, .choice-button { min-height: 92px; padding: 1rem; border: 1px solid rgba(238, 241, 232, 0.17); border-radius: 9px; color: var(--ink); background: rgba(255, 255, 255, 0.04); text-align: left; cursor: pointer; }
.answer-button:hover, .choice-button:hover { border-color: var(--gold); background: rgba(228, 189, 105, 0.08); }
.answer-button b, .answer-button span, .choice-button b, .choice-button span { display: block; }
.answer-button b, .choice-button b { margin-bottom: 0.35rem; font-family: Georgia, serif; font-size: 1rem; }
.answer-button span, .choice-button span { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }

.summary-status { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 9px; background: rgba(228, 189, 105, 0.06); }
.summary-status span { color: var(--muted); }
.summary-status strong { color: var(--gold-bright); font-family: Georgia, serif; font-size: 1.15rem; }
.summary-status .result-level-mastered { color: #c9ead5; }
.summary-status .result-level-progress { color: #f0dba6; }
.summary-status .result-level-practice { color: #f0c0b6; }
.student-result-code { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 0.15rem 0.7rem; width: fit-content; margin: -0.65rem 0 1rem; padding: 0.55rem 0.75rem; border: 1px solid rgba(120, 198, 149, 0.28); border-radius: 8px; background: rgba(120, 198, 149, 0.06); }
.student-result-code span { grid-row: 1 / 3; color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.student-result-code strong { color: #d7f2e0; font-size: 0.95rem; }
.student-result-code small { color: var(--muted); font-size: 0.7rem; }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; margin: 1rem 0 1.35rem; }
.result-grid div { padding: 0.85rem; border: 1px solid rgba(238, 241, 232, 0.12); border-radius: 8px; background: rgba(255, 255, 255, 0.03); }
.result-grid dt { color: var(--muted); font-size: 0.78rem; }
.result-grid dd { margin: 0.3rem 0 0; color: var(--ink); font: 500 1.25rem/1.2 Georgia, serif; }
.result-transfer { margin: 0 0 1.25rem; padding: 0.9rem; border: 1px solid rgba(228, 189, 105, 0.22); border-radius: 9px; background: rgba(228, 189, 105, 0.045); }
.result-transfer.is-warning { border-color: rgba(207, 119, 104, 0.45); background: rgba(112, 49, 42, 0.12); }
.result-transfer > div:first-child strong, .result-transfer > div:first-child span { display: block; }
.result-transfer > div:first-child strong { color: var(--gold-bright); font-size: 0.88rem; }
.result-transfer > div:first-child span { margin: 0.25rem 0 0.75rem; color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.result-transfer > p { min-height: 1.2em; margin: 0.65rem 0 0; color: #c9ead5; font-size: 0.75rem; }

/* Låtbyggaren: a restrained fantasy workbench for teacher-authored material. */
.app-shell.is-teacher .quest-panel { display: none; }
.app-shell.is-teacher .energy-meter, .app-shell.is-teacher .chapter-progress, .app-shell.is-teacher #reset-progress { display: none; }
.app-shell.is-teacher .stage:not(.world-mode) { max-height: calc(100vh - 120px); padding: 1.25rem clamp(0.8rem, 2.4vw, 2rem) 3rem; place-items: start center; }
.app-shell.is-song-exam .quest-panel { display: none; }
.app-shell.is-song-exam .energy-meter, .app-shell.is-song-exam .chapter-progress, .app-shell.is-song-exam #reset-progress { display: none; }
.app-shell.is-song-exam .stage:not(.world-mode) { max-height: calc(100vh - 120px); padding: 1.25rem clamp(0.8rem, 2.4vw, 2rem) 3rem; place-items: start center; }
.teacher-workspace { width: min(1220px, 100%); min-height: min(720px, calc(100vh - 155px)); border: 1px solid rgba(228, 189, 105, 0.22); border-radius: 16px; background: rgba(5, 16, 12, 0.94); box-shadow: var(--shadow); backdrop-filter: blur(22px); overflow: hidden; }
.teacher-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; padding: 1.3rem 1.5rem; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(228, 189, 105, 0.075), transparent 60%); }
.teacher-heading h1 { margin: 0; font: 500 clamp(1.8rem, 4vw, 2.8rem)/1 Georgia, "Times New Roman", serif; letter-spacing: -0.025em; }
.teacher-heading > div > p:last-child { margin: 0.55rem 0 0; color: #bac6bd; font-size: 0.94rem; }
.teacher-tabs { display: flex; gap: 0.3rem; padding: 0.55rem 1.5rem 0; border-bottom: 1px solid var(--line); background: rgba(2, 11, 8, 0.52); }
.teacher-tab { position: relative; min-height: 44px; padding: 0.6rem 0.85rem 0.75rem; border: 0; color: var(--muted); background: transparent; font-weight: 800; cursor: pointer; }
.teacher-tab::after { content: ""; position: absolute; right: 0.7rem; bottom: -1px; left: 0.7rem; height: 2px; background: transparent; }
.teacher-tab[aria-selected="true"] { color: var(--gold-bright); }
.teacher-tab[aria-selected="true"]::after { background: var(--gold); box-shadow: 0 0 10px rgba(228, 189, 105, 0.45); }
.teacher-tab span { display: inline-grid; place-items: center; min-width: 1.45rem; min-height: 1.45rem; margin-left: 0.35rem; padding: 0 0.35rem; border: 1px solid rgba(238, 241, 232, 0.14); border-radius: 999px; color: #d7e0d8; background: rgba(255, 255, 255, 0.045); font-size: 0.68rem; }
.teacher-grid { display: grid; grid-template-columns: minmax(220px, 270px) minmax(0, 1fr); min-height: 610px; }
.teacher-results { padding: clamp(1rem, 2.5vw, 1.6rem); }
.teacher-sessions { padding: clamp(1rem, 2.5vw, 1.6rem); }
.lesson-create-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 0.75fr); align-items: end; gap: 1.25rem; margin: 1rem 0 1.3rem; padding: 1rem; border: 1px solid rgba(228, 189, 105, 0.24); border-radius: 11px; background: linear-gradient(120deg, rgba(228, 189, 105, 0.07), rgba(255, 255, 255, 0.018)); }
.lesson-create-card h2 { margin: 0; font: 500 clamp(1.25rem, 2vw, 1.65rem)/1.15 Georgia, "Times New Roman", serif; }
.lesson-create-card > div > p:last-child { max-width: 620px; margin: 0.45rem 0 0; color: var(--muted); font-size: 0.8rem; line-height: 1.5; }
.lesson-create-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 0.65rem; }
.lesson-create-grid .primary-button { white-space: nowrap; }
.lesson-zero-state { display: grid; justify-items: start; gap: 0.4rem; padding: 0.8rem; border-left: 2px solid var(--gold); background: rgba(228, 189, 105, 0.05); }
.lesson-zero-state strong, .lesson-zero-state span { display: block; }
.lesson-zero-state span { color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.lesson-zero-state .primary-button { margin-top: 0.35rem; }
.lesson-list-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.1rem 0 0.7rem; }
.lesson-list-heading h2 { margin: 0.18rem 0 0; font: 500 1.35rem/1.1 Georgia, "Times New Roman", serif; }
.lesson-list-heading small { max-width: 370px; color: var(--muted); font-size: 0.72rem; line-height: 1.45; text-align: right; }
.lesson-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.85rem; }
.lesson-list > .results-empty { grid-column: 1 / -1; }
.lesson-card { min-width: 0; padding: 1rem; border: 1px solid rgba(238, 241, 232, 0.13); border-left: 3px solid var(--success); border-radius: 10px; background: rgba(255, 255, 255, 0.025); }
.lesson-card.is-closed { border-left-color: #778279; opacity: 0.82; }
.lesson-card.is-highlighted { border-color: var(--gold); box-shadow: 0 0 24px rgba(228, 189, 105, 0.12); }
.lesson-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.lesson-card-heading h2 { margin: 0.35rem 0 0; overflow-wrap: anywhere; font: 500 1.2rem/1.15 Georgia, "Times New Roman", serif; }
.lesson-card-heading > small { color: var(--muted); font-size: 0.68rem; text-align: right; }
.lesson-status { display: inline-block; padding: 0.24rem 0.45rem; border: 1px solid rgba(120, 198, 149, 0.38); border-radius: 999px; color: #c9ead5; background: rgba(41, 105, 70, 0.14); font-size: 0.64rem; font-weight: 850; letter-spacing: 0.06em; text-transform: uppercase; }
.lesson-card.is-closed .lesson-status { border-color: rgba(238, 241, 232, 0.17); color: #bac3bc; background: rgba(255, 255, 255, 0.035); }
.lesson-code-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0.9rem 0 0.7rem; padding: 0.8rem; border: 1px solid rgba(228, 189, 105, 0.2); border-radius: 8px; background: rgba(228, 189, 105, 0.045); }
.lesson-code-row span, .lesson-code-row strong { display: block; }
.lesson-code-row span { color: var(--muted); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.lesson-code-row strong { margin-top: 0.18rem; color: var(--gold-bright); font: 600 1.45rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; }
.lesson-code-row .secondary-button { flex: 0 0 auto; min-height: 39px; padding: 0.5rem 0.7rem; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.lesson-meta span { padding: 0.28rem 0.45rem; border: 1px solid rgba(238, 241, 232, 0.12); border-radius: 999px; color: #c7d0c8; background: rgba(255, 255, 255, 0.025); font-size: 0.68rem; }
.lesson-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; margin: 0.75rem 0 0; }
.lesson-stats > div { padding: 0.55rem; border-radius: 7px; background: rgba(255, 255, 255, 0.025); }
.lesson-stats dt { color: var(--muted); font-size: 0.62rem; line-height: 1.25; }
.lesson-stats dd { margin: 0.2rem 0 0; color: #e2e8e3; font: 500 1.15rem/1 Georgia, serif; }
.lesson-snapshot-note { margin: 0.65rem 0; color: #909d92; font-size: 0.67rem; line-height: 1.4; }
.lesson-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; padding-top: 0.7rem; border-top: 1px solid rgba(238, 241, 232, 0.09); }
.lesson-actions .secondary-button { min-height: 39px; padding: 0.5rem 0.7rem; font-size: 0.76rem; }
.lesson-actions .danger-text-button { margin-left: auto; font-size: 0.72rem; }
.results-local-note { display: grid; grid-template-columns: auto 1fr; gap: 0.7rem; padding: 0.8rem 0.9rem; border-left: 3px solid var(--success); color: var(--muted); background: rgba(120, 198, 149, 0.055); font-size: 0.78rem; line-height: 1.45; }
.results-local-note strong { color: #c9ead5; }
.results-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin: 1.1rem 0; }
.results-filter { display: grid; gap: 0.35rem; color: var(--muted); font-size: 0.74rem; font-weight: 800; }
.results-filter select { min-width: 190px; min-height: 43px; padding: 0.55rem 2rem 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #07140f; }
.results-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.55rem; }
.results-actions { align-items: flex-end; }
.result-file-field { max-width: 245px; font-size: 0.72rem; }
.result-file-field input[type="file"] { width: 100%; min-width: 0; min-height: 46px; }
.result-import-button { display: inline-grid; place-items: center; }
.danger-button { min-height: 46px; padding: 0.7rem 1rem; border: 1px solid rgba(207, 119, 104, 0.5); border-radius: 8px; color: #f0c0b6; background: rgba(112, 49, 42, 0.14); font-weight: 750; cursor: pointer; }
.danger-button:hover { border-color: var(--danger); background: rgba(112, 49, 42, 0.25); }
.secondary-button:disabled, .danger-button:disabled { opacity: 0.45; cursor: not-allowed; }
.text-button:disabled { opacity: 0.42; cursor: not-allowed; text-decoration: none; }
.results-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.results-summary > div { padding: 0.75rem; border: 1px solid rgba(238, 241, 232, 0.12); border-radius: 8px; background: rgba(255, 255, 255, 0.025); }
.results-summary span, .results-summary strong { display: block; }
.results-summary span { color: var(--muted); font-size: 0.7rem; }
.results-summary strong { margin-top: 0.2rem; color: var(--gold-bright); font: 500 1.45rem/1 Georgia, serif; }
.results-table-wrap { overflow-x: auto; border: 1px solid rgba(238, 241, 232, 0.12); border-radius: 10px; }
.results-table-wrap:focus-visible { border-color: var(--gold); outline: 3px solid rgba(228, 189, 105, 0.18); outline-offset: 2px; }
.results-table { width: 100%; min-width: 1060px; border-collapse: collapse; font-size: 0.78rem; }
.results-table th, .results-table td { padding: 0.72rem 0.68rem; border-bottom: 1px solid rgba(238, 241, 232, 0.1); text-align: left; vertical-align: top; }
.results-table th { color: #dbe4dc; background: rgba(228, 189, 105, 0.055); font-size: 0.68rem; letter-spacing: 0.055em; text-transform: uppercase; }
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table td > strong, .results-table td > small { display: block; }
.results-table td > strong { color: #edf3ee; }
.results-table td > small { margin-top: 0.2rem; color: var(--muted); font-size: 0.67rem; }
.result-level { display: inline-block; max-width: 120px; padding: 0.3rem 0.45rem; border: 1px solid rgba(238, 241, 232, 0.15); border-radius: 999px; line-height: 1.2; }
.result-level-mastered { color: #c9ead5; border-color: rgba(120, 198, 149, 0.38); background: rgba(41, 105, 70, 0.16); }
.result-level-progress { color: #f0dba6; border-color: rgba(228, 189, 105, 0.35); background: rgba(126, 93, 39, 0.14); }
.result-level-practice { color: #f0c0b6; border-color: rgba(207, 119, 104, 0.35); background: rgba(112, 49, 42, 0.14); }
.results-empty { display: grid; place-items: center; min-height: 230px; padding: 2rem; border: 1px dashed rgba(238, 241, 232, 0.16); border-radius: 10px; color: var(--muted); text-align: center; }
.results-empty strong, .results-empty span { display: block; }
.results-empty strong { color: #dce4dd; font: 500 1.25rem/1.2 Georgia, serif; }
.results-empty span { max-width: 440px; margin-top: 0.45rem; line-height: 1.5; }
.results-empty.is-compact { min-height: 140px; padding: 1.25rem; }
.results-footnote { margin: 0.8rem 0 0; color: #8f9d92; font-size: 0.7rem; line-height: 1.45; }
.song-results-section { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid rgba(238, 241, 232, 0.11); }
.results-table.song-results-table { min-width: 880px; }
.song-library { display: flex; flex-direction: column; min-width: 0; padding: 1.1rem; border-right: 1px solid var(--line); background: rgba(2, 11, 8, 0.62); }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; margin-bottom: 0.9rem; }
.library-heading span, .library-heading small { display: block; }
.library-heading span { font-weight: 800; }
.library-heading small { margin-top: 0.15rem; color: var(--muted); font-size: 0.75rem; }
.small-button { min-height: 38px; padding: 0.45rem 0.7rem; border: 1px solid var(--line); border-radius: 7px; color: var(--gold-bright); background: rgba(228, 189, 105, 0.07); cursor: pointer; }
.small-button:hover { border-color: var(--gold); background: rgba(228, 189, 105, 0.12); }
.song-list { display: grid; gap: 0.55rem; align-content: start; }
.song-list-item { width: 100%; min-height: 68px; padding: 0.75rem; border: 1px solid rgba(238, 241, 232, 0.12); border-radius: 9px; color: var(--ink); background: rgba(255, 255, 255, 0.025); text-align: left; cursor: pointer; }
.song-list-item:hover, .song-list-item.is-selected { border-color: rgba(228, 189, 105, 0.58); background: rgba(228, 189, 105, 0.075); }
.song-list-item strong, .song-list-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.song-list-item strong { font-size: 0.9rem; }
.song-list-item span { margin-top: 0.28rem; color: var(--muted); font-size: 0.74rem; }
.empty-library { padding: 1.1rem 0.85rem; border: 1px dashed rgba(238, 241, 232, 0.16); border-radius: 9px; color: var(--muted); }
.empty-library strong, .empty-library span { display: block; }
.empty-library strong { color: #d5ddd6; font-size: 0.88rem; }
.empty-library span { margin-top: 0.35rem; font-size: 0.78rem; line-height: 1.45; }
.local-note { margin-top: auto; padding: 0.85rem; border-left: 2px solid var(--success); color: var(--muted); background: rgba(120, 198, 149, 0.055); }
.local-note strong, .local-note span { display: block; }
.local-note strong { color: #c9ead5; font-size: 0.78rem; }
.local-note span { margin-top: 0.25rem; font-size: 0.72rem; line-height: 1.45; }
.song-editor { min-width: 0; padding: clamp(1rem, 2.5vw, 1.65rem); }
.editor-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.editor-title-row h2 { margin: 0; font: 500 clamp(1.35rem, 2.5vw, 1.8rem)/1.1 Georgia, "Times New Roman", serif; }
.danger-text-button { min-height: 38px; padding: 0.35rem 0.55rem; border: 0; color: #e7a99d; background: transparent; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.danger-text-button:hover { color: #ffd1c8; }
.form-grid { display: grid; gap: 0.9rem; }
.form-grid.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field { display: grid; align-content: start; gap: 0.42rem; min-width: 0; color: #d5ddd6; font-size: 0.87rem; font-weight: 700; }
.field.full-width { margin-top: 0.95rem; }
.field input, .field select, .field textarea { width: 100%; min-height: 45px; padding: 0.68rem 0.75rem; border: 1px solid rgba(238, 241, 232, 0.18); border-radius: 8px; color: var(--ink); background: rgba(1, 10, 7, 0.72); font-size: 1rem; }
.field textarea { min-height: 92px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(228, 189, 105, 0.5); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); outline: 3px solid rgba(228, 189, 105, 0.15); }
.field [aria-invalid="true"] { border-color: var(--danger); outline-color: rgba(207, 119, 104, 0.18); }
.field small { color: var(--muted); font-size: 0.75rem; font-weight: 500; line-height: 1.45; }
.field code { color: var(--gold-bright); font-size: 0.76rem; }
.input-with-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid rgba(238, 241, 232, 0.18); border-radius: 8px; background: rgba(1, 10, 7, 0.72); }
.input-with-unit input { border: 0; background: transparent; }
.input-with-unit > span { padding-right: 0.7rem; color: var(--muted); font-size: 0.74rem; }
.draft-section { margin: 0.95rem 0; padding: 0.85rem; border: 1px solid rgba(228, 189, 105, 0.18); border-radius: 10px; background: rgba(228, 189, 105, 0.035); }
.section-label { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.65rem; }
.section-label span { color: #e5eae4; font-size: 0.8rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
.section-label small { color: var(--muted); font-size: 0.74rem; }
.draft-bars-preview { min-height: 65px; color: #c8d1ca; font-size: 0.82rem; }
.draft-bars-preview.is-invalid { display: flex; align-items: center; padding: 0.7rem; border-left: 2px solid var(--danger); color: #f0c0b6; background: rgba(112, 49, 42, 0.13); }
.song-bars { display: flex; gap: 0.5rem; padding: 0.25rem 0.1rem 0.55rem; overflow-x: auto; scrollbar-width: thin; }
.song-bar { flex: 0 0 112px; min-height: 72px; padding: 0.45rem; border: 1px solid rgba(238, 241, 232, 0.15); border-radius: 8px; background: rgba(255, 255, 255, 0.025); transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease; }
.song-bar > span { display: block; color: var(--muted); font: 700 0.65rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.song-bar > div { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.55rem; }
.song-bar strong { flex: 1; min-width: 0; color: var(--gold-bright); font: 500 1.08rem/1 Georgia, serif; text-align: center; }
.song-bar.is-current { border-color: var(--gold); background: rgba(228, 189, 105, 0.1); box-shadow: 0 0 22px rgba(228, 189, 105, 0.13); }
.preview-chord.is-current { color: #fff4c7; text-shadow: 0 0 14px rgba(228, 189, 105, 0.72); }
.song-bars.is-compact .song-bar { flex-basis: 86px; min-height: 58px; }
.song-bars.is-compact .song-bar strong { font-size: 0.94rem; }
.choices-grid { align-items: stretch; }
.choice-fieldset { min-width: 0; margin: 0; padding: 0.8rem; border: 1px solid rgba(238, 241, 232, 0.14); border-radius: 10px; }
.choice-fieldset legend { padding: 0 0.35rem; color: #d5ddd6; font-size: 0.82rem; font-weight: 800; }
.check-choice, .radio-choice { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 0.55rem; padding: 0.55rem; border-radius: 7px; cursor: pointer; }
.check-choice:hover, .radio-choice:hover { background: rgba(228, 189, 105, 0.055); }
.check-choice input, .radio-choice input { width: 18px; height: 18px; margin: 0.12rem 0 0; accent-color: var(--gold); }
.check-choice strong, .check-choice small, .radio-choice strong, .radio-choice small { display: block; }
.check-choice strong, .radio-choice strong { font-size: 0.84rem; }
.check-choice small, .radio-choice small { margin-top: 0.18rem; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.check-line { display: inline-flex; align-items: center; gap: 0.55rem; margin: 0.85rem 0; color: #d7dfd8; font-size: 0.86rem; cursor: pointer; }
.check-line input { width: 18px; height: 18px; accent-color: var(--gold); }
.attachment-grid { padding-top: 0.85rem; border-top: 1px solid rgba(238, 241, 232, 0.1); }
.field input[type="file"] { padding: 0.48rem; color: var(--muted); font-size: 0.82rem; }
.field input[type="file"]::file-selector-button { min-height: 32px; margin-right: 0.6rem; padding: 0.35rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: rgba(228, 189, 105, 0.08); cursor: pointer; }
.attached-file { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.8rem; padding: 0.65rem 0.8rem; border: 1px solid rgba(120, 198, 149, 0.22); border-radius: 8px; background: rgba(120, 198, 149, 0.055); }
.attached-file span, .attached-file strong { display: block; }
.attached-file span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 0.76rem; }
.attached-file strong { margin-bottom: 0.15rem; color: #c9ead5; }
.builder-score-preview { margin-top: 0.75rem; }
.builder-score-preview .score-image, .builder-score-preview .score-pdf { max-height: 320px; }
.builder-feedback { min-height: 44px; margin: 0.9rem 0; padding: 0.7rem 0.8rem; border-left: 2px solid var(--line); color: #c6d0c8; background: rgba(255, 255, 255, 0.025); font-size: 0.82rem; line-height: 1.45; }
.builder-feedback.is-success { border-color: var(--success); color: #c9ead5; background: rgba(41, 105, 70, 0.13); }
.builder-feedback.is-warning { border-color: var(--gold); color: #f0dba6; background: rgba(126, 93, 39, 0.12); }
.builder-feedback.is-error { border-color: var(--danger); color: #f0c0b6; background: rgba(112, 49, 42, 0.13); }
.editor-actions { justify-content: flex-end; }

.score-reference { min-height: 240px; }
.score-reference-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 0.55rem; }
.score-reference-heading strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dce4dd; font-size: 0.78rem; }
.score-reference-heading a { flex: 0 0 auto; color: var(--gold-bright); font-size: 0.76rem; text-underline-offset: 3px; }
.score-image, .score-pdf { display: block; width: 100%; max-height: 480px; border: 1px solid rgba(238, 241, 232, 0.14); border-radius: 8px; background: #f5f3ed; object-fit: contain; }
.score-pdf { min-height: 430px; }
.score-loading, .score-missing { display: grid; place-items: center; min-height: 140px; padding: 1rem; border: 1px dashed rgba(238, 241, 232, 0.18); border-radius: 8px; color: var(--muted); text-align: center; }
.score-missing strong, .score-missing span { display: block; }
.score-missing span { margin-top: 0.35rem; max-width: 360px; font-size: 0.78rem; line-height: 1.45; }

.song-preview-card { width: min(1160px, 100%); }
.song-preview-card.is-exam { border-color: rgba(228, 189, 105, 0.42); }
.song-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.song-preview-heading h2 { font-size: clamp(1.7rem, 4vw, 2.7rem); }
.preview-badge { flex: 0 0 auto; padding: 0.4rem 0.6rem; border: 1px solid rgba(120, 198, 149, 0.45); border-radius: 999px; color: #c9ead5; background: rgba(120, 198, 149, 0.08); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.preview-badge.is-assessed { border-color: rgba(228, 189, 105, 0.5); color: var(--gold-bright); background: rgba(228, 189, 105, 0.09); }
.song-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.8rem 0 1rem; }
.song-meta span { padding: 0.35rem 0.55rem; border: 1px solid rgba(238, 241, 232, 0.14); border-radius: 999px; color: #cbd5cd; background: rgba(255, 255, 255, 0.03); font-size: 0.74rem; }
.student-song-layout { display: grid; grid-template-columns: 1fr; gap: 0.9rem; }
.student-song-layout.has-score { grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr); }
.student-score, .performance-panel { min-width: 0; padding: 0.85rem; border: 1px solid rgba(238, 241, 232, 0.13); border-radius: 11px; background: rgba(1, 10, 7, 0.52); }
.performance-panel { display: grid; align-content: start; justify-items: center; text-align: center; }
.performance-panel .section-label { width: 100%; }
.preview-mode-selector { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0 0 0.7rem; padding: 0.28rem; border: 1px solid rgba(238, 241, 232, 0.13); border-radius: 9px; background: rgba(255, 255, 255, 0.025); }
.preview-mode-selector legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.preview-mode-selector label { position: relative; cursor: pointer; }
.preview-mode-selector input { position: absolute; opacity: 0; pointer-events: none; }
.preview-mode-selector span { display: block; min-height: 38px; padding: 0.55rem 0.7rem; border-radius: 6px; color: var(--muted); font-size: 0.78rem; font-weight: 750; }
.song-preview-card.is-exam .preview-mode-selector span { min-height: 44px; }
.preview-mode-selector input:checked + span { color: #172017; background: linear-gradient(180deg, #f0cf83, #d5a951); }
.preview-mode-selector input:focus-visible + span { outline: 3px solid var(--gold-bright); outline-offset: 2px; }
.preview-mode-selector input:disabled + span { cursor: not-allowed; opacity: 0.62; }
.song-countdown { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center; gap: 0.65rem 1rem; width: min(390px, 100%); min-height: 108px; margin: 0.25rem auto 0.8rem; padding: 0.7rem 1rem; border: 1px solid rgba(228, 189, 105, 0.35); border-radius: 12px; background: radial-gradient(circle at 50% 20%, rgba(228, 189, 105, 0.1), transparent 54%), rgba(5, 20, 14, 0.88); }
.song-countdown > span { justify-self: end; color: #ccd6ce; font-size: 0.76rem; font-weight: 850; letter-spacing: 0.1em; text-transform: uppercase; }
.song-countdown > strong { justify-self: start; min-width: 1.8em; color: var(--gold-bright); font: 500 2.7rem/1 Georgia, serif; }
.song-countdown > div { grid-column: 1 / -1; display: flex; justify-content: center; gap: 0.42rem; }
.song-countdown i { width: 11px; aspect-ratio: 1; transform: rotate(45deg); border: 1px solid rgba(228, 189, 105, 0.42); background: #10271f; }
.song-countdown i.is-live { border-color: var(--gold-bright); background: var(--gold); box-shadow: 0 0 12px rgba(228, 189, 105, 0.55); }
.song-countdown.is-active { animation: countdown-strike 260ms ease-out; }
.song-countdown.is-playing, .song-countdown.is-complete { border-color: rgba(120, 198, 149, 0.55); }
.song-countdown.is-playing > strong, .song-countdown.is-complete > strong { color: #c9ead5; font-size: 1.75rem; }
.song-position { margin: 0; color: var(--muted); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.current-chord { margin: 0.65rem 0; }
.current-chord > span, .current-chord > strong, .current-chord > small { display: block; }
.current-chord > span { color: var(--muted); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.current-chord > strong { margin-top: 0.18rem; color: var(--gold-bright); font: 500 clamp(3.4rem, 8vw, 5.6rem)/0.95 Georgia, serif; text-shadow: 0 0 32px rgba(228, 189, 105, 0.2); }
.current-chord > small { margin-top: 0.45rem; color: #c4cec6; font-size: 0.88rem; }
.hand-expectation { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.hand-expectation span { padding: 0.42rem 0.65rem; border: 1px solid rgba(238, 241, 232, 0.13); border-radius: 7px; color: #dbe3dc; background: rgba(255, 255, 255, 0.035); font-size: 0.78rem; }
.preview-status { min-height: 2.7em; margin: 0.8rem 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.virtual-keyboard-card { margin-top: 0.9rem; padding: clamp(0.75rem, 2vw, 1rem); border: 1px solid rgba(228, 189, 105, 0.22); border-radius: 12px; background: linear-gradient(180deg, rgba(23, 43, 34, 0.94), rgba(2, 12, 8, 0.96)); box-shadow: inset 0 1px rgba(255, 255, 255, 0.035); }
.keyboard-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.keyboard-heading > div > span, .keyboard-heading > div > small { display: block; }
.keyboard-heading > div > span { color: #edf3ed; font-size: 0.9rem; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; }
.keyboard-heading > div > small { margin-top: 0.2rem; color: var(--muted); font-size: 0.76rem; }
.keyboard-score { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; }
.keyboard-score > span { padding: 0.38rem 0.55rem; border: 1px solid rgba(238, 241, 232, 0.13); border-radius: 999px; color: var(--muted); background: rgba(255, 255, 255, 0.03); font-size: 0.72rem; }
.keyboard-score strong { color: var(--gold-bright); }
.keyboard-hand-guide { display: grid; grid-template-columns: 1fr 2fr; min-width: 1050px; margin-bottom: 0.35rem; color: #aebbb0; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.09em; text-align: center; text-transform: uppercase; }
.keyboard-hand-guide.is-chord-only { grid-template-columns: 1fr; }
.piano-scroll { width: 100%; overflow-x: auto; padding: 0.15rem 0 0.65rem; scrollbar-width: thin; outline: none; }
.piano-scroll:focus-visible { border-radius: 8px; outline: 3px solid rgba(246, 217, 142, 0.8); outline-offset: 2px; }
.piano-keyboard { position: relative; isolation: isolate; width: 100%; min-width: 1050px; height: 226px; border: 5px solid #030906; border-radius: 8px; background: #030906; box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42); user-select: none; }
.piano-white-keys { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(21, minmax(0, 1fr)); gap: 2px; }
.piano-black-keys { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.piano-key { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.piano-key.is-white { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; padding: 0.5rem 0.15rem 0.45rem; border: 0; border-radius: 0 0 5px 5px; color: #132019; background: linear-gradient(90deg, #c9cec8 0%, #faf9f2 12%, #f5f4ec 72%, #c5cbc5 100%); box-shadow: inset 0 -9px 12px rgba(45, 55, 49, 0.12); cursor: pointer; }
.piano-key.is-black { position: absolute; top: 0; left: var(--key-x); width: calc(100% / 21 * 0.64); height: 62%; transform: translateX(-50%); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0.35rem 0.08rem 0.4rem; border: 1px solid #000; border-radius: 0 0 5px 5px; color: #f1f2ed; background: linear-gradient(90deg, #050706, #263028 42%, #080b09 80%); box-shadow: 0 8px 9px rgba(0, 0, 0, 0.6), inset 0 -5px rgba(255, 255, 255, 0.035); cursor: pointer; pointer-events: auto; }
.piano-key > span { display: block; font: 700 0.78rem/1 Georgia, serif; }
.piano-key > span small { margin-left: 1px; font: 600 0.58rem/1 ui-sans-serif, system-ui, sans-serif; opacity: 0.65; }
.piano-key kbd { min-width: 22px; margin-top: 0.35rem; padding: 0.2rem 0.25rem; border-color: rgba(6, 18, 12, 0.22); color: #28352d; background: rgba(255, 255, 255, 0.46); font-size: 0.62rem; }
.piano-key.is-black kbd { border-color: rgba(255, 255, 255, 0.22); color: #eef1e8; background: rgba(255, 255, 255, 0.08); }
.piano-key:hover:not(:disabled) { filter: brightness(1.06); }
.piano-key.is-white.is-selected { color: #1a2117; background: linear-gradient(180deg, #ffe4a1, #d9ab4e); box-shadow: inset 0 -10px 16px rgba(101, 66, 12, 0.18), 0 0 20px rgba(228, 189, 105, 0.44); }
.piano-key.is-black.is-selected { color: #fff8db; background: linear-gradient(180deg, #b37b25, #604010); box-shadow: 0 8px 9px rgba(0, 0, 0, 0.58), 0 0 22px rgba(228, 189, 105, 0.58); }
.piano-key.is-white.is-fixed { color: #132019; background: linear-gradient(180deg, #d9f1df, #9dc5aa); box-shadow: inset 0 0 0 3px rgba(52, 106, 73, 0.55), 0 0 18px rgba(120, 198, 149, 0.32); }
.piano-key.is-black.is-fixed { color: #effff4; background: linear-gradient(180deg, #4f8060, #193824); box-shadow: 0 8px 9px rgba(0, 0, 0, 0.58), 0 0 20px rgba(120, 198, 149, 0.4); }
.piano-key.is-white.is-wrong { background: linear-gradient(180deg, #f0c6bd, #b96f61); box-shadow: inset 0 0 0 3px rgba(112, 49, 42, 0.45); }
.piano-key.is-black.is-wrong { background: linear-gradient(180deg, #9d5549, #44201b); box-shadow: 0 8px 9px rgba(0, 0, 0, 0.58), 0 0 18px rgba(207, 119, 104, 0.4); }
.piano-key.is-white.is-correct { background: linear-gradient(180deg, #d5f0dc, #78c695); box-shadow: inset 0 0 0 3px rgba(38, 111, 74, 0.42), 0 0 22px rgba(120, 198, 149, 0.42); }
.piano-key.is-black.is-correct { background: linear-gradient(180deg, #4b9467, #173b25); box-shadow: 0 8px 9px rgba(0, 0, 0, 0.58), 0 0 22px rgba(120, 198, 149, 0.48); }
.piano-key.is-struck { animation: piano-strike 180ms ease-out; }
.piano-key:disabled { cursor: not-allowed; filter: saturate(0.15) brightness(0.72); opacity: 0.48; }
.piano-key.is-correct:disabled { filter: none; opacity: 1; }
.octave-divider { position: absolute; z-index: 3; top: 0; bottom: 0; left: 33.333%; width: 2px; transform: translateX(-1px); background: linear-gradient(180deg, rgba(228, 189, 105, 0.55), rgba(228, 189, 105, 0.08)); box-shadow: 0 0 10px rgba(228, 189, 105, 0.24); pointer-events: none; }
.octave-divider.is-second { left: 66.667%; opacity: 0.5; }
.keyboard-controls { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.55rem; }
.keyboard-controls > div { display: flex; gap: 0.5rem; }
.keyboard-controls .primary-button, .keyboard-controls .secondary-button { min-height: 42px; padding: 0.55rem 0.75rem; font-size: 0.78rem; }
.keyboard-readout { min-width: 0; margin: 0; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.keyboard-readout strong { color: #e8ede8; overflow-wrap: anywhere; }
.keyboard-feedback { min-height: 2.7em; margin: 0.65rem 0 0; padding: 0.58rem 0.7rem; border-left: 2px solid var(--line); color: #c8d1ca; background: rgba(255, 255, 255, 0.025); font-size: 0.78rem; line-height: 1.45; }
.keyboard-feedback.is-success { border-color: var(--success); color: #c9ead5; background: rgba(41, 105, 70, 0.13); }
.keyboard-feedback.is-error { border-color: var(--danger); color: #f0c0b6; background: rgba(112, 49, 42, 0.13); }
.keyboard-feedback.is-warning { border-color: var(--gold); color: #f0dba6; background: rgba(126, 93, 39, 0.12); }
.practice-progress { width: 100%; height: 5px; margin-top: 0.55rem; overflow: hidden; border-radius: 999px; background: rgba(238, 241, 232, 0.08); }
.practice-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4c9b69, var(--gold)); transition: width 220ms ease; }
@keyframes piano-strike { 45% { transform: translateY(3px); filter: brightness(1.12); } }
.piano-key.is-black.is-struck { animation-name: piano-black-strike; }
@keyframes piano-black-strike { 45% { transform: translateX(-50%) translateY(3px); filter: brightness(1.15); } }
.chord-builder-scroll { margin: 1rem 0 0.35rem; padding-bottom: 0.75rem; }
.chord-builder-piano { min-width: 500px; height: 188px; }
.chord-builder-piano .piano-white-keys { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.chord-builder-piano .piano-key.is-black { width: calc(100% / 7 * 0.62); }
.chord-builder-piano .piano-key > span { font-size: 0.95rem; }
.chord-builder-piano .piano-key > small { display: block; min-height: 1em; margin-top: 0.35rem; color: inherit; font-size: 0.62rem; opacity: 0.7; }
.chord-builder-piano .piano-key.is-black > small { font-size: 0.56rem; opacity: 0.76; }
.boss-piano-scroll { margin-bottom: 0.35rem; }
.boss-piano { min-width: 760px; height: 198px; }
.boss-piano .piano-white-keys { grid-template-columns: repeat(14, minmax(0, 1fr)); }
.boss-piano .piano-key.is-black { width: calc(100% / 14 * 0.62); }
.boss-piano .piano-key > span { font-size: 0.86rem; }
.boss-piano .piano-key > span small { font-size: 0.55rem; }
.boss-piano .piano-key kbd { font-size: 0.58rem; }
.boss-octave-divider { left: 50%; }
.preview-progression { margin-top: 0.9rem; padding: 0.85rem; border: 1px solid rgba(238, 241, 232, 0.11); border-radius: 10px; background: rgba(255, 255, 255, 0.02); }
.source-note { margin: 0.8rem 0 0; color: var(--muted); font-size: 0.76rem; }
.source-note strong { color: #d7dfd8; }
.preview-actions { margin-top: 1rem; }
.assignment-import-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 0.9rem; align-items: start; }
.assignment-import-grid > .field { padding: 0.8rem; border: 1px solid rgba(238, 241, 232, 0.12); border-radius: 10px; background: rgba(255, 255, 255, 0.025); }
.exam-brief, .exam-input-note, .exam-advice { padding: 0.75rem 0.9rem; border-left: 2px solid var(--gold); color: #c5cec5; background: rgba(228, 189, 105, 0.055); font-size: 0.82rem; line-height: 1.45; }
.exam-brief, .exam-advice { display: grid; gap: 0.25rem; }
.exam-brief strong, .exam-advice strong { color: var(--gold-bright); }
.exam-input-note { margin: 0.9rem 0 0; }
.practice-count { margin: 0.85rem 0 0; color: var(--muted); font-size: 0.8rem; text-align: center; }
.practice-count strong { color: var(--gold-bright); font-size: 0.95rem; }
.exam-advice { margin: 0 0 1.25rem; border-color: var(--success); background: rgba(120, 198, 149, 0.055); }
.song-exam-result { width: min(820px, 100%); }
.song-exam-result .stage-actions .text-button, .song-preview-card.is-exam .stage-actions .text-button { min-height: 44px; }

@media (max-width: 760px) {
  .chapter-progress, .quest-panel { display: none; }
  .stage { padding-top: 2rem; }
  .stage:not(.world-mode) { max-height: calc(100vh - 145px); }
  .stage.world-mode { min-height: calc(100vh - 145px); }
  .avatar-choice-row { flex-direction: column; }
  .control-hint { display: none; }
  .statusbar span { max-width: 70%; }
  .destination-hub { min-height: calc(100vh - 145px); max-height: calc(100vh - 145px); }
  .destination-hub { padding: 1.4rem 0.85rem 2rem; }
  .destination-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .destination-card { min-height: 188px; }
  .hub-action { padding-top: 0.25rem; }
  .note-grid { grid-template-columns: repeat(6, 1fr); }
  .note-stone { min-height: 60px; }
  .answer-grid, .choice-grid, .result-grid { grid-template-columns: 1fr; }
  .assignment-import-grid { grid-template-columns: 1fr; }
  .challenge-heading { align-items: center; }
  .boss-health { grid-template-columns: 1fr; gap: 0.55rem; }
  .boss-health ol { width: 100%; }
  .boss-keyboard-heading { display: grid; gap: 0.2rem; }
  .teacher-heading { padding: 1rem; }
  .teacher-heading > div > p:last-child { max-width: 440px; }
  .teacher-tabs { padding-inline: 1rem; }
  .teacher-grid { grid-template-columns: 1fr; }
  .lesson-create-card { grid-template-columns: 1fr; align-items: stretch; }
  .lesson-list { grid-template-columns: 1fr; }
  .song-library { border-right: 0; border-bottom: 1px solid var(--line); }
  .song-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .local-note { margin-top: 0.8rem; }
  .results-toolbar { align-items: stretch; flex-direction: column; }
  .results-filter select { width: 100%; }
  .results-actions { justify-content: flex-start; }
  .results-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.two-columns, .student-song-layout.has-score { grid-template-columns: 1fr; }
  .song-preview-heading { align-items: flex-start; }
  .preview-badge { max-width: 150px; text-align: center; }
  .keyboard-heading { flex-direction: column; }
  .keyboard-score { justify-content: flex-start; }
  .keyboard-controls { align-items: stretch; flex-direction: column; }
  .keyboard-controls > div { width: 100%; }
  .keyboard-controls .primary-button { flex: 1; }
  .keyboard-hand-guide { min-width: 990px; }
  .piano-keyboard { min-width: 990px; height: 205px; }
  .chord-builder-piano { min-width: 500px; height: 176px; }
  .boss-piano { min-width: 720px; height: 188px; }
}

@media (max-width: 900px) and (min-width: 761px) {
  .destination-hub { padding-top: 1.5rem; }
  .destination-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 860px; }
  .destination-card { min-height: 185px; }
  .lesson-create-card { grid-template-columns: 1fr; align-items: stretch; }
  .lesson-list { grid-template-columns: 1fr; }
}

@media (min-width: 981px) {
  .stage:not(.world-mode) { padding-top: 3rem; padding-left: 370px; }
}

@media (max-width: 980px) {
  .quest-panel { display: none; }
  .stage:not(.world-mode) { padding-top: 2.2rem; }
}

@media (max-height: 700px) and (min-width: 901px) {
  .destination-hub { gap: 0.7rem; padding-top: 0.85rem; padding-bottom: 4.3rem; }
  .hub-title { font-size: 2.15rem; }
  .hub-copy { margin-top: 0.35rem; }
  .hub-progress { margin-top: 0.5rem; }
  .destination-card { min-height: 178px; }
  .destination-detail { min-height: 1.35em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hub-message { margin-top: 0.35rem; }
}

@media (max-width: 480px) {
  .topbar { padding-block: 0.65rem; }
  .topbar-actions { gap: 0.4rem; }
  .brand-rune { width: 36px; }
  .icon-button { min-height: 36px; }
  .energy-meter > span, .energy-meter strong { display: none; }
  .energy-meter { padding-inline: 0.45rem; }
  .stage { padding-inline: 0.7rem; }
  .stage.world-mode { padding-inline: 0; }
  .panel-padding, .start-card { padding: 1.15rem; }
  .classroom-code-fields { grid-template-columns: 1fr; }
  .control-hint { display: none; }
  .destination-grid { grid-template-columns: 1fr; }
  .destination-card { min-height: 170px; }
  .destination-detail { min-height: auto; }
  .hub-title { font-size: 2rem; }
  .hub-nav .primary-button { min-width: 0; flex: 1; }
  .pulse-countdown { grid-template-columns: 1fr 1fr; gap: 0.5rem 1rem; min-height: 132px; }
  .countdown-label { grid-column: 1 / -1; justify-self: center; }
  .pulse-countdown > strong { justify-self: end; }
  .countdown-beats { justify-self: start; }
  .travel-route { top: 1rem; }
  .travel-arrival { bottom: 4.8rem; }
  .travel-skip span { display: none; }
  .teacher-button { padding-inline: 0.45rem; }
  .teacher-heading { display: grid; }
  .teacher-heading .secondary-button { width: 100%; }
  .teacher-tabs { overflow-x: auto; }
  .teacher-results { padding: 0.85rem; }
  .teacher-sessions { padding: 0.85rem; }
  .lesson-create-grid { grid-template-columns: 1fr; }
  .lesson-create-grid .primary-button { width: 100%; }
  .lesson-list-heading { align-items: flex-start; flex-direction: column; }
  .lesson-list-heading small { text-align: left; }
  .lesson-code-row { align-items: stretch; flex-direction: column; }
  .lesson-code-row .secondary-button { width: 100%; }
  .lesson-actions { display: grid; grid-template-columns: 1fr; }
  .lesson-actions > * { width: 100%; }
  .lesson-actions .danger-text-button { margin-left: 0; }
  .results-local-note { grid-template-columns: 1fr; }
  .results-actions { display: grid; grid-template-columns: 1fr; }
  .results-actions > * { width: 100%; }
  .result-file-field { max-width: none; }
  .song-list { grid-template-columns: 1fr; }
  .song-editor { padding: 0.9rem; }
  .editor-title-row { align-items: center; }
  .choices-grid { grid-template-columns: 1fr !important; }
  .attached-file, .song-preview-heading { display: grid; }
  .preview-badge { max-width: none; justify-self: start; }
  .song-preview-card { padding: 1rem; }
  .score-pdf { min-height: 330px; }
  .current-chord > strong { font-size: 3.6rem; }
  .virtual-keyboard-card { margin-inline: -0.25rem; padding: 0.65rem; }
  .keyboard-hand-guide { min-width: 930px; }
  .piano-keyboard { min-width: 930px; height: 195px; }
  .chord-builder-piano { min-width: 470px; height: 168px; }
  .boss-piano { min-width: 690px; height: 180px; }
  .boss-health li { padding-inline: 0.35rem; }
  .boss-health li b { font-size: 0.62rem; }
  .piano-key > span { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .travel-camera { animation: none; transform: none; }
  .travel-from, .travel-mid, .travel-foreground, .travel-marker, .travel-stride { display: none; }
  .travel-to { opacity: 1; transform: none; animation: none; }
  .travel-route { opacity: 0; animation: none; }
  .travel-arrival { opacity: 1; transform: translateX(-50%); animation: none; }
}
