/* Shared look for every page, modelled on Warframe's in-game menus:
   near-black panels, thin olive borders, parchment-gold uppercase titles,
   grey subtitles, and a cream highlight for whatever is open or selected. */

@import url("https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;600;700&display=swap");

/* ------------------------------------------------------------ colours and timing */
:root {
  --bg: #0b0b0f;
  --panel: rgba(21, 21, 27, .94);       /* #15151b */
  --panel-hi: rgba(32, 31, 36, .96);    /* open / selected panel */
  --field: #101015;
  --line: #3e3c35;                      /* panel border */
  --line-hi: #d9c99a;                   /* open panel border */
  --gold-hi: #e6d5a3;                   /* main titles */
  --gold: #baa564;                      /* buttons, headings */
  --gold-dim: #665c3e;                  /* empty / disabled */
  --text: #d4d4d5;                      /* subtitles */
  --muted: #8f8f91;
  --cream: #f5e3ad;                     /* progress line, highlights */
  --good: #3fa35b;
  --bad: #d1453b;
  --font: "Roboto Condensed", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

/* Light variant (only the Price Watcher page lets you switch to it) */
:root[data-theme="light"] {
  --bg: #e9e4d6; --panel: rgba(250, 247, 239, .97); --panel-hi: #fffdf6; --field: #ffffff;
  --line: #c9bc98; --line-hi: #7d6628; --gold-hi: #5c4a17; --gold: #7d6628; --gold-dim: #b3a57c;
  --text: #2a2a2c; --muted: #6d6a62; --cream: #9c7f2e;
}

/* ------------------------------------------------------------ base */
* { box-sizing: border-box; scrollbar-color: var(--gold-dim) transparent; scrollbar-width: thin; }
html { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
body {
  margin: 0; color: var(--text); font: 15px/1.35 var(--font);
  background:
    radial-gradient(ellipse at 50% -20%, rgba(186, 165, 100, .10), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, .6), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--gold-dim); color: var(--gold-hi); }

/* ------------------------------------------------------------ text */
.wf-title {
  margin: 0; color: var(--gold-hi); font-weight: 700; text-transform: uppercase;
  letter-spacing: .02em; line-height: 1.15;
}
.wf-sub { color: var(--text); }
.wf-label {
  color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; font-size: .85em;
}
.wf-label small { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ------------------------------------------------------------ header bar ("Default Loadout") */
.wf-header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); padding: 6px 10px;
}
.wf-header h1 {
  margin: 0; font-size: 1.45em; font-weight: 600; color: var(--gold); letter-spacing: .01em;
}
.wf-header .wf-rule {  /* the thin line with a chevron on the right of the in-game bar */
  flex: 1; min-width: 40px; height: 1px; position: relative;
  background: linear-gradient(90deg, transparent, var(--line) 30%, var(--gold-dim));
}
.wf-header .wf-rule::after {
  content: "»"; position: absolute; right: -2px; top: -.75em; color: var(--gold); font-size: 1.1em;
}

/* ------------------------------------------------------------ panels */
.wf-panel { background: var(--panel); border: 1px solid var(--line); position: relative; }
.wf-bar {  /* progress bar: <div class="wf-bar"><div style="width: 40%"></div></div> */
  height: 3px; background: var(--field); border: 1px solid var(--line); overflow: hidden;
}
.wf-bar > div { height: 100%; width: 0; background: var(--cream); transition: width .3s; }
.wf-progress {  /* thin cream line, like the "Rank 16" bar */
  height: 2px; background: var(--cream); box-shadow: 0 0 6px rgba(245, 227, 173, .35);
}
pre.wf-log {
  margin: 0; padding: 10px 12px; overflow: auto; background: #08080b; color: var(--text);
  border: 1px solid var(--line); font: 12.5px/1.5 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap;
}
/* A scan's progress box (filled by scanPage in common.js) */
.wf-scan { padding: 10px 14px 0; }
.wf-scan .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.wf-scan .msg { flex: 1; min-width: 200px; }
.wf-scan.failed .msg { color: var(--bad); }
.wf-scan .wf-progress { width: 0; margin: 10px -14px 0; transition: width .3s; }
.wf-scan details { margin: 6px 0 8px; }
.wf-scan summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.wf-scan pre { margin-top: 6px; max-height: 240px; }

/* ------------------------------------------------------------ expanding slots
   Like the in-game loadout list: the open slot grows, its border turns cream,
   its extra content (.wf-more) fades in, and a button column (.wf-actions)
   snaps in beside it. About 200 ms, easing out. Opened by adding class "open"
   (see hoverExpand in common.js). */
.wf-slot {
  background: var(--panel); border: 1px solid var(--line); position: relative;
  transition: border-color .2s var(--ease-out), background-color .2s var(--ease-out),
              padding .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.wf-slot.open { border-color: var(--line-hi); background: var(--panel-hi); }
.wf-slot.open::after {  /* cream line along the bottom of the open slot */
  content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 2px;
  background: var(--cream); box-shadow: 0 0 6px rgba(245, 227, 173, .35);
  animation: wf-grow .2s var(--ease-out);
}
@keyframes wf-grow { from { transform: scaleX(0); transform-origin: left; } }

.wf-more {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows .2s var(--ease-out), opacity .15s ease-out;
}
.wf-more > * { overflow: hidden; min-height: 0; }
.open .wf-more { grid-template-rows: 1fr; opacity: 1; }

.wf-actions { display: flex; flex-direction: column; gap: 4px; visibility: hidden; }
.wf-actions.open { visibility: visible; animation: wf-snap .12s ease-out; }
.wf-actions button, .wf-actions .wf-btn { text-align: left; }
@keyframes wf-snap { from { opacity: 0; transform: translateX(-4px); } }

/* ------------------------------------------------------------ buttons ("SWAP / UPGRADE") */
button, .wf-btn {
  font: inherit; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: var(--gold); background: var(--panel); border: 1px solid var(--line);
  padding: 5px 14px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap;
  border-radius: 0; transition: color .12s, border-color .12s, background .12s;
}
button:hover, .wf-btn:hover { color: var(--gold-hi); border-color: var(--gold-dim); background: var(--panel-hi); }
button.wf-primary { color: var(--gold-hi); border-color: var(--line-hi); background: var(--panel-hi); }
button:disabled { color: var(--gold-dim); border-color: var(--line); background: var(--panel); cursor: not-allowed; }

/* ------------------------------------------------------------ inputs */
input {
  font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line);
  border-radius: 0; padding: 4px 8px;
}
input:focus { outline: none; border-color: var(--line-hi); }
/* No browser up/down arrows in number boxes (the pages use their own − / + buttons) */
input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="checkbox"].wf-switch {  /* on/off switch */
  appearance: none; -webkit-appearance: none; width: 34px; height: 18px; flex: none; margin: 0; padding: 0;
  border: 1px solid var(--line); background: var(--field); position: relative; cursor: pointer;
  transition: border-color .15s;
}
input[type="checkbox"].wf-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  background: var(--gold-dim); transition: transform .15s var(--ease-out), background .15s;
}
input[type="checkbox"].wf-switch:checked { border-color: var(--gold); }
input[type="checkbox"].wf-switch:checked::after {
  transform: translateX(16px); background: var(--cream); box-shadow: 0 0 6px rgba(245, 227, 173, .5);
}

/* ------------------------------------------------------------ tool pages (Price Watcher, Riven Price Check)
   <body class="wf-tool"> fills the window: header, then .cols of .col of .card
   panels; each page sets .cols' grid-template-columns. */
html:has(body.wf-tool), body.wf-tool { height: 100%; }
body.wf-tool { font-size: 14px; }
.wf-tool main { height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 12px 2vw 14px; }
.wf-tool .wf-header h1 { font-size: 1.6em; }
.wf-tool .cols { flex: 1; min-height: 0; display: grid; gap: 12px; }
.wf-tool .col { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.wf-tool .card { padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.wf-tool .card.grow { flex: 1; }
@media (max-width: 900px) {
  .wf-tool main { height: auto; }
  .wf-tool .cols { grid-template-columns: 1fr !important; }
}

/* ------------------------------------------------------------ tool page parts */
.wf-status {  /* status text in the header; .flash briefly shows a message */
  flex: 1; min-width: 140px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wf-status.flash { color: var(--gold-hi); }
.wf-hint { color: var(--muted); font-size: .9em; }
.wf-empty { color: var(--muted); text-align: center; padding: 14px 10px; border: 1px dashed var(--line); }
.wf-whisper {
  margin-top: 6px; padding: 6px 8px; background: var(--field); border: 1px solid var(--line); color: var(--text);
  font: 12px/1.4 Consolas, monospace; word-break: break-word;
}
.wf-chips { display: flex; flex-wrap: wrap; gap: 6px; }  /* filled by chipList in common.js */
.wf-chips:empty { display: none; }
.wf-stepper { display: flex; align-items: center; }  /* − value + (filled by makeStepper in common.js) */
.wf-stepper button { padding: 2px 10px; }
.wf-stepper input { width: 60px; text-align: center; border-left: 0; border-right: 0; }
/* Data tables (table() in common.js): numbers right-aligned, td.name on the left */
.wf-data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.wf-data th {
  position: sticky; top: 0; z-index: 1; background: var(--panel); color: var(--gold); font-size: .78em; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--line);
}
.wf-data td { padding: 3px 6px; text-align: right; border-bottom: 1px solid rgba(62, 60, 53, .45); white-space: nowrap; }
.wf-data th:first-child, .wf-data td.name { text-align: left; }
.wf-data td.name { white-space: normal; }
.wf-data td.name a { text-decoration: none; }
.wf-data td.name a:hover { color: var(--gold-hi); }
.wf-data td.good { color: var(--good); font-weight: 700; }
.wf-data td.bad { color: var(--bad); font-weight: 700; }
.wf-data td .sub { color: var(--muted); font-size: .85em; }
.wf-data td button { padding: 1px 8px; font-size: .85em; }
.wf-tip {  /* hover box that follows the mouse (tooltip in common.js) */
  position: fixed; z-index: 10; pointer-events: none; background: var(--panel-hi); border: 1px solid var(--line-hi);
  padding: 6px 9px; font-size: .85em; line-height: 1.45; font-variant-numeric: tabular-nums; max-width: 420px;
}
.wf-tip b { color: var(--gold-hi); }

/* ------------------------------------------------------------ chips and badges */
.wf-chip {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--field);
  padding: 2px 2px 2px 8px; color: var(--text);
}
.wf-chip button { border: 0; background: none; padding: 0 6px; color: var(--muted); font-size: 1.1em; }
.wf-chip button:hover { color: var(--bad); background: none; }
.wf-badge {
  display: inline-block; padding: 1px 6px; font-size: .78em; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; border: 1px solid currentColor;
}
