:root {
  color-scheme: dark;
  --ink: #f4f2ed;
  --muted: #aeb8c2;
  --dim: #7f8b96;
  --bg: #0d1114;
  --panel: #151b1f;
  --panel-2: #1b2328;
  --line: #34414a;
  --orange: #ff7652;
  --red: #ff4e49;
  --yellow: #f2c14e;
  --ice: #55bde9;
  --fire: #ff7667;
  --electric: #e194ff;
  --ether: #d6a8ff;
  --physical: #e6c56c;
  --wind: #6ed7ae;
  --good: #69d4ad;
  --bad: #ff8d83;
  --max: 70rem;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 118, 82, .055), transparent 24rem),
    var(--bg);
  font: 1rem/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: #ffad91; text-underline-offset: .2em; }
a:hover { color: #ffd2c3; }

.site-header,
main {
  width: min(calc(100% - 2rem), var(--max));
  margin-inline: auto;
}

.site-header { padding: 2.75rem 0 1.5rem; }
.network-label,
.eyebrow {
  margin: 0 0 .45rem;
  color: var(--orange);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: .15rem;
  font-size: clamp(2rem, 8vw, 4rem);
  line-height: .98;
  letter-spacing: -.045em;
}

h2 { margin-bottom: 0; font-size: clamp(1.55rem, 5vw, 2.25rem); }
h3 { margin-bottom: .1rem; line-height: 1.15; }
.dek,
.section-note,
.freshness-note { color: var(--muted); }
.mode-switch {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  margin-top: .9rem;
  padding: .35rem .75rem;
  border: 1px solid #794536;
  color: #ffad91;
  background: #2a1d1a;
  text-decoration: none;
}
.mode-switch:hover,
.mode-switch:focus-visible {
  border-color: var(--orange);
  color: #fff;
  background: #4a2922;
}
.mode-switch:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

.cycle-strip {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  margin-bottom: 3.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid #794536;
  background: #2a1d1a;
}

.cycle-strip p { margin-bottom: 0; }
.freshness-note { max-width: 31rem; text-align: right; font-size: .9rem; }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: end;
  margin-bottom: 1.25rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--line);
}

.section-note { margin-bottom: 0; font-size: .88rem; }
.frontier-list { display: grid; gap: .8rem; }

.frontier {
  border: 1px solid var(--line);
  border-left: .22rem solid var(--orange);
  background: var(--panel);
}

.frontier[open] { border-color: #596873; }
.frontier summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  cursor: pointer;
  list-style: none;
}

.frontier summary::-webkit-details-marker { display: none; }
.frontier summary::after { content: "↓"; color: var(--orange); font-weight: 900; }
.frontier[open] summary::after { content: "↑"; }
.frontier-kicker { color: var(--muted); font-size: .85rem; }
.rooms { display: grid; gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.room { padding: 1.1rem; background: var(--panel-2); }
.room-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .65rem 1rem; }
.room h3 { font-size: 1.05rem; }
.affinities { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .12rem .45rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 750;
}
.tag::before { font-size: .67rem; }
.tag.weak::before { content: "↑"; }
.tag.resist::before { content: "↓"; }
.tag.weak { color: var(--good); }
.tag.resist { color: var(--bad); }
.tag.ice { color: var(--ice); }
.tag.fire { color: var(--fire); }
.tag.electric { color: var(--electric); }
.tag.ether { color: var(--ether); }
.tag.physical { color: var(--physical); }
.tag.wind { color: var(--wind); }

.waves { margin-top: .9rem; display: grid; gap: .75rem; }
.wave { padding-top: .75rem; border-top: 1px solid #39454d; }
.wave-label { margin-bottom: .35rem; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.enemy-list { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.enemy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem; align-items: baseline; }
.enemy-name { font-weight: 700; }
.enemy-count { color: var(--yellow); }
.enemy-hp { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; text-align: right; }

.buff-section { margin-top: 4rem; }
.buff-list { display: grid; gap: 1.5rem; }
.buff { padding-left: 1rem; border-left: .18rem solid var(--orange); }
.buff h3 { font-size: 1.08rem; }
.buff p { margin-bottom: 0; max-width: 72ch; }
.term { font-weight: 800; color: #ffd0bd; }
.term.damage { color: var(--fire); }
.term.stat { color: var(--yellow); }
.term.effect { color: var(--electric); }
.term.specialty.anomaly { color: var(--ice); text-decoration: underline; text-decoration-style: dotted; }
.term.specialty.attack { color: var(--yellow); text-decoration: underline; text-decoration-style: double; }

.source-note {
  margin-top: 3.5rem;
  margin-bottom: 7rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}
.source-note p { margin-bottom: .45rem; }

.feedback {
  position: fixed;
  z-index: 10;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  padding: .72rem 1rem;
  border: 1px solid #ff9b79;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), #d94e22);
  box-shadow: 0 .4rem 1.5rem rgba(0, 0, 0, .42);
  font-weight: 850;
  text-decoration: none;
}
.feedback:hover { color: #fff; background: #f25b34; }
.fatal-error { margin: 2rem auto; width: min(calc(100% - 2rem), var(--max)); color: var(--bad); }

@media (min-width: 48rem) {
  .rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .frontier:last-child .rooms { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 40rem) {
  .site-header { padding-top: 1.75rem; }
  .cycle-strip,
  .section-heading { align-items: start; flex-direction: column; gap: .65rem; }
  .cycle-strip { margin-bottom: 2.75rem; }
  .freshness-note { text-align: left; }
  .section-note { max-width: 24rem; }
  .frontier summary,
  .room { padding: .9rem; }
  .enemy { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .enemy-hp { text-align: left; }
  .buff-section { margin-top: 3.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
