/* ============================================================================
   MARIFA on a laptop (ADR-0014): every step is one screen, no page scrolling.
   The 3D drawing board and its control console on the left; the lesson on a
   paper card on the right; all on a dark drafting-table shell. Phones are not
   affected: everything here applies only to wide, tall-enough screens.
   ============================================================================ */
.lesson-name, .hero-art, .lesson-go { display: none; }

@media (min-width: 1024px) and (min-height: 600px) {
  :root {
    --shell: #0a1729;
    --shell-line: rgba(150, 190, 235, 0.055);
    --shell-edge: rgba(160, 200, 240, 0.16);
    --shell-text: #e9f0f8;
    --shell-dim: #9fb6cf;
    --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  }
  html, body { height: 100%; }
  html { background: var(--shell); }
  body {
    display: flex; flex-direction: column; overflow: hidden;
    font-size: 15.5px; line-height: 1.55;
    background-color: var(--shell);
    background-image:
      radial-gradient(900px 520px at 72% -10%, rgba(52, 110, 180, 0.28), transparent 70%),
      radial-gradient(700px 500px at 0% 110%, rgba(240, 169, 27, 0.07), transparent 70%),
      linear-gradient(var(--shell-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--shell-line) 1px, transparent 1px);
    background-size: auto, auto, 28px 28px, 28px 28px;
  }

  /* ---- top bar: brand, lesson, steps, points ---- */
  .top {
    position: relative; flex: none; height: 62px; padding: 0 26px; gap: 20px;
    background: rgba(7, 18, 33, 0.72); border-bottom: 1px solid var(--shell-edge); color: var(--shell-text);
  }
  .brand { color: #f6f1e7; font-size: 0.9rem; }
  .lesson-name {
    display: flex; flex-direction: column; justify-content: center; padding-left: 20px;
    border-left: 1px solid var(--shell-edge); font: italic 600 1rem/1.15 var(--serif); color: #f6f1e7;
  }
  .lesson-name b { font: normal 700 0.66rem/1.4 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
  .dots { gap: 8px; }
  .dot { width: 36px; height: 36px; font-size: 0.8rem; background: rgba(255, 255, 255, 0.04); border-color: rgba(160, 200, 240, 0.28); color: var(--shell-dim); }
  .dot.done { border-color: #46b38f; color: #8fe6c4; background: rgba(70, 179, 143, 0.1); }
  .dot.current { border-color: var(--accent); background: var(--accent); color: #17191e; box-shadow: 0 0 0 5px rgba(240, 169, 27, 0.18), 0 0 24px rgba(240, 169, 27, 0.35); }
  .score { padding: 7px 14px; font-size: 0.95rem; background: rgba(255, 255, 255, 0.05); border-color: rgba(160, 200, 240, 0.28); color: #f6f1e7; }
  .score-unit { color: var(--shell-dim); }
  .progress { height: 2px; }

  /* ---- the working area ---- */
  main { flex: 1; min-height: 0; width: 100%; max-width: 1760px; margin: 0 auto; padding: 18px 26px 22px; display: flex; flex-direction: column; }
  .step:not([hidden]) { flex: 1; min-height: 0; }
  .foot { display: none; }

  .step.split { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 30vw, 470px); gap: 22px; }

  /* the drawing board: the 3D view, then its control console */
  .view {
    position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
    border-radius: 22px; background: #12365c; border: 1px solid rgba(160, 200, 240, 0.24);
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.85), 0 0 0 6px rgba(255, 255, 255, 0.02);
  }
  .view .stage { flex: 1; min-height: 0; margin: 0; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }
  .view .board { flex: 1; min-height: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; display: flex; align-items: center; justify-content: center; padding: 24px; }
  .view .board svg { width: auto; height: auto; max-width: 100%; max-height: 100%; }
  .view .scene-caption {
    position: absolute; bottom: 14px; right: 14px; z-index: 1; margin: 0; padding: 6px 12px; pointer-events: none;
    border: 1px solid rgba(207, 224, 247, 0.32); border-radius: 8px; background: rgba(8, 26, 48, 0.62);
    color: #cfe0f7; font-size: 10.5px;
  }
  .view .scene-hint { bottom: 14px; left: 14px; }
  .view .scene-reset { top: 14px; right: 14px; bottom: auto; }
  .scene-label { font-size: 16px; }
  .scene-label small { font-size: 12.5px; }
  .scene-tag { font-size: 14px; }
  .scene-tag small { font-size: 11.5px; }

  /* the console under the board, with its own dark palette */
  .dock {
    --surface: #15304f; --bg: #10273f; --text: #eaf1f9; --text-dim: #9fb6cf; --line: #2d4d72;
    --accent-soft: rgba(255, 182, 39, 0.16); --accent-ink: #ffc85a; --shadow: none;
    flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px;
    padding: 14px 18px 16px; color: var(--text);
    background: linear-gradient(180deg, #0f2540, #0b1d33); border-top: 1px solid rgba(160, 200, 240, 0.2);
  }
  .dock > * { margin: 0 !important; }
  .dock .chips { flex: 1 1 auto; }
  .dock .toggle { flex: none; }
  .dock .sliders { flex: 1 1 380px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 26px; padding: 0; border: 0; background: none; }
  .dock .sliders label { color: var(--text-dim); font-size: 0.88rem; }
  .dock .equation { flex: 1 1 100%; order: 5; font-size: 1.05rem; padding: 8px 12px; color: #ffe1a6; background: rgba(255, 182, 39, 0.1); border: 1px solid rgba(255, 182, 39, 0.22); }
  .dock .equation:empty { display: none; }
  .dock .status { flex: 1 1 100%; order: 6; min-height: 0; font-size: 0.92rem; color: #ffd38a; }
  .dock .status:empty { display: none; }
  .dock .hint { color: var(--text-dim); }
  .dock .action, .dock .secondary { padding: 8px 15px; }
  .dock .secondary { border-color: var(--accent); }

  /* the lesson: a paper card on the right */
  .panel {
    display: flex; flex-direction: column; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 26px 28px 0; border-radius: 22px; background: var(--surface); color: var(--text);
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8); scrollbar-width: thin;
  }
  .panel > * { flex-shrink: 0; }
  .panel > .kicker:first-child { margin-top: 0; }
  .panel h1, .step:not(.split) h1 { font: 700 2rem/1.1 var(--serif); letter-spacing: -0.01em; margin: 10px 0 12px; }
  .panel p { margin: 0 0 10px; }
  .panel .safety { font-size: 0.82rem; }
  .panel .task { margin: 14px 0 12px; padding: 13px 15px 13px 18px; }
  .panel .found { margin: 10px 0 12px; }
  .panel .match { margin: 6px 0 12px; }
  .panel .step-nav {
    position: sticky; bottom: 0; margin-top: 0; padding: 4px 0 22px;
    background: linear-gradient(to bottom, transparent, var(--surface) 28%);
  }
  .panel .next { display: block; width: 100%; }
  .lesson-map { list-style: none; margin: auto 0 12px; padding: 12px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 2px; counter-reset: map; }
  .lesson-map li { counter-increment: map; }
  .lesson-map button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 3px 4px; border: 0; border-radius: 8px;
    background: none; color: var(--text-dim); font-size: 0.86rem; text-align: left; cursor: pointer;
  }
  .lesson-map button::before {
    content: counter(map); flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
    border: 1.5px solid var(--line); font: 700 0.68rem var(--font);
  }
  .lesson-map li:last-child button::before { content: "Q"; }
  .lesson-map button:not(:disabled):hover { background: var(--accent-soft); color: var(--text); }
  .lesson-map button:disabled { opacity: 0.45; cursor: default; }
  .lesson-map li.done button::before { content: "✓"; border-color: var(--good); background: var(--good); color: #fff; }
  .lesson-map li.current button { color: var(--text); font-weight: 700; }
  .lesson-map li.current button::before { border-color: var(--accent); background: var(--accent); color: #17191e; }

  /* ---- the quiz and the results: one large sheet each ---- */
  .step:not(.split):not([hidden]) {
    overflow-y: auto; padding: 28px 34px; border-radius: 22px; background: var(--surface); color: var(--text);
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, 0.8); scrollbar-width: thin;
  }
  #step-7 > p:not(.kicker) { margin: 0 0 6px; color: var(--text-dim); }
  #quiz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
  #quiz .q { margin: 0; padding: 14px; font-size: 0.93rem; }
  #quiz .q h2 { font-size: 0.97rem; }
  #quiz .choices { gap: 6px; margin-top: 10px; }
  #quiz .choices button { padding: 8px 10px; }
  #step-7 .step-nav { margin-top: 18px; }
  .step.end:not([hidden]) { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
  .step.end > * { width: 100%; max-width: 760px; }
  .step.end > .end-hero { width: 120px; flex: none; }
  .step.end > #restart { width: auto; }
  .step.end h1 { font-size: 2.6rem; }
  .end-links { justify-content: center; }
  .badges { grid-template-columns: repeat(3, 1fr); }

  .toast { bottom: 30px; }

  /* shorter laptop screens: tighter type, and the step list gives way to the content */
  .lesson-map { display: none; }
}
@media (min-width: 1024px) and (min-height: 860px) {
  .lesson-map { display: grid; }
}
@media (min-width: 1024px) and (min-height: 600px) and (max-height: 780px) {
  body { font-size: 14.5px; line-height: 1.5; }
  .top { height: 54px; }
  main { padding: 12px 22px 14px; }
  .panel { padding: 20px 22px 0; }
  .panel h1, .step:not(.split) h1 { font-size: 1.65rem; margin: 6px 0 8px; }
  .panel .task { margin: 10px 0 8px; padding: 10px 13px 10px 16px; }
  .panel .choices button, .panel .pick { padding: 8px 10px; }
  .panel .step-nav { padding: 4px 0 16px; }
  .panel .next { padding: 12px 18px; }
  .dock { padding: 10px 16px 12px; gap: 8px 14px; }
  .step:not(.split):not([hidden]) { padding: 20px 26px; }
  #quiz { gap: 10px; }
  #quiz .q { padding: 11px 12px; font-size: 0.88rem; }
  #quiz .choices button { padding: 6px 9px; }

}

@media (min-width: 1024px) and (min-height: 600px) {
  /* ---- the home page: one screen, a drawing beside the lessons ---- */
  .home-page main {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr); grid-template-rows: 1fr auto;
    align-items: center; gap: 0 64px; padding: 24px 6vw 18px;
  }
  .home-hero { margin: 0; color: var(--shell-text); }
  .home-hero .kicker { color: var(--shell-dim); }
  .home-hero h1 { font: 700 clamp(2.8rem, 4.6vw, 4.4rem)/1.02 var(--serif); letter-spacing: -0.02em; color: #f6f1e7; margin: 16px 0 18px; }
  .home-hero h1 em { font-style: italic; color: var(--accent); }
  .home-hero p { color: #b9cbe0; font-size: 1.12rem; max-width: 32rem; }
  .hero-art { display: block; width: min(100%, 560px); margin-top: 22px; }
  .hero-art svg { width: 100%; height: auto; }
  .lessons { margin: 0; gap: 18px; }
  .lesson-card {
    grid-template-columns: 72px 1fr; gap: 18px; padding: 22px 24px; border-radius: 20px;
    border: 1px solid rgba(160, 200, 240, 0.18); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
  }
  .lesson-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8), 0 0 0 4px rgba(240, 169, 27, 0.15); }
  .lesson-icon { width: 72px; height: 72px; border-radius: 18px; }
  .lesson-icon svg { width: 42px; height: 42px; }
  .lesson-card h2 { font: 700 1.35rem/1.2 var(--serif); }
  .lesson-card p { font-size: 0.95rem; }
  .lesson-meta { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
  .lesson-go { display: inline; font-weight: 800; color: var(--accent-ink); }
  .home-page .foot { display: block; grid-column: 1 / -1; margin: 0; color: var(--shell-dim); }
}

/* the hero drawing's linework */
.hero-art .ln { fill: none; stroke: #9fc2ea; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hero-art .ln-dim { fill: none; stroke: rgba(159, 194, 234, 0.45); stroke-width: 1; stroke-dasharray: 4 5; }
.hero-art .glow { fill: url(#hero-glow); }
.hero-art .amber { fill: none; stroke: #ffb627; stroke-width: 2; stroke-linecap: round; }
.hero-art .flowdots { fill: none; stroke: #ffb36b; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0.1 16; animation: hero-flow 1.6s linear infinite; }
.hero-art text { fill: #9fb6cf; font: italic 13px Georgia, serif; }
.hero-art .mono { font: 600 10px Consolas, "Courier New", monospace; letter-spacing: 0.12em; fill: #6f8db0; font-style: normal; }
@keyframes hero-flow { to { stroke-dashoffset: -32.2; } }
@media (prefers-reduced-motion: reduce) { .hero-art .flowdots { animation: none; } }
