:root{
    --bg0:#080604; --bg1:#0f0b07;
    --gold:#c8a45b; --text:#e7d7b3; --muted:#bca987;
    --frame:#261b11; --frame2:#120c07;
    --border:#7a5d36;
    --slot: 60px; --gap: 9px; --cols: 11;
    --okA:#a7efb2; --okB:#5bc56f;
    --badA:#f2a9a9; --badB:#d87373;
  }
  *{ box-sizing:border-box; }
  body{
    margin:0; min-height:100vh;
    background: radial-gradient(circle at 50% 0%, #20160d 0%, var(--bg1) 40%, var(--bg0) 100%);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  }
  .page{ width: min(1320px, 96vw); margin: 20px auto 26px; }
  .hud{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
  .hud h1{ margin:0; font-size:14px; letter-spacing:.12em; text-transform:uppercase; color:var(--gold); font-weight:1000; }
  .hud .sub{ font-size:12px; color:var(--muted); margin-top:4px; }

  .grid2{ display:grid; grid-template-columns:1fr 440px; gap:14px; align-items:start; }
  @media (max-width: 1080px){ .grid2{ grid-template-columns:1fr; } }

  .window{
    position:relative; border-radius:16px; border:2px solid var(--border);
    background:
      radial-gradient(circle at 50% 0%, rgba(255,220,160,.08), transparent 55%),
      linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,0,0,.22)),
      linear-gradient(180deg, var(--frame), var(--frame2));
    box-shadow: 0 22px 70px rgba(0,0,0,.60), inset 0 1px 0 rgba(255,255,255,.08);
    overflow:hidden;
  }
  .window::before{
    content:""; position:absolute; inset:10px; border-radius:12px;
    border:1px solid rgba(200,164,91,.20);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.65);
    pointer-events:none;
  }
  .bar{
    position:relative; z-index:1;
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    padding:12px 14px 10px;
    border-bottom:1px solid rgba(200,164,91,.14);
    background: linear-gradient(180deg, rgba(0,0,0,.30), rgba(0,0,0,0));
  }
  .bar .title{ display:flex; flex-direction:column; gap:3px; }
  .bar .title .h{ font-weight:1000; font-size:12px; letter-spacing:.10em; text-transform:uppercase; color:var(--gold); }
  .bar .title .s{ font-size:12px; color:var(--muted); }

  .actions{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
  .btn{
    cursor:pointer; user-select:none;
    padding:8px 10px; border-radius:11px;
    font-weight:1000; font-size:12px; color:var(--text);
    border:1px solid rgba(200,164,91,.28);
    background: linear-gradient(#2a1f14, #140d07);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 10px 18px rgba(0,0,0,.22);
  }
  .btn:hover{ filter: brightness(1.08); }
  .btn:active{ transform: translateY(1px); }
  .btnGold{
    color:#1b1309; border-color: rgba(0,0,0,.55);
    background: linear-gradient(#e3c57e, #b18a42);
  }

  .content{ position:relative; z-index:1; padding:14px; }
  .screen{
    border-radius:14px; border:1px solid rgba(200,164,91,.18);
    background:
      radial-gradient(circle at 50% 0%, rgba(255,255,255,.06), transparent 45%),
      linear-gradient(180deg, rgba(0,0,0,.08), rgba(0,0,0,.36)),
      linear-gradient(180deg, #1a130d, #0f0b07);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 0 0 1px rgba(0,0,0,.65);
    padding:14px;
  }

  .runeGrid{
    display:grid;
    grid-template-columns: repeat(var(--cols), var(--slot));
    gap: var(--gap);
    justify-content:center;
    padding:6px 2px;
  }
  .slot{
    width:var(--slot); height:var(--slot);
    border-radius:10px; border:2px solid rgba(0,0,0,.70);
    background:
      radial-gradient(circle at 30% 20%, rgba(255,255,255,.10), transparent 45%),
      linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,0,0,.20)),
      linear-gradient(180deg, #2a2219, #17110b);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 12px 18px rgba(0,0,0,.22);
    position:relative; overflow:hidden; padding:6px;
  }
  .slot.empty{ background:transparent; border-color:transparent; box-shadow:none; }
  .slot button{ all:unset; cursor:pointer; display:block; width:100%; height:100%; border-radius:8px; position:relative; }
  .runeImg{ width:100%; height:100%; object-fit:contain; display:block; filter: drop-shadow(0 6px 10px rgba(0,0,0,.55)); }
  .slot.zero{
    background:
      radial-gradient(circle at 30% 20%, rgba(255,255,255,.05), transparent 45%),
      linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.28)),
      linear-gradient(180deg, #221a13, #130e08);
  }
  .slot.zero .runeImg{ filter: grayscale(1) brightness(.70) contrast(.95); opacity:.42; }

  .count{
    position:absolute; right:6px; bottom:5px;
    font-weight:1000; font-size:12px; color:#f5e7c7;
    text-shadow: 0 2px 0 rgba(0,0,0,.95), 1px 1px 0 rgba(0,0,0,.95), -1px 1px 0 rgba(0,0,0,.95), 0 0 6px rgba(0,0,0,.6);
    pointer-events:none;
  }
  .slot.zero .count{ color: rgba(245,231,199,.40); text-shadow: 0 2px 0 rgba(0,0,0,.85); }

  .help{
    margin-top:10px; display:flex; justify-content:space-between;
    gap:10px; flex-wrap:wrap; color:var(--muted); font-size:12px;
  }
  .kbd{
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size:12px; padding:2px 6px; border-radius:8px;
    border:1px solid rgba(200,164,91,.20);
    background: rgba(0,0,0,.18); color:var(--text);
  }

  .panelBody{ padding:12px 14px 14px; position:relative; z-index:1; }
  .row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; justify-content:space-between; }
  .input{
    flex:1 1 220px; min-width:220px;
    padding:9px 10px; border-radius:12px;
    border:1px solid rgba(200,164,91,.20);
    background: rgba(0,0,0,.18); color:var(--text);
    outline:none; font-weight:800; font-size:12px;
  }
  .seg{
    display:flex; border:1px solid rgba(200,164,91,.22);
    border-radius:12px; overflow:hidden; margin:10px 0;
  }
  .seg button{
    flex:1; border:0; border-right:1px solid rgba(200,164,91,.18);
    background: rgba(0,0,0,.12); color:var(--text);
    padding:9px 10px; cursor:pointer; font-weight:1000; font-size:12px;
  }
  .seg button:last-child{ border-right:0; }
  .seg button.active{ background: linear-gradient(#2a1f14, #140d07); color:var(--gold); }

  .toggleRow{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    padding:8px 10px;
    border:1px solid rgba(200,164,91,.16);
    border-radius:12px; background: rgba(0,0,0,.10);
    margin-bottom:10px;
  }
  .toggleRow label{ display:flex; align-items:center; gap:8px; cursor:pointer; font-weight:950; font-size:12px; }
  input[type="checkbox"]{ width:16px; height:16px; accent-color:var(--gold); }

  .status{ color:var(--muted); font-size:12px; margin:6px 0 10px; line-height:1.35; }
  .rwList{ max-height:520px; overflow:auto; padding-right:4px; }
  .rwList::-webkit-scrollbar{ width:10px; }
  .rwList::-webkit-scrollbar-thumb{
    background: rgba(200,164,91,.22);
    border-radius:999px;
    border:2px solid rgba(0,0,0,.35);
  }

  .rwCard{
    border:1px solid rgba(200,164,91,.18);
    border-radius:14px;
    background: rgba(0,0,0,.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    padding:10px; margin-bottom:10px;
  }
  .rwTop{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
  .rwName{ margin:0; font-size:14px; font-weight:1000; letter-spacing:.02em; color:var(--gold); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .rwMeta{ margin-top:2px; font-size:12px; color:var(--muted); line-height:1.25; }

  .pill{
    display:inline-flex; align-items:center; gap:6px;
    padding:6px 10px; border-radius:999px;
    font-size:12px; font-weight:1000;
    border:1px solid rgba(0,0,0,.45);
    white-space:nowrap;
  }
  .pill.good{ color:#0f2012; background: linear-gradient(#a7efb2, #5bc56f); }
  .pill.bad{ color:#2a0f0f; background: linear-gradient(#f2a9a9, #d87373); }

  .rwRunes{ margin-top:8px; display:flex; gap:8px; flex-wrap:wrap; }
  .runeTag{
    display:inline-flex; align-items:center; gap:6px;
    padding:6px 10px; border-radius:12px;
    border:1px solid rgba(200,164,91,.16);
    background: rgba(0,0,0,.10);
    font-size:12px; font-weight:1000;
  }
  .runeNeed{ color:var(--gold); }
  .missing{ margin-top:6px; font-size:12px; color:#f2a9a9; font-weight:1000; }

  .craftedRow{
    margin-top:10px; padding-top:8px;
    border-top:1px solid rgba(200,164,91,.12);
    display:flex; align-items:center; justify-content:space-between; gap:10px;
  }
  .craftedRow label{ display:flex; align-items:center; gap:8px; cursor:pointer; font-weight:1000; font-size:12px; }

  /* Base filter chips + Suggestions panel */
  .baseFilterBox{
    margin: 10px 0 10px;
    padding: 10px;
    border:1px solid rgba(200,164,91,.16);
    border-radius:12px;
    background: rgba(0,0,0,.10);
  }
  .baseFilterTop{
    display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
    margin-bottom:8px;
  }
  .baseFilterTitle{
    font-size:12px; font-weight:1000; letter-spacing:.08em; text-transform:uppercase; color:var(--gold);
  }
  .baseChips{ display:flex; gap:8px; flex-wrap:wrap; }
  .chip{
    display:inline-flex; align-items:center; gap:8px;
    padding:6px 10px;
    border-radius:999px;
    border:1px solid rgba(200,164,91,.18);
    background: rgba(0,0,0,.14);
    font-size:12px; font-weight:950;
    cursor:pointer; user-select:none;
  }
  .chip input{ margin:0; }
  .chip small{ color:var(--muted); font-weight:900; }

  .suggestBox{
    margin: 8px 0 10px;
    padding: 10px;
    border:1px solid rgba(200,164,91,.16);
    border-radius:12px;
    background: rgba(0,0,0,.10);
  }
  .suggestTitle{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    color:var(--gold);
    font-weight:1000;
    letter-spacing:.08em;
    text-transform:uppercase;
    font-size:12px;
    margin-bottom:6px;
  }
  .suggestList{ display:flex; flex-direction:column; gap:6px; }
  .suggestItem{ font-size:12px; color: var(--text); line-height:1.35; }
  .hint{ color: var(--muted); font-size:12px; }
  .tag{
    display:inline-flex; align-items:center;
    padding:2px 6px;
    border-radius:999px;
    border:1px solid rgba(200,164,91,.22);
    background: rgba(0,0,0,.16);
    color: var(--gold);
    font-weight:1000;
    font-size:11px;
    letter-spacing:.02em;
  }

  /* Collapsible upgrades box */
  .suggestBox.collapsed .suggestBody{ display:none; }
