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

    :root {
      --black: #000000;
      --void: #050505;
      --surface: #0a0a0a;
      --surface2: #0f0f0f;
      --line: rgba(255, 255, 255, 0.07);
      --line2: rgba(255, 255, 255, 0.12);
      --red: #8b0000;
      --red-glow: #c0392b;
      --text: #c8c4bc;
      --dim: #3a3732;
      --muted: #524e48;
      --ghost: rgba(200, 196, 188, 0.03);
    }

    html,
    body {
      height: 100%;
      overflow: hidden;
      background: var(--black);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      cursor: default;
    }

    .hidden {
      display: none !important;
    }

    /* TOP BAR */
    header {
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      padding: 0 28px;
      height: 52px;
      border-bottom: 1px solid var(--line);
      background: var(--void);
      position: relative;
    }

    header::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--red) 30%, var(--red) 70%, transparent);
      opacity: 0.3;
    }

    .game-title {
      font-family: 'IM Fell English', serif;
      font-size: 0.85rem;
      letter-spacing: 0.35em;
      text-transform: uppercase;
      color: var(--dim);
      justify-self: start;
    }

    .blink {
      display: inline-block;
      width: 6px;
      height: 10px;
      background: var(--dim);
      animation: blink 1.2s step-end infinite;
      vertical-align: middle;
      margin-left: 6px;
    }

    @keyframes blink {

      0%,
      100% {
        opacity: 1
      }

      50% {
        opacity: 0
      }
    }

    .day-time {
      justify-self: center;
      font-size: 0.65rem;
      color: var(--dim);
      letter-spacing: 0.15em;
    }

    .header-season {
      justify-self: end;
      font-size: 0.6rem;
      color: var(--dim);
      letter-spacing: 0.12em;
      opacity: 0.7;
    }

    /* LAYOUT */
    .layout {
      display: grid;
      grid-template-columns: 300px 1fr 300px;
      height: calc(100vh - 52px);
    }

    /* ── LEFT PANEL ── */
    .left-panel {
      background: var(--void);
      border-right: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      padding: 28px 16px;
      gap: 36px;
    }

    .section-label {
      font-size: 0.48rem;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      color: var(--dim);
      margin-bottom: 12px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .section-label::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--line);
    }

    .sys-btn {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 9px 10px;
      background: transparent;
      border: none;
      border-left: 2px solid transparent;
      color: var(--dim);
      font-family: 'Courier Prime', monospace;
      font-size: 0.7rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      cursor: default;
      transition: all 0.2s ease;
      text-align: left;
    }

    .sys-btn:hover {
      color: var(--text);
      border-left-color: var(--red);
      padding-left: 14px;
      background: var(--ghost);
    }

    .sys-btn.danger:hover {
      color: var(--red-glow);
      border-left-color: var(--red-glow);
    }

    .sys-btn .icon {
      width: 13px;
      height: 13px;
      flex-shrink: 0;
      opacity: 0.4;
      transition: opacity 0.2s;
    }

    .sys-btn:hover .icon {
      opacity: 0.9;
    }

    .h-rule {
      height: 1px;
      background: var(--line);
      margin: 6px 0;
    }

    /* Player health (under Settings/Quit) – see damage when NPC hits your limbs */
    .player-health-section {
      margin-top: 20px;
    }

    .player-health-section .section-label {
      margin-bottom: 10px;
    }

    .player-limb-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      font-size: 0.6rem;
      letter-spacing: 0.08em;
      color: var(--text);
      padding: 4px 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    }

    .player-limb-row .limb-name {
      color: var(--dim);
      flex: 0 0 70px;
    }

    .player-limb-row .limb-hp {
      font-variant-numeric: tabular-nums;
    }

    .player-limb-row.hp-high .limb-hp {
      color: #8c8;
    }

    .player-limb-row.hp-mid .limb-hp {
      color: #da6;
    }

    .player-limb-row.hp-low .limb-hp {
      color: #c44;
    }

    .player-limb-row.affliction-bleeding {
      background: rgba(160, 40, 40, 0.35);
      border-left: 3px solid #c44;
      color: #f88;
    }

    .player-limb-row.affliction-bleeding .limb-name {
      color: #faa;
    }

    .player-limb-row.affliction-bleeding .limb-hp {
      color: #fcc;
    }

    .player-limb-row.affliction-poison {
      background: rgba(80, 40, 120, 0.35);
      border-left: 3px solid #a66;
      color: #d8b;
    }

    .player-limb-row.affliction-poison .limb-name {
      color: #dab;
    }

    .player-limb-row.affliction-poison .limb-hp {
      color: #edc;
    }

    .player-limb-row .limb-affliction {
      font-size: 0.7em;
      color: #c44;
      margin-left: 4px;
    }

    .condition-item.hp-high .cond-dot {
      background: #5a5;
    }

    .condition-item.hp-mid .cond-dot {
      background: #da6;
    }

    .condition-item.hp-low .cond-dot {
      background: #c44;
    }

    .condition-item .cond-affliction {
      font-size: 0.7em;
      color: #c44;
      margin-left: 6px;
    }

    .condition-item.affliction-bleeding {
      background: rgba(160, 40, 40, 0.2);
      border-left: 2px solid #c44;
    }

    .condition-item.affliction-poison {
      background: rgba(80, 40, 120, 0.2);
      border-left: 2px solid #a66;
    }

    /* ── CENTER PANEL ── */
    .center-panel {
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .location-frame {
      flex: 1;
      position: relative;
      overflow: hidden;
      background: var(--black);
    }

    .location-frame.mine-room-dark::before {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(0, 0, 0, 0.98);
      pointer-events: none;
      z-index: 2;
    }

    .location-frame.mine-room-dark .loc-img {
      filter: brightness(0);
    }

    .loc-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    /* Scanlines over image */
    .location-frame::after {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(0deg, transparent, transparent 3px,
          rgba(0, 0, 0, 0.06) 3px, rgba(0, 0, 0, 0.06) 4px);
      pointer-events: none;
    }

    /* Day / night / sunset overlay — only applied when setting is on and area allows it */
    .location-time-overlay {
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 1;
      transition: opacity 0.6s ease, background 0.8s ease;
    }

    .location-time-overlay[data-time="day"] {
      background: transparent;
      opacity: 0;
    }

    /* Sunrise: full-frame warm tint so sky and scene both glow */
    .location-time-overlay[data-time="sunrise"] {
      background: linear-gradient(180deg,
          rgba(255, 180, 120, 0.35) 0%,
          rgba(255, 200, 140, 0.2) 35%,
          rgba(255, 190, 130, 0.12) 70%,
          rgba(255, 170, 100, 0.08) 100%);
      opacity: 1;
    }

    /* Sunset: full-frame warm tint so sky and whole scene get the glow, not just the bottom */
    .location-time-overlay[data-time="sunset"] {
      background: linear-gradient(180deg,
          rgba(255, 160, 100, 0.2) 0%,
          rgba(255, 140, 80, 0.25) 30%,
          rgba(255, 120, 60, 0.3) 60%,
          rgba(220, 90, 50, 0.4) 100%);
      opacity: 1;
    }

    /* Night: full-frame darkening so sky and scene both go dark */
    .location-time-overlay[data-time="night"] {
      background: linear-gradient(180deg,
          rgba(15, 20, 50, 0.4) 0%,
          rgba(10, 15, 40, 0.55) 50%,
          rgba(8, 12, 35, 0.7) 100%);
      opacity: 1;
    }

    .location-time-overlay.disabled,
    .location-frame.no-time-effect .location-time-overlay {
      opacity: 0 !important;
      pointer-events: none;
    }

    /* Corner marks */
    .loc-corner {
      position: absolute;
      width: 16px;
      height: 16px;
      opacity: 0.15;
      z-index: 2;
    }

    .loc-corner.tl {
      top: 14px;
      left: 14px;
      border-top: 1px solid var(--text);
      border-left: 1px solid var(--text);
    }

    .loc-corner.tr {
      top: 14px;
      right: 14px;
      border-top: 1px solid var(--text);
      border-right: 1px solid var(--text);
    }

    .loc-corner.bl {
      bottom: 72px;
      left: 14px;
      border-bottom: 1px solid var(--text);
      border-left: 1px solid var(--text);
    }

    .loc-corner.br {
      bottom: 72px;
      right: 14px;
      border-bottom: 1px solid var(--text);
      border-right: 1px solid var(--text);
    }

    /* Single location (no room nav) – corners at bottom of frame */
    .center-panel.single-location .room-nav {
      display: none;
    }

    .center-panel.single-location .loc-corner.bl {
      bottom: 14px;
    }

    .center-panel.single-location .loc-corner.br {
      bottom: 14px;
    }

    /* Room character (e.g. Insane Man in Bedroom) – centered, feet at bottom in line with location text */
    .location-character-wrap {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      transform: none;
      width: 100%;
      max-height: 72vh;
      height: 72vh;
      z-index: 1;
      display: none;
      pointer-events: none;
    }

    .location-character-wrap.visible {
      display: block;
    }

    .location-character-wrap.clickable {
      pointer-events: auto;
      cursor: pointer;
    }

    .location-character-wrap img {
      width: auto;
      height: 100%;
      max-height: 70vh;
      object-fit: contain;
      object-position: bottom center;
      display: block;
      margin: 0 auto;
      transform: none;
    }

    .location-character-wrap .multi-guard,
    .location-character-wrap .location-npc-sub-container {
      position: absolute;
      bottom: 0;
      height: 100%;
      max-height: inherit;
      width: 28%;
    }

    /* Reset some img behaviors for multi-guard images to ensure absolute positioning works */
    .location-character-wrap img.multi-guard {
      margin: 0;
    }

    .location-character-wrap .multi-guard-far-left,
    .location-character-wrap img.multi-guard-far-left {
      left: 25%;
      transform: translateX(-50%);
    }
    
    .location-character-wrap .multi-guard-far-right,
    .location-character-wrap img.multi-guard-far-right {
      left: 75%;
      transform: translateX(-50%);
    }

    /* Special trio layout (shifted left) */
    .location-character-wrap .multi-guard-trio-left,
    .location-character-wrap img.multi-guard-trio-left {
      left: 10%;
      transform: translateX(-50%);
    }

    .location-character-wrap .multi-guard-trio-center,
    .location-character-wrap img.multi-guard-trio-center {
      left: 40%;
      transform: translateX(-50%);
    }

    .location-character-wrap .multi-guard-trio-right,
    .location-character-wrap img.multi-guard-trio-right {
      left: 70%;
      transform: translateX(-50%);
    }

    /* Standard positions */
    .location-character-wrap .multi-guard-left,
    .location-character-wrap img.multi-guard-left {
      left: 15%;
      transform: translateX(-50%);
    }

    .location-character-wrap .multi-guard-center,
    .location-character-wrap img.multi-guard-center {
      left: 50%;
      transform: translateX(-50%);
    }

    .location-character-wrap .multi-guard-right,
    .location-character-wrap img.multi-guard-right {
      left: 85%;
      transform: translateX(-50%);
    }

    /* ── COMBAT MODE (Bedroom encounter) ── */
    .center-panel.in-combat .room-nav {
      display: none;
    }

    .center-panel.in-combat .location-hotspot {
      pointer-events: none;
      cursor: default;
    }

    .center-panel.in-combat .location-overlay {
      opacity: 0.4;
    }

    .center-panel.in-combat .location-character-wrap {
      bottom: 160px;
      max-height: 48vh;
      height: 48vh;
      pointer-events: none;
      z-index: 2;
    }

    .center-panel.in-combat .location-character-wrap img {
      max-height: 48vh;
      transform: translateY(6%);
      pointer-events: auto;
    }

    /* ── COMBAT UI (JRPG Style) ── */
    @keyframes combat-fade-in {
      from {
        opacity: 0;
        transform: scale(0.97);
      }

      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    .combat-ui {
      display: none;
      position: absolute;
      inset: 0;
      z-index: 3;
      pointer-events: none;
    }

    .combat-ui>* {
      pointer-events: auto;
    }

    .center-panel.in-combat .combat-ui {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }

    /* Animate combat enter — snappy 0.3s */
    .center-panel.in-combat .location-frame {
      animation: combat-fade-in 0.3s ease-out both;
    }

    /* Hidden limb bars — still updated by JS for HP data, never shown */
    .combat-limb-bars--hidden {
      display: none !important;
      pointer-events: none;
    }

    /* ── BOTTOM BAR ── */
    .combat-bottom-bar {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      display: flex;
      align-items: flex-end;
      z-index: 4;
      pointer-events: none;
    }

    .combat-bottom-bar>* {
      pointer-events: auto;
    }

    /* ── LEFT PANEL: turn banner + vertical menu ── */
    .combat-left-panel {
      flex: 0 0 160px;
      display: flex;
      flex-direction: column;
    }

    .combat-turn-banner {
      background: linear-gradient(90deg, rgba(20, 14, 6, 0.97), rgba(30, 20, 8, 0.90));
      border-top: 1px solid rgba(200, 160, 80, 0.55);
      border-right: 1px solid rgba(200, 160, 80, 0.35);
      padding: 6px 10px 5px;
    }

    .combat-turn-name {
      font-family: 'IM Fell English', serif;
      font-size: 0.78rem;
      letter-spacing: 0.08em;
      color: #e8c97a;
      text-shadow: 0 0 8px rgba(200, 150, 50, 0.5);
      display: block;
    }

    .combat-action-menu {
      display: flex;
      flex-direction: column;
      background: linear-gradient(180deg, rgba(10, 8, 4, 0.96), rgba(18, 12, 6, 0.99));
      border-top: 1px solid rgba(200, 160, 80, 0.4);
      border-right: 1px solid rgba(200, 160, 80, 0.25);
    }

    .combat-menu-btn {
      display: flex;
      align-items: center;
      gap: 9px;
      width: 100%;
      padding: 9px 14px;
      background: transparent;
      border: none;
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      color: #d4c49a;
      font-family: 'Courier Prime', monospace;
      font-size: 0.72rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      text-align: left;
      cursor: pointer;
      transition: background 0.12s, color 0.12s, padding-left 0.1s;
      position: relative;
    }

    /* SVG icon inside combat menu buttons */
    .combat-btn-icon {
      width: 13px;
      height: 13px;
      flex-shrink: 0;
      opacity: 0.7;
      transition: opacity 0.12s;
    }

    .combat-menu-btn:hover .combat-btn-icon,
    .combat-menu-btn.selected .combat-btn-icon {
      opacity: 1;
    }

    .combat-menu-btn:hover,
    .combat-menu-btn.selected,
    .combat-menu-btn.kb-focus {
      background: rgba(200, 140, 30, 0.15);
      color: #ffe9a0;
      border-left: 2px solid #e8c97a;
      padding-left: 12px;
    }


    .combat-menu-btn:disabled,
    .center-panel.is-busy .combat-menu-btn {
      opacity: 0.38;
      cursor: default;
      pointer-events: none;
    }

    .combat-menu-btn--danger {
      color: #c08080;
    }

    .combat-menu-btn--danger:hover {
      background: rgba(160, 40, 40, 0.2);
      color: #ff9999;
    }

    /* ── CENTER PANEL: status + sub-panel ── */
    .combat-center-panel {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      min-height: 0;
    }

    .combat-sub-panel {
      background: linear-gradient(180deg, rgba(10, 8, 4, 0.97), rgba(16, 12, 6, 0.97));
      border-top: 1px solid rgba(200, 160, 80, 0.45);
      border-left: 1px solid rgba(200, 160, 80, 0.25);
      padding: 6px 0 2px;
      animation: combat-fade-in 0.18s ease-out both;
    }

    .combat-sub-panel-title {
      font-family: 'Courier Prime', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.25em;
      text-transform: uppercase;
      color: #a08040;
      padding: 0 14px 5px;
      border-bottom: 1px solid rgba(200, 160, 80, 0.2);
      margin-bottom: 2px;
    }

    .combat-sub-panel-list {
      display: flex;
      flex-direction: column;
      max-height: 200px;
      overflow-y: auto;
    }

    .combat-sub-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 7px 14px;
      border: none;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      width: 100%;
      text-align: left;
      background: transparent;
      cursor: pointer;
      font-family: 'Courier Prime', monospace;
      font-size: 0.72rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: #d4c49a;
      transition: background 0.1s;
      position: relative;
    }

    .combat-sub-item::before {
      content: '▶';
      font-size: 0.5rem;
      color: #e8c97a;
      opacity: 0;
      flex-shrink: 0;
      transition: opacity 0.1s;
    }

    .combat-sub-item:hover,
    .combat-sub-item.kb-focus {
      background: rgba(200, 140, 30, 0.12);
      color: #ffe9a0;
    }

    .combat-sub-item:hover::before,
    .combat-sub-item.kb-focus::before {
      opacity: 1;
    }

    .combat-sub-item:disabled,
    .combat-sub-item.dead {
      opacity: 0.35;
      cursor: default;
      pointer-events: none;
    }

    /* Inline mini HP bar */
    .combat-sub-hp-bar {
      flex: 1;
      height: 6px;
      background: rgba(0, 0, 0, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 2px;
      overflow: hidden;
    }

    .combat-sub-hp-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.25s ease;
    }

    .combat-sub-hp-fill.hp-high {
      background: linear-gradient(90deg, #3a8a3a, #5aba5a);
    }

    .combat-sub-hp-fill.hp-mid {
      background: linear-gradient(90deg, #8a6a20, #daa030);
    }

    .combat-sub-hp-fill.hp-low {
      background: linear-gradient(90deg, #8a2020, #cc4040);
    }

    .combat-sub-hp-text {
      font-size: 0.6rem;
      color: #888;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .combat-sub-affliction {
      font-size: 0.58rem;
      color: #e06060;
      white-space: nowrap;
      flex-shrink: 0;
    }

    /* Weapon attack type chooser (shoot/buttstroke) */
    .combat-attack-sub {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      padding: 4px 8px 2px;
      background: rgba(10, 8, 4, 0.95);
      border-top: 1px solid rgba(200, 160, 80, 0.35);
      border-left: 1px solid rgba(200, 160, 80, 0.2);
    }

    .combat-sub-row {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: center;
    }

    .combat-action-btn,
    .combat-sub-btn {
      padding: 6px 14px;
      background: rgba(30, 20, 8, 0.95);
      border: 1px solid rgba(200, 160, 80, 0.45);
      color: #d4c49a;
      font-family: 'Courier Prime', monospace;
      font-size: 0.68rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background 0.12s, color 0.12s;
    }

    .combat-action-btn:hover,
    .combat-sub-btn:hover {
      background: rgba(200, 140, 30, 0.2);
      color: #ffe9a0;
    }

    .combat-attack-stem {
      width: 1px;
      height: 6px;
      background: rgba(200, 160, 80, 0.3);
    }

    /* Turn order strip: player → party → enemy */
    .combat-turn-order {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 10px 20px;
      position: absolute;
      left: 50%;
      top: 2%;
      transform: translateX(-50%);
      z-index: 4;
      pointer-events: none;
      background: rgba(0, 0, 0, 0.75);
      border: 1px solid rgba(255, 255, 255, 0.2);
      border-radius: 6px;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    }

    .combat-turn-order-label {
      font-size: 0.75rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: rgba(255, 255, 255, 0.85);
      font-weight: 600;
    }

    .combat-turn-order-list {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 6px 10px;
      justify-content: center;
    }

    .combat-turn-order-list .combat-turn-order-item {
      font-size: 0.85rem;
      letter-spacing: 0.05em;
      color: rgba(255, 255, 255, 0.9);
    }

    .combat-turn-order-list .combat-turn-order-item.current {
      font-weight: bold;
      color: #fff;
      text-shadow: 0 0 8px rgba(255, 200, 100, 0.5);
    }

    .combat-turn-order-list .combat-turn-order-sep {
      color: rgba(255, 255, 255, 0.6);
      font-size: 0.8rem;
      font-weight: bold;
    }

    /* Shuffle animation when turn order wraps back to start (e.g. new round) */
    .combat-turn-order-list.turn-order-shuffle {
      animation: turn-order-shuffle 0.45s ease-out;
    }

    @keyframes turn-order-shuffle {
      0% {
        transform: translateX(24px);
        opacity: 0.5;
      }

      60% {
        transform: translateX(-4px);
        opacity: 1;
      }

      100% {
        transform: translateX(0);
        opacity: 1;
      }
    }

    /* NPC dialogue box above his head */
    .combat-npc-dialogue {
      position: absolute;
      left: 50%;
      top: 6%;
      transform: translateX(-50%);
      padding: 10px 18px 12px;
      background: var(--void);
      border: 1px solid var(--line);
      box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);
      max-width: 85%;
      text-align: center;
      z-index: 4;
      pointer-events: none;
    }

    .combat-npc-dialogue::after {
      content: '';
      position: absolute;
      bottom: -6px;
      left: 50%;
      transform: translateX(-50%);
      border-left: 8px solid transparent;
      border-right: 8px solid transparent;
      border-top: 6px solid var(--line);
    }

    .guard-label {
      position: absolute;
      top: 30%;
      transform: translateX(-50%);
      font-size: 0.8rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: #f5e6da;
      text-shadow: 0 0 4px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.9);
      pointer-events: none;
      transition: color 0.15s, text-shadow 0.15s;
    }

    .guard-label.highlight {
      color: #ffffff;
      text-shadow: 0 0 6px rgba(0, 0, 0, 1), 0 0 14px rgba(0, 0, 0, 1);
    }

    .combat-npc-dialogue-text {
      font-family: 'Courier Prime', monospace;
      font-size: 0.7rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--text);
      line-height: 1.35;
    }

    .combat-npc-dialogue.hidden {
      display: none !important;
    }

    /* .combat-limb-bars – now hidden, only used for internal HP tracking */
    .combat-limb-bars {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }

    .limb-bar {
      position: absolute;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }

    .limb-bar-label {
      font-size: 0.8rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: #f0f0f0;
      white-space: nowrap;
      text-shadow: 0 0 3px #000, 0 0 6px #000, 0 1px 2px #000;
    }

    .limb-bar-track {
      width: 44px;
      height: 10px;
      background: rgba(0, 0, 0, 0.7);
      border: 1px solid var(--line);
      overflow: hidden;
      transition: border-color 0.2s, box-shadow 0.2s;
    }

    .limb-bar-fill {
      height: 100%;
      background: var(--red);
      transition: width 0.2s ease;
    }

    .limb-bar-value {
      font-size: 0.7rem;
      letter-spacing: 0.05em;
      color: #e0e0e0;
      text-shadow: 0 0 2px #000, 0 1px 2px #000;
    }

    .limb-bar-affliction {
      font-size: 0.6rem;
      color: rgba(220, 80, 80, 0.95);
      margin-left: 2px;
      text-shadow: 0 0 2px #000;
    }

    .limb-pos {
      font-size: 0.5rem;
      color: rgba(120, 200, 120, 0.95);
      white-space: nowrap;
      margin-top: 2px;
    }

    .mouse-pos-debug {
      position: fixed;
      z-index: 99999;
      pointer-events: none;
      font-size: 12px;
      font-family: monospace;
      color: #8f8;
      text-shadow: 0 0 4px #000, 0 0 8px #000;
      white-space: nowrap;
      padding: 4px 8px;
      background: rgba(0, 0, 0, 0.85);
      border: 1px solid rgba(100, 180, 100, 0.5);
      border-radius: 4px;
    }

    /* ── NPC Hover Tooltip ── */
    .combat-hover-tooltip {
      position: absolute;
      right: 16px;
      top: 12%;
      z-index: 5;
      pointer-events: none !important;
      min-width: 170px;
      max-width: 220px;
      background: linear-gradient(180deg, rgba(8, 6, 2, 0.97) 0%, rgba(14, 10, 4, 0.97) 100%);
      border: 1px solid rgba(200, 160, 80, 0.5);
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(255, 200, 80, 0.06);
      padding: 8px 10px 6px;
      opacity: 0;
      transform: translateY(-4px);
      transition: opacity 0.15s ease, transform 0.15s ease;
    }

    .combat-hover-tooltip.visible {
      opacity: 1;
      transform: translateY(0);
    }

    .combat-hover-tooltip-name {
      font-family: 'IM Fell English', serif;
      font-size: 0.78rem;
      letter-spacing: 0.08em;
      color: #e8c97a;
      margin-bottom: 7px;
      border-bottom: 1px solid rgba(200, 160, 80, 0.25);
      padding-bottom: 5px;
    }

    .combat-hover-limb-row {
      display: flex;
      align-items: center;
      gap: 7px;
      margin-bottom: 5px;
    }

    .combat-hover-limb-name {
      font-family: 'Courier Prime', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: #a09070;
      flex: 0 0 44px;
    }

    .combat-hover-hp-bar {
      flex: 1;
      height: 5px;
      background: rgba(0, 0, 0, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 2px;
      overflow: hidden;
    }

    .combat-hover-hp-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 0.25s ease;
    }

    .combat-hover-hp-fill.hp-high {
      background: linear-gradient(90deg, #3a8a3a, #5aba5a);
    }

    .combat-hover-hp-fill.hp-mid {
      background: linear-gradient(90deg, #8a6a20, #daa030);
    }

    .combat-hover-hp-fill.hp-low {
      background: linear-gradient(90deg, #8a2020, #cc4040);
    }

    .combat-hover-hp-text {
      font-size: 0.58rem;
      color: #666;
      white-space: nowrap;
      flex-shrink: 0;
      font-family: 'Courier Prime', monospace;
    }

    .combat-hover-affliction {
      font-size: 0.55rem;
      color: #e06060;
      flex-shrink: 0;
    }

    /* ── Keyboard focus highlight ── */
    .kb-focus {
      background: rgba(200, 140, 30, 0.22) !important;
      color: #ffe9a0 !important;
      outline: 1px solid rgba(200, 160, 80, 0.6);
      outline-offset: -1px;
    }

    .kb-focus .combat-btn-icon {
      opacity: 1 !important;
    }



    /* Per-enemy limb positions are set inline from data; no default class positions */

    /* Status text — inside the bottom bar, not absolute positioned */
    .combat-status-text {
      background: linear-gradient(90deg, rgba(10, 8, 4, 0.93), rgba(10, 8, 4, 0.80));
      border-top: 1px solid rgba(200, 160, 80, 0.35);
      border-left: 1px solid rgba(200, 160, 80, 0.2);
      padding: 8px 16px;
      font-family: 'Courier Prime', monospace;
      font-size: 0.8rem;
      letter-spacing: 0.08em;
      color: var(--text);
      text-shadow: 0 0 4px #000, 0 1px 3px #000;
      min-height: 38px;
      display: flex;
      align-items: center;
    }

    .combat-status-text.hit {
      color: #ff9090;
      animation: combat-flash 0.35s ease;
    }

    @keyframes combat-flash {
      0% {
        background: rgba(160, 30, 30, 0.55);
      }

      100% {
        background: rgba(10, 8, 4, 0.93);
      }
    }

    /* ── NPC dialogue overlay (safezone conversations) ── */
    .npc-dialogue-modal {
      position: absolute;
      inset: 0;
      z-index: 4;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 32px 40px;
      background: radial-gradient(circle at top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.98));
      pointer-events: auto;
    }

    .npc-dialogue-modal.visible {
      display: flex;
      gap: 32px;
    }

    .npc-dialogue-panel {
      flex: 0 0 68%;
      max-width: 860px;
      max-height: 72vh;
      min-height: 44vh;
      background: var(--void);
      border: 1px solid var(--line);
      box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
      border-radius: 10px;
      display: flex;
      flex-direction: column;
      padding: 18px 24px 16px;
      overflow: hidden;
    }

    .npc-dialogue-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
    }

    .npc-dialogue-title {
      font-size: 1.1rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: var(--text);
    }

    .npc-dialogue-title span:nth-child(2) {
      font-size: 0.9rem;
      color: var(--dim);
      margin-left: 6px;
    }

    .npc-dialogue-stats {
      display: flex;
      gap: 6px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .npc-stat-pill {
      padding: 4px 9px;
      border-radius: 999px;
      font-size: 0.7rem;
      letter-spacing: 0.09em;
      text-transform: uppercase;
      border: 1px solid var(--line);
      background: rgba(20, 20, 24, 0.95);
      color: var(--text);
      white-space: nowrap;
    }

    .npc-stat-pill.love {
      color: #ff9fd2;
      border-color: rgba(220, 80, 140, 0.9);
    }

    .npc-stat-pill.obedience {
      color: #9fc9ff;
      border-color: rgba(90, 160, 255, 0.9);
    }

    .npc-stat-pill.sluttiness {
      color: #ffd38a;
      border-color: rgba(255, 190, 90, 0.9);
    }

    .npc-dialogue-daily {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      padding: 8px 0;
      margin-bottom: 10px;
      font-size: 0.75rem;
      color: var(--dim);
    }

    .npc-dialogue-daily-title {
      text-transform: uppercase;
      letter-spacing: 0.14em;
      font-weight: 600;
      color: #f0f0f0;
    }

    .npc-dialogue-daily-rows {
      display: flex;
      flex-direction: column;
      gap: 2px;
      text-align: right;
    }

    .npc-dialogue-daily-row span:first-child {
      margin-right: 6px;
    }

    .npc-delta {
      min-width: 32px;
      display: inline-block;
      text-align: right;
      color: #9fd49f;
    }

    .npc-delta.negative {
      color: #ff6262;
    }

    .npc-dialogue-log {
      /* Fixed height so it never grows; extra lines scroll inside. */
      flex: 0 0 auto;
      height: 32vh;
      max-height: 32vh;
      margin-top: 8px;
      margin-bottom: 10px;
      background: rgba(4, 4, 6, 0.98);
      border-radius: 8px;
      border: 1px solid var(--line);
      padding: 10px 12px;
      overflow-y: auto;
      font-size: 0.8rem;
    }

    .npc-dialogue-line {
      margin-bottom: 8px;
    }

    .npc-dialogue-speaker {
      font-size: 0.72rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      margin-bottom: 2px;
    }

    .npc-dialogue-speaker.player {
      color: var(--text);
    }

    .npc-dialogue-speaker.npc {
      color: var(--text);
    }

    .npc-dialogue-text {
      padding: 8px 10px;
      border-radius: 6px;
      line-height: 1.4;
      background: rgba(6, 6, 8, 0.95);
      border: 1px solid var(--line);
      color: var(--text);
    }

    .npc-dialogue-text.player {
      background: rgba(10, 14, 22, 0.96);
      border-color: var(--line);
    }

    .npc-dialogue-text.npc {
      background: rgba(14, 12, 8, 0.96);
      border-color: var(--line);
    }

    .npc-dialogue-line.action .npc-dialogue-speaker {
      color: var(--dim);
      font-style: italic;
    }

    .npc-dialogue-line.action .npc-dialogue-text {
      background: rgba(18, 14, 10, 0.95);
      border-color: rgba(120, 80, 40, 0.4);
      color: var(--dim);
      font-style: italic;
    }

    .npc-dialogue-options {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }

    /* Ensure all option groups (default/actions/commands/sex) lay out buttons with the same spacing */
    .npc-dialogue-options-default,
    .npc-dialogue-options-actions,
    .npc-dialogue-options-commands,
    .npc-dialogue-options-strip,
    .npc-dialogue-options-sex {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      width: 100%;
    }

    .npc-dialogue-option-btn {
      flex: 1 1 0;
      min-width: 120px;
      padding: 7px 11px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.68rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      border-radius: 6px;
      cursor: pointer;
      transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
    }

    .npc-dialogue-option-btn:hover {
      border-color: rgba(139, 0, 0, 0.8);
      color: var(--text);
      background: rgba(139, 0, 0, 0.35);
      transform: translateY(-1px);
    }

    .npc-dialogue-option-btn-locked,
    .npc-dialogue-option-btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      pointer-events: none;
    }

    .npc-dialogue-footer {
      display: flex;
      justify-content: flex-end;
    }

    .npc-dialogue-goodbye-btn {
      padding: 9px 20px;
      border-radius: 999px;
      border: 1px solid rgba(220, 80, 80, 0.9);
      background: linear-gradient(135deg, rgba(120, 40, 40, 0.9), rgba(60, 10, 10, 0.98));
      color: #fff;
      font-family: 'Courier Prime', monospace;
      font-size: 0.78rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background 0.15s, box-shadow 0.15s, transform 0.08s;
    }

    .npc-dialogue-goodbye-btn:hover {
      background: linear-gradient(135deg, rgba(180, 60, 60, 0.95), rgba(80, 14, 14, 0.98));
      box-shadow: 0 0 14px rgba(255, 80, 80, 0.45);
      transform: translateY(-1px);
    }

    /* Sex scene overlay back button - match main UI style */
    #npc-sex-scene-overlay #btn-sex-scene-back,
    #npc-sex-scene-overlay #btn-sex-scene-toggle {
      padding: 9px 20px;
      border-radius: 999px;
      border: 1px solid rgba(220, 80, 80, 0.9);
      background: linear-gradient(135deg, rgba(120, 40, 40, 0.9), rgba(60, 10, 10, 0.98));
      color: #fff;
      font-family: 'Courier Prime', monospace;
      font-size: 0.78rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background 0.15s, box-shadow 0.15s, transform 0.08s;
    }

    #npc-sex-scene-overlay #btn-sex-scene-back:hover,
    #npc-sex-scene-overlay #btn-sex-scene-toggle:hover {
      background: linear-gradient(135deg, rgba(180, 60, 60, 0.95), rgba(80, 14, 14, 0.98));
      box-shadow: 0 0 14px rgba(255, 80, 80, 0.45);
      transform: translateY(-1px);
    }

    .npc-dialogue-character {
      flex: 0 0 32%;
      max-width: 360px;
      display: grid;
      align-items: end;
      justify-items: center;
      pointer-events: none;
    }

    .npc-dialogue-character img {
      grid-area: 1 / 1;
      max-height: 70vh;
      width: auto;
      object-fit: contain;
      filter: drop-shadow(0 0 32px rgba(0, 0, 0, 0.9));
    }

    /* NPC event cutscene overlay */
    .npc-cutscene-overlay {
      position: fixed;
      inset: 0;
      z-index: 10001;
      display: none;
      align-items: center;
      justify-content: center;
      background: rgba(0, 0, 0, 0.92);
      padding: 40px;
    }

    .npc-cutscene-overlay.visible {
      display: flex;
    }

    .npc-cutscene-box {
      max-width: 560px;
      padding: 28px 32px;
      background: var(--void);
      border: 1px solid var(--line);
      box-shadow: 0 0 48px rgba(0, 0, 0, 0.9);
      border-radius: 8px;
    }

    .npc-cutscene-text {
      font-family: 'Courier Prime', monospace;
      font-size: 0.9rem;
      line-height: 1.6;
      color: var(--text);
      margin-bottom: 24px;
      letter-spacing: 0.04em;
    }

    .npc-cutscene-next {
      padding: 10px 24px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.78rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s;
    }

    .npc-cutscene-next:hover {
      border-color: rgba(139, 0, 0, 0.7);
      background: rgba(139, 0, 0, 0.12);
    }

    /* Lockpick minigame (locked door) */
    .lockpick-minigame-overlay {
      align-items: center;
      justify-content: center;
    }

    .lockpick-minigame-box {
      box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
    }

    .lockpick-minigame-green {
      border-radius: 2px;
    }

    .lockpick-minigame-line {
      border-radius: 1px;
    }

    .npc-dialogue-options-default,
    .npc-dialogue-options-commands,
    .npc-dialogue-options-strip,
    .npc-dialogue-options-actions {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
    }

    .npc-dialogue-options-default.hidden,
    .npc-dialogue-options-commands.hidden,
    .npc-dialogue-options-strip.hidden,
    .npc-dialogue-options-actions.hidden {
      display: none;
    }

    .npc-strip-option-btn {
      display: inline-flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .npc-strip-option-label {
      display: inline-block;
    }

    .npc-strip-chance-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid rgba(200, 120, 120, 0.6);
      background: rgba(139, 0, 0, 0.22);
      color: #f6d8d8;
      font-size: 0.62rem;
      letter-spacing: 0.06em;
      min-width: 44px;
      text-align: center;
    }

    .npc-strip-option-disabled .npc-strip-chance-badge,
    .npc-strip-option-btn:disabled .npc-strip-chance-badge {
      opacity: 0.55;
      border-color: rgba(120, 120, 120, 0.45);
      background: rgba(70, 70, 70, 0.25);
      color: #b9b9b9;
    }

    .npc-dialogue-options-event {
      display: none;
      gap: 12px;
      flex-wrap: wrap;
    }

    .npc-dialogue-options-event.visible {
      display: flex;
    }

    .npc-dialogue-goodbye-btn:disabled,
    .npc-dialogue-goodbye-btn.event-disabled {
      opacity: 0.5;
      pointer-events: none;
      cursor: default;
    }

    @keyframes combat-flash {

      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: 0.6;
      }
    }

    /* Combat action box (Attack, Guard, Item) */
    .combat-action-box {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 72px;
      background: var(--void);
      border-top: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 20px;
      padding: 0 24px;
      pointer-events: auto;
    }

    .combat-action-box::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--red) 30%, var(--red) 70%, transparent);
      opacity: 0.35;
    }

    .combat-action-btn {
      padding: 10px 24px;
      background: transparent;
      border: 1px solid var(--line);
      color: var(--dim);
      font-family: 'Courier Prime', monospace;
      font-size: 0.72rem;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      cursor: default;
      transition: border-color 0.2s, color 0.2s, background 0.2s;
    }

    .combat-action-btn:hover {
      border-color: var(--red);
      color: var(--text);
      background: rgba(139, 0, 0, 0.08);
    }

    .combat-action-btn.selected {
      border-color: var(--red);
      color: var(--text);
      background: rgba(139, 0, 0, 0.15);
    }

    .combat-action-btn:disabled {
      opacity: 0.4;
      cursor: not-allowed;
    }

    .center-panel.is-busy .combat-action-btn,
    .center-panel.is-busy .combat-sub-btn,
    .center-panel.is-busy .limb-bar {
      opacity: 0.5;
      pointer-events: none !important;
      cursor: not-allowed !important;
    }

    /* Weapon attack sub-menu (Shoot / ButtStroke above Attack) */
    .combat-actions-wrap {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      min-height: 72px;
      display: flex;
      align-items: flex-end;
      justify-content: center;
    }

    .combat-attack-sub {
      position: absolute;
      bottom: 100%;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      flex-direction: column;
      align-items: center;
      margin-bottom: 4px;
      pointer-events: auto;
    }

    .combat-attack-sub .combat-sub-row {
      display: flex;
      gap: 16px;
      margin-bottom: 8px;
      justify-content: center;
    }

    .combat-attack-sub .combat-sub-btn {
      min-width: 112px;
      width: 112px;
      padding: 10px 16px;
      background: rgba(18, 18, 18, 0.97);
      border: 1px solid rgba(200, 180, 140, 0.6);
      color: #e8e4dc;
      font-size: 0.75rem;
      font-weight: 600;
      text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
    }

    .combat-attack-sub .combat-sub-btn:hover {
      border-color: var(--red);
      color: #fff;
      background: rgba(80, 30, 30, 0.4);
    }

    .combat-attack-sub .combat-attack-stem {
      width: 2px;
      height: 24px;
      background: rgba(255, 255, 255, 0.25);
    }

    .location-overlay {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 56px 28px 20px;
      background: linear-gradient(to top, rgba(0, 0, 0, 0.99) 0%, transparent 100%);
      z-index: 2;
    }

    .location-name {
      font-family: 'IM Fell English', serif;
      font-size: 2.6rem;
      font-weight: 400;
      line-height: 1;
      color: var(--text);
      margin-bottom: 7px;
      animation: flicker 14s ease-in-out infinite;
    }

    .location-event-description {
      font-family: 'Courier Prime', monospace;
      font-size: 0.95rem;
      color: var(--dim);
      margin-top: 4px;
      min-height: 1.2em;
    }

    @keyframes flicker {

      0%,
      93%,
      95.5%,
      97.5%,
      100% {
        opacity: 1;
      }

      94%,
      96.5% {
        opacity: 0.7;
      }
    }

    /* Room nav */
    .room-nav {
      display: flex;
      min-height: 72px;
      align-items: stretch;
      background: var(--void);
      border-top: 1px solid var(--line);
      overflow-x: auto;
    }

    .room-nav::-webkit-scrollbar {
      display: none;
    }

    .nav-room {
      padding: 18px 28px;
      font-size: 0.82rem;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--dim);
      cursor: default;
      transition: all 0.2s;
      border-right: 1px solid var(--line);
      white-space: nowrap;
      flex-shrink: 0;
      position: relative;
      display: flex;
      align-items: center;
    }

    .nav-room::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--red);
      transform: scaleX(0);
      transition: transform 0.25s;
      transform-origin: left;
    }

    .nav-room:hover {
      color: var(--text);
      background: var(--ghost);
    }

    .nav-room:hover::after {
      transform: scaleX(1);
    }

    .nav-room.active {
      color: #8a8078;
    }

    .nav-room.active::after {
      transform: scaleX(1);
    }

    /* ── RIGHT PANEL ── */
    .right-panel {
      background: var(--void);
      border-left: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      align-items: center;
      overflow: hidden;
    }

    /* Combat: hide all action blocks except Debug button */
    .right-panel.in-combat .actions-wrap>.embark-block,
    .right-panel.in-combat .actions-wrap>.go-home-oxdale-block,
    .right-panel.in-combat .actions-wrap>.go-inside-block,
    .right-panel.in-combat .actions-wrap>.buy-block,
    .right-panel.in-combat .actions-wrap>.go-outside-block,
    .right-panel.in-combat .actions-wrap>.go-on-pc-block,
    .right-panel.in-combat .actions-wrap>.visit-block,
    .right-panel.in-combat .actions-wrap>.vault-block,
    .right-panel.in-combat .actions-wrap>.npcs-block,
    .right-panel.in-combat .actions-wrap>.convoy-block,
    .right-panel.in-combat .actions-wrap>.explore-block,
    .right-panel.in-combat .actions-wrap>.go-home-block,
    .right-panel.in-combat .actions-wrap>.loot-block,
    .right-panel.in-combat .actions-wrap>.enter-military-tent-block,
    .right-panel.in-combat .actions-wrap>.enter-tent-block,
    .right-panel.in-combat .actions-wrap>.enter-huntingstand-block,
    .right-panel.in-combat .actions-wrap>.enter-cottageruins-block,
    .right-panel.in-combat .actions-wrap>.back-to-campsite-block,
    .right-panel.in-combat .actions-wrap>.back-to-huntingstand-block,
    .right-panel.in-combat .actions-wrap>.back-to-cottageruins-block,
    .right-panel.in-combat .actions-wrap>.back-to-convoy-block,
    .right-panel.in-combat .actions-wrap>.mine-block,
    .right-panel.in-combat .actions-wrap>.mine-back-block {
      display: none !important;
    }

    .right-panel.in-combat .backpack-wrap>*:not(.show-in-combat) {
      display: none !important;
    }

    .right-header {
      width: 100%;
      padding: 22px 18px 14px;
      border-bottom: 1px solid var(--line);
      position: relative;
      text-align: center;
    }

    .right-header::after {
      content: '';
      position: absolute;
      bottom: -1px;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, var(--red) 0%, transparent 60%);
      opacity: 0.35;
    }

    .right-header h2 {
      font-family: 'IM Fell English', serif;
      font-size: 1rem;
      font-weight: 400;
      letter-spacing: 0.1em;
      color: var(--text);
    }

    /* Action buttons: same size (Embark, Go back home, Open backpack) */
    .backpack-wrap,
    .embark-block {
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .backpack-wrap {
      flex: 1;
      justify-content: flex-start;
      padding: 24px 18px 18px;
    }

    .skills-panel-body {
      margin-top: 8px;
      border: 1px solid var(--line);
      background: rgba(0, 0, 0, 0.4);
      padding: 8px 10px;
      white-space: pre-line;
      display: none;
    }

    .embark-block .btn-embark,
    .backpack-wrap .btn-open-backpack {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .btn-open-backpack {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 12px 20px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.75rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s, color 0.2s;
    }

    .btn-open-backpack:hover {
      border-color: rgba(139, 0, 0, 0.5);
      background: rgba(139, 0, 0, 0.08);
      color: var(--text);
    }

    .btn-debug,
    .btn-show-pos,
    .btn-add-item,
    .btn-trigger-event,
    .btn-debug-time {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      margin-top: 10px;
      padding: 8px 16px;
      font-size: 0.8rem;
      color: var(--dim);
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.1);
      cursor: pointer;
      box-sizing: border-box;
    }

    .btn-debug:hover,
    .btn-show-pos:hover,
    .btn-add-item:hover,
    .btn-trigger-event:hover,
    .btn-debug-time:hover {
      border-color: rgba(120, 160, 120, 0.4);
      color: var(--text);
    }

    .btn-debug.active,
    .btn-show-pos.active,
    .btn-add-item.active,
    .btn-trigger-event.active,
    .btn-debug-time.active {
      background: rgba(80, 140, 80, 0.25);
      border-color: rgba(80, 160, 80, 0.5);
      color: rgba(180, 220, 180, 0.95);
    }

    /* Tutorial overlay: fade to black + dialogue */
    .tutorial-overlay {
      position: fixed;
      inset: 0;
      /* Fully black so the sky / sun never shows through during the cutscene */
      background: rgba(0, 0, 0, 1);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding-bottom: 120px;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.7s ease-in-out;
      z-index: 20000;
    }
    #tutorial-bg, #tutorial-bg-2 {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      z-index: -1;
      object-fit: cover;
      z-index: -1;
      transition: opacity 0.6s ease-in-out;
      opacity: 0;
      backface-visibility: hidden;
      transform: translateZ(0);
    }

    .tutorial-overlay.is-visible {
      opacity: 1;
      pointer-events: auto;
    }

    /* Sky phase: overlay is transparent so TutorialSky shows through; only the dialogue box is visible */
    .tutorial-overlay.sky-phase {
      background: transparent;
    }

    .tutorial-overlay.sky-phase .tutorial-dialogue {
      box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
    }

    .tutorial-dialogue {
      max-width: 520px;
      padding: 18px 22px 16px;
      border-radius: 6px;
      border: 1px solid var(--line2);
      background: radial-gradient(circle at top, rgba(255, 255, 255, 0.03), transparent 55%), #050505;
      box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
      text-align: center;
    }

    .tutorial-line {
      font-family: 'IM Fell English', serif;
      font-size: 1.05rem;
      letter-spacing: 0.08em;
      color: var(--text);
      margin-bottom: 14px;
    }

    .quests-view-step-done {
      color: #469646 !important;
      text-decoration: line-through;
      opacity: 0.8;
    }

    .tutorial-btn {
      padding: 8px 18px;
      border-radius: 2px;
      border: 1px solid var(--line2);
      background: rgba(139, 0, 0, 0.4);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.8rem;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      cursor: pointer;
      transition: background 0.18s, border-color 0.18s, transform 0.07s;
    }

    .tutorial-btn:hover {
      background: rgba(139, 0, 0, 0.55);
      border-color: rgba(139, 0, 0, 0.9);
    }

    .tutorial-btn:active {
      transform: translateY(1px);
    }

    /* While tutorial is active, hide normal actions / backpack but keep debug controls */
    body.tutorial-active .actions-wrap .embark-block,
    body.tutorial-active .actions-wrap .go-home-block,
    body.tutorial-active .actions-wrap .enter-military-tent-block,
    body.tutorial-active .actions-wrap .enter-tent-block,
    body.tutorial-active .actions-wrap .enter-huntingstand-block,
    body.tutorial-active .actions-wrap .enter-cottageruins-block,
    body.tutorial-active .actions-wrap .back-to-campsite-block,
    body.tutorial-active .actions-wrap .back-to-huntingstand-block,
    body.tutorial-active .actions-wrap .back-to-cottageruins-block,
    body.tutorial-active .backpack-wrap #btn-open-backpack,
    body.tutorial-active .backpack-wrap #btn-view-skills-main,
    body.tutorial-active .backpack-wrap #btn-open-quests,
    body.tutorial-active .backpack-wrap #btn-open-journal {
      display: none !important;
    }

    /* Debug events list under "Trigger event in room" */
    .debug-events-wrap {
      width: 100%;
      max-width: 240px;
      margin-top: 6px;
      padding-top: 4px;
      border-top: 1px dashed rgba(255, 255, 255, 0.08);
    }

    .debug-events-wrap .debug-event-btn {
      width: 100%;
      margin-top: 6px;
      padding: 6px 10px;
      font-size: 0.75rem;
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--dim);
      cursor: pointer;
      text-align: left;
    }

    .debug-events-wrap .debug-event-btn:hover {
      border-color: rgba(180, 180, 180, 0.4);
      color: var(--text);
      background: rgba(255, 255, 255, 0.02);
    }

    .debug-events-wrap .debug-events-empty {
      margin-top: 4px;
      font-size: 0.7rem;
      color: rgba(200, 200, 200, 0.4);
    }

    /* Debug Add Item category tabs (inside loot panel when in debug add mode) */
    .debug-additems-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin: 6px 0 4px;
    }

    .debug-additems-tabs .debug-additems-tab {
      padding: 4px 8px;
      font-size: 0.8rem;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      border: 1px solid rgba(255, 255, 255, 0.12);
      background: rgba(0, 0, 0, 0.4);
      color: var(--dim);
      cursor: pointer;
    }

    .debug-additems-tabs .debug-additems-tab.active {
      border-color: rgba(200, 180, 120, 0.7);
      background: rgba(200, 180, 120, 0.16);
      color: var(--text);
    }

    .debug-additems-sort-wrap {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 6px 0 8px;
    }

    .debug-additems-sort-label {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--dim);
    }

    .debug-additems-sort-select {
      padding: 4px 8px;
      font-size: 0.78rem;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: var(--text);
      font-family: inherit;
      cursor: pointer;
    }

    /* Embark / zone picker / Go back home */
    .actions-wrap {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 14px;
      padding: 24px 18px;
      width: 100%;
    }

    .embark-block,
    .visit-block,
    .npcs-block,
    .convoy-block,
    .mine-block,
    .mine-back-block,
    .explore-block,
    .loot-block,
    .enter-military-tent-block,
    .enter-tent-block,
    .enter-huntingstand-block,
    .enter-cottageruins-block,
    .go-home-block,
    .back-to-campsite-block,
    .back-to-huntingstand-block,
    .back-to-cottageruins-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .visit-block .btn-visit {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .npcs-block .btn-embark,
    .convoy-block .btn-embark,
    .mine-block .btn-embark,
    .mine-back-block .btn-embark,
    .vault-block .btn-embark,
    .explore-block .btn-explore,
    .loot-block .btn-loot,
    .enter-military-tent-block .btn-go-inside,
    .enter-tent-block .btn-go-inside,
    .enter-huntingstand-block .btn-go-inside,
    .enter-cottageruins-block .btn-go-inside,
    .go-home-block .btn-go-home,
    .back-to-campsite-block .btn-back-to-campsite,
    .back-to-huntingstand-block .btn-back-to-huntingstand,
    .back-to-cottageruins-block .btn-back-to-cottageruins {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .npcs-area-dropdown {
      width: 100%;
      max-width: 240px;
      box-sizing: border-box;
      margin-top: 4px;
      padding: 6px 0;
      background: rgba(0, 0, 0, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.16);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
    }

    .btn-npc-entry {
      width: 100%;
      padding: 6px 10px;
      background: none;
      border: none;
      text-align: left;
      font-family: 'Courier Prime', monospace;
      font-size: 0.78rem;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--dim);
      cursor: pointer;
    }

    .btn-npc-entry:hover {
      background: rgba(255, 255, 255, 0.06);
      color: var(--text);
    }

    .go-home-oxdale-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .go-home-oxdale-block .btn-go-home-oxdale {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .crafting-block,
    .upgrade-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .crafting-block .btn-crafting,
    .upgrade-block .btn-upgrade {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .go-outside-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .go-on-pc-block,
    .go-sleep-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .go-on-pc-block .btn-go-on-pc,
    .go-sleep-block .btn-go-sleep {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .go-inside-block,
    .go-downstairs-block,
    .go-upstairs-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      width: 100%;
    }

    .go-inside-block .btn-go-inside,
    .go-downstairs-block .btn-go-inside,
    .go-upstairs-block .btn-go-inside {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .go-outside-block .btn-go-outside,
    .vault-block .btn-embark,
    .buy-block .btn-buy {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
    }

    .buy-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 100%;
    }

    .embark-block.hidden,
    .visit-block.hidden,
    .npcs-block.hidden,
    .convoy-block.hidden,
    .mine-block.hidden,
    .mine-back-block.hidden,
    .go-home-oxdale-block.hidden,
    .go-inside-block.hidden,
    .go-outside-block.hidden,
    .go-on-pc-block.hidden,
    .go-sleep-block.hidden,
    .buy-block.hidden,
    .go-home-block.hidden,
    .explore-block.hidden,
    .loot-block.hidden,
    .back-to-campsite-block.hidden,
    .back-to-huntingstand-block.hidden,
    .back-to-convoy-block.hidden,
    .vault-block.hidden,
    .quest-tracker-wrap.hidden {
      display: none !important;
    }

    /* Explore / Loot / Go back home / Back to Campsite / Back to Hunting Stand – same button style */
    .back-to-huntingstand-block,
    .back-to-convoy-block,
    .enter-jeep-block,
    .mine-back-block,
    .vault-block {
      display: flex;
      flex-direction: column;
      align-items: center;
      width: 100%;
    }

    .explore-block .btn-explore,
    .loot-block .btn-loot,
    .go-home-block .btn-go-home,
    .back-to-campsite-block .btn-back-to-campsite,
    .back-to-huntingstand-block .btn-back-to-huntingstand,
    .enter-jeep-block .btn-back-to-convoy,
    .back-to-convoy-block .btn-back-to-convoy {
      width: 100%;
      min-width: 200px;
      max-width: 240px;
      box-sizing: border-box;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 12px 20px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.75rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s, color 0.2s;
    }

    .btn-explore:hover,
    .btn-loot:hover,
    .btn-go-home:hover,
    .btn-back-to-campsite:hover,
    .btn-back-to-huntingstand:hover {
      border-color: rgba(139, 0, 0, 0.5);
      background: rgba(139, 0, 0, 0.08);
      color: var(--text);
    }

    /* Tent hotspot: clickable area on campsite image (adjust position to match your tent) */
    .location-hotspot {
      position: absolute;
      z-index: 5;
      cursor: pointer;
      border: 1px solid transparent;
      transition: border-color 0.2s, background 0.2s;
    }

    .location-hotspot:hover {
      border-color: rgba(139, 0, 0, 0.4);
      background: rgba(139, 0, 0, 0.08);
    }

    .tent-hotspot {
      left: 69%;
      top: 37%;
      width: 14%;
      height: 24%;
    }

    /* Hunting stand ladder — covers the ladder + stand structure on the left (at ~20% mark) */
    .hunting-stand-hotspot {
      left: 52%;
      top: 13%;
      width: 17%;
      height: 50%;
    }

    /* Military camp tent: vertical rectangle left 50–53%, moved down to align with doorway */
    .military-tent-hotspot {
      left: 50%;
      top: 47%;
      width: 3%;
      height: 8%;
    }

    .inside-well-hotspot {
      left: 34%;
      top: 45%;
      width: 42%;
      /* right 76% - left 34% */
      height: 18%;
      /* bottom 63% - top 45% */
    }

    .convoy-jeep-hotspot {
      left: 28%;
      /* was 32% */
      top: 57%;
      width: 14%;
      /* was 10% */
      height: 22%;
      /* was 18% */
    }

    /* Mine lantern hotspots: refill Lantern Light (percentages match room art) */
    .mine-lantern-hotspot {
      background: rgba(139, 0, 0, 0.12);
    }

    .mine-lantern-t1 {
      left: 21%;
      top: 13%;
      width: 7%;
      height: 18%;
    }

    .mine-lantern-split {
      left: 61%;
      top: 22%;
      width: 6%;
      height: 10%;
    }

    .mine-lantern-three-1 {
      left: 6%;
      top: 21%;
      width: 6%;
      height: 10%;
    }

    .mine-lantern-three-2 {
      left: 39%;
      top: 21%;
      width: 6%;
      height: 9%;
    }

    .mine-lantern-three-3 {
      left: 90%;
      top: 22%;
      width: 5%;
      height: 8%;
    }

    .player-money-display {
      margin-top: 14px;
      margin-bottom: 8px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      color: #999;
      padding-left: 2px;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .money-amount {
      color: #4CAF50;
      font-weight: 600;
      text-shadow: 0 0 10px rgba(76, 175, 80, 0.4);
    }

    .quest-tracker-wrap {
      margin-top: 14px;
      padding-top: 12px;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .quest-tracker-title {
      font-family: 'Courier Prime', monospace;
      font-size: 0.65rem;
      text-transform: uppercase;
      letter-spacing: 0.15em;
      color: var(--dim);
      margin-bottom: 10px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .btn-close-tracker {
      background: none;
      border: none;
      color: var(--muted);
      cursor: pointer;
      font-size: 14px;
      padding: 0 4px;
      line-height: 1;
    }

    .btn-close-tracker:hover {
      color: var(--text);
    }

    .quest-tracker-name {
      font-family: 'IM Fell English', serif;
      font-size: 0.95rem;
      color: #c8b478;
      margin-bottom: 6px;
      letter-spacing: 0.04em;
    }

    .quest-tracker-steps {
      list-style: none;
      padding: 0;
      margin: 0;
    }

    .quest-tracker-step {
      font-size: 0.75rem;
      color: var(--muted);
      margin-bottom: 4px;
      line-height: 1.3;
      position: relative;
      padding-left: 14px;
    }

    .quest-tracker-step::before {
      content: '○';
      position: absolute;
      left: 0;
      color: var(--line);
    }

    .quest-tracker-step.done {
      color: #469646;
      text-decoration: line-through;
      opacity: 0.7;
    }

    .quest-tracker-step.done::before {
      content: '●';
      color: #469646;
    }

    .btn-pin-quest {
      background: rgba(200, 180, 120, 0.15);
      border: 1px solid rgba(200, 180, 120, 0.4);
      color: #c8b478;
      font-size: 0.65rem;
      padding: 3px 8px;
      cursor: pointer;
      border-radius: 2px;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      margin-left: auto;
      transition: all 0.2s;
    }

    .btn-pin-quest:hover {
      background: rgba(200, 180, 120, 0.3);
      border-color: #c8b478;
    }

    .stairs-up-hotspot {
      left: 31%;
      top: 13%;
      width: 11%;
      height: 58%;
    }

    .upstairs-player-hotspot {
      left: 7%;
      top: 3%;
      width: 13%;
      height: 87%;
    }

    .upstairs-bath-hotspot {
      left: 46%;
      top: 28%;
      width: 8%;
      height: 25%;
    }

    .upstairs-older-hotspot {
      left: 79%;
      top: 12%;
      width: 14%;
      height: 80%;
    }

    .upstairs-young-hotspot {
      left: 66%;
      top: 22%;
      width: 3%;
      height: 44%;
    }

    .location-hotspot.hidden {
      display: none !important;
    }

    /* Forest area nav – same left-to-right style as room nav */
    .forest-area-nav {
      display: flex;
      min-height: 72px;
      align-items: stretch;
      background: var(--void);
      border-top: 1px solid var(--line);
      overflow-x: auto;
    }

    .forest-area-nav::-webkit-scrollbar {
      display: none;
    }

    .forest-area-nav.hidden {
      display: none !important;
    }

    /* Party health panel: same slot as forest nav, shown during combat */
    .party-health-panel {
      display: flex;
      flex-direction: column;
      min-height: 72px;
      background: linear-gradient(180deg, rgba(20, 14, 6, 0.95), rgba(10, 8, 4, 0.98));
      border-top: 1px solid rgba(200, 160, 80, 0.45);
      padding: 10px 14px;
      gap: 10px;
    }

    .party-health-panel.hidden {
      display: none !important;
    }

    .party-health-boxes {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      align-items: flex-start;
    }

    .party-health-box {
      min-width: 180px;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(200, 160, 80, 0.25);
      border-radius: 2px;
      padding: 8px 12px;
      box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    }

    .party-health-box .party-health-name {
      font-family: 'IM Fell English', serif;
      font-size: 0.72rem;
      font-weight: 500;
      letter-spacing: 0.1em;
      color: #e8c97a;
      margin-bottom: 8px;
      padding-bottom: 5px;
      border-bottom: 1px solid rgba(200, 160, 80, 0.2);
      text-transform: uppercase;
    }

    .party-health-box .party-limb-line {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 4px 10px;
      font-size: 0.65rem;
      letter-spacing: 0.05em;
      color: #bfae8a;
    }

    .party-health-box .party-limb-chip {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      white-space: nowrap;
    }

    .party-health-box .party-limb-chip .limb-name {
      color: var(--dim);
    }

    .party-health-box .party-limb-chip .limb-hp {
      font-variant-numeric: tabular-nums;
    }

    .party-health-box .party-limb-chip.hp-high .limb-hp {
      color: #8c8;
    }

    .party-health-box .party-limb-chip.hp-mid .limb-hp {
      color: #da6;
    }

    .party-health-box .party-limb-chip.hp-low .limb-hp {
      color: #c44;
    }

    .forest-area-list {
      display: flex;
      align-items: stretch;
      flex: 1;
    }

    .forest-area-dot {
      padding: 18px 28px;
      font-size: 0.82rem;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--dim);
      cursor: pointer;
      transition: all 0.2s;
      border-right: 1px solid var(--line);
      white-space: nowrap;
      flex-shrink: 0;
      position: relative;
      display: flex;
      align-items: center;
    }

    .forest-area-dot::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--red);
      transform: scaleX(0);
      transition: transform 0.25s;
      transform-origin: left;
    }

    .forest-area-dot:hover {
      color: var(--text);
      background: var(--ghost);
    }

    .forest-area-dot:hover::after {
      transform: scaleX(1);
    }

    .forest-area-dot.active {
      color: #8a8078;
    }

    .forest-area-dot.active::after {
      transform: scaleX(1);
    }

    /* Safezone visit nav (Checkpoint | Military Camp | Firing Range) */
    .safezone-nav {
      display: flex;
      min-height: 72px;
      align-items: stretch;
      background: var(--void);
      border-top: 1px solid var(--line);
      overflow-x: auto;
    }

    .safezone-nav::-webkit-scrollbar {
      display: none;
    }

    .safezone-nav.hidden {
      display: none !important;
    }

    .safezone-nav-list {
      display: flex;
      align-items: stretch;
      flex: 1;
    }

    .safezone-nav-item {
      padding: 18px 28px;
      font-size: 0.82rem;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--dim);
      cursor: pointer;
      transition: all 0.2s;
      border-right: 1px solid var(--line);
      white-space: nowrap;
      flex-shrink: 0;
      position: relative;
      display: flex;
      align-items: center;
    }

    .safezone-nav-item:last-child {
      border-right: none;
    }

    .safezone-nav-item::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: var(--red);
      transform: scaleX(0);
      transition: transform 0.25s;
      transform-origin: left;
    }

    .safezone-nav-item:hover {
      color: var(--text);
      background: var(--ghost);
    }

    .safezone-nav-item:hover::after {
      transform: scaleX(1);
    }

    .safezone-nav-item.active {
      color: #8a8078;
    }

    .safezone-nav-item.active::after {
      transform: scaleX(1);
    }

    /* Same style as Open backpack for Embark */
    .btn-embark {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 12px 20px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.75rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s, color 0.2s;
    }

    .btn-embark:hover {
      border-color: rgba(139, 0, 0, 0.5);
      background: rgba(139, 0, 0, 0.08);
      color: var(--text);
    }

    .btn-visit.hidden {
      display: none !important;
    }

    /* Safezone travel transition: fade to black, message, 1 hour, fade in */
    .safezone-travel-overlay {
      position: fixed;
      inset: 0;
      background: #000;
      z-index: 20000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.4s ease;
    }

    .safezone-travel-overlay.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .safezone-travel-message {
      color: rgba(255, 255, 255, 0.95);
      font-family: 'IM Fell English', serif;
      font-size: 1.15rem;
      text-align: center;
      padding: 24px 32px;
      max-width: 80%;
      white-space: pre-line;
    }

    /* Map modal – centered overlay, map-style UI */
    .map-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 10000;
    }

    .map-overlay.is-open {
      display: flex;
    }

    .map-modal {
      background: linear-gradient(180deg, #1c1915 0%, #141210 100%);
      border: 2px solid #4a4238;
      padding: 0;
      position: relative;
      box-shadow: 0 0 80px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.03);
      width: 560px;
      max-width: 90vw;
      min-height: 380px;
      display: flex;
      flex-direction: column;
    }

    .map-modal::before {
      content: '';
      position: absolute;
      inset: 8px;
      border: 1px solid rgba(139, 0, 0, 0.2);
      pointer-events: none;
    }

    .map-modal-header {
      padding: 16px 44px 14px 20px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .map-modal-title {
      font-family: 'IM Fell English', serif;
      font-size: 1.1rem;
      letter-spacing: 0.15em;
      color: var(--text);
      text-transform: uppercase;
    }

    .btn-close-map {
      position: absolute;
      top: 0;
      right: 0;
      width: 40px;
      height: 40px;
      border: none;
      border-left: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
      font-size: 1.5rem;
      cursor: pointer;
      line-height: 1;
      transition: color 0.2s, background 0.2s;
    }

    .btn-close-map:hover {
      background: rgba(139, 0, 0, 0.15);
      color: var(--text);
    }

    .map-modal-body {
      flex: 1;
      padding: 28px 24px 32px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 20px;
    }

    .map-zone {
      width: 100%;
      max-width: 320px;
      padding: 18px 24px;
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.9rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      cursor: pointer;
      text-align: center;
      transition: border-color 0.2s, background 0.2s, color 0.2s;
    }

    .map-zone:hover {
      border-color: rgba(139, 0, 0, 0.6);
      background: rgba(139, 0, 0, 0.1);
      color: var(--text);
    }

    .map-zone-label {
      display: block;
      font-weight: 400;
      margin-bottom: 4px;
    }

    .map-zone-desc {
      font-size: 0.7rem;
      letter-spacing: 0.06em;
      color: var(--muted);
      text-transform: none;
    }

    /* Settings modal – centered overlay, tabs */
    .settings-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 10001;
    }

    .settings-overlay.is-open {
      display: flex;
    }

    .settings-modal {
      background: var(--void);
      border: 1px solid var(--line);
      padding: 0;
      position: relative;
      box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
      width: 420px;
      max-width: 92vw;
      min-height: 280px;
      display: flex;
      flex-direction: column;
    }

    .settings-modal-header {
      padding: 14px 44px 12px 20px;
      border-bottom: 1px solid var(--line);
    }

    .settings-modal-title {
      font-family: 'IM Fell English', serif;
      font-size: 1rem;
      letter-spacing: 0.12em;
      color: var(--text);
      text-transform: uppercase;
    }

    .btn-close-settings {
      position: absolute;
      top: 0;
      right: 0;
      width: 40px;
      height: 40px;
      border: none;
      border-left: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
      font-size: 1.5rem;
      cursor: pointer;
      line-height: 1;
      transition: color 0.2s, background 0.2s;
    }

    .btn-close-settings:hover {
      background: rgba(139, 0, 0, 0.15);
      color: var(--text);
    }

    .settings-tabs {
      display: flex;
      gap: 0;
      padding: 0 20px;
      border-bottom: 1px solid var(--line);
      background: rgba(0, 0, 0, 0.2);
    }

    .settings-tab {
      padding: 12px 20px;
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      color: var(--muted);
      font-family: 'Courier Prime', monospace;
      font-size: 0.75rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      cursor: pointer;
      margin-bottom: -1px;
      transition: color 0.2s, border-color 0.2s;
    }

    .settings-tab:hover {
      color: var(--text);
    }

    .settings-tab.active {
      color: var(--text);
      border-bottom-color: var(--red);
    }

    .settings-content {
      flex: 1;
      padding: 24px 20px 28px;
    }

    .settings-panel {
      display: none;
    }

    .settings-panel.active {
      display: block;
    }

    .settings-row {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 18px;
    }

    .settings-row:last-child {
      margin-bottom: 0;
    }

    .settings-label {
      flex: 0 0 80px;
      font-family: 'Courier Prime', monospace;
      font-size: 0.8rem;
      letter-spacing: 0.08em;
      color: var(--text);
    }

    .volume-slider {
      flex: 1;
      min-width: 120px;
      height: 6px;
      -webkit-appearance: none;
      appearance: none;
      background: var(--surface);
      border: 1px solid var(--line);
      outline: none;
    }

    .volume-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 14px;
      height: 14px;
      background: var(--text);
      border: 1px solid var(--line);
      cursor: pointer;
      transition: background 0.2s;
    }

    .volume-slider::-webkit-slider-thumb:hover {
      background: var(--red);
    }

    .volume-slider::-moz-range-thumb {
      width: 14px;
      height: 14px;
      background: var(--text);
      border: 1px solid var(--line);
      cursor: pointer;
    }

    .volume-value {
      flex: 0 0 28px;
      text-align: right;
      font-family: 'Courier Prime', monospace;
      font-size: 0.8rem;
      color: var(--text);
    }

    .volume-unit {
      font-size: 0.75rem;
      color: var(--muted);
    }
    /* ── SAVE / LOAD MODAL ── */
    .saveload-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.88);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 10003;
    }

    .saveload-overlay.is-open {
      display: flex;
    }

    .saveload-modal,
    .sl-modal {
      background: var(--void);
      border: 1px solid rgba(255, 255, 255, 0.1);
      position: relative;
      box-shadow: 0 0 80px rgba(0, 0, 0, 0.95);
      width: 640px;
      max-width: 96vw;
      max-height: 92vh;
      display: flex;
      flex-direction: column;
    }

    .sl-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 14px 50px 12px 20px;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
    }

    .sl-title {
      font-family: 'IM Fell English', serif;
      font-size: 1.05rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--text);
    }

    .sl-mode-sep {
      color: var(--dim);
      font-size: 0.8rem;
    }

    .sl-page-label {
      font-size: 0.65rem;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: var(--muted);
      margin-left: auto;
    }

    .btn-sl-close {
      position: absolute;
      top: 0;
      right: 0;
      width: 42px;
      height: 42px;
      border: none;
      border-left: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      background: transparent;
      color: var(--muted);
      font-size: 1.5rem;
      cursor: pointer;
      line-height: 1;
      transition: color 0.2s, background 0.2s;
    }

    .btn-sl-close:hover {
      background: rgba(139, 0, 0, 0.15);
      color: var(--text);
    }

    .sl-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
      padding: 14px 16px;
      overflow-y: auto;
      flex: 1;
    }

    .sl-slot {
      display: flex;
      flex-direction: column;
      gap: 5px;
      padding: 12px 14px;
      min-height: 84px;
      background: var(--surface);
      border: 1px solid var(--line);
      cursor: pointer;
      position: relative;
      transition: border-color 0.2s, background 0.2s;
    }

    .sl-slot:hover {
      border-color: rgba(139, 0, 0, 0.5);
      background: rgba(139, 0, 0, 0.06);
    }

    .sl-slot.sl-empty-load,
    .sl-slot.sl-empty {
      opacity: 0.28;
      cursor: not-allowed;
      pointer-events: none;
    }

    .sl-slot.sl-empty-load:hover,
    .sl-slot.sl-empty:hover {
      border-color: var(--line);
      background: var(--surface);
    }

    .sl-slot.sl-qs .sl-num {
      color: #ff5555;
      font-weight: bold;
    }

    .sl-num {
      font-size: 0.65rem;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: var(--dim);
      margin-bottom: 4px;
    }

    .sl-location {
      font-size: 0.95rem;
      letter-spacing: 0.05em;
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-weight: bold;
    }

    .sl-time {
      font-size: 0.8rem;
      letter-spacing: 0.04em;
      color: var(--muted);
      font-family: 'Courier Prime', monospace;
    }

    .sl-date {
      font-size: 0.75rem;
      letter-spacing: 0.04em;
      color: var(--dim);
      font-family: 'Courier Prime', monospace;
    }

    .sl-empty-label {
      font-size: 0.7rem;
      letter-spacing: 0.1em;
      color: var(--dim);
      font-style: italic;
      margin: auto;
      text-align: center;
    }

    .sl-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 16px;
      border-top: 1px solid var(--line);
      flex-shrink: 0;
    }

    .sl-nav-btn {
      font-family: 'Courier Prime', monospace;
      font-size: 0.72rem;
      letter-spacing: 0.1em;
      padding: 8px 16px;
      background: transparent;
      border: 1px solid var(--line);
      color: var(--muted);
      cursor: pointer;
      transition: color 0.2s, border-color 0.2s, background 0.2s;
    }

    .sl-nav-btn:hover {
      color: var(--text);
      border-color: rgba(255, 255, 255, 0.15);
      background: var(--ghost);
    }

    .sl-nav-btn:disabled {
      opacity: 0.2;
      cursor: default;
      pointer-events: none;
    }

    .sl-page-info {
      font-size: 0.67rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--dim);
    }

    /* Quick-save / quick-load toast */
    .qs-toast {
      position: fixed;
      bottom: 28px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--surface);
      border: 1px solid var(--line);
      color: var(--text);
      font-family: 'Courier Prime', monospace;
      font-size: 0.75rem;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      padding: 8px 22px;
      z-index: 10099;
      opacity: 0;
      transition: opacity 0.25s;
      pointer-events: none;
    }

    .qs-toast.show {
      opacity: 1;
    }

    /* Backpack modal – centered overlay */
    .backpack-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.75);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 10000;
    }

    .backpack-overlay.is-open {
      display: flex;
    }

    /* Buy overlay – General Store (Tarkov-style: stash left, cart center, trader right) */
    .buy-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.8);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 10000;
    }

    .buy-overlay.is-open {
      display: flex;
    }

    /* PC overlay – in-game computer desktop */
    .pc-overlay {
      position: absolute;
      inset: 0;
      background: #1a1a2e;
      display: none;
      flex-direction: column;
      z-index: 10050;
    }

    .pc-overlay.is-open {
      display: flex;
    }

    .pc-desktop {
      flex: 1;
      background: #0a0a0e;

      padding: 24px;
      display: flex;
      align-items: flex-start;
      position: relative;
    }

    .pc-desktop::before {
      content: "";
      position: absolute;
      inset: 0;
      background: linear-gradient(135deg, rgba(15, 15, 26, 0.8) 0%, rgba(20, 20, 40, 0.4) 100%);
      pointer-events: none;
    }

    .pc-desktop-icons {
      display: flex;
      flex-wrap: wrap;
      gap: 24px 32px;
      align-content: flex-start;
      position: relative;
      z-index: 2;
    }

    .pc-desktop-icon {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      background: none;
      border: none;
      color: var(--text, #e0e0e0);
      font-family: inherit;
      font-size: 0.85rem;
      cursor: pointer;
      padding: 8px;
      width: 80px;
    }

    .pc-desktop-icon:hover {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 4px;
    }

    .pc-icon-img {
      width: 48px;
      height: 48px;
      border-radius: 8px;
      background: #2a2a3e;
    }

    .pc-icon-browser-img {
      background: linear-gradient(135deg, #4285f4 0%, #ea4335 50%, #fbbc04 75%, #34a853 100%);
    }

    .pc-icon-codes-img {
      background: linear-gradient(145deg, #3d5a80, #1a2a3a);
    }

    .pc-icon-gallery-img {
      background: linear-gradient(145deg, #5c4d7d, #2d2438);
    }

    .pc-taskbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 16px;
      background: rgba(0, 0, 0, 0.85);
      border-top: 1px solid var(--line, #333);
      flex-shrink: 0;
    }

    .pc-taskbar-close {
      background: var(--line, #333);
      color: var(--text, #e0e0e0);
      border: none;
      padding: 6px 14px;
      font-family: inherit;
      font-size: 0.9rem;
      cursor: pointer;
      border-radius: 4px;
    }

    .pc-taskbar-close:hover {
      background: #444;
    }

    .pc-taskbar-time {
      font-size: 0.9rem;
      color: var(--dim, #999);
    }

    .pc-window {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      background: var(--void, #1a1a2e);
      border: 1px solid var(--line, #333);
      border-radius: 8px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
      display: flex;
      flex-direction: column;
      min-width: 320px;
      max-width: 90vw;
      max-height: 80vh;
    }

    .pc-window.hidden {
      display: none !important;
    }

    .pc-window-titlebar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 12px;
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(0, 0, 0, 0.4) 100%);
      border-bottom: 1px solid var(--line, #333);
      border-radius: 8px 8px 0 0;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }

    .pc-window-title {
      font-size: 0.9rem;
      color: var(--text, #e0e0e0);
    }

    .pc-window-close {
      background: none;
      border: none;
      color: var(--dim, #999);
      font-size: 1.4rem;
      cursor: pointer;
      line-height: 1;
      padding: 0 4px;
    }

    .pc-window-close:hover {
      color: var(--text, #e0e0e0);
    }

    .pc-browser-window {
      width: 800px;
      height: 600px;
      max-width: 95vw;
      max-height: 85vh;
    }

    .pc-browser-address-wrap {
      padding: 10px 14px;
      background: #2a2a3e;
      border-bottom: 1px solid var(--line, #333);
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .btn-browser-nav {
      background: #151525;
      color: var(--text, #e0e0e0);
      border: 1px solid #45455a;
      border-radius: 50%;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-weight: bold;
      transition: background 0.2s;
    }

    .btn-browser-nav:hover:not(:disabled) {
      background: #3d5a80;
    }

    .btn-browser-nav:disabled {
      color: #555;
      cursor: not-allowed;
      border-color: #333;
    }

    .pc-browser-address {
      width: 100%;
      padding: 8px 12px;
      font-size: 0.9rem;
      background: #151525;
      border: 1px solid #45455a;
      border-radius: 6px;
      color: var(--text, #e0e0e0);
      box-sizing: border-box;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
      font-family: monospace;
    }

    .pc-browser-content {
      flex: 1;
      overflow: auto;
      padding: 0;
      background: #fff;
      color: #333;
    }

    .pc-browser-home {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      height: 100%;
      padding: 20px;
    }

    .browser-logo-wrap {
      margin-bottom: 24px;
    }

    .browser-logo {
      font-size: 2.5rem;
      font-weight: 800;
      color: #4285f4;
      font-family: 'Helvetica Neue', Arial, sans-serif;
      letter-spacing: -1px;
    }

    .logo-accent {
      color: #ea4335;
    }

    .browser-search-box {
      width: 100%;
      max-width: 480px;
      position: relative;
      margin-bottom: 32px;
    }

    .browser-search-input {
      width: 100%;
      padding: 12px 16px 12px 48px;
      font-size: 1rem;
      border: 1px solid #dfe1e5;
      border-radius: 24px;
      outline: none;
      box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
      transition: box-shadow 0.2s;
    }

    .browser-search-input:focus {
      border-color: #fff;
      box-shadow: 0 1px 6px rgba(32, 33, 36, 0.38);
    }

    .search-icon {
      position: absolute;
      left: 16px;
      top: 50%;
      transform: translateY(-50%);
      color: #9aa0a6;
    }

    .browser-shortcuts {
      display: flex;
      gap: 24px;
      flex-wrap: wrap;
      justify-content: center;
    }

    .shortcut-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      background: none;
      border: none;
      cursor: pointer;
      width: 80px;
      padding: 8px;
      border-radius: 8px;
      transition: background 0.2s;
      text-decoration: none !important;
    }

    .shortcut-btn:hover {
      background: #f1f3f4;
    }

    .shortcut-icon {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: 1.2rem;
      font-weight: bold;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    }

    .shortcut-label {
      font-size: 0.8rem;
      color: #3c4043;
      text-align: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: 100%;
    }

    .pc-browser-page {
      padding: 20px;
    }

    .pc-browser-page h2 {
      margin: 0 0 12px 0;
      font-size: 1.5rem;
      color: #111;
      font-family: inherit;
      border-bottom: 2px solid #eee;
      padding-bottom: 8px;
    }

    .pc-browser-page p {
      margin: 0 0 16px 0;
      color: #555;
    }

    .prop-header {
      margin-bottom: 24px;
      text-align: center;
    }

    .prop-header h2 {
      border: none;
      margin-bottom: 4px;
      color: #d12e2e;
    }

    .prop-listing {
      display: flex;
      gap: 20px;
      border: 1px solid #ddd;
      border-radius: 8px;
      padding: 16px;
      background: #fafafa;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
      transition: transform 0.2s;
    }

    .prop-listing:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
      border-color: #ccc;
    }

    .prop-img {
      width: 140px;
      height: 100px;
      border-radius: 4px;
      object-fit: cover;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .prop-details {
      flex: 1;
      display: flex;
      flex-direction: column;
    }

    .prop-title {
      font-size: 1.2rem;
      margin: 0 0 8px 0;
      color: #222;
    }

    .prop-desc {
      font-size: 0.9rem;
      color: #666;
      margin-bottom: auto !important;
    }

    .prop-price {
      font-weight: bold;
      font-size: 1.1rem;
      color: #2c7a36 !important;
      margin-bottom: 12px !important;
    }

    .btn-rent-prop {
      background: #2c7a36;
      color: #fff;
      border: none;
      padding: 8px 16px;
      border-radius: 4px;
      cursor: pointer;
      font-weight: bold;
      font-size: 0.95rem;
      align-self: flex-start;
      transition: background 0.2s;
    }

    .btn-rent-prop:hover {
      background: #23612b;
    }

    .pc-codes-panel {
      width: 320px;
    }

    .pc-codes-body {
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .pc-codes-input {
      padding: 8px 12px;
      font-size: 0.95rem;
      background: #0f0f1a;
      border: 1px solid var(--line, #333);
      border-radius: 4px;
      color: var(--text, #e0e0e0);
      box-sizing: border-box;
    }

    .pc-codes-submit {
      padding: 8px 16px;
      font-size: 0.9rem;
      background: var(--line, #333);
      color: var(--text, #e0e0e0);
      border: none;
      border-radius: 4px;
      cursor: pointer;
      align-self: flex-start;
    }

    .pc-codes-submit:hover {
      background: #444;
    }

    .inventory-item:active {
      background: #444;
    }

    /* ──── CRAFTING UI ──── */
    .crafting-modal {
      background: var(--void);
      border: 1px solid var(--line);
      padding: 0;
      position: relative;
      box-shadow: 0 0 80px rgba(0, 0, 0, 0.9);
      width: 1100px;
      max-width: 95vw;
      height: 640px;
      display: flex;
      flex-direction: column;
      margin: auto;
    }

    .crafting-modal-body {
      display: flex;
      flex: 1;
      min-height: 0;
      gap: 40px;
      padding: 30px 40px;
    }

    .crafting-stash-panel {
      flex: 0 0 auto;
      display: flex;
      flex-direction: column;
    }

    .crafting-center-panel {
      flex: 0 0 460px;
      display: flex;
      flex-direction: column;
      align-items: center;
      border-left: 1px dashed rgba(255, 255, 255, 0.08);
      padding-left: 20px;
      padding-right: 20px;
    }

    .crafting-workflow-wrap {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 15px;
      margin-top: 30px;
      margin-bottom: 25px;
    }

    .crafting-workflow-step {
      display: flex;
      flex-direction: column;
      gap: 10px;
      align-items: center;
    }

    .crafting-step-label {
      color: var(--dim);
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      font-family: 'Courier Prime', monospace;
    }

    .crafting-op {
      color: var(--dim);
      font-size: 20px;
      font-family: 'Courier Prime', monospace;
      font-weight: bold;
      margin-top: 18px;
    }

    /* Slot and Cell Styles */
    .buy-cart-grid-bg {
      width: 54px;
      height: 54px;
      position: relative;
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.15);
      box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    }

    .buy-cell {
      width: 52px;
      height: 52px;
      background: rgba(0, 0, 0, 0.35); /* Standard dark cell background */
      box-sizing: border-box;
      box-shadow: inset 0 0 1px rgba(255, 255, 255, 0.1);
    }

    #crafting-slot-1-item, 
    #crafting-slot-2-item, 
    #crafting-slot-out-item {
      position: absolute;
      top: 1px;
      left: 1px;
      width: 52px;
      height: 52px;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 5;
    }

    .buy-stash-grid-bg {
      display: grid;
      grid-template-columns: repeat(4, 52px);
      grid-template-rows: repeat(4, 52px);
      gap: 2px;
      width: 214px;
      height: 214px;
      position: relative !important; /* Force relative for absolute children */
      background: rgba(0, 0, 0, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .btn-buy-confirm#btn-craft-vial {
      background: #4a634d;
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #fff;
      padding: 12px 40px;
      cursor: pointer;
      transition: all 0.2s;
      margin-top: 30px;
    }

    .btn-buy-confirm#btn-craft-vial:hover {
      background: #5a7a5e;
      box-shadow: 0 0 15px rgba(74, 99, 77, 0.3);
    }

    .crafting-recipes-panel {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 0;
    }

    .recipes-list {

      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 15px;
      overflow-y: auto;
      padding-right: 10px;
    }

    .recipes-list::-webkit-scrollbar {
      width: 4px;
    }

    .recipes-list::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 2px;
    }

    .recipe-item {
      background: rgba(255, 255, 255, 0.015);
      border: 1px solid rgba(255, 255, 255, 0.04);
      padding: 12px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      transition: all 0.2s;
    }

    .recipe-item:hover {
      background: rgba(255, 255, 255, 0.035);
      border-color: rgba(255, 255, 255, 0.08);
    }

    .recipe-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid rgba(255, 255, 255, 0.03);
      padding-bottom: 6px;
    }

    .recipe-name {
      font-size: 11px;
      font-weight: bold;
      color: var(--dim);
      text-transform: uppercase;
      letter-spacing: 0.12em;
      font-family: 'Courier Prime', monospace;
    }

    .recipe-content {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .recipe-ingredients {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .recipe-ingredient {
      width: 52px;
      height: 52px;
      background: rgba(10, 20, 10, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.08);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .recipe-ingredient img {
      max-width: 85%;
      max-height: 85%;
      object-fit: contain;
    }

    .recipe-plus {
      font-size: 14px;
      color: var(--dim);
      font-family: 'Courier Prime', monospace;
      opacity: 0.5;
    }

    .recipe-arrow {
      font-size: 18px;
      color: var(--dim);
      font-family: 'Courier Prime', monospace;
      opacity: 0.7;
    }

    .recipe-result {
      width: 52px;
      height: 52px;
      background: rgba(50, 10, 10, 0.4);
      border: 1px solid rgba(255, 60, 60, 0.15);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .recipe-result img {
      max-width: 85%;
      max-height: 85%;
      object-fit: contain;
    }

    .buy-modal {
      background: var(--void);
      border: 1px solid var(--line);
      padding: 0;
      position: relative;
      box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
      width: auto;
      min-width: 920px;
      max-width: 95vw;
      height: 90vh;
      min-height: 540px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
    }

    .buy-modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 24px;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
      width: 100%;
      box-sizing: border-box;
    }

    .buy-modal-title {
      margin: 0;
      font-size: 1rem;
      font-weight: 600;
    }

    .buy-money-display {
      font-size: 0.95rem;
      color: var(--dim);
    }

    .btn-close-buy {
      background: none;
      border: none;
      color: var(--dim);
      font-size: 1.5rem;
      cursor: pointer;
      padding: 0 4px;
      line-height: 1;
    }

    .btn-close-buy:hover {
      color: #fff;
    }

    .buy-modal-body {
      display: flex;
      flex: 1;
      min-height: 0;
      gap: 16px;
      padding: 16px;
      overflow-y: auto;
    }

    .buy-panel {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .buy-stash-panel {
      flex: 0 0 auto;
    }

    .buy-panel-label {
      font-size: 0.45rem;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--dim);
      margin-bottom: 8px;
    }

    .buy-stash-grid-wrap {
      position: relative;
      line-height: 0;
      flex-shrink: 0;
      min-height: 0;
    }

    .buy-stash-grid-bg {
      display: grid;
      gap: 2px;
      background: transparent;
    }

    .buy-stash-grid-bg .buy-cell {
      width: 52px;
      height: 52px;
      background: rgba(0, 0, 0, 0.38);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
      box-sizing: border-box;
    }

    .buy-grid-5x5 {
      display: grid;
      grid-template-columns: repeat(5, 52px);
      grid-template-rows: repeat(5, 52px);
      gap: 2px;
      width: 270px;
      height: 270px;
      background: transparent;
      padding: 0;
      border: 1px solid var(--line);
      position: relative;
      box-sizing: border-box;
    }

    .buy-grid-5x5 .buy-cell {
      width: 52px;
      height: 52px;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-sizing: border-box;
    }

    .buy-cart-section {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .buy-footer {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 8px;
      padding-top: 10px;
      border-top: 1px solid var(--line);
      flex-shrink: 0;
    }

    .buy-total-label {
      font-size: 0.9rem;
      color: var(--dim);
    }

    .btn-buy-confirm {
      padding: 8px 20px;
      background: var(--accent, #4a7c59);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #fff;
      font-size: 0.9rem;
      cursor: pointer;
      border-radius: 4px;
    }

    .btn-buy-confirm:hover {
      filter: brightness(1.1);
    }

    .btn-buy-confirm:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .buy-trader-panel {
      flex: 1;
      min-width: 200px;
      overflow-y: auto;
    }

    .buy-trader-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .buy-trader-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.08);
      cursor: pointer;
      border-radius: 4px;
    }

    .buy-trader-item:hover {
      background: rgba(255, 255, 255, 0.06);
    }

    .buy-trader-item img {
      width: 52px;
      height: 52px;
      object-fit: contain;
      flex-shrink: 0;
    }

    .buy-trader-item-info {
      flex: 1;
      min-width: 0;
    }

    .buy-trader-item-name {
      font-size: 0.9rem;
      font-weight: 500;
    }

    .buy-trader-item-price {
      font-size: 0.85rem;
      color: var(--dim);
    }

    .buy-cart-item {
      position: absolute;
      z-index: 2;
      width: 52px;
      height: 52px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: rgba(10, 20, 10, 0.94);
      border: 1px solid rgba(255, 255, 255, 0.12);
      box-sizing: border-box;
      font-size: 0.8rem;
      color: #fff;
      pointer-events: auto;
      cursor: pointer;
    }

    .buy-cart-item img {
      width: 44px;
      height: 44px;
      object-fit: contain;
    }

    .buy-sell-grid-bg .buy-cart-item img {
      width: 44px;
      height: 44px;
      object-fit: contain;
    }

    .backpack-modal {
      background: var(--void);
      border: 1px solid var(--line);
      padding: 0;
      position: relative;
      box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
      width: auto;
      min-width: 610px;
      max-width: 96vw;
      height: 600px;
      min-height: 520px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      transition: width 0.3s ease;
    }

    .inv-modal-body {
      display: flex;
      flex: 1;
      min-height: 0;
      flex-wrap: nowrap;
      overflow-x: hidden;
      min-width: 0;
    }

    /* ── LEFT: Body / Status ── */
    .inv-body-panel {
      flex: 0 0 320px;
      padding: 24px 20px 24px 24px;
      border-right: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .inv-panel-label {
      font-size: 0.56rem;
      letter-spacing: 0.3em;
      text-transform: uppercase;
      color: var(--dim);
    }

    .body-wrap {
      display: flex;
      align-items: flex-start;
      justify-content: center;
      gap: 8px;
      min-height: 260px;
      position: relative;
      /* allow absolutely positioned two-handed slot */
    }

    .body-svg {
      width: 72px;
      height: auto;
      flex-shrink: 0;
    }

    .body-dot {
      pointer-events: auto;
      cursor: default;
      transition: fill 0.2s ease;
    }

    .body-dot.body-limb-ok {
      fill: rgba(80, 180, 80, 0.85);
    }

    .body-dot.body-limb-warn {
      fill: rgba(218, 165, 32, 0.9);
    }

    .body-dot.body-limb-bad {
      fill: rgba(200, 60, 60, 0.9);
    }

    .body-dot.body-limb-bleeding {
      fill: rgba(200, 60, 60, 0.95);
    }

    .body-dot.pulse-amber {
      animation: pulse-amber 2s ease-in-out infinite;
    }

    .body-dot.pulse-red {
      animation: pulse-red 2s ease-in-out infinite;
    }

    .body-dot.pulse-purple {
      animation: pulse-purple 2s ease-in-out infinite;
    }

    @keyframes pulse-amber {

      0%,
      100% {
        opacity: .85
      }

      50% {
        opacity: .5
      }
    }

    @keyframes pulse-red {

      0%,
      100% {
        opacity: .9
      }

      50% {
        opacity: .55
      }
    }

    @keyframes pulse-purple {

      0%,
      100% {
        opacity: .8
      }

      50% {
        opacity: .45
      }
    }

    .equip-slots-left,
    .equip-slots-right {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .equip-slots-left {
      align-items: flex-end;
    }

    .equip-slots-right {
      align-items: flex-start;
    }

    .equip-slot-group {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }

    .equip-slot-label {
      font-size: 0.45rem;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: var(--dim);
    }

    .equip-slot {
      width: 36px;
      height: 36px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--surface);
      border: 1px solid var(--line);
      font-size: 1.1rem;
      color: var(--text);
      transition: border-color 0.2s, background 0.2s;
    }

    .equip-slot:hover {
      border-color: rgba(139, 0, 0, 0.5);
      background: rgba(139, 0, 0, 0.06);
    }

    .equip-slot:not(.empty-slot) {
      cursor: pointer;
    }

    .equip-slot.empty-slot {
      color: var(--dim);
      opacity: 0.6;
      font-size: 0.75rem;
    }

    /* L. Hand and R. Hand slots bigger (default) */
    .equip-slot-group.hand-group .equip-slot {
      width: 48px;
      height: 48px;
      font-size: 1.35rem;
    }

    .equip-slot-group.hand-group .equip-slot.empty-slot {
      font-size: 0.85rem;
    }

    /* Two-handed weapon: merge hand slots into one long bar centered under the body */
    .equip-slot-group.hand-group .equip-slot.two-handed-primary {
      position: absolute;
      left: 59%;
      /* shift a bit further right so it's centered between L/R hands */
      bottom: 44px;
      /* tiny bit lower so label + slot breathe */
      transform: translateX(-50%);
      width: 170px;
      height: 60px;
    }

    .equip-slot-group.hand-group .equip-slot.two-handed-primary::before {
      content: 'TWO HANDS';
      position: absolute;
      top: -18px;
      left: 50%;
      transform: translateX(-50%);
      font-size: 0.52rem;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: rgba(200, 200, 200, 0.85);
    }

    .equip-slot-group.hand-group .equip-slot.two-handed-primary .equip-slot-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      padding: 0;
      /* no inner padding so the rifle fills the slot */
      transform: scale(1.45);
      /* slightly larger rifle image */
      transform-origin: center center;
    }

    .equip-slot-group.hand-group .equip-slot.two-handed-secondary {
      width: 0;
      height: 0;
      padding: 0;
      margin: 0;
      border: none;
      background: transparent;
    }

    .equip-slot-group.hand-group .equip-slot.two-handed-secondary .equip-slot-img {
      display: none;
    }

    .condition-list {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }

    .condition-item {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 0.65rem;
      letter-spacing: 0.08em;
      color: var(--text);
    }

    .cond-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .cond-dot.ok {
      background: rgba(70, 150, 70, 0.9);
    }

    .cond-dot.warn {
      background: rgba(170, 90, 10, 0.9);
    }

    .cond-dot.bad {
      background: rgba(200, 50, 50, 0.9);
    }

    .cond-dot.muted {
      background: rgba(110, 70, 170, 0.8);
    }

    .cond-name {
      flex: 0 0 72px;
      color: var(--dim);
    }

    .cond-status {
      flex: 1;
    }

    /* Divider */
    .inv-divider {
      width: 1px;
      background: var(--line);
      flex-shrink: 0;
    }

    /* ── CENTER: Inventory grid ── */
    .inv-items-panel {
      flex: 0 0 260px;
      min-width: 260px;
      max-width: 260px;
      /* fixed cap so panel and item-detail never grow wide on hover */
      overflow: hidden;
      position: relative;
      padding: 20px 20px 20px 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    /* ── LOOT / Add Item panel (right of inventory) ── */
    .inv-loot-panel,
    .inv-vault-panel {
      flex: 0 0 580px;
      flex-shrink: 0;
      min-width: 580px;
      width: 580px;
      padding: 24px 20px 24px 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
      overflow: visible;
    }

    .inv-vault-panel {
      min-width: 460px;
      /* Accommodate 8x8 grid (432px) + padding */
    }

    .vault-area-items-wrap {
      position: relative;
      overflow-y: auto;
      max-height: 100%;
      scrollbar-width: thin;
      scrollbar-color: var(--line) transparent;
    }

    .vault-area-items-wrap::-webkit-scrollbar {
      width: 4px;
    }

    .vault-area-items-wrap::-webkit-scrollbar-track {
      background: transparent;
    }

    .vault-area-items-wrap::-webkit-scrollbar-thumb {
      background: var(--line);
    }

    .loot-divider {
      width: 1px;
      background: var(--line);
      flex-shrink: 0;
    }

    .inv-items-panel .inv-panel-label {
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .inv-count {
      font-size: 0.56rem;
      letter-spacing: 0.2em;
      color: var(--dim);
    }

    .inv-value {
      font-size: 0.52rem;
      letter-spacing: 0.08em;
      color: var(--dim);
      opacity: 0.9;
    }

    /* ── TRASH BIN ── */
    .inv-trash-bin {
      width: 52px !important;
      height: 52px !important;
      background: rgba(10, 10, 10, 0.6);
      border: 1px dashed #444 !important;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: #777;
      transition: border-color 0.2s, background 0.2s, color 0.2s;
      margin-right: 10px; /* Align perfectly above 4th slot considering panel padding vs grid width */
      z-index: 10;
    }

    .inv-trash-bin:hover,
    .inv-trash-bin.drag-over {
      border-color: var(--accent) !important;
      background: rgba(139, 0, 0, 0.15);
      color: var(--accent);
    }
    
    .inv-trash-bin svg {
        opacity: 0.5;
        transition: opacity 0.2s;
    }
    
    .inv-trash-bin:hover svg,
    .inv-trash-bin.drag-over svg {
        opacity: 1;
    }

    .inv-trash-bin .tarkov-item {
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        cursor: pointer;
        z-index: 11;
    }

    /* ── Tarkov-style inventory grid ── */
    .tarkov-grid-wrap {
      position: relative;
      flex-shrink: 0;
      align-self: flex-start;
      line-height: 0;
      outline: 2px solid transparent;
      transition: outline-color 0.15s;
    }

    .tarkov-grid-bg {
      display: grid;
      grid-template-columns: repeat(4, 52px);
      grid-auto-rows: 52px;
      gap: 2px;
    }

    .tg-cell {
      background: rgba(0, 0, 0, 0.38);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
      box-sizing: border-box;
    }

    .tarkov-cell {
      width: 52px;
      height: 52px;
      background: rgba(0, 0, 0, 0.38);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
      box-sizing: border-box;
      pointer-events: none;
    }

    .tarkov-cell.hl-ok {
      background: rgba(60, 140, 60, 0.22);
      box-shadow: inset 0 0 0 1px rgba(60, 140, 60, 0.55);
    }

    .tarkov-cell.hl-bad {
      background: rgba(139, 0, 0, 0.22);
      box-shadow: inset 0 0 0 1px rgba(139, 0, 0, 0.55);
    }

    .tarkov-item {
      position: absolute;
      box-sizing: border-box;
      background: rgba(10, 20, 10, 0.94);
      border: 1px solid rgba(55, 95, 55, 0.55);
      cursor: grab;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      padding: 4px 3px;
      user-select: none;
      z-index: 1;
      transition: border-color 0.15s;
    }

    .tarkov-item:hover {
      border-color: rgba(139, 0, 0, 0.7);
      z-index: 2;
    }

    .tarkov-item.dragging {
      opacity: 0.35;
      pointer-events: none;
    }

    .tarkov-item-name {
      font-size: 0.43rem;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      color: rgba(165, 158, 145, 0.85);
      text-align: center;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      max-width: 100%;
      pointer-events: none;
      line-height: 1.3;
    }

    .tarkov-item-size {
      font-size: 0.36rem;
      color: rgba(80, 80, 80, 0.9);
    }

    .tarkov-item-stack {
      position: absolute;
      bottom: 2px;
      right: 2px;
      font-size: 0.65rem;
      font-weight: bold;
      color: #fff;
      text-shadow: 0 0 2px #000, 0 1px 2px #000;
      pointer-events: none;
      pointer-events: none;
      font-family: 'Courier Prime', monospace;
    }

    .tarkov-drag-ghost {
      position: fixed;
      pointer-events: none;
      z-index: 10099;
      box-sizing: border-box;
      background: rgba(10, 20, 10, 0.92);
      border: 1px solid rgba(139, 0, 0, 0.75);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      padding: 4px 3px;
      transition: none;
    }

    /* Item image fills the slot; name/size labels are hidden (image is enough) */
    .tarkov-item-img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      pointer-events: none;
      user-select: none;
      opacity: 0.9;
      padding: 4px;
      z-index: 0;
    }

    .tarkov-item-name,
    .tarkov-item-size {
      display: none;
    }

    /* Ghost image */
    .tarkov-drag-ghost .tarkov-item-img {
      position: absolute;
      inset: 0;
      padding: 4px;
      opacity: 0.78;
    }

    /* Rarity borders and subtle outer glow (higher rarity = stronger effect) */
    .tarkov-item.rarity-common {
      border-color: rgba(157, 157, 157, 0.55);
    }

    .tarkov-item.rarity-uncommon {
      border-color: rgba(74, 143, 217, 0.75);
      box-shadow:
        0 0 6px rgba(74, 143, 217, 0.35),
        inset 0 0 6px rgba(74, 143, 217, 0.16);
    }

    .tarkov-item.rarity-rare {
      border-color: rgba(155, 89, 182, 0.85);
      box-shadow:
        0 0 10px rgba(155, 89, 182, 0.55),
        inset 0 0 8px rgba(155, 89, 182, 0.22);
    }

    .tarkov-item.rarity-legendary {
      border-color: rgba(241, 196, 15, 0.9);
      box-shadow:
        0 0 12px rgba(241, 196, 15, 0.65),
        inset 0 0 10px rgba(241, 196, 15, 0.28);
    }

    .tarkov-item.rarity-epic {
      border-color: rgba(148, 87, 235, 0.85);
      box-shadow:
        0 0 10px rgba(148, 87, 235, 0.55),
        inset 0 0 8px rgba(148, 87, 235, 0.22);
    }

    .tarkov-item.rarity-quest {
      border-color: rgba(163, 73, 164, 1);
      box-shadow:
        0 0 14px rgba(163, 73, 164, 0.7),
        inset 0 0 10px rgba(163, 73, 164, 0.3);
    }

    .tarkov-item.rarity-uncommon .tarkov-item-name {
      color: rgba(100, 170, 230, 0.9);
    }

    .tarkov-item.rarity-rare .tarkov-item-name {
      color: rgba(185, 130, 220, 0.9);
    }

    .tarkov-item.rarity-legendary .tarkov-item-name {
      color: rgba(241, 196, 15, 0.95);
    }

    .tarkov-item.rarity-epic .tarkov-item-name {
      color: rgba(180, 140, 255, 0.95);
    }

    /* Visual tweak: make the Rusted Machete image a bit larger (but not too big) inside its slot */
    .tarkov-item.item-rusted-machete img {
      transform: scale(1.07);
      transform-origin: center center;
    }

    /* Visual tweak: make the Cracked Compass image larger so it's easier to see */
    .tarkov-item.item-cracked-compass img {
      transform: scale(1.18);
      transform-origin: center center;
    }

    /* Visual tweak: slightly shrink scoped hunting rifle so scope doesn't clip */
    .tarkov-item.item-hunting-rifle-scope img {
      transform: scale(0.94);
      transform-origin: center center;
    }

    /* Back + Chest side-by-side row */
    .equip-side-row {
      display: flex;
      flex-direction: row;
      gap: 6px;
      align-items: flex-start;
    }

    /* Chest same size as Back so row height matches Legs on the right */
    .equip-side-row .equip-slot-group:not(.backpack-group) .equip-slot {
      width: 52px;
      height: 52px;
    }

    /* Legs slot same height as Back+Chest row so L.Hand and R.Hand align */
    .equip-slot-group.legs-group .equip-slot {
      width: 52px;
      height: 52px;
    }

    /* Backpack equip slot */
    .equip-slot-group.backpack-group .equip-slot {
      width: 52px;
      height: 52px;
    }

    .equip-slot-group.backpack-group .equip-slot.empty-slot {
      font-size: 0.60rem;
    }

    .equip-slot-group.backpack-group .equip-slot.drag-over-slot,
    .equip-slot-group.hand-group .equip-slot.drag-over-slot {
      border-color: rgba(60, 140, 60, 0.7);
      background: rgba(60, 140, 60, 0.1);
    }

    .equip-slot-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      pointer-events: none;
      padding: 4px;
    }

    /* ── Loot modal — Tarkov-style split layout ─────────────────── */
    @keyframes loot-blink {

      0%,
      100% {
        opacity: 0.85;
      }

      50% {
        opacity: 0.25;
      }
    }

    /* Highlight for the inventory grid when dragging a loot item over it */
    .tarkov-grid-wrap.drop-ok {
      outline-color: rgba(60, 140, 60, 0.55);
    }

    /* Right panel: area loot — tarkov grid */
    .loot-area-items-wrap {
      position: relative;
      line-height: 0;
      flex-shrink: 0;
      align-self: flex-start;
      width: fit-content;
      max-height: 65vh;
      overflow: hidden;
    }

    .loot-area-item-box {
      overflow: hidden;
      cursor: default;
      transition: border-color 0.2s, opacity 0.2s;
      border: 1px solid rgba(255, 255, 255, 0.07);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    }

    .loot-area-item-box.is-scanning {
      border-color: rgba(200, 180, 100, 0.4);
    }

    .loot-area-item-box.is-found {
      cursor: grab;
    }

    .loot-area-item-box.is-taken {
      opacity: 0.28;
      cursor: default;
      pointer-events: none;
    }

    .loot-area-item-box.is-dragging {
      opacity: 0.25;
    }

    .loot-area-item-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      padding: 5px;
      display: block;
      pointer-events: none;
      user-select: none;
      transition: filter 0.45s ease;
    }

    /* Scanning pulse on current item */
    .loot-area-item-box.is-scanning::after {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(200, 180, 100, 0.06);
      animation: scan-pulse 0.55s ease-in-out infinite;
      pointer-events: none;
    }

    @keyframes scan-pulse {

      0%,
      100% {
        background: rgba(200, 180, 100, 0.03);
      }

      50% {
        background: rgba(200, 180, 100, 0.14);
      }
    }

    /* Per-item scan progress bar */
    .loot-scan-bar-wrap {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 2px;
      background: rgba(255, 255, 255, 0.07);
      pointer-events: none;
    }

    .loot-scan-bar {
      height: 100%;
      width: 0%;
      background: rgba(200, 180, 100, 0.75);
    }

    /* Magnifying glass overlay */
    .loot-magnify-icon {
      position: absolute;
      pointer-events: none;
      z-index: 5;
      color: rgba(210, 200, 170, 0.85);
      filter: drop-shadow(0 0 3px rgba(200, 180, 100, 0.6));
      transition: left 0.18s ease, top 0.18s ease;
    }

    /* Scan status label */
    .loot-scan-status {
      font-family: 'Courier Prime', monospace;
      font-size: 0.6rem;
      letter-spacing: 0.25em;
      text-transform: uppercase;
      color: var(--muted);
      min-height: 14px;
      flex-shrink: 0;
    }

    .loot-scan-status.blinking {
      animation: loot-blink 0.85s ease-in-out infinite;
    }

    /* Drag ghost for loot items */
    .loot-item-drag-ghost {
      position: fixed;
      pointer-events: none;
      z-index: 10200;
      box-sizing: border-box;
      background: rgba(10, 20, 10, 0.90);
      border: 1px solid rgba(60, 140, 60, 0.7);
      opacity: 0.85;
    }

    .loot-item-drag-ghost img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      padding: 4px;
      display: block;
    }

    .loot-empty-msg {
      font-size: 0.68rem;
      letter-spacing: 0.1em;
      color: var(--dim);
      font-style: italic;
      text-align: center;
      padding: 24px 0;
      width: 100%;
    }

    .item-detail {
      margin-top: auto;
      padding-top: 12px;
      border-top: 1px solid var(--line);
      min-height: 60px;
      min-width: 0;
      /* contain long text so panel doesn't grow on hover */
      overflow-wrap: break-word;
      word-break: break-word;
    }

    .item-detail-name {
      font-family: 'IM Fell English', serif;
      font-size: 0.85rem;
      color: var(--text);
      margin-bottom: 4px;
      min-width: 0;
      overflow-wrap: break-word;
      word-break: break-word;
    }

    .item-detail-desc {
      font-size: 0.55rem;
      color: var(--dim);
      letter-spacing: 0.04em;
      font-style: italic;
      overflow-wrap: break-word;
      word-break: break-word;
      max-width: 100%;
      min-width: 0;
    }

    .item-detail-price {
      font-size: 0.6rem;
      color: var(--muted);
      margin-top: 4px;
      min-width: 0;
      overflow-wrap: break-word;
      word-break: break-word;
    }

    .item-detail-weapon {
      min-width: 0;
      overflow-wrap: break-word;
      word-break: break-word;
      font-size: 0.6rem;
      color: var(--dim);
      margin-top: 4px;
    }

    .item-detail-actions {
      margin-top: 8px;
    }

    .weapon-attach-window {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      min-width: 340px;
      background: rgba(18, 18, 18, 0.97);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
      z-index: 100;
      font-family: inherit;
    }

    .weapon-attach-drag-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 14px;
      background: rgba(0, 0, 0, 0.5);
      border-bottom: 1px solid var(--line);
      border-radius: 8px 8px 0 0;
      cursor: move;
      font-size: 0.95rem;
      color: var(--dim);
      user-select: none;
    }

    .weapon-attach-drag-bar:active {
      cursor: grabbing;
    }

    .weapon-attach-close {
      background: none;
      border: none;
      color: var(--dim);
      cursor: pointer;
      font-size: 1.3rem;
      line-height: 1;
      padding: 0 6px;
      margin: -4px -4px 0 0;
    }

    .weapon-attach-close:hover {
      color: #ccc;
    }

    .skills-view-window {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 720px;
      max-width: 95vw;
      background: rgba(10, 10, 10, 0.98);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
      z-index: 10001;
      font-family: inherit;
      display: flex;
      flex-direction: column;
      max-height: 85vh;
    }

    .skills-view-drag-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 14px;
      background: rgba(0, 0, 0, 0.6);
      border-bottom: 1px solid var(--line);
      border-radius: 8px 8px 0 0;
      cursor: move;
      font-size: 0.95rem;
      color: var(--dim);
      user-select: none;
    }

    .skills-view-drag-bar:active {
      cursor: grabbing;
    }

    .skills-view-close {
      background: none;
      border: none;
      color: var(--dim);
      cursor: pointer;
      font-size: 1.3rem;
      line-height: 1;
      padding: 0 6px;
      margin: -4px -4px 0 0;
    }

    .skills-view-close:hover {
      color: #ccc;
    }

    .skills-view-body {
      display: flex;
      padding: 0;
      overflow: hidden;
      flex: 1;
    }

    .skills-view-left {
      flex: 0 0 320px;
      padding: 18px 20px;
      border-right: 1px solid var(--line);
      overflow-y: auto;
      min-width: 0;
    }

    .skills-view-right {
      flex: 1;
      padding: 18px 20px;
      background: rgba(0, 0, 0, 0.2);
      overflow-y: auto;
      min-width: 0;
    }

    .skills-view-stat-detail-lines {
      font-size: 0.72rem;
      line-height: 1.5;
      color: var(--dim);
      word-wrap: break-word;
      overflow-wrap: break-word;
    }

    .skills-view-stat-detail-line {
      margin-bottom: 6px;
      word-wrap: break-word;
      overflow-wrap: break-word;
    }

    .skills-view-stat-detail-line strong {
      color: var(--muted);
      font-weight: 600;
    }

    .skills-view-heading {
      margin-bottom: 8px;
    }

    .skills-view-name {
      font-family: 'IM Fell English', serif;
      font-size: 1.1rem;
      letter-spacing: 0.1em;
      color: var(--text);
    }

    .skills-view-sex {
      font-size: 0.72rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted);
      margin-top: 4px;
    }

    .skills-view-body .section-rule {
      height: 1px;
      background: linear-gradient(90deg, transparent 0%, var(--line2) 20%, var(--line2) 80%, transparent 100%);
      margin: 10px 0 14px;
    }

    .skills-view-stats {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .skills-view-stat-row {
      display: grid;
      grid-template-columns: 1.4fr 40px 1fr;
      align-items: center;
      gap: 12px;
      padding: 8px 12px;
      border-radius: 4px;
      transition: background 0.2s, transform 0.1s;
      cursor: pointer;
      border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    }

    .skills-view-stat-row:hover {
      background: rgba(255, 255, 255, 0.04);
      transform: translateX(4px);
      border-bottom-color: transparent;
    }

    .skills-view-stat-name {
      font-size: 0.72rem;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      color: var(--dim);
      transition: color 0.2s;
    }

    .skills-view-stat-row:hover .skills-view-stat-name {
      color: var(--text);
    }

    .skills-view-stat-value {
      font-family: 'Courier Prime', monospace;
      font-size: 0.85rem;
      font-weight: bold;
      color: var(--text);
      text-align: right;
      padding-right: 8px;
    }

    .skills-view-stat-scale {
      height: 4px;
      background: rgba(255, 255, 255, 0.06);
      border-radius: 2px;
      overflow: hidden;
    }

    .skills-view-stat-scale-fill {
      height: 100%;
      background: linear-gradient(90deg, #521111, #8b0000);
      box-shadow: 0 0 8px rgba(139, 0, 0, 0.4);
      transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    /* Level bar (above karma) – same width as karma bar */
    .skills-view-level-wrap {
      margin-top: 24px;
      padding-top: 16px;
      border-top: 1px solid var(--line);
    }

    .level-label-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
      padding: 0 10px;
    }

    .level-label {
      font-size: 0.7rem;
      text-transform: uppercase;
      letter-spacing: 0.15em;
      color: var(--dim);
    }

    .level-value {
      font-weight: 700;
      color: var(--text);
    }

    .level-bar-container {
      position: relative;
      height: 6px;
      background: rgba(0, 0, 0, 0.4);
      border-radius: 3px;
      border: 1px solid rgba(255, 255, 255, 0.05);
      margin: 0 10px;
    }

    .level-bar-fill {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      border-radius: 2px;
      background: linear-gradient(to right, #3498db, #2980b9);
      transition: width 0.4s ease;
    }

    .level-exp-text {
      text-align: center;
      font-size: 0.65rem;
      letter-spacing: 0.1em;
      color: var(--dim);
      margin-top: 8px;
    }

    /* Karma System Styles */
    .skills-view-karma-wrap {
      margin-top: 32px;
      padding-top: 20px;
      border-top: 1px solid var(--line);
    }

    .karma-label-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 12px;
      margin-bottom: 12px;
      padding: 0 10px;
    }

    .karma-icon {
      width: 28px;
      height: 28px;
      object-fit: contain;
      opacity: 0.2;
      transition: all 0.4s ease;
      filter: grayscale(1);
    }

    .karma-icon.active {
      opacity: 1;
      filter: grayscale(0) drop-shadow(0 0 8px rgba(192, 57, 43, 0.6));
      transform: scale(1.1);
    }

    .karma-icon.good-active {
      filter: grayscale(0) drop-shadow(0 0 10px rgba(241, 196, 15, 0.5));
    }

    .karma-bar-container {
      position: relative;
      height: 6px;
      background: rgba(0, 0, 0, 0.4);
      border-radius: 3px;
      border: 1px solid rgba(255, 255, 255, 0.05);
      margin: 0 10px;
    }

    .karma-bar-center {
      position: absolute;
      left: 50%;
      top: -4px;
      bottom: -4px;
      width: 2px;
      background: var(--line2);
      z-index: 2;
      box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
    }

    .karma-bar-fill {
      position: absolute;
      top: 0;
      bottom: 0;
      transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), left 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .karma-bar-fill.evil {
      background: linear-gradient(to left, #c0392b, #4b0000);
      box-shadow: 0 0 10px rgba(192, 57, 43, 0.4);
    }

    .karma-bar-fill.good {
      background: linear-gradient(to right, #f1c40f, #7f6a00);
      box-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
    }

    .karma-text {
      text-align: center;
      font-size: 0.65rem;
      letter-spacing: 0.2em;
      text-transform: uppercase;
      color: var(--dim);
      margin-top: 14px;
      transition: color 0.3s;
    }

    .karma-text.active {
      color: var(--muted);
    }

    /* Quests view popup – larger, list + dropdown style */
    .quests-view-window {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 960px;
      min-width: 800px;
      max-width: 98vw;
      min-height: 700px;
      max-height: 94vh;
      background: rgba(8, 8, 8, 0.98);
      border: 1px solid var(--line);
      border-radius: 6px;
      box-shadow: 0 16px 56px rgba(0, 0, 0, 0.85);
      z-index: 10001;
      font-family: inherit;
      display: flex;
      flex-direction: column;
    }

    .quests-view-drag-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 10px 14px;
      background: rgba(0, 0, 0, 0.6);
      border-bottom: 1px solid var(--line);
      border-radius: 8px 8px 0 0;
      cursor: move;
      font-size: 0.95rem;
      color: var(--dim);
      user-select: none;
    }

    .quests-view-drag-bar:active {
      cursor: grabbing;
    }

    .quests-view-close {
      background: none;
      border: none;
      color: var(--dim);
      cursor: pointer;
      font-size: 1.3rem;
      line-height: 1;
      padding: 0 6px;
      margin: -4px -4px 0 0;
    }

    .quests-view-close:hover {
      color: #ccc;
    }

    .quests-view-body {
      display: flex;
      flex-direction: column;
      padding: 0;
      overflow: hidden;
    }

    .quests-view-tabs {
      display: flex;
      gap: 0;
      padding: 0 14px;
      background: rgba(0, 0, 0, 0.3);
      border-bottom: 1px solid var(--line);
    }

    /* Quests tab styles moved below */

    /* System Button (Settings) */
    .sys-btn {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      padding: 10px 14px;
      margin-top: 6px;
      background: rgba(255, 255, 255, 0.01);
      border: 1px solid rgba(255, 255, 255, 0.05);
      border-radius: 4px;
      color: var(--muted);
      font-size: 0.78rem;
      letter-spacing: 0.05em;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    .sys-btn:hover {
      background: rgba(255, 255, 255, 0.04);
      color: var(--text);
      border-color: rgba(255, 255, 255, 0.1);
      transform: translateX(2px);
    }

    .sys-btn .icon {
      width: 16px;
      height: 16px;
      opacity: 0.6;
    }

    .sys-btn:hover .icon {
      opacity: 1;
      color: var(--line2);
    }

    /* Settings View Popup */
    .settings-view-window {
      position: fixed;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 500px;
      max-width: 90vw;
      min-height: 300px;
      background: rgba(12, 12, 12, 0.99);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
      z-index: 10005;
      display: none;
      flex-direction: column;
      overflow: hidden;
    }

    .settings-view-drag-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 16px;
      background: rgba(0, 0, 0, 0.5);
      border-bottom: 1px solid var(--line);
      cursor: move;
      font-size: 0.9rem;
      letter-spacing: 0.1em;
      color: var(--dim);
      text-transform: uppercase;
    }

    .settings-view-close {
      background: none;
      border: none;
      color: var(--dim);
      font-size: 1.5rem;
      cursor: pointer;
      line-height: 1;
    }

    .settings-tabs {
      display: flex;
      padding: 0 10px;
      background: rgba(255, 255, 255, 0.02);
      border-bottom: 1px solid var(--line);
    }

    .settings-tab {
      padding: 12px 20px;
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      color: var(--muted);
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      cursor: pointer;
      transition: all 0.2s;
    }

    .settings-tab:hover {
      color: var(--text);
    }

    .settings-tab.active {
      color: var(--text);
      border-bottom-color: var(--line2);
    }

    .settings-view-content {
      padding: 24px;
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .settings-tab-panel {
      display: none;
    }

    .settings-group {
      margin-bottom: 24px;
    }

    .settings-group-toggle {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 12px;
    }

    .settings-group-toggle .settings-label {
      margin-bottom: 0;
      flex: 1;
    }

    .settings-toggle {
      position: relative;
      display: inline-block;
      width: 42px;
      height: 22px;
      flex-shrink: 0;
    }

    .settings-toggle input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .settings-toggle-slider {
      position: absolute;
      cursor: pointer;
      inset: 0;
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid var(--line);
      border-radius: 22px;
      transition: background 0.2s;
    }

    .settings-toggle-slider::before {
      content: '';
      position: absolute;
      height: 14px;
      width: 14px;
      left: 3px;
      bottom: 3px;
      background: var(--muted);
      border-radius: 50%;
      transition: transform 0.2s, background 0.2s;
    }

    .settings-toggle input:checked+.settings-toggle-slider {
      background: rgba(100, 160, 100, 0.3);
      border-color: rgba(100, 180, 100, 0.5);
    }

    .settings-toggle input:checked+.settings-toggle-slider::before {
      transform: translateX(20px);
      background: rgba(130, 200, 130, 0.95);
    }

    .settings-hint {
      width: 100%;
      font-size: 0.72rem;
      color: var(--dim);
      margin: 2px 0 0 0;
      line-height: 1.4;
      opacity: 0.7;
    }

    .settings-label {
      display: block;
      margin-bottom: 10px;
      font-size: 0.8rem;
      color: var(--muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .settings-slider {
      display: block;
      width: 100%;
      height: 6px;
      -webkit-appearance: none;
      appearance: none;
      background: var(--surface, rgba(255, 255, 255, 0.1));
      border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
      border-radius: 3px;
      outline: none;
      cursor: pointer;
    }

    .settings-slider::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 14px;
      height: 14px;
      background: var(--text, #ccc);
      border: 1px solid var(--line, rgba(255, 255, 255, 0.2));
      border-radius: 50%;
      cursor: pointer;
      transition: background 0.2s;
    }

    .settings-slider::-webkit-slider-thumb:hover {
      background: #aaa;
    }

    .settings-slider::-moz-range-thumb {
      width: 14px;
      height: 14px;
      background: var(--text, #ccc);
      border: 1px solid var(--line, rgba(255, 255, 255, 0.2));
      border-radius: 50%;
      cursor: pointer;
    }

    .quests-view-tab {
      padding: 10px 18px;
      font-size: 0.72rem;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--dim);
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: pointer;
      font-family: 'Courier Prime', monospace;
      margin-bottom: -1px;
      transition: all 0.2s;
    }

    .quests-view-tab:hover {
      color: var(--text);
    }

    .quests-view-tab.active {
      color: var(--text);
      border-bottom-color: var(--line2);
      background: rgba(255, 255, 255, 0.03);
    }

    .quests-view-panel {
      flex: 1;
      padding: 16px 20px;
      overflow-y: auto;
      overflow-x: hidden;
    }

    .quests-view-empty {
      font-size: 0.85rem;
      color: var(--dim);
      font-style: italic;
      padding: 12px 0;
    }

    .quests-view-list {
      list-style: none;
      margin: 0;
      padding: 0;
    }

    .quests-view-list-item {
      margin-bottom: 6px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: 4px;
      background: rgba(0, 0, 0, 0.25);
      overflow: hidden;
    }

    .quests-view-list-item:last-child {
      margin-bottom: 0;
    }

    .quests-view-quest-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      cursor: pointer;
      font-family: 'IM Fell English', serif;
      font-size: 1rem;
      color: var(--text);
      user-select: none;
      transition: background 0.15s, color 0.15s;
      border: none;
      width: 100%;
      text-align: left;
      background: transparent;
    }

    .quests-view-quest-header:hover {
      background: rgba(255, 255, 255, 0.04);
      color: #e8e6e3;
    }

    .quests-view-quest-header .quests-view-quest-name {
      margin: 0;
      font-weight: 600;
      letter-spacing: 0.04em;
    }

    .quests-view-quest-header .quests-view-chevron {
      flex-shrink: 0;
      margin-left: 10px;
      color: var(--dim);
      font-size: 0.9rem;
      transition: transform 0.2s;
    }

    .quests-view-list-item.expanded .quests-view-chevron {
      transform: rotate(180deg);
      color: var(--text);
    }

    .quests-view-quest-detail {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.25s ease-out;
    }

    .quests-view-list-item.expanded .quests-view-quest-detail {
      max-height: 600px;
    }

    .quests-view-quest-detail-inner {
      padding: 0 16px 16px 16px;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
      padding-top: 14px;
      margin-top: 0;
    }

    .quests-view-quest-desc {
      font-size: 0.82rem;
      color: var(--dim);
      line-height: 1.5;
      margin-bottom: 12px;
    }

    .quests-view-steps {
      list-style: none;
      margin: 0 0 10px 0;
      padding: 0 0 0 14px;
      border-left: 2px solid rgba(255, 255, 255, 0.12);
    }

    .quests-view-steps li {
      font-size: 0.78rem;
      color: var(--muted);
      margin-bottom: 6px;
      line-height: 1.4;
    }

    .quests-view-steps li.quests-view-step-done {
      color: rgba(120, 180, 120, 0.95);
    }

    .quests-view-quest-reward {
      font-size: 0.8rem;
      color: rgba(180, 80, 80, 0.95);
      margin-top: 8px;
      padding-top: 8px;
      border-top: 1px dashed rgba(255, 255, 255, 0.06);
    }

    /* Journal Styles */
    .journal-view-body {
      padding: 15px;
    }

    .journal-sub-tabs {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      padding: 10px 20px;
      background: rgba(255, 255, 255, 0.05);
      border-bottom: 1px solid var(--line);
    }

    .journal-sub-tab {
      padding: 6px 14px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--line);
      border-radius: 4px;
      color: var(--dim);
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      cursor: pointer;
      transition: all 0.2s;
    }

    .journal-sub-tab:hover {
      background: rgba(255, 255, 255, 0.08);
      color: var(--text);
    }

    .journal-sub-tab.active {
      background: var(--red);
      border-color: var(--red);
      color: var(--text);
      box-shadow: 0 0 10px rgba(139, 0, 0, 0.3);
    }

    .hidden {
      display: none !important;
    }

    .journal-category {
      margin-bottom: 24px;
    }

    .journal-category-title {
      font-family: 'IM Fell English', serif;
      font-size: 1.2rem;
      color: var(--text);
      border-bottom: 1px solid var(--line);
      padding-bottom: 6px;
      margin-bottom: 14px;
      letter-spacing: 0.05em;
    }

    .journal-entry-list {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .journal-entry {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 12px 16px;
      transition: background 0.2s;
    }

    .journal-entry.undiscovered {
      opacity: 0.5;
      border-style: dashed;
    }

    .journal-entry-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 6px;
    }

    .journal-entry-number {
      font-family: 'IM Fell English', serif;
      font-size: 1.1rem;
      color: var(--dim);
      min-width: 24px;
    }

    .journal-entry-name {
      font-size: 0.95rem;
      font-weight: bold;
      color: var(--text);
      letter-spacing: 0.02em;
    }

    .journal-entry.undiscovered .journal-entry-name {
      color: var(--dim);
    }

    .journal-entry-desc {
      font-size: 0.82rem;
      color: var(--muted);
      line-height: 1.4;
      padding-left: 36px;
    }

    .journal-entry-bullets {
      margin-top: 8px;
      padding-left: 52px;
      list-style: disc;
      font-size: 0.78rem;
      color: var(--dim);
    }

    /* Redesigned Journal Codex Styles */
    .journal-npc-list, .journal-item-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      gap: 20px;
      padding: 10px;
    }

    .journal-npc-card, .journal-item-card {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--line);
      border-radius: 4px;
      padding: 15px;
      display: flex;
      flex-direction: column;
      align-items: center;
      transition: all 0.2s;
      cursor: pointer;
    }

    .journal-npc-card:hover, .journal-item-card:hover {
      background: rgba(255, 255, 255, 0.08);
      border-color: var(--text);
    }

    .journal-npc-sprite-wrap, .journal-item-img-wrap {
      width: 140px;
      height: 180px;
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      margin-bottom: 12px;
      position: relative;
    }

    .journal-npc-sprite, .journal-item-img {
      max-width: 90%;
      max-height: 90%;
      object-fit: contain;
    }

    /* Silhouette Effect */
    .journal-npc-card.undiscovered .journal-npc-sprite {
      filter: brightness(0) contrast(1);
      opacity: 0.6;
    }

    .journal-item-card.undiscovered .journal-item-img {
      filter: brightness(0) contrast(1);
      opacity: 0.4;
    }

    .journal-npc-name, .journal-item-name {
      font-family: 'IM Fell English', serif;
      font-size: 1.1rem;
      color: var(--text);
      text-align: center;
    }

    .journal-npc-role, .journal-item-type {
      font-size: 0.7rem;
      color: var(--dim);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-top: 4px;
    }

    .journal-npc-card.undiscovered .journal-npc-name,
    .journal-item-card.undiscovered .journal-item-name {
      color: var(--dim);
    }

    .weapon-attach-panel {
      padding: 16px;
    }

    .weapon-attach-body {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-start;
      gap: 16px;
    }

    .weapon-attach-scope-slot {
      width: 120px;
      height: 60px;
      border: 1px dashed rgba(255, 255, 255, 0.25);
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.7rem;
      color: var(--muted);
      background: rgba(0, 0, 0, 0.3);
      box-sizing: border-box;
    }

    .weapon-attach-drop-zone.drag-over {
      border-color: rgba(80, 180, 80, 0.8);
      background: rgba(80, 180, 80, 0.15);
    }

    .weapon-attach-weapon-preview {
      min-width: 260px;
      min-height: 110px;
      background: rgba(0, 0, 0, 0.3);
      border-radius: 6px;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .weapon-attach-weapon-preview img {
      max-width: 100%;
      max-height: 108px;
      width: auto;
      height: auto;
      object-fit: contain;
    }

    .weapon-attach-ammo {
      width: 54px;
      height: 54px;
      margin-left: auto;
      align-self: flex-start;
      border: 1px dashed rgba(255, 255, 255, 0.25);
      border-radius: 6px;
      background: rgba(0, 0, 0, 0.35);
      box-sizing: border-box;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }

    .weapon-attach-ammo .weapon-ammo-silhouette {
      width: 100%;
      height: 100%;
      object-fit: contain;
      padding: 4px;
      opacity: 0.7;
    }

    .weapon-attach-ammo .weapon-ammo-count {
      position: absolute;
      bottom: 2px;
      right: 2px;
      font-size: 0.7rem;
      font-weight: bold;
      color: #fff;
      text-shadow: 0 0 2px #000;
    }

    .weapon-attach-scope-slot.has-attachment {
      position: relative;
    }

    .weapon-attach-remove {
      position: absolute;
      bottom: 2px;
      right: 2px;
      font-size: 0.55rem;
      padding: 2px 4px;
      background: rgba(120, 40, 40, 0.9);
      border: 1px solid #a44;
      color: #fcc;
      cursor: pointer;
    }

    .weapon-context-menu {
      position: fixed;
      z-index: 10000;
      min-width: 160px;
      padding: 4px 0;
      background: rgba(18, 18, 18, 0.98);
      border: 1px solid var(--line);
      border-radius: 4px;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
      font-family: inherit;
    }

    .weapon-context-menu-item {
      display: block;
      width: 100%;
      padding: 8px 14px;
      border: none;
      background: none;
      color: var(--dim);
      font-size: 0.8rem;
      text-align: left;
      cursor: pointer;
    }

    .weapon-context-menu-item:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #ccc;
    }

    .btn-use-item {
      padding: 4px 10px;
      font-size: 0.75rem;
      background: var(--void);
      border: 1px solid var(--line);
      color: var(--dim);
      cursor: pointer;
    }

    .btn-use-item:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #ccc;
    }

    .btn-close-backpack {
      position: absolute;
      top: 0;
      right: 0;
      width: 32px;
      height: 32px;
      padding: 0;
      background: var(--void);
      border: 1px solid var(--line);
      border-top: none;
      border-right: none;
      color: var(--dim);
      font-size: 1.1rem;
      line-height: 1;
      cursor: default;
      transition: border-color 0.2s, color 0.2s;
    }

    .btn-close-backpack:hover {
      border-color: var(--red);
      color: var(--text);
    }

    .backpack-modal-header {
      padding: 12px 36px 10px 20px;
      border-bottom: 1px solid var(--line);
      flex-shrink: 0;
    }

    /* ── PARTY VIEW MODAL ── */
    .party-view-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.85);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      backdrop-filter: blur(4px);
    }

    .party-view-window {
      width: 90%;
      max-width: 800px;
      height: 80vh;
      background: var(--surface);
      border: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    }

    .party-view-header {
      padding: 16px 24px;
      border-bottom: 1px solid var(--line);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--void);
    }

    .party-view-title {
      font-family: 'IM Fell English', serif;
      font-size: 1.2rem;
      letter-spacing: 0.1em;
      color: var(--text);
      margin: 0;
    }

    .party-view-close {
      background: transparent;
      border: none;
      color: var(--dim);
      font-size: 1.8rem;
      cursor: pointer;
      line-height: 1;
      transition: color 0.2s;
    }

    .party-view-close:hover {
      color: var(--red-glow);
    }

    .party-view-body {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
    }

    .party-member-card {
      background: var(--surface2);
      border: 1px solid var(--line2);
      padding: 20px;
      margin-bottom: 20px;
      display: grid;
      grid-template-columns: 150px 1fr;
      gap: 24px;
    }

    .party-member-img-wrap {
      width: 150px;
      height: 200px;
      background: var(--void);
      border: 1px solid var(--line);
      overflow: hidden;
    }

    .party-member-img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: top center;
    }

    .party-member-info {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .party-member-name {
      font-size: 1.1rem;
      color: #e8c97a;
      margin-bottom: 4px;
    }

    .party-member-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 10px;
    }

    .party-stat-pill {
      background: var(--void);
      padding: 6px 10px;
      border-radius: 4px;
      font-size: 0.7rem;
      text-align: center;
      border: 1px solid var(--line);
    }

    .party-stat-pill.love {
      color: #ffb6c1;
      border-color: rgba(255, 182, 193, 0.3);
    }

    .party-stat-pill.obedience {
      color: #add8e6;
      border-color: rgba(173, 216, 230, 0.3);
    }

    .party-stat-pill.sluttiness {
      color: #dda0dd;
      border-color: rgba(221, 160, 221, 0.3);
    }

    .party-member-equipment {
      margin-top: 12px;
    }

    .party-equip-title {
      font-size: 0.65rem;
      text-transform: uppercase;
      color: var(--dim);
      margin-bottom: 8px;
      letter-spacing: 0.1em;
    }

    .party-equip-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
      gap: 8px;
    }

    .party-equip-slot {
      width: 60px;
      height: 60px;
      background: var(--void);
      border: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }

    .party-equip-slot img {
      max-width: 80%;
      max-height: 80%;
      object-fit: contain;
    }

    .party-equip-slot::after {
      content: attr(data-slot);
      position: absolute;
      bottom: 2px;
      right: 2px;
      font-size: 0.5rem;
      color: var(--muted);
      text-transform: uppercase;
    }

    /* Redesigned Party View */
    .party-view-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      backdrop-filter: blur(8px);
    }

    .party-view-window {
      width: 95%;
      max-width: 1000px;
      height: 90vh;
      background: var(--void);
      border: 1px solid var(--line);
      display: flex;
      flex-direction: column;
      box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
      position: relative;
    }

    .party-view-header {
      padding: 18px 28px;
      border-bottom: 1px solid var(--line);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: #0a0a0a;
    }

    .party-view-title {
      font-family: 'IM Fell English', serif;
      font-size: 1.4rem;
      letter-spacing: 0.12em;
      color: var(--text);
      margin: 0;
      text-transform: none;
    }

    .party-view-close {
      background: transparent;
      border: none;
      color: var(--dim);
      font-size: 2rem;
      cursor: pointer;
      line-height: 1;
      padding: 0;
      transition: color 0.2s, transform 0.2s;
    }

    .party-view-close:hover {
      color: var(--text);
      transform: rotate(90deg);
    }

    .party-view-container {
      flex: 1;
      overflow: hidden;
      display: flex;
    }

    .character-status-panel {
      display: flex;
      flex-direction: column;
      height: 100%;
    }

    .character-preview-wrap {
      flex: 1;
      position: relative;
      display: flex;
      align-items: flex-start;
      /* Upper alignment like backpack */
      justify-content: center;
      background: none;
      border-radius: 8px;
      margin: 0;
      /* Remove 15px margin to match backpack */
      min-height: 320px;
      overflow: hidden;
    }

    .party-character-sprite {
      max-width: 90%;
      max-height: 90%;
      object-fit: contain;
      position: absolute;
      z-index: 2;
      filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.5));
    }

    .character-status-panel #party-character-silhouette {
      opacity: 0.3;
      transition: opacity 0.3s;
    }

    .character-status-panel.showing-sprite #party-character-silhouette {
      opacity: 0.1;
    }

    .character-switcher {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 20px;
      background: #080808;
      border: 1px solid var(--line);
      border-radius: 4px;
      margin: 10px 20px 20px;
    }

    .btn-switch-char {
      background: none;
      border: 1px solid var(--line);
      color: var(--dim);
      cursor: pointer;
      padding: 6px;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }

    .btn-switch-char:hover {
      border-color: var(--text);
      color: var(--text);
      background: rgba(255, 255, 255, 0.05);
    }

    .switcher-dots {
      display: flex;
      gap: 10px;
    }

    .switcher-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #333;
      cursor: pointer;
      transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .switcher-dot:hover {
      background: #555;
    }

    .switcher-dot.active {
      background: var(--text);
      box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
      transform: scale(1.2);
    }

    /* Backpack modal: when viewing NPC, hide inventory and disable equipment slots */
    /* When viewing NPC: inventory stays visible (shared); only backpack slot is disabled for NPCs */
    .backpack-modal.viewing-npc .inv-body-panel .equip-slot[data-slot="backpack"] {
      pointer-events: none;
      opacity: 0.7;
    }

    .character-status-panel .condition-list {
      max-height: 180px;
      overflow-y: auto;
      padding-right: 5px;
    }

    .character-status-panel .condition-list::-webkit-scrollbar {
      width: 4px;
    }

    .character-status-panel .condition-list::-webkit-scrollbar-thumb {
      background: var(--line);
      border-radius: 2px;
    }

    /* Mind Control Power Effect */
    .btn-mind-control.active {
      background: rgba(180, 50, 255, 0.3) !important;
      color: #e0b0ff !important;
      border-left-color: #b040ff !important;
      box-shadow: 0 0 10px rgba(180, 50, 255, 0.5);
    }

    .mind-control-effect {
      animation: mind-trip 4s ease-in-out infinite alternate;
      z-index: 5 !important;
    }

    @keyframes mind-trip {
      0% {
        filter: hue-rotate(0deg) blur(0px) brightness(1);
        transform: scale(1) skew(0deg);
      }

      25% {
        filter: hue-rotate(90deg) blur(1px) brightness(1.1);
        transform: scale(1.02) skew(1deg);
      }

      50% {
        filter: hue-rotate(180deg) blur(0px) brightness(1);
        transform: scale(1) skew(-1deg);
      }

      75% {
        filter: hue-rotate(270deg) blur(1px) brightness(0.9);
        transform: scale(0.98) skew(0.5deg);
      }

      100% {
        filter: hue-rotate(360deg) blur(0px) brightness(1);
        transform: scale(1) skew(0deg);
      }
    }

    /* GAME OVER SCREEN */
    .game-over-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.98);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 10000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 2s ease;
    }

    .game-over-overlay.visible {
      opacity: 1;
      pointer-events: auto;
    }

    .game-over-content {
      text-align: center;
      animation: game-over-slide-up 1s ease-out both;
    }

    @keyframes game-over-slide-up {
      from { transform: translateY(20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    .game-over-title {
      font-family: 'IM Fell English', serif;
      font-size: 5rem;
      color: #8b0000;
      letter-spacing: 0.5em;
      text-shadow: 0 0 20px rgba(139, 0, 0, 0.5);
      margin-bottom: 20px;
    }

    .game-over-subtitle {
      font-size: 1.2rem;
      color: var(--dim);
      margin-bottom: 40px;
      letter-spacing: 0.2em;
    }

    .game-over-actions {
      display: flex;
      flex-direction: column;
      gap: 15px;
      align-items: center;
    }

    .game-over-btn {
      background: transparent;
      border: 1px solid var(--line);
      color: var(--dim);
      padding: 12px 30px;
      font-family: 'Courier Prime', monospace;
      font-size: 0.9rem;
      letter-spacing: 0.15em;
      text-transform: uppercase;
      cursor: pointer;
      transition: all 0.3s ease;
      min-width: 250px;
    }

    .game-over-btn:hover {
      border-color: var(--red);
      color: var(--text);
      background: rgba(139, 0, 0, 0.1);
    }