/* ═══════════════════════════════════════════
   ROUTING / Conduit Run mini-game (dark theme)
   ═══════════════════════════════════════════ */

  .routing-screen-wrap {
    padding: var(--sp-16);
    display: flex;
    flex-direction: column;
    gap: var(--sp-16);
    max-width: 720px;
    margin: 0 auto;
  }

  .routing-intro {
    padding: var(--sp-12) var(--sp-14);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    background: var(--surface-1);
    color: var(--dim);
    font-size: 11px;
    line-height: 1.5;
  }

  .routing-streak-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-10) var(--sp-14);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: linear-gradient(180deg, rgba(255,179,0,0.06), rgba(255,179,0,0.02));
  }

  .routing-streak-num {
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    color: var(--amber);
    font-weight: 700;
  }

  .routing-streak-label {
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--dim);
  }

  .routing-difficulty-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-10);
  }

  .routing-difficulty-card {
    padding: var(--sp-14);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
    cursor: pointer;
    transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast);
    display: flex;
    align-items: center;
    gap: var(--sp-12);
  }

  .routing-difficulty-card:active {
    border-color: var(--line-strong);
    background: rgba(255,179,0,0.05);
    transform: translateY(1px);
  }

  .routing-difficulty-card.solved {
    border-color: var(--green-dim);
    background: linear-gradient(180deg, rgba(0,255,136,0.06), rgba(0,255,136,0.02));
  }

  .routing-card-icon {
    font-family: 'Orbitron', monospace;
    font-size: 20px;
    width: 32px;
    text-align: center;
    color: var(--accent);
  }

  .routing-card-body { flex: 1; min-width: 0; }

  .routing-card-title {
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    letter-spacing: 2.4px;
    color: var(--white);
    margin-bottom: 2px;
  }

  .routing-card-detail {
    font-size: 10px;
    color: var(--dim);
  }

  .routing-card-status {
    font-size: 11px;
    color: var(--accent);
    text-align: right;
    white-space: nowrap;
  }

  .routing-card-status.solved {
    color: var(--green);
  }

  /* ===== PUZZLE BOARD ===== */
  .routing-puzzle-wrap {
    padding: var(--sp-16);
    display: flex;
    flex-direction: column;
    gap: var(--sp-12);
    align-items: center;
  }

  .routing-puzzle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 480px;
    padding: var(--sp-8) var(--sp-12);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    background: var(--surface-1);
  }

  .routing-puzzle-title {
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--accent);
  }

  .routing-puzzle-timer {
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    color: var(--white);
    letter-spacing: 1.5px;
  }

  /* Live progress: "X/49 cells · 5/6 pairs" — shows what's left to win */
  .routing-puzzle-status {
    width: 100%;
    max-width: 480px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: var(--dim);
    letter-spacing: 1px;
    padding: 2px 0;
  }
  .routing-puzzle-status--ready {
    color: var(--green) !important;
  }

  .routing-grid {
    display: grid;
    background: var(--bg);
    border: 2px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 4px;
    gap: 2px;
    position: relative;
    touch-action: none; /* prevent scroll while dragging */
    user-select: none;
    width: 100%;
    max-width: 480px;
    aspect-ratio: 1 / 1;
  }

  .routing-cell {
    background: var(--bg2);
    border: 1px solid rgba(255,179,0,0.04);
    position: relative;
    aspect-ratio: 1 / 1;
    container-type: inline-size;
  }

  .routing-cell--blocked {
    background: repeating-linear-gradient(
      45deg,
      rgba(255,179,0,0.18),
      rgba(255,179,0,0.18) 4px,
      rgba(0,0,0,0.6) 4px,
      rgba(0,0,0,0.6) 8px
    );
    border-color: var(--accent-dim);
  }

  /* Endpoint dots — flat matte fills, subtle inner shadow for depth, no neon glow.
     Each dot also prints its glyph (A-J) so the pair is identifiable even when two
     colours read as similar. Glyph sized as % of dot box → scales down to 15x15 grids. */
  .routing-endpoint {
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.4);
    z-index: 3;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono, monospace);
    font-weight: 800;
    /* Glyph scales with the cell via container queries — 50% of cell width.
       Dots are 64% of cell width, so the glyph fills the dot's inner area cleanly. */
    font-size: clamp(13px, 50cqi, 58px);
    /* Engraved look — soft white fill sunk into the dot via a crisp dark shadow
       below + a faint dark halo. Reads on every palette colour in both themes
       without the cartoon-outline cheapness. */
    color: rgba(255, 255, 255, 0.95);
    text-shadow:
      0 1.5px 0 rgba(0, 0, 0, 0.65),
      0 0 4px rgba(0, 0, 0, 0.35);
    letter-spacing: 0;
    line-height: 1;
  }

  /* Path overlay (cell tint when wire passes through) */
  .routing-path {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.5;
    pointer-events: none;
  }

  /* Wire colours — 10 distinct hues, spread ~36° apart on the hue wheel so no two
     read as the same colour at endpoint-dot scale. Glyphs (A-J) inside dots act as
     the second visual channel for accessibility / colourblind play. */
  .routing-c-amber   { background: #c9a73a; color: #c9a73a; }
  .routing-c-cyan    { background: #3aa4a4; color: #3aa4a4; }
  .routing-c-magenta { background: #c44a8a; color: #c44a8a; }
  .routing-c-green   { background: #4d9c5a; color: #4d9c5a; }
  .routing-c-red     { background: #c14a4a; color: #c14a4a; }
  .routing-c-blue    { background: #4470c4; color: #4470c4; }
  .routing-c-purple  { background: #8a4ec4; color: #8a4ec4; }
  .routing-c-orange  { background: #d6802a; color: #d6802a; }
  .routing-c-olive   { background: #8aa83a; color: #8aa83a; }
  .routing-c-pink    { background: #d68aa8; color: #d68aa8; }

  /* Active drag indicator */
  .routing-cell--active-trail {
    box-shadow: inset 0 0 0 2px var(--white);
  }

  /* Win overlay */
  .routing-win-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-20);
  }

  .routing-win-panel {
    background: linear-gradient(180deg, var(--surface-2), var(--surface-3));
    border: 2px solid var(--accent);
    border-radius: var(--r-xl);
    padding: var(--sp-24);
    text-align: center;
    max-width: 360px;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(255,179,0,0.3);
  }

  .routing-win-title {
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    letter-spacing: 3px;
    color: var(--amber);
    margin-bottom: var(--sp-12);
  }

  .routing-win-stats {
    color: var(--dim);
    font-size: 11px;
    line-height: 1.6;
    margin-bottom: var(--sp-16);
  }

  .routing-win-bonus {
    color: var(--green);
    font-family: 'Orbitron', monospace;
    font-size: 13px;
    letter-spacing: 1.5px;
    padding: var(--sp-10);
    border: 1px solid var(--green-dim);
    border-radius: var(--r-md);
    background: rgba(0,255,136,0.06);
    margin-bottom: var(--sp-16);
  }

  /* !important needed — global glossy-button rule uses !important so all overrides must too */
  .routing-win-btn {
    width: 100% !important;
    padding: var(--sp-12) !important;
    background: linear-gradient(180deg, #ffb300, #c88800) !important;
    color: #1a1208 !important;
    border: 1px solid #ffb300 !important;
    border-radius: var(--r-md) !important;
    font-family: 'Orbitron', monospace !important;
    font-size: 11px !important;
    letter-spacing: 2.4px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
  }
  .routing-win-btn:active {
    transform: translateY(1px) !important;
    background: linear-gradient(180deg, #c88800, #a87000) !important;
  }

  /* Reset / undo / new puzzle button row */
  .routing-controls {
    display: flex;
    gap: var(--sp-8);
    width: 100%;
    max-width: 480px;
  }

  /* Variant for the home screen RECORDS row — buttons are auto-sized and the
     pair sits centred in the row instead of stretching to the wrap edges. */
  .routing-controls--center {
    justify-content: center;
  }

  .routing-control-btn {
    flex: 1;
    padding: var(--sp-10);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-md);
    background: var(--surface-1);
    color: var(--dim);
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    letter-spacing: 1.6px;
    cursor: pointer;
  }

  .routing-control-btn:active {
    background: rgba(255,179,0,0.08);
    color: var(--accent);
  }

  /* Auto-width variant — opts out of the flex:1 stretch so the button sizes to
     its label + horizontal padding (used for centred pairs like the RECORDS row). */
  .routing-control-btn--auto {
    flex: 0 0 auto;
    padding-left: var(--sp-20);
    padding-right: var(--sp-20);
  }

  /* History view */
  .routing-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
  }

  .routing-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-10) var(--sp-12);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    background: var(--surface-1);
    font-size: 10px;
    color: var(--dim);
  }

  .routing-history-date {
    font-family: 'JetBrains Mono', monospace;
    color: var(--white);
  }

  .routing-history-marks {
    display: flex;
    gap: var(--sp-4);
    font-size: 12px;
  }

  .routing-history-mark.done { color: var(--green); }
  .routing-history-mark.miss { color: rgba(255,255,255,0.15); }

  /* Status pill — used inline in the difficulty card title */
  .routing-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: var(--r-full);
    font-family: 'Orbitron', monospace;
    font-size: 8px;
    letter-spacing: 1.5px;
    background: rgba(0,255,136,0.12);
    color: var(--green);
    margin-left: var(--sp-6);
  }

  /* ===== PRACTICE CARD (4th tile) — any size, no reward ===== */
  .routing-practice-card {
    padding: var(--sp-12) var(--sp-14);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-lg);
    background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
    display: flex;
    align-items: flex-start;
    gap: var(--sp-12);
  }
  .routing-practice-controls {
    display: flex;
    align-items: center;
    gap: var(--sp-8);
    margin-top: var(--sp-10);
  }
  .routing-practice-select {
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-sm);
    color: var(--white);
    font-family: 'Orbitron', monospace;
    font-size: 11px;
    letter-spacing: 1.2px;
    cursor: pointer;
  }
  /* !important needed to defeat the global glossy-button rule */
  .routing-practice-play-btn {
    padding: 6px 14px !important;
    background: linear-gradient(180deg, #ffb300, #c88800) !important;
    color: #1a1208 !important;
    border: 1px solid #ffb300 !important;
    border-radius: var(--r-sm) !important;
    font-family: 'Orbitron', monospace !important;
    font-size: 10px !important;
    letter-spacing: 1.5px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    text-shadow: none !important;
  }
  .routing-practice-play-btn:active {
    background: linear-gradient(180deg, #c88800, #a87000) !important;
    transform: translateY(1px) !important;
  }

  /* Section divider for "today" vs "history" sections */
  .routing-section-title {
    font-family: 'Orbitron', monospace;
    font-size: 8px;
    letter-spacing: 3px;
    color: var(--dim);
    padding: var(--sp-12) 4px var(--sp-6);
  }

  /* ===== HOW-TO-PLAY GUIDE OVERLAY ===== */
  .routing-guide-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(4px);
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--sp-20);
    overflow-y: auto;
  }

  .routing-guide-modal {
    width: 100%;
    max-width: 480px;
    background: linear-gradient(180deg, var(--surface-2), var(--surface-3));
    border: 1px solid var(--line-strong);
    border-radius: var(--r-xl);
    padding: var(--sp-20);
    box-shadow: var(--shadow-xl);
    margin: var(--sp-20) auto;
  }

  .routing-guide-title {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    letter-spacing: 3px;
    color: var(--amber);
    text-align: center;
    padding-bottom: var(--sp-12);
    border-bottom: 1px solid var(--line-soft);
    margin-bottom: var(--sp-16);
  }

  .routing-guide-section {
    margin-bottom: var(--sp-16);
  }

  .routing-guide-heading {
    font-family: 'Orbitron', monospace;
    font-size: 9px;
    letter-spacing: 2.5px;
    color: var(--accent);
    margin-bottom: var(--sp-8);
  }

  .routing-guide-text {
    color: var(--dim);
    font-size: 11px;
    line-height: 1.55;
  }

  .routing-guide-rules {
    display: flex;
    flex-direction: column;
    gap: var(--sp-6);
    color: var(--dim);
    font-size: 11px;
    line-height: 1.5;
  }

  .routing-guide-rules strong {
    color: var(--white);
    font-weight: 700;
  }

  /* Demo grid uses dedicated classes (rg-cell/rg-fill/rg-dot) so the puzzle's
     aspect-ratio + absolute-positioning rules don't bleed into this 3x3 demo. */
  .routing-guide-grid-demo {
    display: grid;
    grid-template-columns: repeat(3, 44px);
    grid-auto-rows: 44px;
    background: var(--bg);
    border: 2px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 6px;
    gap: 3px;
    width: max-content;
    margin: 0 auto;
  }
  .rg-cell {
    width: 44px;
    height: 44px;
    background: var(--bg2);
    border: 1px solid rgba(255,179,0,0.05);
    position: relative;
  }
  .rg-fill {
    position: absolute;
    inset: 0;
    opacity: 0.5;
    pointer-events: none;
  }
  .rg-dot {
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    z-index: 2;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 700 14px var(--font-mono, monospace);
    color: rgba(0, 0, 0, 0.55);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  /* !important needed — global glossy-button rule otherwise wins */
  .routing-guide-btn {
    width: 100% !important;
    padding: var(--sp-12) !important;
    margin-top: var(--sp-8) !important;
    background: linear-gradient(180deg, #ffb300, #c88800) !important;
    color: #1a1208 !important;
    border: 1px solid #ffb300 !important;
    border-radius: var(--r-md) !important;
    font-family: 'Orbitron', monospace !important;
    font-size: 11px !important;
    letter-spacing: 2.4px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    text-shadow: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
  }
  .routing-guide-btn:active {
    transform: translateY(1px) !important;
    background: linear-gradient(180deg, #c88800, #a87000) !important;
  }

  /* ═══════════════════════════════════════════
     ROUTING visual polish pass
     CSS-only appearance upgrade: industrial console shell
     ═══════════════════════════════════════════ */

  :root {
    --routing-shell-max: 1180px;
    --routing-board-max: 840px;
    --routing-shell-bg:
      linear-gradient(180deg, rgba(22,17,12,0.84) 0%, rgba(10,9,8,0.94) 44%, rgba(5,4,3,1) 100%);
    --routing-panel-bg:
      linear-gradient(180deg, rgba(24,20,16,0.96) 0%, rgba(11,10,9,0.98) 100%);
    --routing-panel-bg-soft:
      linear-gradient(180deg, rgba(20,18,15,0.9) 0%, rgba(10,10,10,0.95) 100%);
    --routing-panel-border: rgba(255,179,0,0.13);
    --routing-panel-border-strong: rgba(255,179,0,0.28);
    --routing-panel-shadow:
      0 18px 40px rgba(0,0,0,0.38),
      inset 0 1px 0 rgba(255,255,255,0.03);
    --routing-panel-shadow-soft:
      0 12px 26px rgba(0,0,0,0.28),
      inset 0 1px 0 rgba(255,255,255,0.025);
    --routing-status-bg: rgba(255,179,0,0.05);
    --routing-status-border: rgba(255,179,0,0.16);
    --routing-board-bg:
      linear-gradient(180deg, rgba(24,20,15,0.98) 0%, rgba(8,8,8,1) 100%);
    --routing-board-border: rgba(255,179,0,0.24);
    --routing-cell-bg:
      linear-gradient(180deg, rgba(18,16,14,1) 0%, rgba(10,10,10,1) 100%);
    --routing-cell-border: rgba(255,179,0,0.07);
    --routing-cell-shadow:
      inset 0 1px 0 rgba(255,255,255,0.02),
      inset 0 -1px 0 rgba(0,0,0,0.3);
    --routing-path-alpha: 0.66;
    --routing-path-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.08),
      0 0 12px rgba(0,0,0,0.35);
    --routing-endpoint-ring: rgba(255,255,255,0.14);
    --routing-endpoint-shadow:
      inset 0 1px 2px rgba(0,0,0,0.35),
      0 0 0 1px rgba(0,0,0,0.24),
      0 10px 18px rgba(0,0,0,0.34);
    --routing-active-ring: rgba(245,248,250,0.92);
    --routing-button-bg:
      linear-gradient(180deg, rgba(30,26,22,0.98) 0%, rgba(12,11,10,1) 100%);
    --routing-button-border: rgba(255,179,0,0.18);
    --routing-button-text: var(--white);
    --routing-button-shadow:
      inset 0 1px 0 rgba(255,255,255,0.04),
      0 10px 20px rgba(0,0,0,0.24);
    --routing-overlay-bg: rgba(4,4,4,0.78);
    --routing-sheen: linear-gradient(180deg, rgba(255,255,255,0.05), transparent 42%);
    --routing-muted: rgba(200,221,232,0.74);
  }

  #screen-routing {
    position: relative;
    container-type: inline-size;
    container-name: routing-screen;
    height: 100%;
    max-height: 100%;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,179,0,0.34) rgba(255,179,0,0.05);
    background:
      radial-gradient(circle at 50% -8%, rgba(255,179,0,0.18) 0%, transparent 32%),
      linear-gradient(180deg, rgba(255,255,255,0.03), transparent 160px),
      linear-gradient(90deg, rgba(255,179,0,0.035) 0, rgba(255,179,0,0.035) 1px, transparent 1px, transparent 28px),
      linear-gradient(0deg, rgba(255,179,0,0.035) 0, rgba(255,179,0,0.035) 1px, transparent 1px, transparent 28px),
      var(--routing-shell-bg);
    background-size: auto, auto, 28px 28px, 28px 28px, auto;
  }

  #screen-routing::-webkit-scrollbar {
    width: 10px;
  }

  #screen-routing::-webkit-scrollbar-track {
    background: rgba(255,179,0,0.05);
  }

  #screen-routing::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255,179,0,0.42), rgba(168,120,0,0.34));
    border-radius: 999px;
    border: 2px solid rgba(5,4,3,0.7);
  }

  .routing-screen-wrap,
  .routing-puzzle-wrap {
    width: min(100%, var(--routing-shell-max));
    padding: clamp(14px, 2.2vw, 24px);
    padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px));
    gap: clamp(12px, 2vw, 18px);
    position: relative;
    z-index: 1;
  }

  .routing-intro,
  .routing-streak-banner,
  .routing-difficulty-card,
  .routing-practice-card,
  .routing-history-row,
  .routing-puzzle-header,
  .routing-puzzle-status,
  .routing-controls,
  .routing-guide-modal,
  .routing-win-panel {
    position: relative;
    overflow: hidden;
    background: var(--routing-panel-bg);
    border-color: var(--routing-panel-border);
    box-shadow: var(--routing-panel-shadow-soft);
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
  }

  .routing-intro::before,
  .routing-streak-banner::before,
  .routing-difficulty-card::before,
  .routing-practice-card::before,
  .routing-history-row::before,
  .routing-puzzle-header::before,
  .routing-guide-modal::before,
  .routing-win-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 44%;
    background: var(--routing-sheen);
    pointer-events: none;
  }

  .routing-intro {
    padding: clamp(15px, 2vw, 20px) clamp(16px, 2.4vw, 22px);
    border-radius: 18px;
    border: 1px solid var(--routing-panel-border);
    background:
      linear-gradient(135deg, rgba(255,179,0,0.07) 0%, transparent 38%),
      var(--routing-panel-bg);
    color: var(--routing-muted);
    font-size: clamp(11px, 1.55vw, 13px);
    line-height: 1.7;
    box-shadow: var(--routing-panel-shadow);
  }

  .routing-streak-banner {
    padding: clamp(14px, 1.8vw, 18px) clamp(16px, 2vw, 20px);
    border-radius: 20px;
    border: 1px solid var(--routing-panel-border);
    background:
      linear-gradient(135deg, rgba(255,179,0,0.08) 0%, transparent 46%),
      var(--routing-panel-bg);
    box-shadow: var(--routing-panel-shadow);
  }

  .routing-streak-banner > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .routing-streak-num {
    font-size: clamp(19px, 2.2vw, 24px);
    line-height: 1;
    text-shadow: 0 0 18px rgba(255,179,0,0.24);
  }

  .routing-streak-label {
    font-size: 9px;
    letter-spacing: 2.4px;
    color: var(--routing-muted);
  }

  .routing-difficulty-grid {
    gap: clamp(10px, 1.4vw, 14px);
  }

  .routing-difficulty-card,
  .routing-practice-card {
    min-height: 110px;
    padding: clamp(15px, 2vw, 20px);
    border: 1px solid var(--routing-panel-border);
    border-radius: 20px;
    gap: clamp(12px, 1.8vw, 16px);
    align-items: center;
    background:
      linear-gradient(145deg, rgba(255,179,0,0.045) 0%, transparent 38%),
      var(--routing-panel-bg);
    box-shadow: var(--routing-panel-shadow);
  }

  .routing-difficulty-card:active,
  .routing-practice-card:active {
    transform: translateY(1px);
    border-color: var(--routing-panel-border-strong);
    background:
      linear-gradient(145deg, rgba(255,179,0,0.075) 0%, transparent 38%),
      var(--routing-panel-bg-soft);
  }

  .routing-difficulty-card.solved {
    border-color: rgba(0,255,136,0.26);
    background:
      linear-gradient(145deg, rgba(0,255,136,0.07) 0%, transparent 42%),
      var(--routing-panel-bg);
  }

  .routing-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 46px;
    font-size: 18px;
    background: linear-gradient(180deg, rgba(255,179,0,0.14), rgba(255,179,0,0.04));
    border: 1px solid rgba(255,179,0,0.18);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.05),
      0 10px 18px rgba(0,0,0,0.22);
  }

  .routing-card-title {
    font-size: clamp(11px, 1.4vw, 13px);
    letter-spacing: 2.2px;
    margin-bottom: 4px;
  }

  .routing-card-detail {
    font-size: clamp(10px, 1.25vw, 11px);
    line-height: 1.55;
    color: var(--routing-muted);
  }

  .routing-card-status {
    align-self: center;
    padding: 8px 12px;
    border-radius: var(--r-full);
    border: 1px solid rgba(255,179,0,0.16);
    background: rgba(255,179,0,0.08);
    color: var(--accent);
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    letter-spacing: 1.7px;
    min-width: 72px;
  }

  .routing-card-status.solved {
    border-color: rgba(0,255,136,0.28);
    background: rgba(0,255,136,0.09);
    color: var(--green);
  }

  .routing-section-title {
    font-size: 9px;
    letter-spacing: 3.4px;
    color: var(--routing-muted);
    padding: 2px 4px 0;
  }

  .routing-practice-card {
    background:
      linear-gradient(135deg, rgba(255,179,0,0.05) 0%, transparent 34%),
      linear-gradient(180deg, rgba(26,22,18,0.96), rgba(11,10,9,0.98));
  }

  .routing-practice-controls {
    margin-top: var(--sp-12);
    gap: var(--sp-10);
    flex-wrap: wrap;
  }

  .routing-practice-select {
    min-height: 42px;
    padding: 9px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(14,12,10,0.98), rgba(8,8,8,1));
    border: 1px solid rgba(255,179,0,0.14);
    color: var(--white);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  }

  .routing-practice-play-btn,
  .routing-guide-btn,
  .routing-win-btn {
    min-height: 44px !important;
    border-radius: 14px !important;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.1),
      0 14px 26px rgba(0,0,0,0.24) !important;
  }

  .routing-puzzle-wrap {
    width: min(100%, 940px);
    gap: clamp(12px, 1.8vw, 16px);
  }

  .routing-puzzle-header,
  .routing-puzzle-status,
  .routing-grid,
  .routing-controls {
    width: min(100%, var(--routing-board-max));
    max-width: none;
  }

  .routing-puzzle-header {
    padding: clamp(12px, 1.8vw, 16px) clamp(14px, 2vw, 18px);
    border-radius: 18px;
    border: 1px solid var(--routing-panel-border);
    background:
      linear-gradient(135deg, rgba(255,179,0,0.08) 0%, transparent 42%),
      var(--routing-panel-bg);
    box-shadow: var(--routing-panel-shadow);
  }

  .routing-puzzle-title {
    font-size: 11px;
    letter-spacing: 2.6px;
  }

  .routing-puzzle-timer {
    font-size: clamp(14px, 1.9vw, 18px);
    letter-spacing: 1.8px;
  }

  .routing-puzzle-status {
    padding: 10px 14px;
    border: 1px solid var(--routing-status-border);
    border-radius: 14px;
    background:
      linear-gradient(180deg, rgba(255,179,0,0.06), rgba(255,179,0,0.02)),
      var(--routing-panel-bg-soft);
    color: var(--routing-muted);
    box-shadow: var(--routing-panel-shadow-soft);
  }

  .routing-grid {
    border: 1px solid var(--routing-board-border);
    border-radius: 24px;
    padding: clamp(6px, 0.9vw, 10px);
    gap: clamp(2px, 0.45vw, 4px);
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(255,179,0,0.04) 0, rgba(255,179,0,0.04) 1px, transparent 1px, transparent 24px),
      linear-gradient(0deg, rgba(255,179,0,0.04) 0, rgba(255,179,0,0.04) 1px, transparent 1px, transparent 24px),
      var(--routing-board-bg);
    background-size: 24px 24px, 24px 24px, auto;
    box-shadow:
      0 28px 48px rgba(0,0,0,0.42),
      inset 0 0 0 1px rgba(255,255,255,0.03),
      inset 0 0 28px rgba(255,179,0,0.05);
  }

  .routing-cell {
    background: var(--routing-cell-bg);
    border-color: var(--routing-cell-border);
    border-radius: clamp(4px, 0.6vw, 8px);
    box-shadow: var(--routing-cell-shadow);
  }

  .routing-cell--blocked {
    background:
      repeating-linear-gradient(
        45deg,
        rgba(255,179,0,0.24),
        rgba(255,179,0,0.24) 5px,
        rgba(25,20,14,0.9) 5px,
        rgba(25,20,14,0.9) 10px
      ),
      linear-gradient(180deg, rgba(20,16,13,1), rgba(10,10,10,1));
    border-color: rgba(255,179,0,0.28);
    box-shadow:
      inset 0 0 0 1px rgba(255,179,0,0.08),
      inset 0 1px 0 rgba(255,255,255,0.02);
  }

  .routing-endpoint {
    inset: 16%;
    border: 1px solid var(--routing-endpoint-ring);
    box-shadow: var(--routing-endpoint-shadow);
  }

  .routing-path {
    opacity: var(--routing-path-alpha);
    border-radius: inherit;
    box-shadow: var(--routing-path-shadow);
  }

  .routing-cell--active-trail {
    box-shadow:
      inset 0 0 0 2px var(--routing-active-ring),
      0 0 0 1px rgba(255,179,0,0.18);
  }

  .routing-controls {
    padding: 10px;
    border: 1px solid var(--routing-panel-border);
    border-radius: 18px;
    background:
      linear-gradient(180deg, rgba(255,179,0,0.04), transparent 70%),
      var(--routing-panel-bg-soft);
    box-shadow: var(--routing-panel-shadow-soft);
  }

  .routing-controls--center {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
  }

  .routing-control-btn {
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid var(--routing-button-border);
    border-radius: 14px;
    background: var(--routing-button-bg);
    color: var(--routing-button-text);
    box-shadow: var(--routing-button-shadow);
    font-size: 10px;
    letter-spacing: 1.7px;
    transition:
      transform var(--dur-fast),
      border-color var(--dur-fast),
      background var(--dur-fast),
      color var(--dur-fast),
      box-shadow var(--dur-fast);
  }

  .routing-control-btn:active {
    background:
      linear-gradient(180deg, rgba(22,19,17,1) 0%, rgba(10,10,10,1) 100%);
    border-color: var(--routing-panel-border-strong);
    color: var(--accent);
  }

  .routing-history-list {
    gap: var(--sp-10);
  }

  .routing-history-row {
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid var(--routing-panel-border);
    background:
      linear-gradient(135deg, rgba(255,179,0,0.05) 0%, transparent 40%),
      var(--routing-panel-bg-soft);
  }

  .routing-history-date {
    font-size: 11px;
    letter-spacing: 0.6px;
  }

  .routing-history-marks {
    gap: 6px;
    font-size: 14px;
  }

  .routing-pill {
    padding: 3px 8px;
    background: rgba(0,255,136,0.1);
    border: 1px solid rgba(0,255,136,0.22);
  }

  .routing-guide-overlay,
  .routing-win-overlay {
    background:
      linear-gradient(180deg, rgba(255,179,0,0.08), transparent 24%),
      var(--routing-overlay-bg);
    backdrop-filter: blur(12px) saturate(115%);
    -webkit-backdrop-filter: blur(12px) saturate(115%);
  }

  .routing-guide-modal,
  .routing-win-panel {
    border-radius: 22px;
    border: 1px solid var(--routing-panel-border-strong);
    background:
      linear-gradient(140deg, rgba(255,179,0,0.08) 0%, transparent 44%),
      var(--routing-panel-bg);
    box-shadow:
      0 26px 60px rgba(0,0,0,0.46),
      inset 0 1px 0 rgba(255,255,255,0.04);
  }

  .routing-guide-title,
  .routing-win-title {
    text-shadow: 0 0 18px rgba(255,179,0,0.18);
  }

  .routing-guide-title {
    font-size: 15px;
  }

  .routing-guide-heading {
    letter-spacing: 2.8px;
  }

  .routing-guide-text,
  .routing-guide-rules,
  .routing-win-stats {
    color: var(--routing-muted);
  }

  .routing-guide-grid-demo {
    border-radius: 16px;
    box-shadow:
      inset 0 0 0 1px rgba(255,255,255,0.03),
      0 12px 24px rgba(0,0,0,0.28);
  }

  .rg-cell {
    border-radius: 8px;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.02),
      inset 0 -1px 0 rgba(0,0,0,0.24);
  }

  .rg-fill {
    border-radius: 7px;
  }

  .rg-dot {
    border: 1px solid rgba(255,255,255,0.12);
  }

  @media (hover: hover) and (pointer: fine) {
    .routing-difficulty-card:hover,
    .routing-practice-card:hover,
    .routing-history-row:hover {
      transform: translateY(-2px);
      border-color: var(--routing-panel-border-strong);
      box-shadow:
        0 22px 44px rgba(0,0,0,0.34),
        inset 0 1px 0 rgba(255,255,255,0.04);
    }

    .routing-control-btn:hover {
      transform: translateY(-1px);
      border-color: var(--routing-panel-border-strong);
      color: var(--accent);
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 14px 24px rgba(0,0,0,0.26);
    }
  }

  @container routing-screen (min-width: 980px) {
    .routing-difficulty-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .routing-history-list {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @container routing-screen (min-width: 1100px) {
    .routing-puzzle-wrap {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 260px;
      align-items: start;
    }

    .routing-puzzle-wrap > .routing-puzzle-header,
    .routing-puzzle-wrap > .routing-puzzle-status,
    .routing-puzzle-wrap > .routing-grid {
      grid-column: 1 / 2;
      width: 100%;
    }

    .routing-puzzle-wrap > .routing-controls {
      grid-column: 2 / 3;
      grid-row: 1 / span 3;
      width: 100%;
      position: sticky;
      top: 16px;
      flex-direction: column;
      justify-content: flex-start;
      align-self: start;
    }
  }

  @media (max-width: 639px) {
    #screen-routing {
      background-size: auto, auto, 24px 24px, 24px 24px, auto;
    }

    .routing-streak-banner {
      padding: 14px;
    }

    .routing-streak-label,
    .routing-card-title,
    .routing-puzzle-title,
    .routing-control-btn,
    .routing-section-title {
      letter-spacing: 1.8px;
    }

    .routing-card-status {
      min-width: 62px;
      padding: 7px 10px;
    }

    .routing-puzzle-header {
      flex-wrap: wrap;
      gap: 8px;
    }

    .routing-controls {
      flex-direction: column;
    }

    .routing-controls--center {
      width: 100%;
    }

    .routing-control-btn--auto {
      width: 100%;
    }

    .routing-practice-controls {
      flex-direction: column;
      align-items: stretch;
    }
  }
