/* Pokémon Hoops: fantasy-sports app UI.
   Flat hard-edged blocks, condensed uppercase labels, ESPN-style roster rows, FUT-style status strip and cards.
   No rounded corners anywhere; chamfered cuts are the only shape language. */
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("assets/fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("assets/fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("assets/fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("assets/fonts/barlow-condensed-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("assets/fonts/barlow-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("assets/fonts/barlow-condensed-700.woff2") format("woff2"); }

:root {
  --ink: #0d0e10;
  --slate: #1a1d21;
  --slate-2: #23272d;
  --row: #151719;
  --row-alt: #1b1e21;
  --line: #2d3238;
  --line-hi: #454c55;
  --text: #f2f1ec;
  --muted: #9ba2ac;
  --dim: #69707a;
  --cream: #eee8d6;
  --accent: #ff7a1a;
  --good: #3ddc84;
  --bad: #ff4b52;

  --bronze: #cf9462;
  --silver: #cdd5e1;
  --gold: #f6cb4c;
  --diamond: #7be6ff;

  --cond: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --sans: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shield: polygon(0 7%, 11% 0, 89% 0, 100% 7%, 100% 80%, 50% 100%, 0 80%);
}
* { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ink); color: var(--text);
  font-family: var(--sans); font-size: 15px; line-height: 1.4; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tier-bronze { --tier: var(--bronze); color: var(--bronze); }
.tier-silver { --tier: var(--silver); color: var(--silver); }
.tier-gold { --tier: var(--gold); color: var(--gold); }
.tier-diamond { --tier: var(--diamond); color: var(--diamond); }
.num, .rstars, td { font-variant-numeric: tabular-nums; }

/* ---------- sticky app bar + status strip (FUT squad header) ---------- */
.head { position: sticky; top: 0; z-index: 30; background: var(--slate); box-shadow: 0 1px 0 var(--line), 0 8px 18px rgba(0, 0, 0, 0.45); padding-top: env(safe-area-inset-top); }
.appbar { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 46px; }
.appbar h1 { font-family: var(--cond); font-weight: 700; font-size: 24px; letter-spacing: 0.06em; line-height: 1; }
.appbar h1 span { color: var(--accent); }
.appbar-sub { margin-left: auto; font-family: var(--cond); font-weight: 600; font-size: 12.5px; letter-spacing: 0.16em; color: var(--dim); }
.ball {
  flex: none; width: 22px; height: 22px; border-radius: 50% !important;
  background: radial-gradient(circle, #fff 0 2.5px, #15181f 3px 4.5px, transparent 5px), linear-gradient(#e5383b 0 46%, #15181f 46% 54%, #f4f5f7 54%);
  box-shadow: 0 0 0 1.5px #15181f;
}
.strip { background: var(--slate-2); border-top: 1px solid var(--line); display: flex; justify-content: center; }
.strip-stats { flex: 1; max-width: 640px; display: flex; gap: 28px; align-items: center; padding: 8px 16px; }
.st small { display: block; font-family: var(--cond); font-weight: 600; font-size: 12px; letter-spacing: 0.14em; color: var(--muted); line-height: 1.1; }
.st-row { display: flex; align-items: baseline; gap: 8px; }
.st b { font-family: var(--cond); font-weight: 700; font-size: 30px; line-height: 1.05; letter-spacing: 0.01em; }
.st em { font-style: normal; font-family: var(--cond); font-weight: 600; font-size: 15px; color: var(--dim); }
.rstars { display: inline-flex; gap: 2px; align-self: center; }
.rstars i, .star { display: block; clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.rstars i { width: 15px; height: 15px; background: rgba(255, 255, 255, 0.2); }
.rstars i.on { background: var(--gold); }
.save {
  position: relative; flex: none; margin-left: -18px; padding: 0 20px 0 38px; min-width: 112px; border: 0; background: var(--cream); color: #17140c;
  clip-path: polygon(20px 0, 100% 0, 100% 100%, 0 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.save span { font-family: var(--cond); font-weight: 700; font-size: 22px; letter-spacing: 0.1em; }
.save small { font-family: var(--cond); font-weight: 600; font-size: 11.5px; letter-spacing: 0.2em; color: #6b624a; margin-top: 2px; }
.save:hover { background: #fff6dc; }
.save:active { background: #ddd5bd; }
.save::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }

main { max-width: 720px; margin: 0 auto; padding: 0 16px calc(48px + env(safe-area-inset-bottom)); }

/* ---------- tabs + toolbar (ESPN) ---------- */
.tabs { display: flex; margin: 0 -16px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; background: none; border: 0; padding: 14px 16px 11px; font-family: var(--cond); font-weight: 600; font-size: 17px; letter-spacing: 0.1em;
  color: var(--dim); border-bottom: 3px solid transparent; margin-bottom: -1px; text-transform: uppercase;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button {
  height: 36px; padding: 0 14px; background: transparent; border: 1.5px solid var(--line-hi);
  font-family: var(--cond); font-weight: 700; font-size: 14.5px; letter-spacing: 0.1em; color: var(--text);
}
.actions button:hover { border-color: var(--cream); background: rgba(255, 255, 255, 0.05); }
.actions button:active { background: rgba(255, 255, 255, 0.1); }
.seg { display: inline-flex; border: 1.5px solid var(--line-hi); }
.seg button { border: 0; background: transparent; height: 33px; padding: 0 12px; font-family: var(--cond); font-weight: 700; font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.seg button + button { border-left: 1.5px solid var(--line-hi); }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--cream); color: #17140c; }
.hint-line { margin: 10px 0 12px; font-family: var(--cond); font-weight: 500; font-size: 13.5px; letter-spacing: 0.06em; color: var(--dim); text-transform: uppercase; }

/* ---------- court ---------- */
#court { position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--line-hi); }
#court .court-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
#links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
#starters { position: absolute; inset: 0; }

/* ---------- FUT-style player card ---------- */
.slot {
  --c1: #2b2f36; --c2: #3b414a; --c3: #565d68;
  position: absolute; width: 16.5%; z-index: 2; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  touch-action: none; user-select: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.slot.t-bronze, .obox.t-bronze { --c1: #5a3a1d; --c2: #c58b58; --c3: #ebc59a; }
.slot.t-silver, .obox.t-silver { --c1: #4d5463; --c2: #a9b2c1; --c3: #e8ecf3; }
.slot.t-gold, .obox.t-gold { --c1: #6e5416; --c2: #d8b04a; --c3: #f8e7a8; }
.slot.t-diamond, .obox.t-diamond { --c1: #17306f; --c2: #4a8be0; --c3: #a4ecff; }
.cardwrap { position: relative; width: 100%; filter: drop-shadow(0 7px 7px rgba(0, 0, 0, 0.55)); transition: transform 0.15s ease; }
.slot:hover .cardwrap { transform: translateY(-3px); }
.card { position: relative; width: 100%; aspect-ratio: 100 / 132; container-type: inline-size; background: var(--c1); clip-path: var(--shield); color: #17130a; }
.card-in {
  position: absolute; inset: 2.6cqw 2.6cqw 3.6cqw; clip-path: var(--shield);
  background:
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.10) 0 5cqw, rgba(255, 255, 255, 0) 5cqw 11cqw),
    linear-gradient(158deg, var(--c3) 0%, var(--c2) 58%, var(--c1) 135%);
}
.card .r { z-index: 2; position: absolute; left: 10cqw; top: 6cqw; font-family: var(--cond); font-weight: 700; font-size: 28cqw; line-height: 1; letter-spacing: -0.01em; }
.card .p { z-index: 2; position: absolute; left: 10.5cqw; top: 33cqw; font-family: var(--cond); font-weight: 700; font-size: 13.5cqw; line-height: 1; letter-spacing: 0.04em; }
.card .types { z-index: 2; position: absolute; left: 10.5cqw; top: 49cqw; display: flex; flex-direction: column; gap: 2.4cqw; }
.card .ty { width: 8.4cqw; height: 8.4cqw; box-shadow: 0 0 0 0.6cqw rgba(0, 0, 0, 0.55); }
.card .spr { position: absolute; right: -1cqw; top: 4cqw; width: 80cqw; height: 80cqw; object-fit: contain; pointer-events: none; filter: drop-shadow(0 1.4cqw 1.2cqw rgba(0, 0, 0, 0.35)); }
.card .spr.pixel { image-rendering: pixelated; }
.card .cn {
  z-index: 2; position: absolute; left: 6cqw; right: 6cqw; top: 87cqw; padding-top: 2.6cqw; border-top: 0.7cqw solid rgba(0, 0, 0, 0.32);
  text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--cond); font-weight: 700; font-size: 13cqw; line-height: 1; letter-spacing: 0.06em; text-transform: uppercase;
}
.card.empty { background: rgba(255, 255, 255, 0.34); }
.card.empty .card-in { background: rgba(10, 12, 15, 0.7); display: grid; place-items: center; }
.card.empty .plus { font-family: var(--cond); font-weight: 600; font-size: 38cqw; line-height: 1; color: rgba(255, 255, 255, 0.85); margin-top: -8cqw; }
.oop {
  position: absolute; top: -3px; right: -6px; z-index: 4; padding: 1px 6px 0; background: var(--bad); color: #fff;
  font-family: var(--cond); font-weight: 700; font-size: 15px; line-height: 1.25; letter-spacing: 0.04em; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.plate {
  display: flex; align-items: center; gap: 7px; padding: 2px 13px 1px; background: rgba(10, 11, 13, 0.92);
  clip-path: polygon(7px 0, 100% 0, calc(100% - 7px) 100%, 0 100%);
}
.plate .pos { font-family: var(--cond); font-weight: 700; font-size: 16px; line-height: 1.2; letter-spacing: 0.08em; color: var(--cream); }
.stars { display: flex; gap: 2px; }
.star { width: 11px; height: 11px; background: rgba(255, 255, 255, 0.24); }
.slot.over .cardwrap { outline: 3px solid var(--accent); outline-offset: 3px; }
.slot.dragging { opacity: 0.35; }
.ghost { position: fixed; z-index: 50; width: 84px; pointer-events: none; transform: translate(-50%, -50%); opacity: 0.92; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.6)); }
.ghost img { width: 100%; }
.ghost img.pixel { image-rendering: pixelated; }

.slot.coach { width: 14%; }
.slot.coach .card .p { font-size: 9.5cqw; text-transform: uppercase; letter-spacing: 0.02em; }
.plate .cb { font-family: var(--cond); font-weight: 700; font-size: 16px; line-height: 1.2; color: var(--good); }
.plate .cb.zero { color: var(--dim); }
.final.pos-n { color: var(--good); }
.final.muted { color: var(--dim); }

/* ---------- blocks ---------- */
.block { margin-top: 12px; background: var(--slate); border: 1px solid var(--line); }
.block-head, .r-head, .plist-head {
  display: flex; justify-content: space-between; align-items: baseline; padding: 11px 14px 9px; background: var(--ink);
  font-family: var(--cond); font-weight: 600; font-size: 14px; letter-spacing: 0.12em; color: var(--muted);
}
.block-head h2 { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: 0.14em; }
.block-head span { font-size: 12.5px; color: var(--dim); }
#bench { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; padding: 14px 12px 12px; }
#bench .slot { position: relative; width: 100%; transform: none; gap: 0; }

/* ---------- team panel ---------- */
#team { padding: 0; }
.attr { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; padding: 14px; }
.sb { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline; padding: 6px 0; }
.sb span { font-family: var(--cond); font-weight: 600; font-size: 14.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sb b { font-family: var(--cond); font-weight: 700; font-size: 20px; line-height: 1; }
.sb div { grid-column: 1 / -1; height: 6px; background: var(--ink); }
.sb i { display: block; height: 100%; background: var(--tier, var(--silver)); transition: width 0.35s ease; }
.chem-seg { display: flex; gap: 3px; padding: 14px 14px 4px; }
.chem-seg i { flex: 1; height: 10px; background: var(--ink); transform: skewX(-18deg); }
.chem-seg i.on { background: var(--good); }
.chem-seg i.on.m { background: #ffd23f; }
.chem-seg i.on.l { background: var(--bad); }

.r-row { display: grid; grid-template-columns: 50px 46px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--row); }
.r-row.alt { background: var(--row-alt); }
.pbtn { display: grid; place-items: center; height: 30px; border: 1.5px solid var(--line-hi); font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; color: var(--cream); }
.av { width: 46px; height: 46px; background: var(--ink); border-bottom: 3px solid var(--tier, var(--line-hi)); display: grid; place-items: center; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: contain; }
.av img.pixel { image-rendering: pixelated; }
.who { min-width: 0; }
.who b { display: block; font-weight: 600; font-size: 17px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .sub { margin-top: 2px; font-family: var(--cond); font-weight: 500; font-size: 13.5px; letter-spacing: 0.05em; color: var(--muted); text-transform: uppercase; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.sub .tdot { display: inline-block; width: 9px; height: 9px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
.sub .neg { color: var(--bad); font-weight: 700; }
.sub .pos-n { color: var(--good); font-weight: 700; }
.final { font-family: var(--cond); font-weight: 700; font-size: 34px; line-height: 1; min-width: 44px; text-align: right; }
.r-total { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; background: var(--ink); border-top: 1px solid var(--line-hi); }
.r-total span { font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.14em; color: var(--muted); }
.r-total b { font-family: var(--cond); font-weight: 700; font-size: 34px; line-height: 1; }
.note { padding: 12px 14px 14px; font-size: 13px; color: var(--dim); line-height: 1.5; border-top: 1px solid var(--line); }

footer p { margin-top: 22px; font-size: 12px; color: var(--dim); line-height: 1.55; }
footer a { color: var(--muted); }

/* ---------- save sheet (iPhone) ---------- */
#savesheet { position: fixed; inset: 0; z-index: 45; background: rgba(4, 5, 7, 0.85); display: grid; place-items: end center; animation: fade 0.16s ease; }
#savesheet[hidden] { display: none; }
.save-card { width: min(520px, 100%); max-height: 94vh; max-height: 94dvh; display: flex; flex-direction: column; background: var(--slate); border: 1px solid var(--line-hi); border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); animation: rise 0.22s ease; }
.save-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; background: var(--ink); display: grid; place-items: start center; }
.save-body img { max-width: 100%; max-height: 62vh; max-height: 62dvh; width: auto; height: auto; display: block; -webkit-touch-callout: default; user-select: auto; }
.save-actions { padding: 12px 14px 14px; flex: none; }
.save-actions p { margin-top: 8px; text-align: center; font-family: var(--cond); font-weight: 500; font-size: 14px; letter-spacing: 0.05em; color: var(--dim); text-transform: uppercase; }
.save-primary { width: 100%; height: 52px; border: 0; background: var(--cream); color: #17140c; font-family: var(--cond); font-weight: 700; font-size: 22px; letter-spacing: 0.12em; border-bottom: 4px solid var(--accent); }
.save-primary:active { background: #ddd5bd; }
@media (min-width: 640px) { #savesheet { place-items: center; padding: 24px; } .save-card { border-bottom: 1px solid var(--line-hi); } }

/* ---------- picker: ESPN player list (bottom sheet on phones) ---------- */
#picker { position: fixed; inset: 0; z-index: 40; background: rgba(4, 5, 7, 0.78); display: grid; place-items: end center; animation: fade 0.16s ease; }
#picker[hidden], #toast[hidden] { display: none; }
.picker-card {
  width: min(620px, 100%); max-height: 90vh; max-height: 90dvh; display: flex; flex-direction: column; background: var(--slate);
  border: 1px solid var(--line-hi); border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); animation: rise 0.22s ease;
}
.picker-head { display: flex; justify-content: space-between; align-items: center; height: 50px; padding: 0 0 0 16px; background: var(--slate-2); border-bottom: 3px solid var(--accent); flex: none; }
.picker-head h3 { font-family: var(--cond); font-weight: 700; font-size: 20px; letter-spacing: 0.1em; }
.picker-head small { margin-left: 10px; padding: 1px 8px; background: var(--cream); color: #17140c; font-size: 15px; letter-spacing: 0.08em; }
#picker-close, #save-close { width: 50px; height: 50px; border: 0; background: transparent; font-size: 16px; color: var(--muted); }
#picker-close:hover, #save-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.picker-tools { display: flex; gap: 10px; align-items: center; padding: 10px 12px; flex: none; }
#picker-search {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px; background: var(--ink); border: 1.5px solid var(--line-hi); color: var(--text);
  font-family: var(--cond); font-weight: 600; font-size: 15px; letter-spacing: 0.08em;
}
#picker-search::placeholder { color: var(--dim); }
.plist-head { flex: none; }
#picker-grid { overflow-y: auto; overscroll-behavior: contain; }
.prow {
  --tier: var(--line-hi); width: 100%; display: grid; grid-template-columns: 46px 46px 1fr auto; gap: 12px; align-items: center; text-align: left;
  padding: 8px 14px; border: 0; border-top: 1px solid var(--line); background: var(--row); color: var(--text);
}
.prow:nth-child(even) { background: var(--row-alt); }
.prow:hover { background: #262b31; }
.prow.used { opacity: 0.4; }
.prow .obox {
  display: grid; place-items: center; height: 38px; font-family: var(--cond); font-weight: 700; font-size: 24px; color: #17130a;
  background: linear-gradient(150deg, var(--c3, #888), var(--c2, #666)); font-variant-numeric: tabular-nums;
}
.prow .who b { font-size: 16.5px; }
.prow .fit { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.prow .fit i { font-style: normal; padding: 0 9px; min-width: 40px; text-align: center; border: 1.5px solid var(--line-hi); font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; color: var(--cream); }
.prow .fit em { font-style: normal; font-family: var(--cond); font-weight: 700; font-size: 14px; color: var(--bad); }
.prow.empty-row { grid-template-columns: 1fr; padding: 14px; font-family: var(--cond); font-weight: 700; font-size: 15px; letter-spacing: 0.14em; color: var(--muted); }

#toast {
  position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; background: var(--cream); color: #17140c;
  padding: 10px 20px; font-family: var(--cond); font-weight: 700; font-size: 16px; letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 3px solid var(--accent); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: rise 0.2s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(22px); opacity: 0; } }

@media (min-width: 640px) {
  #picker { place-items: center; padding: 24px; }
  .picker-card { border-bottom: 1px solid var(--line-hi); max-height: 82vh; }
}
@media (max-width: 520px) {
  .appbar h1 { font-size: 22px; }
  .strip-stats { gap: 18px; padding: 7px 14px; }
  .st b { font-size: 27px; }
  .rstars i { width: 12px; height: 12px; }
  .save { min-width: 96px; padding: 0 16px 0 34px; }
  .tabs button { padding: 13px 13px 10px; font-size: 16px; }
  .actions { gap: 6px; }
  .actions button { padding: 0 10px; font-size: 13.5px; letter-spacing: 0.06em; }
  .attr { grid-template-columns: 1fr; }
  .r-row { grid-template-columns: 42px 40px 1fr auto; gap: 10px; padding: 9px 12px; }
  .av { width: 40px; height: 40px; }
  .final { font-size: 30px; }
  #bench { gap: 6px; padding: 12px 8px 10px; }
  .plate { padding: 1px 10px 0; gap: 5px; }
  .plate .pos { font-size: 14px; }
  .star { width: 9px; height: 9px; }
  .oop { font-size: 13px; padding: 0 4px; }
  .slot.coach .plate .pos { font-size: 12px; }
  .plate .cb { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
