/* AME Draft League — pokeball-dark dashboard.
   Charcoal ground, pokeball red + off-white accents, type-colored chips.
   (House rules: never orange, never flat, never too-blue.) */

:root {
  --bg:      #14161a;
  --bg-2:    #191c21;
  --panel:   #1e2229;
  --panel-2: #242933;
  --line:    #2e3440;
  --line-2:  #3a4150;
  --ink:     #ecE8dd;
  --ink-2:   #b8b3a6;
  --ink-3:   #7d7a70;
  --red:     #e5484d;   /* pokeball red — the accent */
  --red-2:   #ff6b6f;
  --cream:   #f4f2ec;   /* pokeball white */
  --good:    #4ec98a;
  --bad:     #e5484d;
  --gold:    #d9b44a;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 var(--sans);
  background-image:
    radial-gradient(1000px 420px at 85% -10%, rgba(229, 72, 77, 0.09), transparent 60%),
    radial-gradient(800px 380px at 0% 0%, rgba(244, 242, 236, 0.05), transparent 55%);
}
a { color: var(--red-2); }

/* ---------------------------------------------------------------- header */
.hero { border-bottom: 1px solid var(--line); background: var(--bg-2); }
.hero-in {
  max-width: 1180px; margin: 0 auto; padding: 26px 22px 22px;
  display: flex; align-items: center; gap: 18px;
}
.hero h1 { margin: 0; font-size: 1.7rem; letter-spacing: 0.01em; }
.hero .tag { margin: 2px 0 0; color: var(--ink-2); font-size: 0.9rem; }
.backlink { margin-left: auto; font-size: 0.82rem; color: var(--ink-3); text-decoration: none; }
.backlink:hover { color: var(--ink-2); }

/* the pokeball: red top, cream bottom, band, button. Floats; spins on hover. */
.ball {
  width: 54px; height: 54px; border-radius: 50%; position: relative; flex: none;
  background: linear-gradient(180deg, var(--red) 0 46%, #101216 46% 54%, var(--cream) 54% 100%);
  box-shadow: 0 6px 22px rgba(229, 72, 77, 0.35), inset 0 -4px 10px rgba(0, 0, 0, 0.35);
  animation: bob 4.5s ease-in-out infinite;
}
.ball-btn {
  position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  background: var(--cream); border: 4px solid #101216; border-radius: 50%;
}
.ball:hover { animation: spin 0.7s ease-in-out; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ball { animation: none; } }

/* ------------------------------------------------------------------- nav */
.bar { position: sticky; top: 0; z-index: 10; background: rgba(20, 22, 26, 0.92);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 10px 22px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
select, input[type="text"] {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 7px 10px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button {
  font: 600 0.85rem var(--sans); color: var(--ink-2); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 15px; transition: all 0.15s;
}
.pills button:hover { border-color: var(--red); color: var(--ink); transform: translateY(-1px); }
.pills button.on { background: var(--red); border-color: var(--red); color: #fff;
  box-shadow: 0 3px 14px rgba(229, 72, 77, 0.4); }

/* ------------------------------------------------------------------ main */
main { max-width: 1180px; margin: 0 auto; padding: 24px 22px 60px; }
.dim { color: var(--ink-3); }
.center { text-align: center; }
h2 { font-size: 1.15rem; margin: 26px 0 10px; }
h2:first-child { margin-top: 4px; }

.statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 6px 0 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.5rem; color: var(--cream); }
.stat span { font-size: 0.78rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 18px; }
.card h3 { margin: 0 0 10px; font-size: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.chartbox { position: relative; height: 320px; }
.chartbox.tall { height: 420px; }

table.t { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.t th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3);
  text-align: left; padding: 6px 10px; border-bottom: 2px solid var(--red); }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
table.t tr:hover td { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.wl b { color: var(--good); } .wl s { color: var(--bad); text-decoration: none; }
.scroll { overflow-x: auto; }

.sprite { width: 40px; height: 40px; image-rendering: pixelated; vertical-align: middle; }
.sprite.s { width: 28px; height: 28px; }
.rankpill { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-2); }
.rankpill.hot { background: rgba(229, 72, 77, 0.15); border-color: var(--red); color: var(--red-2); }
.tagpill { display: inline-block; font-size: 0.68rem; font-weight: 700; padding: 1px 7px;
  border-radius: 999px; }
.tagpill.ban { background: rgba(229, 72, 77, 0.15); color: var(--red-2); border: 1px solid var(--red); }
.restricted { color: var(--red-2); }
.restricted::after { content: " ✶"; font-size: 0.75em; }

/* type chips — canonical-ish type colors, muted for dark ground */
.ty { display: inline-block; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #fff; border-radius: 4px; padding: 1px 6px; margin-right: 3px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.ty-normal{background:#8a8a75}.ty-fire{background:#d3562f}.ty-water{background:#4f77c9}
.ty-electric{background:#c7a422}.ty-grass{background:#589a3e}.ty-ice{background:#5fb8b4}
.ty-fighting{background:#a83c31}.ty-poison{background:#8e4392}.ty-ground{background:#b3985a}
.ty-flying{background:#8579c9}.ty-psychic{background:#d1566f}.ty-bug{background:#8b9c27}
.ty-rock{background:#9c8a4b}.ty-ghost{background:#63548e}.ty-dragon{background:#5d4bc9}
.ty-dark{background:#5a4a3e}.ty-steel{background:#7b7b95}.ty-fairy{background:#c574b3}

/* team cards */
.teamgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.teamcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; cursor: pointer; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
.teamcard:hover { transform: translateY(-3px); border-color: var(--red);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45); }
.teamcard h3 { margin: 0; font-size: 1rem; }
.teamcard .coach { color: var(--ink-3); font-size: 0.8rem; }
.teamcard .facesprites { margin: 8px 0 4px; min-height: 32px; }
.teamcard .facesprites .sprite.s { margin-right: -6px; }
.teamcard .metric { font-size: 0.78rem; color: var(--ink-2); }
.teamcard .metric b { color: var(--red-2); }

.roster li { display: flex; align-items: center; gap: 8px; padding: 5px 0;
  border-bottom: 1px solid var(--line); list-style: none; }
.roster { margin: 0; padding: 0; }
.roster .kd { margin-left: auto; font-size: 0.78rem; color: var(--ink-2); white-space: nowrap; }

/* weekly matches */
.week { margin-bottom: 20px; }
.week h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3);
  border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.match { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.match .side { font-size: 0.88rem; }
.match .side.b { text-align: right; }
.match .side .win { color: var(--good); font-weight: 700; }
.match .score { font-family: var(--mono); font-size: 1.15rem; font-weight: 700; color: var(--cream);
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 3px 10px; white-space: nowrap; }

/* board tiers - wrapping grid, page scrolls vertically (no sideways scrolling) */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px; align-items: start; }
.tier { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tier h4 { margin: 0; padding: 6px 12px; font-size: 0.78rem; letter-spacing: 0.05em;
  background: var(--red); color: #fff; border-radius: 11px 11px 0 0; }
.tier ul { list-style: none; margin: 0; padding: 6px 12px 10px; font-size: 0.82rem; }
.tier li { padding: 2px 0; white-space: nowrap; }
.tier li.taken { color: var(--ink-3); text-decoration: line-through; }
.tier li .who { font-size: 0.68rem; color: var(--gold); }

/* scout cards */
.scoutgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.scard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; font-size: 0.86rem; }
.scard h4 { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.scard .lbl { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); display:block; margin-top: 6px; }
.mine { background: rgba(78, 201, 138, 0.18); color: var(--good); border-radius: 4px; padding: 0 5px; font-weight: 600; }

.detail { animation: rise 0.25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
.linkish { color: var(--red-2); cursor: pointer; background: none; border: none; font: inherit; padding: 0; }

.foot { max-width: 1180px; margin: 0 auto; padding: 18px 22px 30px; color: var(--ink-3); font-size: 0.78rem;
  border-top: 1px solid var(--line); }

.champ { font-size: 1.05rem; border-color: var(--gold); background: linear-gradient(90deg, rgba(217,180,74,.12), var(--panel)); }
.champ.soft { border-color: var(--line-2); background: var(--panel); font-size: .95rem; }
.ab { border-bottom: 1px dotted var(--ink-3); cursor: help; }
.adminpill { margin-left: auto; font-size: .72rem; color: var(--gold); border: 1px solid var(--gold);
  border-radius: 999px; padding: 2px 10px; opacity: .8; }

/* Hall of Fame */
.trophies { display: flex; flex-wrap: wrap; gap: 12px; }
.trophy { background: linear-gradient(180deg, rgba(217,180,74,.16), var(--panel-2)); border: 1px solid var(--gold);
  border-radius: 12px; padding: 12px 16px; min-width: 150px; }
.trophy .tn { font-weight: 700; font-size: 1.05rem; }
.trophy .tc { font-size: .82rem; color: var(--gold); margin-top: 3px; }
.hallcard { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 4px 14px; }
.hallcard summary { cursor: pointer; padding: 8px 0; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hallcard summary::-webkit-details-marker { display: none; }
.hallcard summary::before { content: '▸'; color: var(--ink-3); }
.hallcard[open] summary::before { content: '▾'; }
.hallbadges { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; }
.badge { font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.badge.champ { background: rgba(217,180,74,.18); color: var(--gold); border: 1px solid var(--gold); }
.badge.fin { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line-2); }
.medal { font-weight: 700; font-size: .78rem; padding: 1px 7px; border-radius: 5px; }
.medal.g { background: rgba(217,180,74,.2); color: var(--gold); }
.medal.s { background: rgba(190,190,200,.18); color: #cfd2da; }
.medal.b { background: rgba(176,120,70,.2); color: #d69b6b; }
.medal.f { background: var(--panel-2); color: var(--ink-2); }

/* Stone planner */
.planbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.plantoggle { font: 600 .85rem var(--sans); cursor: pointer; color: var(--ink-2);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 15px; white-space: nowrap; }
.plantoggle.on { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 3px 14px rgba(229,72,77,.4); }
.roster li.mrow { flex-wrap: wrap; }
.megaon { background: linear-gradient(90deg, rgba(229,72,77,.08), transparent); border-radius: 8px; }
.stonepick { flex-basis: 100%; display: flex; align-items: center; gap: 10px; padding: 4px 0 6px 48px; }
.stonesel { font: inherit; font-size: .82rem; color: var(--ink); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 7px; padding: 4px 8px; max-width: 320px; }
.stonedelta { font-size: .74rem; }
#toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--red); color: #fff; font-size: .85rem; font-weight: 600; padding: 10px 18px;
  border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* stone planner: two slots + active toggle */
.stonepick { flex-wrap: wrap; gap: 8px; }
.useblock { font-size: .74rem; color: var(--ink-3); display: inline-flex; align-items: center; gap: 4px; }
.activebtn { font: 700 .72rem var(--sans); width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  background: var(--bg-2); color: var(--ink-2); border: 1px solid var(--line-2); }
.activebtn.on { background: var(--red); color: #fff; border-color: var(--red); }
.activebtn:disabled { opacity: .35; cursor: default; }
.gotoseason { text-align: left; }

/* team builder */
.plantoggle:disabled { opacity: .4; cursor: default; }
.swapsel { font: inherit; font-size: .82rem; color: var(--ink); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 7px; padding: 4px 8px; max-width: 300px; }
.rmslot { font: 700 .8rem var(--sans); cursor: pointer; color: var(--ink-3); background: none;
  border: 1px solid var(--line-2); border-radius: 6px; width: 24px; height: 24px; }
.rmslot:hover { color: var(--red); border-color: var(--red); }

/* team builder — searchable pool picker */
.buildrow .rowbtns { margin-left: auto; display: flex; gap: 6px; }
.swapbtn { font: 600 .74rem var(--sans); cursor: pointer; color: var(--ink-2); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 9px; white-space: nowrap; }
.swapbtn:hover { border-color: var(--red); color: var(--ink); }
.swapbtn.on { background: var(--red); color: #fff; border-color: var(--red); }
.buildrow.picking { background: linear-gradient(90deg, rgba(229,72,77,.10), transparent); border-radius: 8px; }
.pickerpanel { border-color: var(--red); }
.pickerhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.addbtn { margin-left: auto; font: 700 .82rem var(--sans); cursor: pointer; color: #fff; background: var(--red);
  border: none; border-radius: 8px; padding: 6px 14px; box-shadow: 0 3px 12px rgba(229,72,77,.35); }
.addbtn:hover { background: var(--red-2); }
#poolsearch { width: 100%; font-size: .95rem; padding: 9px 12px; margin-bottom: 10px; }
.poolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px;
  max-height: 340px; overflow-y: auto; }
.poolchip { display: flex; align-items: center; gap: 6px; text-align: left; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 8px; color: var(--ink); }
.poolchip:hover { border-color: var(--red); background: var(--panel); transform: translateY(-1px); }
.poolchip > span:nth-child(2) { font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poolchip .pc { margin-left: auto; font-family: var(--mono); font-size: .74rem; color: var(--gold); }
.poolchip .pt { display: flex; flex-basis: 100%; gap: 2px; }
