/* Outrider theme: shared tokens, header and theme toggle. Each tool keeps its own copy. */
:root{
  --bg:#14181f; --surface:#1c222b; --surface-2:#232a35; --border:#333c49;
  --text:#e7e4db; --text-dim:#9aa4b2; --text-faint:#6b7684;
  --brand:#7000d6; --brand-hover:#8f00ff; --on-brand:#ffffff;
  --accent:#b98cff; --accent-soft:rgba(185,140,255,0.16);
  --green:#4c9a63; --green-text:#a8d6b6;
  --red:#c1503f; --red-text:#f0b3ab;
  --amber:#d4a24c; --amber-text:#f0d29b;
  --shadow:0 4px 14px rgba(0,0,0,0.35);
  --radius:8px;
  --mono:"SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans:-apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --head:"Cinzel", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  color-scheme:dark;
}
@media (prefers-color-scheme: light){
  :root:not([data-theme="dark"]){
    --bg:#e8eaef; --surface:#ffffff; --surface-2:#f1f2f6; --border:#cdd1db;
    --text:#22242c; --text-dim:#545a6b; --text-faint:#7f8598;
    --accent:#7000d6; --accent-soft:rgba(112,0,214,0.10);
    --green:#2f7a48; --green-text:#1f5533;
    --red:#a5372a; --red-text:#7a281e;
    --amber:#93701f; --amber-text:#6e5416;
    --shadow:0 4px 14px rgba(40,50,80,0.14);
    color-scheme:light;
  }
}
:root[data-theme="light"]{
  --bg:#e8eaef; --surface:#ffffff; --surface-2:#f1f2f6; --border:#cdd1db;
  --text:#22242c; --text-dim:#545a6b; --text-faint:#7f8598;
  --accent:#7000d6; --accent-soft:rgba(112,0,214,0.10);
  --green:#2f7a48; --green-text:#1f5533;
  --red:#a5372a; --red-text:#7a281e;
  --amber:#93701f; --amber-text:#6e5416;
  --shadow:0 4px 14px rgba(40,50,80,0.14);
  color-scheme:light;
}
*,*::before,*::after{ box-sizing:border-box; }
body{
  margin:0; background:var(--bg); color:var(--text); font-family:var(--sans);
  line-height:1.5;
}
a{ color:var(--accent); }
a:hover{ color:var(--brand-hover); }
:root[data-theme="dark"] a:hover{ color:#d3b8ff; }
h1,h2,h3{ font-family:var(--head); }
.site-header{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  max-width:1180px; margin:0 auto; padding:24px 24px 18px;
  border-bottom:1px solid var(--border);
}
.brand{ flex-shrink:0; display:block; line-height:0; border-radius:12px; }
.brand img{ width:56px; height:56px; object-fit:contain; }
.brand:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; }
.head-text{ flex:1; min-width:200px; }
.site-header h1{
  font-size:1.5rem; font-weight:600; letter-spacing:0.05em; margin:0 0 4px;
  text-transform:uppercase; color:var(--text);
}
.site-header p{ margin:0; color:var(--text-dim); font-size:14.5px; max-width:640px; }
#themeToggle{
  flex-shrink:0; display:flex; align-items:center; gap:7px;
  background:var(--surface); border:1px solid var(--border); color:var(--text-dim);
  border-radius:20px; padding:7px 14px 7px 12px; font-size:13px; font-family:var(--sans);
  cursor:pointer;
}
#themeToggle:hover{ color:var(--text); border-color:var(--accent); }
#themeToggle:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
#themeToggle svg{ width:15px; height:15px; }
.btn{
  background:var(--brand); color:var(--on-brand); border:1px solid transparent;
  border-radius:6px; padding:8px 14px; font-size:14px; font-family:var(--sans);
  font-weight:600; cursor:pointer;
}
.btn:hover{ background:var(--brand-hover); }
.btn-secondary{
  background:transparent; color:var(--accent); border:1px solid var(--accent);
  border-radius:6px; padding:8px 14px; font-size:14px; font-family:var(--sans);
  font-weight:600; cursor:pointer;
}
.btn-secondary:hover{ background:var(--accent-soft); }

/* ===============================
   LAYOUT
   =============================== */
main{ padding-bottom:24px; }

.card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; margin:20px auto; width:min(900px, calc(100% - 32px));
  box-shadow:var(--shadow);
}
.card h2{
  font-size:1.05rem; font-weight:600; letter-spacing:0.04em;
  border-bottom:1px solid var(--border); padding-bottom:8px; margin:0 0 15px;
}
.intro-spacer{ height:10px; margin:0; }

.split-container{ display:flex; gap:20px; flex-wrap:wrap; }
.input-side, .output-side{ flex:1; min-width:260px; }

/* ===============================
   INPUTS
   =============================== */
.input-label{ display:block; font-weight:600; margin-top:15px; margin-bottom:5px; }
.range-display{ font-size:0.9rem; font-weight:600; margin-bottom:10px; color:var(--text-dim); }

input[type="range"]{ width:100%; margin:6px 0; accent-color:var(--brand); }

.player-grid{ display:grid; grid-template-columns:repeat(3, 1fr); gap:12px; margin-top:10px; }
.player-box{
  display:none; flex-direction:row; align-items:center; justify-content:space-between;
  padding:8px 10px; border-radius:var(--radius);
  background:var(--surface-2); border:1px solid var(--border);
}
.player-box-label{ font-weight:600; margin-right:6px; }
.player-level-input{
  width:55px; padding:4px 6px; border-radius:6px;
  border:1px solid var(--border); background:var(--bg); color:var(--text);
  font-family:var(--sans);
}
.player-level-input.invalid{ border-color:var(--red); background:rgba(193,80,63,0.15); }
.player-level-input:hover{ border-color:var(--accent); }

input[type="number"]:focus,
input[type="range"]:focus{ outline:2px solid var(--accent); outline-offset:2px; }

/* ===============================
   OUTPUT
   =============================== */
.output-row{ display:flex; justify-content:space-between; padding:6px 0; margin-bottom:4px; }
.output-value{ font-weight:700; }
.greyed{ opacity:0.5; }
.pregen-active{ color:var(--accent); }
.invalid{ color:var(--red-text) !important; font-weight:700; }
.hardmode-highlight{ color:var(--amber-text); font-weight:700; }
.total-value{ font-size:1.6rem; font-weight:700; color:var(--accent); }
.play-direction{ font-weight:700; font-size:1.2rem; color:var(--accent); }
.play-row{ margin-top:14px; }

.footnotes li{ margin-bottom:10px; line-height:1.4; }
.fn-purple{ color:var(--accent); font-weight:700; }
.fn-red{ color:var(--red-text); font-weight:700; }
.fn4-part{ display:none; }

/* ===============================
   APPENDIX
   =============================== */
.collapse-button{
  width:100%; padding:10px; background:var(--surface-2); color:var(--text);
  border:1px solid var(--border); border-radius:var(--radius);
  font-family:var(--head); font-weight:600; letter-spacing:0.04em; font-size:1rem;
  cursor:pointer;
}
.collapse-button:hover{ border-color:var(--accent); color:var(--accent); }
.collapse-content{ display:none; margin-top:15px; }
.collapse-content.open{ display:block; }
.appendix-spacer{ height:20px; }

.cp-table{ width:100%; border-collapse:collapse; margin-top:10px; }
.cp-table th, .cp-table td{ border:1px solid var(--border); padding:6px; text-align:center; }
.cp-table th{ background:var(--surface-2); }
.cp-table tr:nth-child(even){ background:var(--surface-2); }

/* ===============================
   RESPONSIVE + ANIMATION
   =============================== */
@media (max-width:600px){
  .split-container{ flex-direction:column; }
  .total-value{ font-size:1.4rem; }
}
@keyframes slowPulse{
  0%{ transform:scale(1); opacity:1; }
  50%{ transform:scale(1.06); opacity:0.85; }
  100%{ transform:scale(1); opacity:1; }
}
.valid-total{ animation:slowPulse 2.8s ease-in-out infinite; }
@keyframes fastPulse{
  0%{ transform:scale(1); opacity:1; }
  50%{ transform:scale(1.12); opacity:0.6; }
  100%{ transform:scale(1); opacity:1; }
}
.invalid-total{ animation:fastPulse 0.7s ease-in-out infinite; color:var(--red-text) !important; }

/* Header lines up with the card column */
.site-header{ width:min(900px, calc(100% - 32px)); padding-left:0; padding-right:0; }

[hidden]{ display:none !important; }
#installBtn{
  flex-shrink:0; background:var(--brand); border:1px solid transparent; color:var(--on-brand);
  border-radius:20px; padding:7px 14px; font-size:13px; font-family:var(--sans);
  font-weight:600; cursor:pointer;
}
#installBtn:hover{ background:var(--brand-hover); }
#installBtn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
