  @import url('https://fonts.googleapis.com/css2?family=IM+Fell+English:ital@0;1&family=IM+Fell+DW+Pica+SC&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

  * { margin: 0; padding: 0; box-sizing: border-box; }

  :root {
    --parchment: #f4edd3;
    --parchment-dark: #e8dfc0;
    --ink: #2a1f0e;
    --ink-light: #5a4a2e;
    --ink-faint: #9a8a6a;
    --copper: #8b5e3c;
    --gold: #c9a84c;
    --gold-dim: #a08030;
    --red-ink: #8b2500;
  }

  body {
    background: var(--parchment);
    color: var(--ink);
    font-family: 'Cormorant Garamond', serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(42,31,14,0.015) 3px, rgba(42,31,14,0.015) 4px),
      radial-gradient(ellipse at 20% 50%, rgba(139,94,60,0.08) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 30%, rgba(139,94,60,0.05) 0%, transparent 40%);
    pointer-events: none;
    z-index: 1;
  }

  body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(42,31,14,0.25) 100%);
    pointer-events: none;
    z-index: 2;
  }

  /* ============ STEP SYSTEM ============ */

  .step {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
  }
  .step.active { opacity: 1; pointer-events: auto; }

  .step-bg {
    position: absolute;
    inset: 0;
    background: rgba(244, 237, 211, 0.97);
    z-index: -1;
  }

  .nav-btn {
    font-family: 'IM Fell DW Pica SC', serif;
    font-size: 13px;
    letter-spacing: 2px;
    padding: 9px 28px;
    border: 1.5px solid var(--ink);
    background: none;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.3s;
  }
  .nav-btn:hover { background: var(--ink); color: var(--parchment); }
  .nav-btn.small {
    font-size: 11px;
    padding: 6px 16px;
    border-width: 1px;
    border-color: var(--ink-faint);
    color: var(--ink-light);
    letter-spacing: 1px;
  }
  .nav-btn.small:hover { background: var(--ink-light); color: var(--parchment); }

  .ornament { color: var(--ink-faint); font-size: 18px; letter-spacing: 12px; margin: 20px 0; }

  /* ============ STEP 1 — TITLE ============ */

  #step-title { z-index: 60; }
  #step-title h1 { font-family: 'IM Fell DW Pica SC', serif; font-size: 34px; letter-spacing: 6px; font-weight: 400; }
  #step-title .lat { font-family: 'IM Fell English', serif; font-style: italic; font-size: 16px; color: var(--ink-light); margin-top: 4px; }
  #step-title .author { font-family: 'Cormorant Garamond', serif; font-size: 14px; color: var(--ink-faint); letter-spacing: 2px; margin-top: 2px; }
  #step-title .btn-row { display: flex; gap: 16px; margin-top: 8px; align-items: center; }
  #step-title .footer-note { font-size: 11px; color: var(--ink-faint); font-style: italic; max-width: 420px; line-height: 1.6; margin-top: 20px; padding: 0 24px; }

  /* ============ STEP 2 — DESCRIPTION ============ */

  #step-desc { overflow-y: auto; padding: 60px 24px; justify-content: flex-start; }
  #step-desc .content { max-width: 600px; margin: auto; text-align: left; }
  #step-desc h2 { font-family: 'IM Fell DW Pica SC', serif; font-size: 22px; letter-spacing: 3px; text-align: center; margin-bottom: 6px; }
  #step-desc .subtitle-line { text-align: center; font-family: 'IM Fell English', serif; font-style: italic; font-size: 13px; color: var(--copper); margin-bottom: 24px; }
  #step-desc p { font-size: 16px; line-height: 1.85; margin-bottom: 16px; color: var(--ink-light); text-align: justify; hyphens: auto; }
  #step-desc p .dropcap { font-family: 'IM Fell DW Pica SC', serif; font-size: 42px; float: left; line-height: 0.8; margin: 4px 8px 0 0; color: var(--ink); }
  #step-desc p em { color: var(--copper); }
  #step-desc .quote-block { border-left: 2px solid var(--ink-faint); padding: 8px 0 8px 20px; margin: 20px 0; font-family: 'IM Fell English', serif; font-style: italic; font-size: 15px; color: var(--ink); line-height: 1.7; }
  #step-desc .quote-attr { font-family: 'Cormorant Garamond', serif; font-style: normal; font-size: 12px; color: var(--ink-faint); margin-top: 6px; letter-spacing: 1px; }
  #step-desc .btn-row, #step-solids .btn-row { display: flex; gap: 14px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }

  /* ============ STEP 3 — PLATONIC SOLIDS ============ */

  #step-solids { overflow-y: auto; padding: 40px 16px; justify-content: flex-start; }
  #step-solids h2 { font-family: 'IM Fell DW Pica SC', serif; font-size: 20px; letter-spacing: 3px; margin-bottom: 4px; }
  #step-solids .subtitle-line { font-family: 'IM Fell English', serif; font-style: italic; font-size: 13px; color: var(--copper); margin-bottom: 20px; }
  #step-solids .solids-intro { max-width: 560px; font-size: 14px; line-height: 1.7; color: var(--ink-light); text-align: center; margin-bottom: 24px; }

  .solids-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; max-width: 820px; width: 100%; padding: 0 8px; }
  .solid-card { border: 1px solid var(--ink-faint); padding: 16px; background: rgba(244,237,211,0.6); text-align: center; transition: border-color 0.3s; }
  .solid-card:hover { border-color: var(--copper); }
  .solid-card canvas { width: 140px !important; height: 140px !important; margin: 0 auto 10px; display: block; }
  .solid-card h4 { font-family: 'IM Fell DW Pica SC', serif; font-size: 13px; letter-spacing: 2px; margin-bottom: 2px; }
  .solid-card .solid-name { font-family: 'IM Fell English', serif; font-style: italic; font-size: 13px; color: var(--copper); margin-bottom: 6px; }
  .solid-card .solid-between { font-size: 12px; color: var(--ink-light); line-height: 1.5; }
  .solid-card .solid-faces { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

  /* ============ STEP 4 — SIMULATION ============ */

  #canvas-container { position: fixed; inset: 0; z-index: 0; }
  canvas { display: block; }

  .sim-ui { opacity: 0; pointer-events: none; transition: opacity 0.6s; }
  .sim-ui.visible { opacity: 1; pointer-events: auto; }

  #title-cartouche {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 10; text-align: center; padding: 12px 40px 8px;
    border: 1.5px solid var(--ink-faint); border-radius: 2px;
    background: rgba(244,237,211,0.92); backdrop-filter: blur(4px);
  }
  #title-cartouche::before, #title-cartouche::after { content: '✦'; position: absolute; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 10px; }
  #title-cartouche::before { left: 12px; }
  #title-cartouche::after { right: 12px; }
  #title-cartouche h1 { font-family: 'IM Fell DW Pica SC', serif; font-size: 18px; letter-spacing: 4px; font-weight: 400; text-transform: uppercase; }
  #title-cartouche .subtitle { font-family: 'IM Fell English', serif; font-style: italic; font-size: 12px; color: var(--ink-light); margin-top: 2px; letter-spacing: 1px; }

  #controls {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 10; display: flex; gap: 16px; align-items: center; padding: 10px 24px;
    border: 1px solid var(--ink-faint); background: rgba(244,237,211,0.92); backdrop-filter: blur(4px);
    font-family: 'Cormorant Garamond', serif; font-size: 13px;
  }
  #controls label { display: flex; align-items: center; gap: 6px; color: var(--ink-light); white-space: nowrap; user-select: none; }
  #controls input[type="range"] { -webkit-appearance: none; appearance: none; width: 100px; height: 2px; background: var(--ink-faint); outline: none; cursor: pointer; }
  #controls input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; background: var(--ink); border-radius: 50%; cursor: pointer; }

  .btn { background: none; border: 1px solid var(--ink-faint); color: var(--ink); font-family: 'IM Fell English', serif; font-size: 12px; padding: 4px 14px; cursor: pointer; transition: all 0.2s; letter-spacing: 1px; }
  .btn:hover { background: var(--ink); color: var(--parchment); }
  .btn.active { background: var(--ink); color: var(--parchment); }

  .controls-sep { width: 1px; height: 20px; background: var(--ink-faint); opacity: 0.4; flex-shrink: 0; }
  .controls-label { font-family: 'IM Fell English', serif; font-style: italic; font-size: 11px; color: var(--ink-faint); white-space: nowrap; }

  .staff-planet.seq-active .dot { box-shadow: 0 0 6px 2px var(--gold); }
  .staff-planet.seq-active .name { color: var(--copper); font-weight: 600; }

  #planet-info {
    position: fixed; top: 100px; right: 24px; z-index: 10; width: 220px; padding: 16px 20px;
    border: 1px solid var(--ink-faint); background: rgba(244,237,211,0.92); backdrop-filter: blur(4px);
    font-size: 13px; line-height: 1.6; opacity: 0; transition: opacity 0.4s; pointer-events: none;
  }
  #planet-info.visible { opacity: 1; pointer-events: auto; }
  #planet-info h3 { font-family: 'IM Fell DW Pica SC', serif; font-size: 15px; letter-spacing: 2px; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--ink-faint); }
  #planet-info .interval { font-family: 'IM Fell English', serif; font-style: italic; color: var(--copper); font-size: 14px; }
  #planet-info .note-range { color: var(--ink-light); font-size: 12px; margin-top: 4px; }

  #staff-display { position: fixed; left: 24px; top: 100px; z-index: 10; width: 180px; font-family: 'Cormorant Garamond', serif; font-size: 11px; color: var(--ink-light); }
  .staff-planet { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; transition: color 0.2s; }
  .staff-planet:hover { color: var(--ink); }
  .staff-planet.muted { opacity: 0.3; }
  .staff-planet .dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink-faint); flex-shrink: 0; }
  .staff-planet .name { width: 60px; font-family: 'IM Fell English', serif; font-size: 11px; }
  .staff-planet .note-indicator { font-style: italic; font-size: 11px; color: var(--copper); min-width: 40px; }
  .staff-planet .toggle-eye { margin-left: auto; font-size: 10px; color: var(--ink-faint); cursor: pointer; padding: 2px 4px; user-select: none; transition: color 0.2s; flex-shrink: 0; }
  .staff-planet .toggle-eye:hover { color: var(--ink); }
  .staff-planet.disabled .toggle-eye { color: var(--red-ink); }
  .staff-planet.disabled .dot, .staff-planet.disabled .name, .staff-planet.disabled .note-indicator { opacity: 0.2; }

  #planets-toggle {
    display: none; position: fixed; top: 12px; left: 12px; z-index: 15;
    background: rgba(244,237,211,0.92); border: 1px solid var(--ink-faint); color: var(--ink);
    font-family: 'IM Fell English', serif; font-size: 11px; padding: 5px 10px;
    cursor: pointer; backdrop-filter: blur(4px); letter-spacing: 1px;
  }

  /* ============ MOBILE ============ */

  @media (max-width: 768px) {
    #step-title h1 { font-size: 22px; letter-spacing: 3px; }
    #step-title .lat { font-size: 13px; }
    #step-title .author { font-size: 12px; }
    #step-title .footer-note { font-size: 10px; max-width: 300px; }
    #step-title .btn-row { flex-direction: column; gap: 10px; }

    #step-desc { padding: 50px 20px; }
    #step-desc h2 { font-size: 18px; }
    #step-desc p { font-size: 14px; line-height: 1.75; }
    #step-desc .quote-block { font-size: 13px; }

    #step-solids { padding: 50px 12px; }
    #step-solids h2 { font-size: 17px; }
    .solids-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
    .solid-card { padding: 12px; }
    .solid-card canvas { width: 100px !important; height: 100px !important; }

    #title-cartouche { top: 10px; left: auto; right: 12px; transform: none; padding: 8px 16px 6px; max-width: calc(100vw - 100px); }
    #title-cartouche h1 { font-size: 13px; letter-spacing: 2px; }
    #title-cartouche .subtitle { font-size: 10px; }
    #title-cartouche::before, #title-cartouche::after { display: none; }

    #planets-toggle.visible { display: block; }

    #staff-display {
      position: fixed; left: 0; top: 0; bottom: 0; width: 200px;
      padding: 70px 12px 80px 12px; background: rgba(244,237,211,0.96);
      backdrop-filter: blur(8px); border-right: 1px solid var(--ink-faint);
      transform: translateX(-100%); transition: opacity 0.6s, transform 0.3s ease;
      overflow-y: auto;
    }
    #staff-display.open { transform: translateX(0); pointer-events: auto; }

    .staff-planet { padding: 6px 0; }
    .staff-planet .name { font-size: 12px; }
    .staff-planet .toggle-eye { font-size: 12px; padding: 4px 6px; }

    #planet-info { top: auto; right: auto; bottom: 80px; left: 50%; transform: translateX(-50%); width: calc(100vw - 32px); max-width: 320px; }

    #controls { bottom: 10px; padding: 8px 12px; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 16px); font-size: 11px; }
    #controls input[type="range"] { width: 60px; }
    .btn { font-size: 10px; padding: 4px 8px; }
    .controls-sep { display: none; }
    .controls-label { font-size: 10px; }
  }

  @media (max-width: 420px) {
    #step-title h1 { font-size: 18px; letter-spacing: 2px; }
    #title-cartouche h1 { font-size: 11px; }
    #title-cartouche .subtitle { display: none; }
    #controls input[type="range"] { width: 48px; }
    #controls { gap: 6px; padding: 6px 8px; }
    .btn { padding: 3px 6px; font-size: 9px; }
    .solids-grid { grid-template-columns: 1fr 1fr; }
  }
