:root {
  --bg: #14110e;
  --panel: #1e1a16;
  --panel-2: #262019;
  --line: #3a3128;
  --text: #e8ded0;
  --muted: #9b8d7c;
  --accent: #c8a45c;
  --accent-dim: #8a7038;
  --good: #7bbf6a;
  --warn: #d8a54a;
  --bad: #cc6b5a;
  --radius: 6px;
}

* { box-sizing: border-box; }

/* A `display` rule of our own would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 1rem 4rem;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}

main, .page-head, footer { max-width: 1000px; margin: 0 auto; }

.page-head { padding: 2.5rem 0 1.5rem; }
.page-head h1 { margin: 0 0 .4rem; font-size: 1.9rem; color: var(--accent); font-weight: 600; }
.tagline { margin: 0; color: var(--muted); max-width: 60ch; }
/* Why a search can end with nothing: the seed space is finite. */
.tagline.note { margin-top: .7rem; font-size: .88rem; opacity: .85; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.panel h2 { margin: 0 0 1rem; font-size: 1.15rem; font-weight: 600; }

.muted { color: var(--muted); }
.note { font-size: .85rem; margin-top: .9rem; }

/* --- pickers ------------------------------------------------------------ */

.picker label {
  display: block; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: .35rem;
}

/* Prefix and suffix are optional and only ever land on non-epic bases, so they fold away under
   the item picker rather than framing it. */
.affix-grid { font-size: 15px; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 720px) { .affix-grid { grid-template-columns: 1fr; } }
.affix-grid .picker label { font-size: .72rem; }
.picker-na { margin: .7rem 0 0; font-size: .85rem; color: var(--muted); }
/* Which of the dozen records called 'of Alacrity' is actually selected. */
.affix-pick:empty { display: none; }
.affix-pick { margin: .35rem 0 0; font-size: .8rem; color: var(--muted); }

/* Crafting bonus (the Modifier record): only crafted items carry one, so it stays folded away
   under the three main pickers instead of competing with them. */
.extra-picker { margin-top: .7rem; font-size: .85rem; }
.extra-picker > summary {
  cursor: pointer; color: var(--muted); width: fit-content;
  list-style: none; user-select: none;
}
.extra-picker > summary::-webkit-details-marker { display: none; }
.extra-picker > summary::before { content: '▸ '; font-size: .8em; }
.extra-picker[open] > summary::before { content: '▾ '; }
.extra-picker > summary:hover { color: var(--text); }
.extra-picker > summary > span:not(:empty)::before { content: ': '; }
.extra-picker > summary > span { color: var(--text); }
.extra-picker > div { margin-top: .45rem; }
#modifier-combo { max-width: 38rem; }

.combo { position: relative; }
.combo-input {
  width: 100%; padding: .55rem .7rem;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius);
  font: inherit;
}
.combo-input:focus { outline: none; border-color: var(--accent-dim); }

.combo-panel {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 12px 28px rgba(0,0,0,.5);
}
/* Affixes repeat their names ('of Alacrity' twelve times over), so the stat line beside the name
   is what tells two entries apart -- the list is dropped out to this width so it survives. */
.combo.is-wide .combo-panel { left: 0; right: auto; width: max(100%, 42rem); max-width: min(64rem, 92vw); }
.combo.is-wide.align-right .combo-panel { left: auto; right: 0; }
/* On a narrow screen the input is already the full width; widening the list would only push
   it off the edge. */
@media (max-width: 720px) {
  .combo.is-wide .combo-panel, .combo.is-wide.align-right .combo-panel {
    left: 0; right: 0; width: auto; max-width: none;
  }
}

.combo-scroll { position: relative; max-height: 340px; overflow-y: auto; }
.combo-sizer { width: 1px; }
.combo-rows { position: absolute; inset: 0; }
.combo-row {
  position: absolute; left: 0; right: 0; height: 34px;
  display: flex; align-items: baseline; gap: .6rem;
  padding: 0 .7rem; cursor: pointer; overflow: hidden; white-space: nowrap;
}
.combo-row:hover, .combo-row.is-active { background: rgba(200,164,92,.14); }
/* The name never shrinks; the stat line beside it gives way instead, since its first few words
   are already enough to tell one 'of Alacrity' from the next. */
.combo-label { flex: 0 0 auto; max-width: 60%; overflow: hidden; text-overflow: ellipsis; }
.combo-sub { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .82rem; }
.combo-tail {
  flex: 0 0 auto; margin-left: auto; padding-left: .4rem;
  color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums;
}
.combo-empty { padding: .7rem; color: var(--muted); }

.status { margin: 1rem 0 0; color: var(--muted); font-size: .9rem; }
.status.is-error { color: var(--bad); }

/* --- stat sliders ------------------------------------------------------- */

.stats { display: flex; flex-direction: column; }
.stat-head, .stat-row {
  display: grid; grid-template-columns: minmax(0,1.5fr) 7rem minmax(0,1.6fr);
  gap: 1rem; align-items: center;
}
.stat-head {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding-bottom: .5rem; border-bottom: 1px solid var(--line);
}
.stat-range-head { text-align: center; }
.stat-row { padding: .45rem 0; border-bottom: 1px solid rgba(58,49,40,.5); }
.stat-row.is-off { opacity: .45; }

/* The pet block is its own section of the tooltip, so its sliders get their own heading. */
.stat-group {
  margin: 1.4rem 0 .3rem; font-size: .85rem; font-weight: 600;
  letter-spacing: .04em; color: var(--accent);
}

.stat-name { display: flex; align-items: center; gap: .5rem; cursor: pointer; min-width: 0; }
.stat-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-enable { accent-color: var(--accent); }
.stat-range { color: var(--muted); font-size: .88rem; text-align: center; white-space: nowrap; }
.stat-control { display: flex; align-items: center; gap: .7rem; }
.stat-slider { flex: 1; min-width: 0; accent-color: var(--accent); }
.stat-value {
  flex: 0 0 3.2rem; text-align: right; font-variant-numeric: tabular-nums;
  color: var(--accent); font-weight: 600;
}

/* --- odds + actions ----------------------------------------------------- */

.odds { margin: 1rem 0 0; font-size: .9rem; color: var(--muted); }
.odds.is-warn { color: var(--warn); }
.odds.is-bad { color: var(--bad); }

/* Verdict of a completed sweep: every seed was checked, so this is the final word. */
.exhausted {
  margin: 0; padding: .8rem 1rem; color: var(--warn);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(0, 0, 0, .18); font-size: .92rem;
}
.results .result + .exhausted { margin-top: 1rem; }

.actions { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.1rem; flex-wrap: wrap; }
button {
  background: var(--accent); color: #201a10; border: 0;
  padding: .6rem 1.4rem; border-radius: var(--radius);
  font: inherit; font-weight: 600; cursor: pointer;
}
button:hover:not(:disabled) { background: #dcb96c; }
button:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }

.progress { display: flex; gap: 1.25rem; color: var(--muted); font-size: .9rem; }
.progress strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* --- results ------------------------------------------------------------ */

.results { display: flex; flex-direction: column; gap: .9rem; }
.result { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.result header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; }
.result h3 { margin: 0; font-size: 1rem; color: var(--accent); font-weight: 600; }
.seed {
  position: relative;
  font-family: ui-monospace, Consolas, monospace; font-size: .85rem;
  background: rgba(0,0,0,.3); padding: .15rem .5rem; border-radius: 4px; user-select: all;
  cursor: pointer; border: 1px solid transparent;
}
.seed:hover, .seed:focus-visible { border-color: var(--line); background: rgba(0,0,0,.45); }

/* Confirmation floats above the seed so the value itself never moves or changes. */
.seed.is-copied::after, .seed.is-copy-failed::after {
  position: absolute; right: 0; bottom: calc(100% + .3rem);
  padding: .1rem .4rem; border-radius: 4px; white-space: nowrap;
  font-family: inherit; font-size: .75rem; pointer-events: none;
  animation: seed-copied 1.4s ease-out forwards;
}
.seed.is-copied::after { content: 'Copied'; background: var(--accent); color: #1a1a12; }
.seed.is-copy-failed::after { content: 'Press Ctrl+C'; background: var(--line); color: var(--text); }

@keyframes seed-copied {
  0% { opacity: 0; transform: translateY(.2rem); }
  15%, 70% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-.2rem); }
}
.result ul { margin: 0; padding-left: 1.1rem; }
.result li { color: #b9d4a8; }
.pet-head {
  margin: .6rem 0 .2rem; font-size: .8rem; font-weight: 600;
  letter-spacing: .04em; color: var(--muted);
}
.pet-lines li { color: #a8c6d4; }

footer { margin-top: 2rem; color: var(--muted); font-size: .85rem; }
footer p { max-width: 70ch; }
footer a { color: var(--accent); }
footer a:hover { color: #dcb96c; }

.sdk-link {
  position: fixed; right: .9rem; bottom: .7rem;
  font-size: .75rem; letter-spacing: .04em; color: var(--muted);
  opacity: .55; text-decoration: none;
}
.sdk-link:hover { opacity: 1; color: var(--accent); }
