/* ═══════════════════════════════════════════
   Salvage ops grid, cells, feedback, loot, how to play guide
   ═══════════════════════════════════════════ */

  /* ===== ACTIVE GRID ===== */
  .svgg-status-bar { display: flex; flex-direction: column; gap: 4px; }
  .svgg-derelict-name { font-size: 11px; color: var(--dim); letter-spacing: 1px; text-align: center; }
  .svgg-status-stats { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 2px 8px;
    font-size: 13px; color: var(--text); padding: 4px 0; }
  .svgg-stat { letter-spacing: 0.5px; white-space: nowrap; }
  .svgg-stat strong { color: var(--accent); }

  /* Grid — wrapper enforces square, grid fills it */
  .svgg-grid-wrap { position: relative; width: 100%; margin: 8px 0; }
  .svgg-grid-wrap::before { content: ''; display: block; padding-bottom: 100%; }
  .svgg-grid { position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    display: grid; gap: 3px; padding: 3px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px; box-sizing: border-box; }

  /* Cells — base */
  .svgg-cell { display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: var(--r-xs); cursor: default; position: relative;
    transition: background var(--dur-fast), border-color 0.15s;
    border: 2px solid transparent; gap: 1px; overflow: hidden; aspect-ratio: 1; }

  /* Fog — distant unrevealed */
  .svgg-cell-fog { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
  .svgg-room-label-dim { font-size: 11px; font-weight: bold; letter-spacing: 1px;
    color: rgba(255,255,255,0.35); font-family: 'Orbitron', monospace; }

  /* Adjacent — tappable, pulsing */
  .svgg-cell-adjacent { border-color: rgba(255,179,0,0.3);
    cursor: pointer; animation: svgg-pulse 1.5s ease-in-out infinite; }
  .svgg-cell-adjacent:active { background: rgba(255,179,0,0.2) !important; }
  .svgg-room-label { font-size: 11px; font-weight: bold; letter-spacing: 1px;
    font-family: 'Orbitron', monospace; }

  /* Scan border colours on adjacent cells */
  .svgg-scan-clear { border-color: var(--green, #4CAF50) !important; animation: none !important; }
  .svgg-scan-caution { border-color: var(--amber, #FF9800) !important; }
  .svgg-scan-danger { border-color: var(--red, #f44336) !important;
    background: rgba(244,67,54,0.08) !important; }
  .svgg-scan-loot { border-color: var(--green, #4CAF50) !important;
    background: rgba(76,175,80,0.06) !important; }
  .svgg-scan-o2 { border-color: var(--blue, #2196F3) !important;
    background: rgba(33,150,243,0.06) !important; }
  .svgg-scan-icon { position: absolute; bottom: 2px; right: 3px; font-size: 9px;
    line-height: 1; pointer-events: none; }

  /* Revealed — entered cells */
  .svgg-cell-revealed { background: rgba(140,110,70,0.12); border-color: rgba(140,110,70,0.2); }
  .svgg-cell-revealed::before { content: ''; position: absolute; inset: 3px; pointer-events: none;
    background: linear-gradient(to top right, transparent calc(50% - 0.5px), rgba(255,255,255,0.13) calc(50% - 0.5px), rgba(255,255,255,0.13) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
                linear-gradient(to bottom right, transparent calc(50% - 0.5px), rgba(255,255,255,0.13) calc(50% - 0.5px), rgba(255,255,255,0.13) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }
  .svgg-step-num { position: absolute; top: 1px; right: 3px; font-size: 9px; color: rgba(180,140,80,0.85); font-family: 'JetBrains Mono', monospace; pointer-events: none; }
  .svgg-cell-traversable { cursor: pointer; }
  .svgg-cell-traversable:active { background: rgba(255,255,255,0.12) !important; }
  .svgg-content-label { font-size: 14px; font-weight: bold; line-height: 1; }
  .svgg-content-sub { font-size: 8px; font-weight: bold; letter-spacing: 1px;
    font-family: 'Orbitron', monospace; line-height: 1; }

  /* Player position */
  .svgg-cell-player { background: rgba(255,179,0,0.15) !important;
    border-color: var(--accent) !important; box-shadow: 0 0 10px rgba(255,179,0,0.3); }
  .svgg-player-icon { font-size: 20px; color: var(--accent); }
  .svgg-airlock-here { font-size: 7px; color: var(--accent); letter-spacing: 1px;
    font-family: 'Orbitron', monospace; font-weight: bold; }

  /* Airlock — EXIT beacon */
  .svgg-cell-airlock { border-color: var(--amber, #ffb300) !important;
    background: rgba(255,179,0,0.06); animation: svgg-airlock-pulse 2s ease-in-out infinite; }
  .svgg-airlock-label { font-size: 11px; font-weight: bold; color: var(--amber, #ffb300);
    letter-spacing: 2px; font-family: 'Orbitron', monospace; }
  @keyframes svgg-airlock-pulse {
    0%, 100% { border-color: rgba(255,179,0,0.3); box-shadow: none; }
    50% { border-color: rgba(255,179,0,0.7); box-shadow: 0 0 8px rgba(255,179,0,0.2); }
  }

  /* Collapsed */
  .svgg-cell-collapsed { background: rgba(244,67,54,0.06); border-color: rgba(244,67,54,0.15); }
  .svgg-cell-collapsed::before { content: ''; position: absolute; inset: 3px; pointer-events: none;
    background: linear-gradient(to top right, transparent calc(50% - 0.5px), rgba(244,67,54,0.5) calc(50% - 0.5px), rgba(244,67,54,0.5) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
                linear-gradient(to bottom right, transparent calc(50% - 0.5px), rgba(244,67,54,0.5) calc(50% - 0.5px), rgba(244,67,54,0.5) calc(50% + 0.5px), transparent calc(50% + 0.5px)); }

  @keyframes svgg-pulse {
    0%, 100% { border-color: rgba(255,179,0,0.2); }
    50% { border-color: rgba(255,179,0,0.5); }
  }

  /* Feedback bar */
  .svgg-feedback { font-size: 11px; padding: 8px 12px; border-radius: var(--r-xs); text-align: center;
    letter-spacing: 0.5px; }
  .svgg-feedback-log { color: var(--cyan, #00bcd4); background: rgba(0,188,212,0.06);
    border: 1px solid rgba(0,188,212,0.15); font-style: italic; text-align: left; }
  .svgg-feedback-hazard { color: var(--red, #f44336); background: rgba(244,67,54,0.06);
    border: 1px solid rgba(244,67,54,0.15); }
  .svgg-feedback-loot { color: var(--green, #4CAF50); background: rgba(76,175,80,0.06);
    border: 1px solid rgba(76,175,80,0.15); }

  /* O2 bar */
  .svgg-o2-bar-wrap { position: relative; height: 20px; background: rgba(255,255,255,0.06);
    border-radius: var(--r-xs); overflow: hidden; margin: 6px 0; }
  .svgg-o2-bar { height: 100%; transition: width 0.3s, background 0.3s; }
  .svgg-legend-o2 { font-size: 10px; font-weight: bold; letter-spacing: 1px;
    font-family: 'Orbitron', monospace; margin-left: auto; padding: 2px 6px;
    border-radius: var(--r-xs); border: 1px solid rgba(255,255,255,0.06); white-space: nowrap; }

  /* Breach warning */
  .svgg-breach-warn { text-align: center; font-size: 11px; color: var(--red, #f44336);
    letter-spacing: 1px; padding: 4px; background: rgba(244,67,54,0.06);
    border: 1px solid rgba(244,67,54,0.15); border-radius: var(--r-xs); }

  /* Return warning */
  .svgg-return-warning { text-align: center; font-size: 10px; letter-spacing: 1px; padding: 3px;
    border-radius: var(--r-xs); }
  .svgg-return-tight { color: var(--amber); background: rgba(255,179,0,0.06); }
  .svgg-return-critical { color: var(--red); background: rgba(244,67,54,0.08);
    border: 1px solid rgba(244,67,54,0.2); animation: svgg-pulse 1s ease-in-out infinite; }
  .svgg-return-cut { color: var(--red); background: rgba(244,67,54,0.1);
    border: 1px solid rgba(244,67,54,0.3); font-weight: bold; }

  /* Room legend — above grid */
  .svgg-room-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px;
    padding: 4px 0; }
  .svgg-legend-item { font-size: 10px; font-weight: bold; letter-spacing: 1px; padding: 4px 8px;
    border-radius: var(--r-xs); font-family: 'Orbitron', monospace; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); }

  /* O2 refill feedback */
  .svgg-feedback-o2 { color: var(--blue, #2196F3); background: rgba(33,150,243,0.06);
    border: 1px solid rgba(33,150,243,0.15); }
  .svgg-feedback-scan { color: var(--amber, #ffb300); background: rgba(255,179,0,0.06);
    border: 1px solid rgba(255,179,0,0.15); }

  /* Scan button */
  .svg-btn-scan { color: var(--amber, #ffb300); border-color: var(--amber, #ffb300);
    background: rgba(255,179,0,0.06); flex: 1; }
  .svg-btn-scan:active { background: rgba(255,179,0,0.15); }

  /* Emergency extract */
  .svg-btn-emergency { color: var(--red, #f44336); border-color: var(--red, #f44336);
    background: rgba(244,67,54,0.06); flex: 1; }
  .svg-btn-emergency:active { background: rgba(244,67,54,0.15); }

  /* Crew selection — compact dropdown + filters */
  .svg-crew-section { display: flex; flex-direction: column; gap: 6px; }
  .svg-crew-title { font-size: 11px; color: var(--dim); letter-spacing: 2px; }
  .svg-crew-filters { display: flex; gap: 6px; align-items: center; }
  .svg-crew-filters > .cargo-filter-dropdown:first-child { flex: 0 0 auto; }
  .svg-crew-filters > .cargo-filter-dropdown:last-child { flex: 1; }
  .svg-crew-role-filter { padding: 6px 10px; font-size: 12px;
    font-family: 'JetBrains Mono', monospace; background: var(--sb-bg);
    color: var(--dim); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--r-xs);
    -webkit-appearance: none; appearance: none; width: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
  .svg-crew-role-filter:focus { outline: none; border-color: var(--amber, #ffb300); }
  .svg-crew-dropdown { width: 100%; padding: 10px 12px; font-size: 13px;
    font-family: 'JetBrains Mono', monospace; background: var(--sb-bg);
    color: var(--text); border: 1px solid rgba(255,255,255,0.12); border-radius: var(--r-xs);
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; }
  .svg-crew-dropdown:focus { outline: none; border-color: var(--amber, #ffb300); }
  .svg-crew-bonus-display { font-size: 11px; color: var(--amber, #ffb300);
    font-family: 'JetBrains Mono', monospace; padding: 2px 0; min-height: 16px; }
  .svg-crew-result { text-align: center; font-size: 12px; padding: 4px 0; }

  /* Injured crew section */
  .svg-injured-section { margin: 8px 0 4px; padding: 8px; border: 1px solid rgba(244,67,54,0.25);
    border-radius: var(--r-xs); background: rgba(244,67,54,0.06); }
  .svg-injured-title { font-size: 10px; color: var(--dim); letter-spacing: 2px; margin-bottom: 6px; }
  .svg-injured-entry { display: flex; justify-content: space-between; align-items: center;
    padding: 3px 0; font-family: 'JetBrains Mono', monospace; font-size: 12px; }

  /* Actions bar */
  .svgg-actions { display: flex; gap: 6px; padding: 4px 0; }
  .svgg-actions .svg-btn { padding: 6px 6px; font-size: 10px; letter-spacing: 0.5px; }
  .svg-btn-extract { flex: 1; }

  /* In-game guide button (small) */
  .svg-btn-guide-sm { padding: 6px 10px !important; min-width: 0 !important; width: auto !important;
    flex: none !important; font-size: 12px !important;
    font-weight: bold !important; color: var(--dim) !important; border-color: rgba(255,255,255,0.1) !important; }

  /* HOW TO PLAY button */
  .svg-btn-guide { color: var(--dim); border-color: rgba(255,255,255,0.1); font-size: 11px;
    padding: 8px; margin-top: 4px; }

  /* Loot manifest panel (in-game) */
  .svgg-loot-manifest { border: 1px solid rgba(255,255,255,0.08); border-radius: var(--r-xs);
    margin: 4px 0; overflow: hidden; }
  .svgg-loot-header { display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; cursor: pointer; font-size: 11px; color: var(--green, #4CAF50);
    font-family: 'JetBrains Mono', monospace; letter-spacing: 1px;
    background: rgba(76,175,80,0.04); }
  .svgg-loot-header:active { background: rgba(76,175,80,0.08); }
  .svgg-loot-toggle { font-size: 12px; }
  .svgg-loot-body { display: flex; flex-direction: column; gap: 2px;
    padding: 4px 10px 8px; border-top: 1px solid rgba(255,255,255,0.04); }
  .svgg-loot-row { display: flex; justify-content: space-between; align-items: center;
    font-size: 11px; font-family: 'JetBrains Mono', monospace; padding: 2px 0; }
  .svgg-loot-row-tag { font-size: 9px; letter-spacing: 0.5px; opacity: 0.7; }

  /* Results screen loot tag + cargo confirmation */
  .svg-loot-tag { font-size: 9px; letter-spacing: 0.5px; opacity: 0.7;
    margin-left: auto; padding-left: 8px; }
  .svg-cargo-confirm { text-align: center; font-size: 11px; color: var(--green, #4CAF50);
    font-family: 'JetBrains Mono', monospace; letter-spacing: 1px;
    padding: 6px 0; border-top: 1px solid rgba(255,255,255,0.06); margin-top: 4px; }

  /* ===== HOW TO PLAY GUIDE MODAL ===== */
  .svg-guide-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 9999; display: flex; align-items: center;
    justify-content: center; padding: 16px; }
  .svg-guide-modal { background: var(--sb-bg); border: 1px solid rgba(255,179,0,0.2);
    border-radius: 8px; padding: 20px; max-width: 360px; width: 100%;
    max-height: 85vh; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
  .svg-guide-title { font-family: 'Orbitron', monospace; font-size: 16px; color: var(--accent);
    letter-spacing: 3px; text-align: center; }
  .svg-guide-section { display: flex; flex-direction: column; gap: 8px; }
  .svg-guide-heading { font-family: 'Orbitron', monospace; font-size: 11px; color: var(--dim);
    letter-spacing: 2px; border-bottom: 1px solid rgba(255,255,255,0.06); padding-bottom: 4px; }

  /* Mock grid in guide */
  .svg-guide-grid-demo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
    max-width: 200px; margin: 0 auto; }
  .svg-guide-grid-demo .svgg-cell { aspect-ratio: 1; min-height: 50px; }

  /* Guide labels */
  .svg-guide-labels { display: flex; flex-direction: column; gap: 3px; font-size: 11px;
    color: var(--text); font-family: 'JetBrains Mono', monospace; }
  .svg-guide-rules { display: flex; flex-direction: column; gap: 4px; font-size: 11px;
    color: var(--text); font-family: 'JetBrains Mono', monospace; }
  .svg-guide-scan-legend { display: flex; flex-direction: column; gap: 4px; }
  .svg-guide-scan-item { font-size: 11px; padding: 4px 8px; border-radius: var(--r-xs);
    border: 2px solid; font-family: 'JetBrains Mono', monospace; color: var(--text); }

  /* ═══════════════════════════════════════════════════════════
     WORKSHOP / FORGE — uses svg-* and svg-btn from salvage
     ═══════════════════════════════════════════════════════════ */

  #screen-workshop.active { display: flex; flex-direction: column; height: 100%; overflow: auto; }

  /* Type filter bar */
  .ws-type-filter-bar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
    padding: 8px 0; margin-bottom: 4px; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .ws-type-chip { padding: 4px 10px; border: 1px solid; border-radius: 12px; font-size: 10px;
    font-family: 'Orbitron', monospace; letter-spacing: 0.5px; cursor: pointer;
    background: transparent; transition: background var(--dur-fast), color 0.15s; }
  .ws-type-chip:active { opacity: 0.7; }

  /* System accordion headers */
  .ws-system-header { padding: 12px 4px; color: var(--accent); font-family: 'Orbitron', monospace;
    font-size: 12px; letter-spacing: 1px; cursor: pointer; border-bottom: 1px solid rgba(255,179,0,0.15);
    display: flex; align-items: center; gap: 8px; transition: background var(--dur-fast); border-radius: var(--r-xs); min-height: var(--touch-min); }
  .ws-system-header:active { background: rgba(255,179,0,0.04); }

  /* Archetype cards (reuses border-left pattern from manifest items) */
  .ws-archetype-card { padding: 12px; margin: 6px 0; border-left: 3px solid var(--dim);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    background: rgba(255,255,255,0.02);
    font-family: 'JetBrains Mono', monospace; transition: border-color var(--dur-fast); }

  /* Rarity pills */
  .ws-rarity-pill { padding: 5px 10px; border: 1px solid; border-radius: var(--r-full); font-size: 11px;
    font-family: 'JetBrains Mono', monospace; cursor: pointer; background: transparent; transition: all var(--dur-fast); min-height: 30px; display: inline-flex; align-items: center; }
  .ws-pill-ready:active { background: rgba(255,255,255,0.1); transform: scale(0.95); }
  .ws-pill-short { opacity: 0.4; cursor: default; border-style: dashed; }
  .ws-pill-locked { opacity: 0.2; cursor: not-allowed; text-decoration: line-through; }

  /* Ingredient +/- buttons and rows */
