:root {
  --bg: #1b1814;
  --panel: #2a251f;
  --panel-2: #332c24;
  --border: #4d4133;
  --text: #eadfc8;
  --muted: #a8997f;
  --accent: #ff981f;      /* OSRS orange */
  --accent-2: #ffb74d;
  --good: #3ecf6e;
  --bad: #ff5c4d;
  --slot-bg: #3e362c;     /* bank slots stay dark in both themes */
  --slot-border: #544838;
  --rare: #c77dff;
  --shadow: 0 2px 10px rgb(0 0 0 / .35);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #e9dfc9;
    --panel: #f6efdf;
    --panel-2: #efe4cc;
    --border: #c9b48f;
    --text: #2e2517;
    --muted: #7a6a50;
    --accent: #b85c00;
    --accent-2: #d97706;
    --good: #16803c;
    --bad: #c0271b;
    --rare: #7b2cbf;
    --shadow: 0 2px 8px rgb(80 60 30 / .15);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent-2); }
h1, h2 { margin: 0; font-weight: 700; }
h1 { font-size: 1.25rem; color: var(--accent); letter-spacing: .02em; }
h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .6rem; }
.muted { color: var(--muted); font-size: .85rem; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 1rem;
  background: var(--panel);
  border-bottom: 2px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .6rem; }
.price-status { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .85rem; }

.banner {
  margin: 1rem auto 0; max-width: 1280px; padding: .7rem 1rem;
  border: 1px solid var(--bad); border-radius: 8px; color: var(--bad);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}

/* ---------- layout ---------- */
.layout {
  max-width: 1280px; margin: 0 auto; padding: 1rem;
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 1rem; align-items: start;
}
.col-left, .col-right { display: grid; gap: 1rem; min-width: 0; }
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 1rem 16px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel-2); color: var(--text);
  padding: .5rem .8rem; font: inherit; font-weight: 600;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: color-mix(in srgb, var(--accent) 22%, var(--panel-2)); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 35%, var(--panel-2)); }
.btn.danger { color: #fff; background: color-mix(in srgb, var(--bad) 70%, #000); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad); }
.btn.small { padding: .3rem .6rem; font-size: .8rem; }
.btn.wide { width: 100%; }

input, select {
  font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  padding: .45rem .6rem; min-width: 0;
}
input:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.kill-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-bottom: .6rem; }
.kill-buttons .btn { padding: .5rem .2rem; }
.row { display: flex; gap: .4rem; margin-bottom: .6rem; }
.row > input, .row > select { flex: 1; }
.field { display: grid; gap: .25rem; margin-bottom: .7rem; font-size: .85rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; cursor: pointer; }
.check input { accent-color: var(--accent); width: 1rem; height: 1rem; }

/* ---------- monster search ---------- */
.search { position: relative; }
.search input { width: 100%; }
.dropdown {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: .25rem; list-style: none;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); max-height: 320px; overflow-y: auto;
}
.dropdown li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: .55rem;
  padding: .3rem .5rem; border-radius: 5px; cursor: pointer;
}
.dropdown .mthumb { width: 30px; height: 28px; object-fit: contain; display: block; }
.dropdown .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown li[aria-selected="true"], .dropdown li:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.dropdown .lvl { color: var(--muted); font-size: .8rem; white-space: nowrap; }

/* "kill until" drop picker */
.until { position: relative; }
.picker { flex: 1; min-width: 0; }
.picker-btn {
  width: 100%; min-height: 2.45rem; display: flex; align-items: center; gap: .45rem;
  font: inherit; color: var(--text); text-align: left; cursor: pointer;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .25rem .5rem;
}
.picker-btn:hover { border-color: var(--accent); }
.picker-btn:disabled { opacity: .5; cursor: not-allowed; }
.picker-icon { width: 28px; height: 26px; display: grid; place-items: center; flex: none; }
.picker-icon img, .picker-list .ico img { max-width: 28px; max-height: 26px; }
.picker-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-rate { font-size: .76rem; color: var(--muted); white-space: nowrap; }
.caret { color: var(--muted); font-size: .8rem; }
.picker-pop {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: .4rem;
}
.picker-pop input { width: 100%; margin-bottom: .35rem; }
.picker-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.picker-list li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: .5rem;
  padding: .3rem .4rem; border-radius: 5px; cursor: pointer;
}
.picker-list li[aria-selected="true"], .picker-list li:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.picker-list .ico { display: grid; place-items: center; height: 26px; }
.picker-list .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-list .meta { font-size: .74rem; color: var(--muted); text-align: right; line-height: 1.2; white-space: nowrap; }
.picker-list li.none { display: block; color: var(--muted); cursor: default; }
.picker-list li.none:hover { background: none; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.chip {
  font: inherit; font-size: .78rem; cursor: pointer;
  padding: .2rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--muted);
}
.chip:hover { color: var(--text); border-color: var(--accent); }

.monster-card {
  display: flex; align-items: center; gap: .8rem;
  margin-top: .9rem; padding: .7rem; border-radius: 8px; background: var(--panel-2);
}
.monster-card img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.monster-name { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.monster-name:hover { color: var(--accent-2); text-decoration: underline; }

.variants { margin-top: .7rem; display: grid; gap: .35rem; }
.variants .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: .3rem; }
.variants label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-size: .9rem; }
.variants input { accent-color: var(--accent); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .6rem; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .8rem; box-shadow: var(--shadow); min-width: 0;
}
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stat .v { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .s { font-size: .75rem; color: var(--muted); }
.good { color: var(--good) !important; }
.bad  { color: var(--bad) !important; }

/* ---------- bank-style loot grid ---------- */
.bank {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px;
  min-height: 60px;
}
.slot {
  position: relative; height: 48px;
  background: var(--slot-bg); border: 1px solid var(--slot-border); border-radius: 4px;
  display: grid; place-items: center;
}
.slot img { max-width: 36px; max-height: 32px; image-rendering: pixelated; }
.slot .q {
  position: absolute; top: 1px; left: 3px;
  font: 700 12px/1 Verdana, sans-serif;
  text-shadow: 1px 1px 0 #000;
  pointer-events: none;
}
.q.y { color: #ffff00; }
.q.w { color: #ffffff; }
.q.g { color: #00ff80; }
/* Rare (collection log) items breathe with a vivid glow. Only box-shadow/border animate, never transform,
   so the pixel-art icons stay sharp. */
.slot.rare { border-color: var(--rare-glow); animation: rareGlow 1.3s ease-in-out infinite alternate; }
@keyframes rareGlow {
  from { box-shadow: 0 0 0 1px var(--rare-glow) inset, 0 0 3px 0 color-mix(in srgb, var(--rare-glow) 60%, transparent); }
  to   { box-shadow: 0 0 0 2px var(--rare-glow) inset, 0 0 16px 4px color-mix(in srgb, var(--rare-glow) 85%, transparent),
                     0 0 28px 6px color-mix(in srgb, var(--rare-glow) 35%, transparent); }
}
/* New items flash in with a highlight instead of scaling (scaling blurred the sprites). */
.slot.fresh:not(.rare) { animation: slotIn .6s ease-out; }
@keyframes slotIn {
  from { background: color-mix(in srgb, var(--accent) 45%, var(--slot-bg)); border-color: var(--accent); }
  to   { background: var(--slot-bg); }
}
.slot img, .log img, .picker-icon img, .picker-list .ico img { image-rendering: pixelated; }
.empty { color: var(--muted); font-size: .9rem; padding: .6rem 0; grid-column: 1 / -1; }

/* tooltip */
.slot:hover::after {
  content: attr(data-tip);
  position: absolute; z-index: 10; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  white-space: pre; font-size: .78rem; line-height: 1.35;
  background: #0f0d0a; color: #f3e9d2; border: 1px solid #5c4d3a; border-radius: 6px;
  padding: .4rem .55rem; pointer-events: none;
}

/* ---------- notable log ---------- */
.log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; display: grid; gap: 2px; }
.log li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: .55rem;
  padding: .3rem .4rem; border-radius: 6px; font-size: .88rem;
}
.log li:nth-child(odd) { background: var(--panel-2); }
.log img { max-width: 28px; max-height: 26px; }
.log .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log .kc { color: var(--muted); font-size: .8rem; white-space: nowrap; text-align: right; }

/* ---------- drop table ---------- */
details.panel > summary { list-style: none; cursor: pointer; display: flex; gap: .7rem; align-items: baseline; flex-wrap: wrap; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { margin: 0; }
details.panel > summary h2::before { content: "▸ "; }
details[open].panel > summary h2::before { content: "▾ "; }
.table-scroll { overflow-x: auto; margin-top: .8rem; }
table.drops { width: 100%; border-collapse: collapse; font-size: .86rem; }
.drops th, .drops td { padding: .35rem .5rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.drops th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.drops .num { text-align: right; font-variant-numeric: tabular-nums; }
.drops td.item { display: flex; align-items: center; gap: .5rem; }
.drops td.item img { width: 24px; height: 22px; object-fit: contain; }
.drops tr.sect td { background: var(--panel-2); font-weight: 700; color: var(--accent); }
.tag { font-size: .72rem; padding: .05rem .4rem; border-radius: 4px; border: 1px solid var(--border); color: var(--muted); }

.footer { max-width: 1280px; margin: 0 auto; padding: .5rem 1rem 2rem; text-align: center; }
.footer .credit { margin: 0 0 .5rem; color: var(--text); font-weight: 600; }

.loading { opacity: .55; pointer-events: none; }

/* ---------- lifetime / sound ---------- */
.lifetime { color: var(--accent-2); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- auto-kill ---------- */
.row.auto > .btn { flex: 1; }
.btn.running {
  border-color: var(--accent);
  animation: running 0.9s ease-in-out infinite alternate;   /* one pulse per auto-kill (3 game ticks) */
}
@keyframes running { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
                     to   { box-shadow: 0 0 14px 2px color-mix(in srgb, var(--accent) 55%, transparent); } }

/* ---------- OSRS-style chatbox ---------- */
.chatbox {
  /* Classic OSRS chatbox: parchment background, dark text, no shadow. */
  height: 190px; overflow-y: auto; padding: .45rem .6rem;
  background: linear-gradient(180deg, #d6c7a2 0%, #cdbb93 55%, #c2b087 100%); color: #000;
  border: 2px solid #4a3b28; border-radius: 6px;
  box-shadow: inset 0 0 0 1px #8a7654, inset 0 0 16px rgb(74 59 40 / .35);
  font: 13px/1.45 Verdana, Tahoma, sans-serif;
}
.chatbox .line { overflow-wrap: anywhere; }
.chatbox .kc { color: #5b4a30; }
.chatbox .red { color: #b00000; }         /* in-game red game messages */
.chatbox .pet { color: #6200a0; font-weight: 700; }
.chatbox .lvl { color: #00008b; }
.chatbox .sys { color: #000; }
/* RuneLite value tiers (20K+ blue, 100K+ green, 1M+ orange, 10M+ pink), darkened to read on the parchment. */
.chatbox .v-low { color: #0050c8; font-weight: 700; }
.chatbox .v-med { color: #007000; font-weight: 700; }
.chatbox .v-high { color: #c25a00; font-weight: 700; }
.chatbox .v-insane { color: #c0006a; font-weight: 700; }

/* ---------- collection log ---------- */
.clog-bar {
  appearance: none; -webkit-appearance: none;
  width: 100%; height: 10px; margin: .1rem 0 .7rem;
  border: 1px solid var(--border); border-radius: 999px; overflow: hidden; background: var(--bg);
}
.clog-bar::-webkit-progress-bar { background: var(--bg); }
.clog-bar::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), #ffd54a); transition: width .4s; }
.clog-bar::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), #ffd54a); }
.clog-bar.done::-webkit-progress-value { background: linear-gradient(90deg, var(--good), #a8ff60); }
.clog-bar.done::-moz-progress-bar { background: linear-gradient(90deg, var(--good), #a8ff60); }
.slot.missing img { opacity: .22; filter: grayscale(1); }
.slot.got { border-color: color-mix(in srgb, var(--good) 70%, var(--slot-border)); }
.clog-reset { margin-top: .7rem; }

/* ---------- rare drop celebration ---------- */
.fx {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 16px; cursor: pointer; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--tier) 26%, transparent), rgb(0 0 0 / .6) 70%);
  animation: fxIn .25s ease-out;
}
.fx[hidden] { display: none; }
.fx.out { animation: fxOut .32s ease-in forwards; }
.fx.tier-rare { --tier: #ffb300; }
.fx.tier-mega { --tier: #ff4df0; }
.fx.tier-pet  { --tier: #3dffa8; }
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 70; }

.fx-beam {
  position: absolute; left: 50%; top: -10%; bottom: -10%; width: 160px; transform: translateX(-50%);
  background: linear-gradient(to top, transparent 0%, var(--tier) 40%, var(--tier) 60%, transparent 100%);
  opacity: .5; filter: blur(16px);
  animation: beam 1.2s ease-in-out infinite alternate;
}
.fx-beam::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 22px; transform: translateX(-50%);
  background: linear-gradient(to top, transparent, #fff 50%, transparent); filter: blur(4px); opacity: .85;
}
.fx-flash { position: absolute; inset: 0; background: #fff; opacity: 0; animation: flash .55s ease-out; pointer-events: none; }

.fx-card {
  position: relative; text-align: center; max-width: 100%;
  padding: 1.3rem 2.2rem 1.1rem; border-radius: 14px;
  background: rgb(14 11 8 / .88); border: 2px solid var(--tier);
  box-shadow: 0 0 44px var(--tier), inset 0 0 30px color-mix(in srgb, var(--tier) 28%, transparent);
  animation: popIn .6s cubic-bezier(.2, 1.6, .4, 1);
}
.fx-kicker {
  font-weight: 900; font-size: clamp(1.7rem, 7vw, 2.8rem); letter-spacing: .06em; text-transform: uppercase; line-height: 1.1;
  color: var(--tier); text-shadow: 0 0 14px var(--tier), 3px 3px 0 #000;
  animation: pulse .8s ease-in-out infinite alternate;
}
.fx-new { color: #ff6b5e; font-weight: 800; margin-top: .35rem; text-shadow: 1px 1px 0 #000; }
.fx-icon { width: 140px; height: 124px; margin: .7rem auto .35rem; display: grid; place-items: center; animation: float 1.6s ease-in-out infinite alternate; }
.fx-icon img { width: 108px; height: auto; max-height: 124px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 0 16px var(--tier)); }
.fx-name { font-size: 1.3rem; font-weight: 800; color: #fff; overflow-wrap: anywhere; }
.fx-meta { color: #d9c9a8; font-size: .92rem; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.fx-more { color: var(--tier); font-size: .86rem; font-weight: 700; margin-top: .45rem; }
.fx-hint { color: #8f8069; font-size: .72rem; margin-top: .7rem; }

body.shake .layout, body.shake .topbar { animation: shake .5s; }

@keyframes fxIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fxOut  { to { opacity: 0; } }
@keyframes beam   { from { opacity: .35; width: 120px; } to { opacity: .65; width: 190px; } }
@keyframes flash  { from { opacity: .85; } to { opacity: 0; } }
@keyframes popIn  { from { transform: scale(.3) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse  { from { transform: scale(1); } to { transform: scale(1.07); } }
@keyframes float  { from { transform: translateY(-5px); } to { transform: translateY(5px); } }
@keyframes shake  {
  0%, 100% { transform: none; } 20% { transform: translate(-9px, 4px); } 40% { transform: translate(8px, -5px); }
  60% { transform: translate(-6px, 3px); } 80% { transform: translate(4px, -2px); }
}

@media (prefers-reduced-motion: reduce) {
  .fx-beam, .fx-kicker, .fx-icon, .fx-card, .btn.running, .slot.fresh, .slot.rare, .levelbar.levelup, .lvl-float { animation: none; }
}

/* ---------- sound settings ---------- */
.subhead { margin: 1.1rem 0 .6rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.sound-preview { align-items: center; margin: -.2rem 0 .7rem; }
.custom-sounds { border-top: 1px solid var(--border); padding-top: .6rem; }
.custom-sounds > p { font-size: .8rem; margin: 0 0 .6rem; }
.clip-row { display: grid; grid-template-columns: 1fr auto; gap: .15rem .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--border); }
.clip-label { font-weight: 600; font-size: .88rem; }
.clip-name { grid-column: 1; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: .3rem; }
.clip-actions label.btn { cursor: pointer; }
.clip-error { color: var(--bad); font-size: .82rem; margin: .5rem 0 0; }

/* ---------- collection log popup (in-game style) ---------- */
.clog-toast {
  position: fixed; z-index: 80; top: 14px; left: 50%; transform: translateX(-50%);
  min-width: min(300px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  padding: .55rem 1.2rem .6rem; text-align: center;
  background: #3b3326; color: #fff; font: 13px/1.4 Verdana, Tahoma, sans-serif;
  border: 2px solid #1c1710; outline: 1px solid #6e5d45; outline-offset: -4px; border-radius: 3px;
  box-shadow: 0 6px 24px rgb(0 0 0 / .55);
  animation: toastIn .45s cubic-bezier(.2, 1.4, .4, 1);
}
.clog-toast[hidden] { display: none; }
.clog-toast.out { animation: toastOut .4s ease-in forwards; }
.clog-toast .t-title { color: #ff981f; font-weight: 700; font-size: 15px; text-shadow: 1px 1px 0 #000; }
.clog-toast .t-body { color: #d8ccb4; }
.clog-toast .t-item { color: #fff; font-weight: 700; text-shadow: 1px 1px 0 #000; }
.clog-toast .t-more { color: #ffb74d; font-size: 12px; margin-top: .15rem; }
@keyframes toastIn  { from { transform: translate(-50%, -120%); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes toastOut { to { transform: translate(-50%, -120%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .clog-toast, .clog-toast.out { animation: none; } }

/* ---------- gold values: green for millions, like in-game stacks ---------- */
:root { --gp-mil: #00ff80; --gp-norm: #ffffff; --rare-glow: #d17bff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --gp-mil: #0b8a3e; --gp-norm: var(--text); --rare-glow: #9d3fe0; } }
.v.gp-mil, #lifetime .gp-mil { color: var(--gp-mil); }
.v.gp-norm, #lifetime .gp-norm { color: var(--gp-norm); }
.v.gp-mil { text-shadow: 0 0 12px color-mix(in srgb, var(--gp-mil) 35%, transparent); }

/* ---------- sticky rare-drop card buttons ---------- */
.fx-actions { display: flex; gap: .5rem; justify-content: center; margin-top: .9rem; }
.fx-btn {
  font: inherit; font-weight: 700; cursor: pointer; padding: .5rem 1rem; border-radius: 8px;
  background: rgb(255 255 255 / .06); color: #eadfc8; border: 1px solid rgb(255 255 255 / .2);
}
.fx-btn.primary { background: var(--tier); color: #140f08; border-color: var(--tier); }
.fx-btn:hover { filter: brightness(1.12); }
.fx-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Looting level bar ---------- */
.levelbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.lvl-inner { max-width: 1280px; margin: 0 auto; padding: .4rem 1rem; display: flex; align-items: center; gap: .75rem; }
.lvl-badge { display: inline-flex; align-items: baseline; gap: .3rem; white-space: nowrap; }
.lvl-skill { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lvl-badge strong { font-size: 1.15rem; color: var(--accent); min-width: 1.4em; text-align: right; }
.lvl-max { font-size: .75rem; color: var(--muted); }
.lvl-track { flex: 1; height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.lvl-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #c96a00, #ff981f 60%, #ffd54a); transition: width .5s ease-out; }
.lvl-text { font-size: .76rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .lvl-text { display: none; } }
.levelbar.levelup { animation: lvlGlow 2.2s ease-out; }
.levelbar.levelup .lvl-fill { box-shadow: 0 0 12px #ffd54a; }
@keyframes lvlGlow {
  0% { box-shadow: 0 0 0 0 rgb(255 213 74 / 0); }
  15% { box-shadow: 0 2px 26px 4px rgb(255 213 74 / .55); background: color-mix(in srgb, #ffd54a 18%, var(--panel)); }
  100% { box-shadow: 0 0 0 0 rgb(255 213 74 / 0); }
}
.lvl-float {
  position: fixed; z-index: 75; pointer-events: none; transform: translate(-50%, -50%);
  font-weight: 900; font-size: 1.3rem; color: #ffd54a; text-shadow: 2px 2px 0 #000, 0 0 12px #ff981f; white-space: nowrap;
  animation: lvlFloat 2.4s ease-out forwards;
}
.lvl-float.big { font-size: 2rem; }
@keyframes lvlFloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -260%) scale(1); }
}

/* ---------- collapsible settings ---------- */
details.settings > summary { align-items: baseline; }
details.settings[open] > summary { margin-bottom: .8rem; }
.settings-body > .field:first-child { margin-top: 0; }
details.subsection { border-top: 1px solid var(--border); margin-top: .9rem; padding-top: .7rem; }
details.subsection > summary { list-style: none; cursor: pointer; }
details.subsection > summary::-webkit-details-marker { display: none; }
details.subsection > summary h3 { display: inline; margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
details.subsection > summary h3::before { content: "▸ "; }
details.subsection[open] > summary h3::before { content: "▾ "; }
details.subsection[open] > summary { margin-bottom: .7rem; }

/* Phones: one column, with loot and stats before the settings. */
@media (max-width: 860px) {
  .col-left, .col-right { display: contents; }
  .settings { order: 10; }
}

/* ---------- raid settings ---------- */
.raid-opts { display: grid; gap: .55rem; margin-top: .2rem; }
.raid-opts .field { margin: 0; }
.raid-opts input[type=range] { width: 100%; accent-color: var(--accent); padding: 0; }
.raid-opts strong { color: var(--text); font-weight: 700; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: .45rem .4rem; font-size: .85rem; font-weight: 600; color: var(--muted); background: var(--bg); }
.seg label + label span { border-left: 1px solid var(--border); }
.seg input:checked + span { color: #140f08; background: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -3px; }
.raid-summary { margin: .6rem 0 0; font-size: .82rem; color: var(--accent-2); font-weight: 600; }
.fx.tier-purple { --tier: #b44dff; }

/* ---------- level-locked features ---------- */
.locked { position: relative; opacity: .55; filter: grayscale(.6); }
.locked::after {
  content: "\1F512  " attr(data-lock);
  position: absolute; top: -9px; right: -6px; z-index: 2; pointer-events: none;
  font-size: .62rem; font-weight: 700; line-height: 1.5; white-space: nowrap;
  padding: 0 .35rem; border-radius: 999px;
  background: #1b1611; color: #ffd54a; border: 1px solid #6e5d45;
}
.picker-btn.dim { opacity: .6; }
.nope { animation: nope .35s ease-in-out; }
@keyframes nope { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-3px); } }
.lock-bubble {
  position: fixed; z-index: 70; width: 260px; transform: translateY(-100%); pointer-events: none;
  padding: .45rem .65rem; border-radius: 8px; font-size: .8rem; line-height: 1.35;
  background: #1b1611; color: #fff; border: 1px solid #ff981f; box-shadow: 0 6px 18px rgb(0 0 0 / .45);
  animation: fxIn .15s ease-out;
}
.lock-bubble[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .nope { animation: none; } }

/* ---------- bug report dialog ---------- */
.report-open { margin-top: .2rem; }
.report-dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); color: var(--text); box-shadow: 0 16px 48px rgb(0 0 0 / .5);
}
.report-dialog::backdrop { background: rgb(0 0 0 / .55); }
.report-dialog form { padding: 1.1rem 1.2rem 1rem; }
.report-dialog h2 { margin-bottom: .3rem; }
.report-dialog p.muted { margin: 0 0 .8rem; }
.report-dialog textarea {
  width: 100%; resize: vertical; min-height: 7rem; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .6rem;
}
.report-dialog textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.report-meta { display: flex; justify-content: flex-end; margin: -.4rem 0 .4rem; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.report-meta .near { color: var(--accent); font-weight: 700; }
.report-msg { margin: .2rem 0 .6rem; font-size: .85rem; }
.report-msg.ok { color: var(--good); }
.report-msg.warn { color: var(--bad); }
.report-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- kill conditions ---------- */
.cond-hint { flex-basis: 100%; margin: -.15rem 0 .1rem 1.45rem; font-size: .74rem; color: var(--muted); }
.variants label:has(.cond-hint) { align-items: flex-start; flex-wrap: wrap; }

/* ---------- first-visit tutorial (never blocks the page) ---------- */
.replay-tutorial { margin: .1rem 0 .4rem; }
.tut-dim { position: fixed; inset: 0; z-index: 54; pointer-events: none; background: rgb(0 0 0 / .45); }
.tut-ring {
  position: fixed; z-index: 55; pointer-events: none; border-radius: 10px;
  border: 2px solid var(--accent);
  box-shadow: 0 0 18px 2px color-mix(in srgb, var(--accent) 60%, transparent);
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.tut-bubble {
  position: fixed; z-index: 56; padding: .7rem .8rem .6rem; border-radius: 10px;
  background: var(--panel); color: var(--text); border: 1px solid var(--accent);
  box-shadow: 0 10px 30px rgb(0 0 0 / .5); animation: fxIn .2s ease-out;
}
.tut-text { margin: 0 0 .55rem; font-size: 1rem; font-weight: 700; line-height: 1.35; }
.tut-bar { height: 3px; border-radius: 999px; background: var(--accent); transform-origin: left; animation: tutBar linear forwards; margin-bottom: .55rem; }
.tut-bubble.paused .tut-bar { animation-play-state: paused; opacity: .4; }
@keyframes tutBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.tut-actions { display: flex; align-items: center; gap: .4rem; }
.tut-step { margin-right: auto; font-size: .75rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .tut-ring { transition: none; } .tut-bar { animation: none; } }

/* ---------- "There are currently N people looting!" (like the OSRS homepage) ---------- */
.online { flex: 1 1 auto; margin: 0; text-align: center; font-size: .92rem; color: var(--text); white-space: nowrap; }
.online strong { color: var(--accent); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .online { order: 3; flex-basis: 100%; white-space: normal; } }

/* ---------- live drop feed (bottom-left, floats up and fades, like TikTok live) ---------- */
.feed {
  position: fixed; left: 12px; bottom: 12px; z-index: 45; pointer-events: none;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; gap: 6px;
  max-width: min(360px, calc(100vw - 24px));
}
.feed-bubble {
  display: inline-flex; align-items: center; gap: .4rem; max-width: 100%;
  padding: .28rem .7rem .28rem .35rem; border-radius: 999px;
  background: rgb(20 16 12 / .58); color: rgb(255 255 255 / .9); border: 1px solid rgb(255 255 255 / .1);
  font-size: .78rem; line-height: 1.25; text-shadow: 0 1px 1px rgb(0 0 0 / .6);
  backdrop-filter: blur(2px);
  animation: feedLife 6.5s ease-out forwards;
}
.feed-bubble img { width: 22px; height: 20px; object-fit: contain; image-rendering: pixelated; flex: none; }
.feed-bubble .fb-name { font-weight: 700; color: rgb(255 213 150 / .95); }
.feed-bubble strong { font-weight: 700; }
.feed-bubble.tier-rare strong { color: #ffc94d; }
.feed-bubble.tier-mega strong { color: #ff8ae0; }
.feed-bubble.tier-pet strong { color: #6dffc0; }
.feed-bubble.tier-purple strong { color: #d59bff; }
.feed-bubble .fb-from { opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes feedLife {
  0%   { opacity: 0; transform: translateY(16px) scale(.94); }
  8%   { opacity: .85; transform: translateY(0) scale(1); }
  75%  { opacity: .78; transform: translateY(-8px); }
  100% { opacity: 0; transform: translateY(-46px); }
}
@media (prefers-reduced-motion: reduce) {
  @keyframes feedLife { 0% { opacity: 0; } 10% { opacity: .85; } 80% { opacity: .8; } 100% { opacity: 0; } }
}
@media (max-width: 560px) { .feed-bubble { font-size: .72rem; } .feed-bubble .fb-from { display: none; } }

/* ---------- name settings ---------- */
.name-now { margin: 0 0 .5rem; font-size: .88rem; }
.name-now strong { color: var(--accent); }
.name-msg { margin: -.2rem 0 .5rem; font-size: .82rem; }
.name-msg.ok { color: var(--good); }
.name-msg.warn { color: var(--bad); }
.name-code { margin-bottom: .5rem; }
.name-code p { margin: 0 0 .4rem; font-size: .8rem; }
.name-code code { user-select: all; font-size: .78rem; overflow-wrap: anywhere; }

/* ---------- big sprites: sharp "detail" renders ---------- */
.fx-icon img.detail { width: auto; height: auto; max-width: 132px; max-height: 118px; image-rendering: auto; }
.fx-note { margin-top: .45rem; font-size: .82rem; font-weight: 700; color: #fff; opacity: .85; }

/* ---------- auto-kill status (always visible in the sticky level bar) ---------- */
.auto-status {
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  padding: .15rem .3rem .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  border: 1px solid var(--border); background: var(--panel-2);
}
.auto-status[hidden] { display: none; }
.auto-status .btn.small { padding: .15rem .55rem; font-size: .74rem; }
.auto-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.auto-status.running { border-color: var(--good); }
.auto-status.running .auto-dot { background: var(--good); animation: autoDot .9s ease-in-out infinite alternate; }
.auto-status.paused { border-color: var(--accent); color: var(--accent); }
.auto-status.paused .auto-dot { background: var(--accent); }
.auto-close { border: 0; background: none; color: var(--muted); font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.auto-status.running .auto-close { display: none; }
@keyframes autoDot { from { opacity: .35; } to { opacity: 1; } }
@media (max-width: 560px) { .auto-status { font-size: .72rem; } }
@media (prefers-reduced-motion: reduce) { .auto-status.running .auto-dot { animation: none; } }
