/* Layout: night match under floodlights. Top nav, one view at a time. Match view = scoreboard, field track, two team benches around a central play panel. */
:root {
  --pitch: #0d3523;
  --pitch-2: #124630;
  --pitch-3: #1a5a3e;
  --chalk: #f2efe3;
  --chalk-dim: #b9c4b5;
  --ink: #12160f;
  --panel: #0a2419;
  --panel-2: #0f2f21;
  --line: rgba(242, 239, 227, 0.16);
  --flood: #f5cf45;
  --home: #d4283c;
  --good: #59d18a;
  --bad: #ff7466;
  --stock: #f6f1e2;
  --stock-2: #e8dfc7;
  --r-common: #8a9196;
  --r-uncommon: #3e9b5f;
  --r-rare: #2f74c9;
  --r-epic: #8d4fd6;
  --r-legendary: #d8a420;
  --f-display: 'Big Shoulders Display', 'Oswald', 'Arial Narrow', sans-serif;
  --f-ui: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  background: var(--pitch);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.025) 0 80px, transparent 80px 160px), radial-gradient(ellipse at 50% -20%, rgba(245,207,69,0.14), transparent 60%);
  color: var(--chalk); font-family: var(--f-body); font-size: 15px; line-height: 1.4;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, .mini:focus-visible, .card:focus-visible { outline: 2px solid var(--flood); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); text-transform: uppercase; letter-spacing: 0.02em; margin: 0; text-wrap: balance; }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); max-width: 1320px; margin: 0 auto; }

/* nav */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(6, 22, 14, 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: #06160e; }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding-block: 8px; flex-wrap: wrap; }
.brand { font-family: var(--f-display); font-weight: 900; font-size: 26px; letter-spacing: 0.04em; color: var(--chalk); display: flex; align-items: baseline; gap: 6px; }
.brand b { color: var(--flood); }
.brand small { font-family: var(--f-ui); font-size: 12px; font-weight: 600; color: var(--chalk-dim); letter-spacing: 0.12em; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav button { background: none; border: 0; padding: 6px 10px; font-family: var(--f-ui); font-weight: 600; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk-dim); border-bottom: 2px solid transparent; }
.nav button[aria-current="page"] { color: var(--chalk); border-color: var(--flood); }
.nav button:hover { color: var(--chalk); }
.coins { font-family: var(--f-ui); font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 6px; background: rgba(245,207,69,0.12); border: 1px solid rgba(245,207,69,0.4); padding: 3px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.coin { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe98a, #c9971a); box-shadow: inset 0 0 0 2px #a87b10; }

main { padding-block: 20px 60px; }
.view-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-head h1 { font-size: clamp(34px, 6vw, 56px); line-height: 0.9; }
.view-head p { margin: 4px 0 0; color: var(--chalk-dim); max-width: 60ch; }
.btn { background: var(--flood); color: var(--ink); border: 0; border-radius: 4px; padding: 9px 16px; font-family: var(--f-ui); font-weight: 700; font-size: 17px; letter-spacing: 0.05em; text-transform: uppercase; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--chalk-dim); }
.btn.sm { padding: 5px 10px; font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-ui); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: rgba(255,255,255,0.08); }
.muted { color: var(--chalk-dim); }

/* ---------- CARD ---------- */
.card { --cw: 200px; --rc: var(--r-common); width: var(--cw); aspect-ratio: 5 / 7; flex: none; border-radius: calc(var(--cw) * 0.055); padding: calc(var(--cw) * 0.035); background: linear-gradient(150deg, color-mix(in srgb, var(--rc) 70%, #fff) 0%, var(--rc) 45%, color-mix(in srgb, var(--rc) 70%, #000) 100%); box-shadow: 0 6px 18px rgba(0,0,0,0.45); position: relative; color: var(--ink); font-size: calc(var(--cw) * 0.058); line-height: 1.2; user-select: none; text-align: left; border: 0; display: block; }
.card[data-r="uncommon"] { --rc: var(--r-uncommon); }
.card[data-r="rare"] { --rc: var(--r-rare); }
.card[data-r="epic"] { --rc: var(--r-epic); }
.card[data-r="legendary"] { --rc: var(--r-legendary); }
.card .face { height: 100%; border-radius: calc(var(--cw) * 0.03); background: var(--stock); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.card .c-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0.35em 0.5em 0.15em; }
.card .c-name { font-family: var(--f-ui); font-weight: 700; font-size: 1.32em; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: 0.01em; }
.card .c-sta { font-family: var(--f-display); font-weight: 900; font-size: 1.35em; display: flex; align-items: baseline; gap: 2px; color: #b8282b; white-space: nowrap; }
.card .c-sta small { font-family: var(--f-ui); font-size: 0.55em; font-weight: 700; letter-spacing: 0.06em; }
.card .c-sub { display: flex; justify-content: space-between; padding: 0 0.6em 0.2em; font-family: var(--f-ui); font-weight: 600; font-size: 0.82em; letter-spacing: 0.06em; text-transform: uppercase; color: #5a5440; }
.card .c-art { margin: 0 0.45em; border-radius: 3px; overflow: hidden; aspect-ratio: 16 / 10.5; position: relative; box-shadow: inset 0 0 0 2px var(--rc); background: #2b5; flex: none; }
.card .c-art svg, .card .c-art img { width: 100%; height: 100%; display: block; object-fit: cover; }
.card .c-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; margin: 0.35em 0.45em 0.25em; }
.card .st { text-align: center; background: var(--stock-2); border-radius: 2px; padding: 0.12em 0 0.18em; }
.card .st b { display: block; font-family: var(--f-display); font-weight: 800; font-size: 1.25em; line-height: 1; }
.card .st span { font-family: var(--f-ui); font-weight: 700; font-size: 0.62em; letter-spacing: 0.06em; color: #6a6450; }
.card .st.hi { background: color-mix(in srgb, var(--rc) 25%, var(--stock-2)); }
.card .c-abil { flex: 1; margin: 0 0.45em; padding: 0.25em 0.35em; font-size: 0.74em; line-height: 1.22; overflow: hidden; border-top: 1px solid #d9cfb4; }
.card .c-abil p { margin: 0 0 0.3em; }
.card .c-abil b { font-family: var(--f-ui); font-weight: 700; font-size: 1.12em; text-transform: uppercase; letter-spacing: 0.02em; color: color-mix(in srgb, var(--rc) 60%, #000); }
.card .c-abil.flavour { color: #6a6450; font-style: italic; display: flex; align-items: center; }
.card .c-foot { display: flex; justify-content: space-between; align-items: center; padding: 0.25em 0.55em 0.35em; font-family: var(--f-ui); font-size: 0.66em; font-weight: 600; letter-spacing: 0.08em; color: #7a7460; text-transform: uppercase; }
.gem { width: 0.85em; height: 0.85em; display: inline-block; background: var(--rc); transform: rotate(45deg); border-radius: 1px; margin-right: 0.35em; box-shadow: 0 0 0 1px rgba(0,0,0,0.3); }
.card[data-r="common"] .gem { border-radius: 50%; transform: none; }
.card .c-band { font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.14em; font-size: 0.78em; text-transform: uppercase; color: #fff; background: color-mix(in srgb, var(--rc) 80%, #000); padding: 0.15em 0.6em; }
.card .c-text { flex: 1; margin: 0.4em 0.5em; padding: 0.5em; background: var(--stock-2); border-radius: 3px; font-size: 0.9em; line-height: 1.3; }
.card .c-text .when { display: block; margin-top: 0.5em; font-family: var(--f-ui); font-weight: 700; font-size: 0.8em; letter-spacing: 0.08em; text-transform: uppercase; color: #7a7460; }
/* foil for rare+ */
.card[data-r="rare"] .face::after, .card[data-r="epic"] .face::after, .card[data-r="legendary"] .face::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.0) 35%, rgba(255,255,255,0.35) 45%, rgba(160,220,255,0.25) 50%, rgba(255,200,255,0.2) 55%, transparent 70%); background-size: 250% 100%; mix-blend-mode: soft-light; animation: foil 5s linear infinite; }
.card[data-r="legendary"] { box-shadow: 0 0 0 1px #fff3, 0 0 22px rgba(245,207,69,0.45), 0 6px 18px rgba(0,0,0,0.45); }
@keyframes foil { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.card .badge { position: absolute; top: -6px; right: -6px; z-index: 2; font-family: var(--f-ui); font-weight: 700; font-size: 12px; padding: 2px 7px; border-radius: 99px; background: var(--ink); color: var(--chalk); box-shadow: 0 0 0 1.5px var(--chalk); }
.card .badge.new { background: var(--flood); color: var(--ink); box-shadow: none; left: -6px; right: auto; }
.card.locked { background: #1c2a22; box-shadow: inset 0 0 0 2px rgba(255,255,255,0.08); }
.card.locked .face { background: repeating-linear-gradient(135deg, #14231b 0 8px, #172a20 8px 16px); color: var(--chalk-dim); align-items: center; justify-content: center; gap: 0.4em; }
.card.locked .q { font-family: var(--f-display); font-size: 3em; font-weight: 900; opacity: 0.4; }
.card.locked .ln { font-family: var(--f-ui); font-size: 1em; font-weight: 600; letter-spacing: 0.08em; }
.card.back { background: linear-gradient(145deg, #1d6a46, #0b2c1d); }
.card.back .face { background: repeating-linear-gradient(45deg, #13442e 0 10px, #0f3a27 10px 20px); align-items: center; justify-content: center; box-shadow: inset 0 0 0 3px rgba(245,207,69,0.5); }
.card.back .logo { font-family: var(--f-display); font-weight: 900; color: var(--flood); font-size: 2.2em; transform: rotate(-12deg); letter-spacing: 0.04em; text-shadow: 0 2px 0 #0008; }
button.card { cursor: pointer; transition: transform 0.15s; }
button.card:hover { transform: translateY(-3px); }

/* ---------- CLUBHOUSE ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; align-items: center; padding-block: 12px 28px; }
.hero h1 { font-size: clamp(48px, 7.5vw, 100px); line-height: 0.86; font-weight: 900; }
.hero h1 b { color: var(--flood); }
.hero h1 span { display: block; margin-top: 10px; font-family: var(--f-ui); font-size: clamp(16px, 1.8vw, 22px); letter-spacing: 0.2em; color: var(--chalk-dim); line-height: 1.1; }
.hero .tag { font-family: var(--f-ui); font-size: 20px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--chalk-dim); margin: 10px 0 18px; }
.hero .fan { display: flex; justify-content: center; height: 300px; position: relative; }
.hero .fan .card { position: absolute; top: 10px; --cw: 180px; }
.hero .fan .card:nth-child(1) { transform: translateX(-120px) rotate(-14deg); top: 30px; }
.hero .fan .card:nth-child(2) { transform: rotate(-2deg); z-index: 2; }
.hero .fan .card:nth-child(3) { transform: translateX(120px) rotate(11deg); top: 30px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
.tile .k { font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk-dim); }
.tile .v { font-family: var(--f-display); font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- FIXTURES ---------- */
.fixtures { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.fixture { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.fixture::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--tc); }
.fixture .rd { font-family: var(--f-ui); letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; color: var(--chalk-dim); }
.fixture h3 { font-size: 28px; line-height: 1; }
.fixture .mix, .tnext .mix, .tside .mix { display: flex; height: 8px; border-radius: 4px; overflow: hidden; }
.fixture .mix i, .tnext .mix i, .tside .mix i { display: block; height: 100%; }
.fixture.locked { opacity: 0.45; }
.fixture .beat { position: absolute; top: 12px; right: 12px; }

/* ---------- PACKS ---------- */
.packzone { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.pack { width: 190px; height: 270px; border-radius: 10px 10px 6px 6px; background: linear-gradient(160deg, #1f7a52, #0c3a26 60%, #082417); position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(245,207,69,0.5); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; overflow: hidden; flex: none; }
.pack::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 18px; background: repeating-linear-gradient(90deg, #c9a227 0 6px, #e8c64a 6px 12px); }
.pack::after { content: ""; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.18) 45%, transparent 60%); background-size: 250% 100%; animation: foil 4s linear infinite; }
.pack .pl { font-family: var(--f-display); font-weight: 900; font-size: 44px; color: var(--flood); transform: rotate(-8deg); line-height: 0.9; text-shadow: 0 3px 0 #0009; }
.pack .ps { font-family: var(--f-ui); letter-spacing: 0.2em; font-size: 13px; text-transform: uppercase; color: var(--chalk); }
.pack.shake { animation: shake 0.5s ease; }
@keyframes shake { 20%, 60% { transform: rotate(-3deg) scale(1.03); } 40%, 80% { transform: rotate(3deg) scale(1.03); } }
.reveal { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 24px; perspective: 1200px; }
.flip { width: 170px; aspect-ratio: 5 / 7; position: relative; transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(.3,.7,.3,1); cursor: pointer; border: 0; background: none; padding: 0; }
.flip.on { transform: rotateY(180deg); cursor: default; }
.flip > .card { position: absolute; inset: 0; --cw: 170px; backface-visibility: hidden; }
.flip > .card.front { transform: rotateY(180deg); }
.flip { -webkit-transform-style: preserve-3d; }
.flip > .card { -webkit-backface-visibility: hidden; }
.flip.glow-rare.on > .card.front { box-shadow: 0 0 0 2px #fff4, 0 0 22px 4px rgba(47,116,201,0.85); }
.flip.glow-epic.on > .card.front { box-shadow: 0 0 0 2px #fff4, 0 0 24px 5px rgba(141,79,214,0.9); }
.flip.glow-legendary.on > .card.front { box-shadow: 0 0 0 2px #fff6, 0 0 30px 8px rgba(245,207,69,0.95); }
.flip .hint { position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-dim); backface-visibility: hidden; }
.odds { font-size: 13px; color: var(--chalk-dim); }
.odds td { padding: 2px 10px 2px 0; }

/* ---------- COLLECTION ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; font-family: var(--f-ui); font-weight: 600; font-size: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk-dim); }
.filters button[aria-pressed="true"] { background: var(--chalk); color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(154px, 1fr)); gap: 16px 12px; justify-items: center; }
.grid .card { --cw: 154px; }
.progress { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; min-width: 160px; flex: 1; max-width: 320px; }
.progress i { display: block; height: 100%; background: var(--flood); }

/* ---------- SQUAD ---------- */
.squad { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.pitchbox { background: linear-gradient(180deg, var(--pitch-3), var(--pitch-2)); border: 2px solid rgba(242,239,227,0.5); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.pitchbox .zone { display: flex; flex-direction: column; gap: 6px; }
.zone-label { font-family: var(--f-ui); font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--chalk-dim); }
.zone-row { display: flex; gap: 8px; flex-wrap: wrap; }
.slotbtn { width: 108px; min-height: 92px; border: 1.5px dashed rgba(242,239,227,0.45); border-radius: 6px; background: rgba(0,0,0,0.18); padding: 0; display: flex; align-items: stretch; }
.slotbtn .empty { margin: auto; font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--chalk-dim); text-align: center; padding: 6px; }
.slotbtn.sel { border-color: var(--flood); border-style: solid; box-shadow: 0 0 0 2px var(--flood); }
.side { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; }
.panel h3 { font-size: 22px; margin-bottom: 8px; }
.deckrow { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.deckrow .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.deckrow .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step { width: 26px; height: 26px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 700; }
.step:disabled { opacity: 0.3; }
.errs { color: var(--bad); font-size: 14px; margin: 6px 0 0; padding-left: 18px; }
.ok { color: var(--good); font-size: 14px; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; justify-items: center; max-height: 60vh; overflow: auto; padding: 4px; }
.picker .card { --cw: 124px; }
.picker.sq { max-height: none; overflow: visible; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.picker.sq .card { --cw: 132px; }
.picker.sq .card.unplayable { opacity: 0.5; }
input.txt { background: var(--panel-2); border: 1px solid var(--line); color: var(--chalk); border-radius: 4px; padding: 6px 8px; font: inherit; width: 100%; }

/* ---------- MINI (field) ---------- */
.mini { --rc: var(--r-common); width: 100%; min-width: 0; background: var(--stock); color: var(--ink); border: 0; border-radius: 5px; padding: 0; text-align: left; position: relative; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,0.4), inset 0 0 0 2px var(--rc); display: flex; flex-direction: column; font-size: 12px; line-height: 1.15; }
.mini[data-r="uncommon"] { --rc: var(--r-uncommon); } .mini[data-r="rare"] { --rc: var(--r-rare); } .mini[data-r="epic"] { --rc: var(--r-epic); } .mini[data-r="legendary"] { --rc: var(--r-legendary); }
.mini .mt { background: var(--rc); color: #fff; font-family: var(--f-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.08em; padding: 1px 5px; display: flex; justify-content: space-between; text-transform: uppercase; }
.mini .mn { font-family: var(--f-ui); font-weight: 700; font-size: 13.5px; padding: 3px 5px 0; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .ms { display: flex; gap: 6px; padding: 1px 5px; font-family: var(--f-ui); font-weight: 600; font-size: 12px; color: #4a4636; flex-wrap: wrap; }
.mini .ms b { font-family: var(--f-display); font-weight: 800; color: var(--ink); font-size: 14px; }
.mini .ab { padding: 0 5px; font-size: 10.5px; font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.03em; color: color-mix(in srgb, var(--rc) 60%, #000); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }
.pips { display: flex; gap: 2px; padding: 3px 5px 4px; margin-top: auto; }
.pips i { flex: 1; height: 5px; border-radius: 1px; background: #d8cfb5; }
.pips i.on { background: #2f9b5a; }
.pips.low i.on { background: #d49a1e; }
.pips.zero i { background: #e2a39a; }
.mini.selectable { cursor: pointer; box-shadow: 0 0 0 2px var(--flood), 0 0 14px rgba(245,207,69,0.6); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--flood), 0 0 4px rgba(245,207,69,0.3); } }
.mini.dim { opacity: 0.45; }
.mini .tagx { position: absolute; right: 3px; bottom: 12px; font-family: var(--f-ui); font-weight: 700; font-size: 10px; letter-spacing: 0.06em; background: var(--ink); color: var(--chalk); padding: 0 4px; border-radius: 2px; text-transform: uppercase; }
.mini.active { box-shadow: 0 0 0 3px #fff, 0 0 16px rgba(255,255,255,0.6); }
.mini.subsel { box-shadow: 0 0 0 3px #59d18a; }
.mini.empty-slot { background: rgba(0,0,0,0.2); box-shadow: inset 0 0 0 1.5px dashed rgba(255,255,255,0.3); color: var(--chalk-dim); min-height: 60px; align-items: center; justify-content: center; font-family: var(--f-ui); text-transform: uppercase; font-size: 11px; letter-spacing: 0.08em; }

/* ---------- MATCH ---------- */
.match { display: flex; flex-direction: column; gap: 10px; }
.board { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; background: #050f0a; border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; }
.board .tm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.board .tm.r { justify-content: flex-end; text-align: right; }
.board .tn-s { display: none; }
.board .tn { font-family: var(--f-display); font-size: clamp(16px, 2.6vw, 26px); font-weight: 800; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .sw { width: 12px; height: 30px; border-radius: 2px; flex: none; }
.board .sc { font-family: var(--f-display); font-weight: 900; font-size: clamp(32px, 5vw, 48px); color: var(--flood); font-variant-numeric: tabular-nums; min-width: 1.4em; text-align: center; line-height: 1; }
.board .clock { text-align: center; font-family: var(--f-ui); }
.board .clock b { display: block; font-family: var(--f-display); font-size: 22px; font-weight: 800; }
.board .clock span { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk-dim); }
.track { position: relative; display: grid; grid-template-columns: 0.6fr repeat(7, 1fr) 0.6fr; background: linear-gradient(180deg, var(--pitch-3), var(--pitch-2)); border: 2px solid rgba(242,239,227,0.6); border-radius: 4px; height: 64px; overflow: hidden; }
.track .z { border-right: 2px solid rgba(242,239,227,0.5); display: flex; align-items: end; justify-content: center; padding-bottom: 4px; font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(242,239,227,0.75); text-align: center; line-height: 1; }
.track .z:last-child { border-right: 0; }
.track .z.end { background: rgba(0,0,0,0.15); }
.track .z.ingoal { background: repeating-linear-gradient(135deg, rgba(245,207,69,0.16) 0 8px, rgba(245,207,69,0.05) 8px 16px); color: var(--flood); }
.track .z.ingoal.own { border-right: 5px solid var(--chalk); }
.track .z:nth-last-child(1 of .z):not(.ingoal), .track .z.end + .z.ingoal { }
.track .z.ingoal.theirs { border-left: 5px solid var(--chalk); margin-left: -2px; }
.track .z.end:has(+ .z.ingoal) { border-right: 0; }
.track .z.half { border-right-style: solid; }
.ball { position: absolute; top: 8px; width: 28px; height: 18px; margin-left: -14px; border-radius: 50%; background: radial-gradient(ellipse at 40% 35%, #fff, #e8e2cc 60%, #b9b29a); box-shadow: 0 2px 5px rgba(0,0,0,0.5); transition: left 0.6s cubic-bezier(.4,1.4,.5,1); }
.ball::after { content: ""; position: absolute; left: 6px; right: 6px; top: 8px; height: 2px; background: #6b5a3a; border-radius: 1px; }
.possmark { position: absolute; top: 29px; transform: translateX(-50%); font-family: var(--f-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; padding: 0 5px; border-radius: 2px; color: #fff; transition: left 0.6s; white-space: nowrap; }
.dirnote { font-family: var(--f-ui); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-dim); display: flex; justify-content: space-between; }
.side-panel { background: rgba(5,18,11,0.6); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; flex-wrap: wrap; }
.side-head h3 { font-size: 18px; }
.formation { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 10px repeat(3, minmax(0, 1fr)) 10px repeat(2, minmax(0, 1fr)) 10px repeat(3, minmax(0, 1fr)); gap: 5px; align-items: stretch; }
.formation .gap { }
.flabels { display: grid; grid-template-columns: 3fr 10px 3fr 10px 2fr 10px 3fr; gap: 5px; margin-bottom: 3px; font-family: var(--f-ui); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk-dim); }
.benchrow { display: flex; gap: 5px; margin-top: 6px; align-items: stretch; }
.benchrow .bl { font-family: var(--f-ui); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk-dim); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.benchrow .mini { flex: 1; }
.center { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; }
.act { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 210px; }
.act .prompt { font-family: var(--f-ui); font-weight: 700; font-size: 21px; letter-spacing: 0.02em; line-height: 1.1; }
.act .hint { color: var(--chalk-dim); font-size: 14px; margin-top: -4px; }
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choice { background: var(--panel-2); border: 1.5px solid var(--line); border-radius: 6px; padding: 8px 12px; text-align: left; min-width: 120px; flex: 1 1 140px; }
.choice:hover { border-color: var(--flood); }
.choice b { display: block; font-family: var(--f-ui); font-size: 18px; text-transform: uppercase; letter-spacing: 0.04em; }
.choice span { font-size: 13px; color: var(--chalk-dim); }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; background: rgba(0,0,0,0.25); border-radius: 6px; padding: 10px; min-height: 120px; }
.stage .who { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stage .who.r { text-align: right; align-items: end; }
.stage .pname { font-family: var(--f-ui); font-weight: 700; font-size: 16px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.stage .tline { font-size: 13px; color: var(--chalk-dim); font-variant-numeric: tabular-nums; }
.stage .tot { font-family: var(--f-display); font-weight: 900; font-size: 36px; line-height: 1; }
.stage .vs { font-family: var(--f-display); font-weight: 900; color: var(--chalk-dim); font-size: 18px; text-align: center; }
.die { width: 38px; height: 38px; background: #fbf8ee; border-radius: 7px; display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 5px; box-shadow: inset 0 -3px 0 #d7cfb6, 0 2px 4px rgba(0,0,0,0.4); }
.die i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); align-self: center; justify-self: center; visibility: hidden; }
.die.rolling { animation: tumble 0.5s linear; }
@keyframes tumble { 0% { transform: rotate(0); } 50% { transform: rotate(200deg) scale(1.1); } 100% { transform: rotate(360deg); } }
.outcome { grid-column: 1 / -1; text-align: center; font-family: var(--f-ui); font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.outcome.good { color: var(--good); } .outcome.bad { color: var(--bad); }
.margin { font-family: var(--f-ui); font-size: 13px; color: var(--chalk-dim); text-align: center; letter-spacing: 0.08em; text-transform: uppercase; }
.log { background: rgba(0,0,0,0.25); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; height: 260px; overflow-y: auto; font-size: 13.5px; display: flex; flex-direction: column; gap: 3px; }
.log p { margin: 0; }
.log .head { font-family: var(--f-ui); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--flood); margin-top: 4px; }
.log .big { font-family: var(--f-ui); font-weight: 700; font-size: 16px; color: var(--chalk); }
.log .try { font-family: var(--f-display); font-weight: 900; font-size: 22px; color: var(--flood); }
.log .good { color: var(--good); } .log .bad { color: var(--bad); } .log .dim { color: var(--chalk-dim); } .log .ability { color: #c9a8ff; } .log .tactic { color: #8fd3ff; } .log .sub { color: #9fe0b8; } .log .rv { color: var(--chalk); font-weight: 600; }
.hand { display: flex; gap: 10px 18px; flex-wrap: wrap; padding: 4px 2px 8px; align-items: flex-start; }
.hand .fcard { --cw: var(--cw-mine); }
.log .draw { color: #ffd98a; }
.hand .card { --cw: 140px; }
.hand .card.unplayable { opacity: 0.55; }
.hand .card.armed { transform: translateY(-8px); box-shadow: 0 0 0 3px var(--flood), 0 0 20px rgba(245,207,69,0.6); }
.hand-empty { color: var(--chalk-dim); font-size: 14px; padding: 10px 0; }
.ctrlrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ctrlrow .lbl { font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-dim); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { background: none; border: 0; padding: 3px 9px; font-family: var(--f-ui); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--chalk-dim); }
.seg button[aria-pressed="true"] { background: var(--chalk); color: var(--ink); }
.tryflash { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 40; }
.tryflash b { font-family: var(--f-display); font-weight: 900; font-size: clamp(80px, 18vw, 200px); color: var(--flood); text-shadow: 0 6px 0 #0008; animation: tryin 1.4s ease forwards; }
@keyframes tryin { 0% { transform: scale(0.3) rotate(-10deg); opacity: 0; } 25% { transform: scale(1.1) rotate(-4deg); opacity: 1; } 75% { transform: scale(1) rotate(-4deg); opacity: 1; } 100% { transform: scale(1.4) rotate(-4deg); opacity: 0; } }

/* modal & toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(2,8,5,0.78); display: grid; place-items: center; padding: 20px max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; max-width: 760px; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.modal .box.cardbox { background: none; border: 0; align-items: center; max-width: 320px; }
.modal .box.cardbox .card { --cw: min(300px, 80vw); }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--chalk); color: var(--ink); padding: 8px 14px; border-radius: 6px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,0.5); max-width: calc(100vw - 32px); }
.result h2 { font-size: 54px; line-height: 0.9; }
.result .fs { font-family: var(--f-display); font-size: 40px; font-weight: 900; color: var(--flood); }
.statgrid { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 16px; font-variant-numeric: tabular-nums; }
.statgrid .h { font-family: var(--f-ui); color: var(--chalk-dim); letter-spacing: 0.08em; text-transform: uppercase; font-size: 13px; }

/* rules */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.rules section { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
.rules h3 { font-size: 22px; margin-bottom: 6px; color: var(--flood); }
.rules p, .rules li { font-size: 14.5px; max-width: 65ch; }
.rules ul { padding-left: 18px; margin: 6px 0; }
.rules table { border-collapse: collapse; font-size: 14px; width: 100%; }
.rules td { padding: 3px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rules td:first-child { font-family: var(--f-ui); font-weight: 700; white-space: nowrap; }
.abil-list { columns: 2 280px; column-gap: 18px; }
.abil-list p { break-inside: avoid; margin: 0 0 8px; font-size: 14px; }
.abil-list b { font-family: var(--f-ui); text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------- full-card field ---------- */
:root { --cw-mine: clamp(104px, 9.4vw, 136px); --cw-opp: clamp(92px, 7.5vw, 104px); }
.fwrap { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-start; }
.fgroup { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.frow { display: flex; gap: 6px; flex-wrap: wrap; }
.mine .card, .mine .slot-empty { --cw: var(--cw-mine); }
.opp .card, .opp .slot-empty { --cw: var(--cw-opp); }
.fgroup.bench .card { --cw: calc(var(--cw-mine) * 0.82); }
.opp .fgroup.bench .card { --cw: calc(var(--cw-opp) * 0.85); }
.card.fcard { font-size: calc(var(--cw) * 0.064); }
.card.fcard .c-abil { font-size: 0.78em; }
.card.fcard .c-name, .spot .card .c-name, .coachcol .card .c-name, .hand .card .c-name, .picker .card .c-name { white-space: normal; font-size: 1.08em; line-height: 1; overflow: visible; }
.card.fcard .c-top { align-items: flex-start; }
@media (hover: hover) and (min-width: 900px) {
  .card.fcard { transition: transform 0.15s, box-shadow 0.15s; }
  .card.fcard:hover, .hand .card:hover { transform: translateY(-3px); z-index: 5; }
  .hand .card { transition: transform 0.15s; }
}
.card.fcard.selectable { box-shadow: 0 0 0 3px var(--flood), 0 0 18px rgba(245,207,69,0.7); animation: pulse2 1.4s ease-in-out infinite; }
@keyframes pulse2 { 50% { box-shadow: 0 0 0 3px var(--flood), 0 0 5px rgba(245,207,69,0.3); } }
.card.fcard.chosen { box-shadow: 0 0 0 4px #fff, 0 0 22px rgba(255,255,255,0.8); animation: none; transform: translateY(-6px); }
.card.fcard.active { box-shadow: 0 0 0 3px #fff, 0 6px 18px rgba(0,0,0,0.5); }
.card.fcard.subsel { box-shadow: 0 0 0 4px var(--good); }
.card.dim { opacity: 0.42; filter: grayscale(0.4); }
.ftag { position: absolute; z-index: 3; left: 50%; top: 38%; transform: translateX(-50%) rotate(-6deg); background: var(--ink); color: var(--chalk); font-family: var(--f-ui); font-weight: 700; font-size: max(10px, 0.9em); letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; white-space: nowrap; box-shadow: 0 0 0 1px var(--chalk); }
.stabar { position: absolute; z-index: 3; left: 8%; right: 8%; bottom: -5px; display: flex; gap: 2px; background: var(--ink); padding: 2px; border-radius: 3px; }
.stabar i { flex: 1; height: 4px; border-radius: 1px; background: #4a3b33; }
.stabar i.on { background: #3fcf78; } .stabar i.on.low { background: #f0a92a; }
.slot-empty { --cw: 120px; width: var(--cw); aspect-ratio: 5 / 7; flex: none; border: 2px dashed rgba(242,239,227,0.35); border-radius: calc(var(--cw) * 0.055); background: rgba(0,0,0,0.18); color: var(--chalk-dim); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; text-align: center; font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.slot-empty:disabled { cursor: default; }
.slot-empty.eligible { border-color: var(--flood); border-style: solid; color: var(--chalk); background: rgba(245,207,69,0.12); animation: pulse2 1.4s ease-in-out infinite; cursor: pointer; }
.slot-empty.eligible b { color: var(--flood); }
.arena { display: grid; grid-template-columns: 172px minmax(0, 1fr) minmax(240px, 300px); gap: 10px; align-items: stretch; }
.coachcol { background: rgba(5,18,11,0.6); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.coachcol .card { --cw: 150px; }
.duel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 330px; }
.duel .prompt { font-family: var(--f-ui); font-weight: 700; font-size: 21px; line-height: 1.1; }
.duel .hint { color: var(--chalk-dim); font-size: 14px; margin-top: -4px; }
.spots { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; flex: 1; }
.spot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spot .card { --cw: 168px; }
.spot-l { font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-dim); }
.spot-empty { width: 168px; aspect-ratio: 5 / 7; border: 2px dashed rgba(242,239,227,0.5); border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; text-align: center; font-family: var(--f-ui); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk); background: rgba(0,0,0,0.2); }
.spot-empty small { font-weight: 500; font-size: 12px; color: var(--chalk-dim); letter-spacing: 0.04em; }
.spot-empty.pack-box { border-style: solid; background: rgba(255,255,255,0.05); }
.spot-empty.pack-box b { font-family: var(--f-display); font-size: 22px; }
.mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 150px; max-width: 260px; text-align: center; }
.vs { font-family: var(--f-display); font-weight: 900; color: var(--chalk-dim); font-size: 18px; text-align: center; }
.vs.big { font-size: 40px; color: var(--chalk); }
.rollkind { font-family: var(--f-ui); font-weight: 700; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--flood); }
.rollrow { display: flex; align-items: center; gap: 10px; }
.rollside { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rollside .tline { font-size: 12px; color: var(--chalk-dim); font-family: var(--f-ui); letter-spacing: 0.04em; }
.rollside .tot { font-family: var(--f-display); font-weight: 900; font-size: 30px; line-height: 1; }
.die { width: 46px; height: 46px; }
.die i { width: 8px; height: 8px; }
.die.rolling { animation: tumble 0.35s linear infinite; }
.die.landed { animation: land 0.3s ease-out; box-shadow: inset 0 -3px 0 #d7cfb6, 0 0 0 3px var(--flood); }
@keyframes land { 0% { transform: scale(1.35); } 100% { transform: scale(1); } }
.duel .outcome { font-size: 17px; }
.choice.primary { background: var(--flood); color: var(--ink); border-color: var(--flood); }
.choice.primary span { color: #3a3416; }
.duel .choices { justify-content: center; }
.duel .choices .btn { min-width: 220px; font-size: 19px; padding: 11px 20px; }
.logcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.logcol .log { flex: 1; height: auto; min-height: 260px; max-height: 420px; }
@media (max-width: 1100px) {
  .arena { grid-template-columns: 172px minmax(0, 1fr); }
  .logcol { grid-column: 1 / -1; }
  .logcol .log { min-height: 180px; max-height: 240px; }
}
@media (max-width: 700px) {
  .arena { grid-template-columns: minmax(0, 1fr); }
  .coachcol { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .coachcol .card, .coachcol .slot-empty { --cw: 110px; }
  .spot .card { --cw: 128px; } .spot-empty { width: 128px; }
  .mid { min-width: 100%; order: 3; }
  :root { --cw-mine: calc((100vw - 64px) / 3); --cw-opp: calc((100vw - 64px) / 3.2); }
}

@media (max-width: 980px) {
  .center { grid-template-columns: minmax(0, 1fr); }
  .squad { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero .fan { height: 270px; }
}
@media (max-width: 760px) {
  .board .tn-l { display: none; } .board .tn-s { display: block; }
  .benchrow .mini .mt span:last-child { display: none; }
  .choice { flex-basis: 120px; padding: 6px 9px; } .choice b { font-size: 16px; }
  .formation { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .formation .gap { display: none; }
  .flabels { display: none; }
  .mini .ab { display: none; }
  .mini .mn { font-size: 12px; }
  .track .z { font-size: 10px; }
  .log { height: 200px; }
  .hero .fan .card { --cw: 140px; }
  .hero .fan .card:nth-child(1) { transform: translateX(-90px) rotate(-14deg); }
  .hero .fan .card:nth-child(3) { transform: translateX(90px) rotate(11deg); }
  .slotbtn { width: calc(33% - 6px); }
}
@media (max-width: 460px) {
  .formation { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid .card { --cw: min(154px, 42vw); }
  .reveal .flip, .reveal .flip > .card { width: 42vw; --cw: 42vw; }
  .stage .tot { font-size: 28px; }
}
/* ---------- animations ---------- */
#view.viewin > * { animation: viewin 0.32s ease-out both; }
@keyframes viewin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.callout { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 41; }
.callout b { font-family: var(--f-display); font-weight: 900; font-size: clamp(48px, 10vw, 120px); letter-spacing: 0.02em; color: var(--chalk); text-shadow: 0 5px 0 #000a, 0 0 30px rgba(0,0,0,0.5); padding: 0 0.3em; transform: skewX(-8deg); animation: callout 1.4s cubic-bezier(.2,.9,.3,1) forwards; white-space: nowrap; }
.callout.small b { font-size: clamp(30px, 6vw, 64px); animation-duration: 1s; }
.callout.good b { color: var(--good); }
.callout.bad b { color: var(--bad); }
.callout.neutral b { color: var(--flood); }
@keyframes callout { 0% { opacity: 0; transform: skewX(-8deg) translateX(-60px) scale(0.85); } 18% { opacity: 1; transform: skewX(-8deg) translateX(0) scale(1.05); } 70% { opacity: 1; transform: skewX(-8deg) translateX(10px) scale(1); } 100% { opacity: 0; transform: skewX(-8deg) translateX(70px) scale(1); } }
.spots.enter .spot:first-child .card, .spots.enter .spot:first-child .spot-empty { animation: slideL 0.45s cubic-bezier(.2,.9,.3,1.2) both; }
.spots.enter .spot:last-child .card { animation: flipIn 0.55s ease-out both; }
@keyframes slideL { from { opacity: 0; transform: translateX(-60px) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes flipIn { from { opacity: 0; transform: perspective(700px) rotateY(90deg); } to { opacity: 1; transform: none; } }
.spot.win .card { animation: win 0.7s ease-out both; box-shadow: 0 0 0 3px var(--good), 0 0 26px rgba(89,209,138,0.6); }
.spot.lose .card { animation: lose 0.5s ease-in-out both; filter: saturate(0.6) brightness(0.85); }
.spot.still .card { animation: none; }
.spot.win.still .card { transform: translateY(-4px) scale(1.03); }
@keyframes win { 0% { transform: none; } 40% { transform: translateY(-10px) scale(1.06); } 100% { transform: translateY(-4px) scale(1.03); } }
@keyframes lose { 0%, 100% { transform: none; } 20% { transform: translateX(-8px) rotate(-2deg); } 40% { transform: translateX(7px) rotate(2deg); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.sc.bump { animation: bump 0.7s cubic-bezier(.2,.9,.3,1.4); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.6); color: #fff; } 100% { transform: scale(1); } }
.ball.hop { animation: hop 0.6s ease-out; }
@keyframes hop { 0% { transform: translateY(0) rotate(0); } 40% { transform: translateY(-14px) rotate(160deg); } 70% { transform: translateY(0) rotate(300deg); } 85% { transform: translateY(-4px) rotate(340deg); } 100% { transform: translateY(0) rotate(360deg); } }
.possmark.flash { animation: flash 0.8s ease-out; }
@keyframes flash { 0%, 60% { box-shadow: 0 0 0 0 rgba(255,255,255,0.9); } 100% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } }
.card.placed { animation: dropIn 0.45s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-40px) scale(1.15); } to { opacity: 1; transform: none; } }
.card.drawn { animation: drawUp 0.6s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes drawUp { 0% { opacity: 0; transform: translateY(40px) rotate(4deg); box-shadow: 0 0 0 3px var(--flood), 0 0 24px rgba(245,207,69,0.8); } 100% { opacity: 1; transform: none; } }
.flip.on.glow-epic > .card.front::before, .flip.on.glow-legendary > .card.front::before { content: ""; position: absolute; inset: -45%; border-radius: 50%; z-index: -1; pointer-events: none; animation: burst 1.1s ease-out 0.35s both; }
.flip.on.glow-epic > .card.front::before { background: radial-gradient(circle, rgba(141,79,214,0.85) 0%, rgba(141,79,214,0) 60%); }
.flip.on.glow-legendary > .card.front::before { background: conic-gradient(from 0deg, rgba(245,207,69,0.9), transparent 12%, rgba(245,207,69,0.9) 25%, transparent 37%, rgba(245,207,69,0.9) 50%, transparent 62%, rgba(245,207,69,0.9) 75%, transparent 87%, rgba(245,207,69,0.9)); mask: radial-gradient(circle, #000 25%, transparent 62%); -webkit-mask: radial-gradient(circle, #000 25%, transparent 62%); }
@keyframes burst { 0% { opacity: 0; transform: scale(0.3) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4) rotate(40deg); } }
.die.landed { animation: land 0.35s cubic-bezier(.2,.9,.3,1.6); }

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

/* match record */
.log p.rl { padding: 3px 6px; background: rgba(255,255,255,0.04); border-left: 3px solid var(--flood); border-radius: 2px; margin: 2px 0; }
.log p.rl b { font-family: var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--flood); font-size: 12px; }
.log .calc { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; color: var(--chalk); }
.log .res { font-weight: 600; }
.log .res.good { color: var(--good); } .log .res.bad { color: var(--bad); }
.log p.dice { font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; color: #c9c3a8; padding-left: 6px; border-left: 2px solid rgba(201,195,168,0.4); }
.log.nodice p.dice { display: none; }
.logcol .log { max-height: 520px; }
.lastroll { font-size: 13px; background: rgba(0,0,0,0.25); border-radius: 4px; padding: 5px 8px; color: var(--chalk-dim); font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; }
.lastroll span { font-family: var(--f-ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--flood); margin-right: 4px; }
textarea.rec { min-height: 60vh; font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace; font-size: 12px; white-space: pre; overflow: auto; }
.coachcol { gap: 10px; }
.coachslot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.coachcol .card { --cw: 138px; }

.cardtag { position: absolute; z-index: 3; left: 50%; bottom: -9px; transform: translateX(-50%); background: var(--ink); color: var(--chalk); font-family: var(--f-ui); font-weight: 700; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 7px; border-radius: 99px; white-space: nowrap; box-shadow: 0 0 0 1.5px var(--chalk); }
.picker.sq { row-gap: 18px; }

/* ad slots: one slim, clearly labelled strip per page, never during a match */
.gl-strip { margin-top: 22px; display: flex; align-items: center; gap: 14px; min-height: 90px; max-width: 970px; margin-inline: auto; padding: 12px 16px 12px 14px; background: repeating-linear-gradient(135deg, rgba(255,255,255,0.025) 0 10px, transparent 10px 20px), var(--panel); border: 1px solid var(--line); border-radius: 6px; position: relative; }
.gl-strip .gl-strip-tag { position: absolute; top: 4px; right: 8px; font-family: var(--f-ui); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--chalk-dim); opacity: 0.8; }
.gl-strip .gl-strip-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.gl-strip .gl-strip-body b { font-family: var(--f-ui); font-size: 18px; letter-spacing: 0.03em; text-transform: uppercase; }
.gl-strip .gl-strip-body span { color: var(--chalk-dim); font-size: 14px; }
.gl-strip ins { flex: 1; min-height: 90px; }
.modal .gl-strip { margin-top: 4px; min-height: 70px; }
@media (max-width: 560px) { .gl-strip { flex-direction: column; align-items: flex-start; min-height: 100px; } }

/* ---------- event stage: headline, dice tray, roll button ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: rgba(5,18,11,0.6); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.toolbar .lbl { font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--chalk-dim); }
.arena { grid-template-columns: 172px minmax(0, 1fr) !important; }
.duel { min-height: 420px; }
.headline { display: flex; flex-direction: column; gap: 2px; border-left: 4px solid var(--flood); padding: 4px 10px; background: rgba(0,0,0,0.2); border-radius: 0 4px 4px 0; }
.headline p { margin: 0; }
.headline .old { font-size: 13px; color: var(--chalk-dim); opacity: 0.7; }
.headline .now { font-family: var(--f-ui); font-weight: 700; font-size: 22px; line-height: 1.15; letter-spacing: 0.01em; animation: viewin 0.3s ease-out; }
.headline .now.good { color: var(--good); } .headline .now.bad { color: var(--bad); } .headline .now.head, .headline .now.big { color: var(--flood); } .headline .now.try { color: var(--flood); font-family: var(--f-display); font-size: 30px; }
.tray { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dt { min-width: 150px; max-width: 220px; flex: 1 1 150px; background: rgba(0,0,0,0.28); border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; }
.dt.fresh { animation: tileIn 0.35s ease-out both; }
@keyframes tileIn { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: none; } }
.dt .dl { display: flex; flex-direction: column; line-height: 1.1; }
.dt .dl b { font-family: var(--f-ui); font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--flood); }
.dt .dl span { font-size: 12px; color: var(--chalk-dim); }
.dt .dd { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.dt .die { width: 40px; height: 40px; }
.dt .dmod { font-family: var(--f-ui); font-weight: 700; font-size: 13px; color: var(--chalk-dim); }
.die.blank, .die.big-n { display: inline-grid; place-items: center; font-family: var(--f-display); font-weight: 900; font-size: 22px; color: var(--ink); padding: 0; }
.die.blank { background: rgba(251,248,238,0.35); color: var(--chalk); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.4); animation: pulse2 1.2s ease-in-out infinite; }
.dt .dsum { display: flex; align-items: baseline; gap: 8px; }
.dt .dtot { font-family: var(--f-display); font-weight: 900; font-size: 34px; line-height: 1; }
.dt .dneed { font-size: 12px; color: var(--chalk-dim); }
.dt .dres { font-family: var(--f-ui); font-weight: 700; font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase; padding: 1px 10px; border-radius: 99px; background: rgba(255,255,255,0.08); }
.dt.good { border-color: rgba(89,209,138,0.6); } .dt.good .dres { background: rgba(89,209,138,0.2); color: var(--good); }
.dt.bad { border-color: rgba(255,116,102,0.6); } .dt.bad .dres { background: rgba(255,116,102,0.2); color: var(--bad); }
.dt.fresh .dsum, .dt.fresh .dres { animation: revealLate 0.9s ease-out both; }
@keyframes revealLate { 0%, 60% { opacity: 0; transform: scale(0.8); } 100% { opacity: 1; transform: none; } }
.dt.fresh .die { animation: tumble 0.25s linear 0s 3; }
.dt.waiting { border-color: var(--flood); box-shadow: 0 0 0 2px rgba(245,207,69,0.4); }
.btn.rollbtn { font-size: 22px; padding: 12px 26px; animation: pulse3 1.3s ease-in-out infinite; }
@keyframes pulse3 { 50% { box-shadow: 0 0 0 6px rgba(245,207,69,0.25); } }
@media (max-width: 700px) { .arena { grid-template-columns: minmax(0, 1fr) !important; } .dt { min-width: 130px; } .headline .now { font-size: 18px; } }

/* ---- website: account + login ---- */
.account { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.account:empty { display: none; }
.authbox { max-width: 400px; margin: 48px auto; display: flex; flex-direction: column; gap: 14px; }
.authbox h1 { font-family: var(--f-display); font-size: 52px; line-height: .9; margin: 0; }
.authbox h1 span { display: block; font-family: var(--f-ui); font-size: 16px; letter-spacing: .2em; color: var(--chalk-dim); }
.authbox form { display: flex; flex-direction: column; gap: 8px; }
.authbox label { font-family: var(--f-ui); font-weight: 600; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
.authbox input.txt { padding: 10px; font-size: 16px; }
.authbox .errs { padding-left: 0; min-height: 1em; }
.authbox .btn { margin-top: 6px; justify-content: center; }
.linkbtn { background: none; border: 0; color: var(--gold, #f5cf45); font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.coins:empty { display: none; }

/* ---- deck pile + draw animation ---- */
.handwrap { display: flex; gap: 18px; align-items: flex-start; }
.handwrap .hand { flex: 1; min-width: 0; }
.deckpile { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 22px; }
.pile { position: relative; width: 84px; height: calc(84px * 7 / 5 + 9px); }
.pile .pl { position: absolute; left: 0; top: calc(var(--i) * 3px); }
.pile .pl .card { box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.pile .pl:last-child .card { box-shadow: 0 6px 14px rgba(0,0,0,0.5); }
.pile.empty { border: 2px dashed var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; height: calc(84px * 7 / 5); color: var(--chalk-dim); font-size: 13px; }
.pile-n { font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk-dim); text-align: center; line-height: 1.1; }
.pile-n b { display: block; font-size: 22px; color: var(--chalk); letter-spacing: 0; }
.flyer { position: absolute; z-index: 60; pointer-events: none; perspective: 900px; transform-origin: center; }
.fl-in { position: absolute; inset: 0; transform-style: preserve-3d; }
.fl-side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fl-side > .card { position: absolute; inset: 0; width: 100%; margin: 0; }
.fl-back { transform: rotateY(180deg); }
.flyer .fl-face > .card { box-shadow: 0 18px 40px rgba(0,0,0,0.6), 0 0 0 3px var(--flood), 0 0 26px rgba(245,207,69,0.7); }
.card.landed { animation: landGlow 0.9s ease-out; }
@keyframes landGlow { 0% { box-shadow: 0 0 0 3px var(--flood), 0 0 26px rgba(245,207,69,0.8); } 100% { box-shadow: 0 6px 18px rgba(0,0,0,0.45); } }
@media (max-width: 640px) { .deckpile { padding-top: 0; } .pile { width: 60px; height: calc(60px * 7 / 5 + 9px); } .pile .pl .card { --cw: 60px !important; } .handwrap { gap: 10px; } }

/* ---- pack shop ---- */
.packshop { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; margin: 14px 0; }
.packshop.busy { opacity: 0.5; pointer-events: none; }
.packcard { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.packcard .pack { width: var(--pw); height: calc(var(--pw) * 1.42); background: linear-gradient(160deg, color-mix(in srgb, var(--pk) 80%, #fff 10%), var(--pk) 55%, color-mix(in srgb, var(--pk) 60%, #000)); }
.packcard .pack .pl { font-size: calc(var(--pw) * 0.23); }
.packcard .pack .ps { font-size: 11px; letter-spacing: 0.14em; }
.packcard .pack.pk-rare { box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 0 2px rgba(245,207,69,0.9), 0 0 22px rgba(141,79,214,0.5); }
.pc-body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.pc-body h3 { font-size: 22px; margin: 0; }
.pc-body p { margin: 0; font-size: 14px; }
.pc-body .btn { display: inline-flex; gap: 6px; align-items: center; }
.freepacks { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }

/* ---- tournament ---- */
.tourintro { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
@media (max-width: 760px) { .tourintro { grid-template-columns: 1fr; } }
.tourintro h2 { font-size: 34px; margin: 0 0 4px; }
.tsides { display: flex; flex-direction: column; gap: 8px; }
.tside { border-left: 4px solid var(--tc); padding: 6px 10px; background: var(--panel-2); border-radius: 4px; display: flex; flex-direction: column; gap: 4px; }
.prizes { padding-left: 18px; margin: 6px 0 14px; display: flex; flex-direction: column; gap: 4px; }
.tourgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.tourgrid .tnext { grid-column: 1 / -1; }
@media (max-width: 860px) { .tourgrid { grid-template-columns: 1fr; } }
.tnext { border-left: 6px solid var(--tc, var(--flood)); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.tnext h2 { font-size: 30px; margin: 0; }
.tnext .rd, .tround .lbl, .tbracket .lbl { font-family: var(--f-ui); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk-dim); }
.tnext .mix { width: min(320px, 100%); }
.tnext.done { border-left-color: var(--flood); }
.tlog { grid-row: span 2; overflow-x: auto; }
.tlog h3, .tbracket h3 { margin: 0 0 8px; }
.logtbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
.logtbl th { font-family: var(--f-ui); font-size: 12px; letter-spacing: 0.08em; color: var(--chalk-dim); font-weight: 600; padding: 4px; text-align: center; }
.logtbl td { padding: 6px 4px; text-align: center; border-top: 1px solid var(--line); }
.logtbl .tl { text-align: left; white-space: nowrap; }
.logtbl .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }
.logtbl tr.me td { background: rgba(245,207,69,0.12); font-weight: 600; }
.logtbl tr.cut td { border-bottom: 2px dashed var(--flood); }
@media (max-width: 520px) { .logtbl .wide { display: none; } .logtbl { font-size: 13px; } .tgame { font-size: 13px; padding: 5px 6px; gap: 4px; } .tgame b { min-width: 38px; } }
.brk { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center; }
.brk .col { display: flex; flex-direction: column; gap: 8px; }
.tgame { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; background: var(--panel-2); border-radius: 4px; padding: 6px 10px; font-family: var(--f-ui); font-weight: 600; font-size: 15px; }
.tgame span:first-child { text-align: right; }
.tgame b { font-variant-numeric: tabular-nums; min-width: 46px; text-align: center; }
.tgame .me { color: var(--flood); }
.tgame .won { text-decoration: underline; text-decoration-color: var(--good); text-underline-offset: 3px; }
.tgame.mine { box-shadow: inset 0 0 0 1px rgba(245,207,69,0.45); }
.tgame.tbd { display: block; text-align: center; color: var(--chalk-dim); font-weight: 500; }
.champ { font-family: var(--f-display); font-weight: 900; font-size: 22px; color: var(--flood); text-align: center; }
.trounds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.tround { display: flex; flex-direction: column; gap: 4px; }
.tround.now .lbl { color: var(--flood); }

/* ---- card peek (hover a small card to see it full size) ---- */
.peek { position: fixed; z-index: 80; pointer-events: none; filter: drop-shadow(0 16px 30px rgba(0,0,0,0.6)); animation: peekIn 0.12s ease-out; }
.peek > .card { margin: 0; }
@keyframes peekIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* ---- compact match layout: everything on one screen ---- */
body.in-match #view.wrap { max-width: 1760px; }
.match { gap: 8px; }
.mtop { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.mtop-l { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.toolbar { padding: 4px 8px; gap: 8px; }
.toolbar .btn.sm { padding: 3px 8px; font-size: 13px; }
.side-panel.opp, .side-panel.mine { display: flex; gap: 12px; align-items: flex-start; padding: 6px 8px; }
.side-panel.opp > .side-head, .side-panel.mine > .side-head { flex-direction: column; align-items: flex-start; width: 132px; flex: none; margin: 0; gap: 6px; }
.side-panel > .side-head h3 { font-size: 16px; line-height: 1.15; }
.side-btns { flex-direction: column; align-items: flex-start; gap: 5px; }
.side-btns .chip { font-size: 11px; }
.side-btns .btn.sm { font-size: 13px; padding: 4px 8px; }
.side-panel .fwrap { flex: 1; min-width: 0; gap: 4px 14px; }
.fgroup { gap: 2px; }
.zone-label { font-size: 11px; }
.frow { gap: 5px; }
.mmid { display: grid; grid-template-columns: 132px minmax(0, 1fr) minmax(250px, 330px); gap: 8px; align-items: stretch; }
.coachcol { padding: 8px 6px; }
.coachcol .card, .coachcol .slot-empty { --cw: 108px; }
.coachcol .slot-empty { font-size: 11px; padding: 6px; }
.coachcol .slot-empty b { display: none; }
.handcol { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.handcol > .side-head { margin: 0; }
.handcol #deckinfo { font-size: 13px; }
.handcol .hand { overflow-y: auto; max-height: calc(var(--spot) * 1.4 + 150px); align-content: flex-start; gap: 6px 12px; padding: 2px; }
.hand .card, .hand .fcard { --cw: 88px; }
.hand .fgroup .frow { gap: 6px; }
.deckpile { flex-direction: row; align-items: center; padding-top: 0; gap: 8px; }
.pile { width: 46px; height: calc(46px * 7 / 5 + 9px); }
.pile.empty { height: calc(46px * 7 / 5); font-size: 10px; }
.pile-n { text-align: left; font-size: 11px; }
.pile-n b { font-size: 18px; }
:root { --spot: clamp(112px, 16vh, 168px); }
.spot .card { --cw: var(--spot); }
.spot-empty { width: var(--spot); font-size: 13px; }
.duel { min-height: 0; padding: 10px 12px; }
.duel .prompt { font-size: 19px; }
@media (min-width: 1100px) {
  /* field cards shrink so the 11 spots fit on one row; hover any card to read it */
  :root { --cw-mine: clamp(64px, calc((100vw - 330px) / 11.6), 112px); --cw-opp: clamp(58px, calc((100vw - 330px) / 13), 96px); }
  .mtop { grid-template-columns: minmax(400px, 0.8fr) 2fr; align-items: start; }
  .board { padding: 4px 12px; }
  .board .sc { font-size: 34px; }
  .board .tn { font-size: 20px; }
  .board .clock b { font-size: 17px; }
  .board .sw { height: 24px; }
}
@media (max-width: 1099px) {
  .mmid { grid-template-columns: 132px minmax(0, 1fr); }
  .handcol { grid-column: 1 / -1; }
  .handcol .hand { max-height: none; }
  .side-panel.opp, .side-panel.mine { flex-direction: column; }
  .side-panel.opp > .side-head, .side-panel.mine > .side-head { width: auto; flex-direction: row; flex-wrap: wrap; }
  .side-btns { flex-direction: row; }
}
@media (max-width: 700px) {
  .mmid { grid-template-columns: minmax(0, 1fr); }
}
.duel-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
@media (min-width: 1100px) {
  :root { --spot: clamp(100px, 14vh, 168px); }
  .board .tn-l { display: none; }
  .board .tn-s { display: block; }
  .toolbar .spd { display: none; }
  .duel-body { flex-direction: row; align-items: center; }
  .duel-body .spots { flex: 1; }
  .duel-body .tray { flex-direction: column; flex-wrap: nowrap; width: 250px; flex: none; gap: 6px; }
  .duel-body .dt { max-width: none; min-width: 0; flex: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "dl dsum" "dd dres"; align-items: center; gap: 2px 8px; text-align: left; padding: 6px 8px; }
  .duel-body .dt .dl { grid-area: dl; } .duel-body .dt .dd { grid-area: dd; justify-content: flex-start; }
  .duel-body .dt .dsum { grid-area: dsum; justify-self: end; gap: 4px; flex-direction: column; align-items: flex-end; }
  .duel-body .dt .dres { grid-area: dres; justify-self: end; font-size: 13px; padding: 1px 8px; }
  .duel-body .dt .dl b { font-size: 13px; }
  .duel-body .dt .dl span, .duel-body .dt .dneed { font-size: 11px; }
  .duel-body .dt .die { width: 28px; height: 28px; }
  .duel-body .dt .die.big-n, .duel-body .dt .die.blank { font-size: 16px; }
  .duel-body .dt .dtot { font-size: 26px; }
  .duel .headline .now { font-size: 19px; }
  .duel .choices .btn { min-width: 180px; font-size: 17px; padding: 8px 16px; }
}
.offlist .card, .opp .offlist .card, .mine .offlist .card { --cw: 44px !important; }
.offlist .frow { gap: 4px; }
.offlist .ftag { display: none; }
@media (min-width: 1100px) {
  :root {
    --spot: clamp(96px, 12.5vh, 168px);
    --cw-mine: clamp(64px, min(calc((100vw - 330px) / 11.6), 10.5vh), 112px);
    --cw-opp: clamp(58px, min(calc((100vw - 330px) / 13), 9vh), 96px);
  }
  .mtop { grid-template-columns: minmax(450px, 0.8fr) 2fr; }
  .toolbar { flex-wrap: nowrap; }
  .toolbar .seg button { padding: 3px 8px; font-size: 13px; }
  .headline .old:first-child:not(:nth-last-child(2)) { display: none; }
  .duel { gap: 6px; }
  .duel .hint { font-size: 13px; }
  .duel-body .dt { padding: 4px 8px; }
  .duel-body .dt .die { width: 24px; height: 24px; }
  .duel-body .dt .dtot { font-size: 22px; }
  .duel-body .dt .dsum { flex-direction: row; align-items: baseline; }
}
.spot .card { --cw: var(--spot) !important; }
.toolbar label { white-space: nowrap; }
@media (min-width: 1100px) {
  :root {
    --cw-mine: clamp(64px, min(calc((100vw - 330px) / 11.6), 9.6vh), 112px);
    --cw-opp: clamp(58px, min(calc((100vw - 330px) / 13), 8.2vh), 96px);
  }
  .mtop { grid-template-columns: minmax(480px, 0.8fr) 2fr; }
  .toolbar { gap: 6px; }
  .toolbar .btn.sm { padding: 3px 7px; font-size: 12px; }
  .side-panel > .side-head h3 { font-size: 15px; }
  #view.wrap { padding-top: 0; }
  body.in-match main#view { margin-top: 4px; }
}
@media (min-width: 1100px) {
  .duel-body .dt { grid-template-columns: minmax(80px, 1fr) auto; }
  .duel-body .dt .dsum { flex-direction: column; align-items: flex-end; gap: 0; }
  .duel-body .dt .dneed { max-width: 140px; text-align: right; line-height: 1.15; }
  .coachcol .card, .coachcol .slot-empty { --cw: clamp(76px, 11vh, 108px); }
  .handcol .hand { max-height: calc(var(--spot) * 1.4 + 90px); }
  .pile { width: 38px; height: calc(38px * 7 / 5 + 9px); }
  .pile .pl .card { --cw: 38px !important; }
  .pile.empty { height: calc(38px * 7 / 5); }
}
@media (min-width: 1100px) and (max-height: 820px) {
  /* short screens: keep the latest two rolls beside the cards */
  .duel-body .tray .dt:nth-last-child(n+3) { display: none; }
  .duel .headline .old { display: none; }
}
/* during a match the top bar slims down to leave room for the game */
@media (min-width: 1100px) {
  body.in-match .topbar .wrap { padding-block: 2px; max-width: 1760px; }
  body.in-match .topbar .nav button { padding-block: 4px; }
}
@media (min-width: 1100px) and (max-height: 820px) {
  :root { --spot: clamp(84px, 11vh, 120px); }
  .duel .choices .btn { padding: 6px 14px; }
  .duel .prompt { font-size: 17px; }
}
/* two abilities: shorter art and tighter text so both fit */
.card.ab2 .c-art { aspect-ratio: 16 / 7.6; }
.card.ab2 .c-abil { font-size: 0.7em; line-height: 1.17; padding-top: 0.2em; }
.card.ab2 .c-abil p { margin-bottom: 0.25em; }
.card.fcard.ab2 .c-abil { font-size: 0.66em; }
body.in-match main#view { padding-block: 6px 10px; }
.card.fcard .c-abil { font-size: 0.72em; }
@media (min-width: 1100px) and (max-height: 820px) {
  :root { --cw-opp: clamp(56px, min(calc((100vw - 330px) / 13), 7.6vh), 96px); }
}
.spot-empty { aspect-ratio: 5 / 7; height: auto; overflow: hidden; font-size: clamp(11px, calc(var(--spot) * 0.1), 16px); padding: 8px; }
@media (min-width: 1100px) and (max-height: 820px) { .spot-empty small { display: none; } }
.peek .card .c-name { white-space: normal; overflow: visible; font-size: 1.12em; line-height: 1.02; }
@media (max-width: 700px) {
  :root { --cw-mine: calc((100vw - 56px) / 4); --cw-opp: calc((100vw - 60px) / 5); --spot: 118px; }
  .side-panel .side-head h3 { font-size: 15px; }
}
/* dice scale as a whole, so the pips always fit */
.die { --d: 38px; width: var(--d) !important; height: var(--d) !important; padding: calc(var(--d) * 0.14) !important; border-radius: calc(var(--d) * 0.18); }
.die i { width: calc(var(--d) * 0.18) !important; height: calc(var(--d) * 0.18) !important; }
.rollside .die, .rollrow .die { --d: 46px; }
.dt .die { --d: 40px; }
.die.blank { font-size: calc(var(--d) * 0.55); padding: 0 !important; }
/* d10 and d20 rolls: a polyhedral die with the number on it */
.pdie { --d: 40px; width: var(--d); height: var(--d); display: inline-grid; place-items: center; position: relative; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.45)); }
.pdie::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, #fbf8ee 0%, #e9e1c8 100%); }
.pdie.d20::before { clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%); }
.pdie.d10::before { clip-path: polygon(50% 0, 96% 42%, 50% 100%, 4% 42%); }
.pdie:not(.d10):not(.d20)::before { border-radius: 6px; }
.pdie b { position: relative; font-family: var(--f-display); font-weight: 900; font-size: calc(var(--d) * 0.42); line-height: 1; color: var(--ink); }
.pdie.d10 b { margin-top: calc(var(--d) * -0.08); }
.pdie.rolling { animation: tumble 0.25s linear 0s 3; }
@media (min-width: 1100px) {
  .duel-body .dt .die, .duel-body .dt .pdie { --d: 30px; }
}
@media (min-width: 1100px) and (max-height: 820px) {
  .duel-body .dt .die, .duel-body .dt .pdie { --d: 28px; }
}
/* every pop-up gets a close button */
.modal .box { position: relative; }
.mclose { position: absolute; top: 6px; right: 8px; z-index: 5; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(255,255,255,0.08); color: var(--chalk); font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.mclose:hover { background: rgba(255,255,255,0.18); }
.modal .box.cardbox .mclose { top: -6px; right: -6px; background: rgba(0,0,0,0.6); }
/* ad spaces on the match screen: kept apart from the game's buttons */
.match-ad .gl-strip { margin-top: 0; }
.match-ad.bottom { margin-top: 6px; }
.gl-strip.slim { min-height: 60px; padding: 8px 14px; }
.gl-strip.slim ins { min-height: 60px; }
.match-ad.side { margin-top: auto; padding-top: 10px; }
.gl-strip.compact { flex-direction: column; align-items: flex-start; min-height: 0; max-width: none; padding: 10px 12px; gap: 4px; }
.gl-strip.compact .gl-strip-body b { font-size: 14px; }
.gl-strip.compact .gl-strip-body span { font-size: 12px; }
.gl-strip.compact ins { min-height: 120px; width: 100%; }
.match-ad:empty { display: none; }
@media (max-width: 1099px), (max-height: 820px) { .match-ad.side { display: none; } }

/* ---- clubs ---- */
.c-club { background: var(--cc); color: #fff; border-radius: 3px; padding: 0 0.4em; letter-spacing: 0.06em; }
.crest { --cs: 44px; width: var(--cs); height: calc(var(--cs) * 1.12); flex: none; display: inline-grid; place-items: center; background: linear-gradient(160deg, color-mix(in srgb, var(--cc) 75%, #fff), var(--cc) 55%, color-mix(in srgb, var(--cc) 65%, #000)); clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.3); }
.crest b { font-family: var(--f-display); font-weight: 900; color: #fff; font-size: calc(var(--cs) * 0.3); letter-spacing: 0.02em; margin-top: calc(var(--cs) * -0.12); text-shadow: 0 1px 0 #0008; }
.clubshop { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 10px; margin: 14px 0; }
.clubshop.busy { opacity: 0.5; pointer-events: none; }
.clubcard { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--cc, var(--line)); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.clubcard.on { box-shadow: 0 0 0 2px var(--flood); }
.clubcard.done { background: linear-gradient(135deg, rgba(245,207,69,0.08), transparent 60%), var(--panel); }
.cc-head { display: flex; gap: 10px; align-items: center; background: none; border: 0; color: inherit; padding: 0; text-align: left; cursor: pointer; font: inherit; }
.cc-head:hover .cc-name b { text-decoration: underline; }
.cc-name { display: flex; flex-direction: column; min-width: 0; }
.cc-name b { font-family: var(--f-ui); font-size: 19px; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.05; }
.cc-name span { font-size: 13px; color: var(--chalk-dim); }
.cc-prog, .cd-prog { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.cc-prog i, .cd-prog i { display: block; height: 100%; background: var(--cc, var(--flood)); }
.clubcard.done .cc-prog i { background: var(--flood); }
.cc-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; flex-wrap: wrap; }
.cc-row .btn { display: inline-flex; gap: 5px; align-items: center; }
.rarecard { flex-direction: row; align-items: center; border-left-color: #8d4fd6; }
.rarecard .pack { --pw: 64px; width: var(--pw); height: calc(var(--pw) * 1.42); }
.rarecard .pack .pl { font-size: 15px; }
.rarecard .pack .ps { font-size: 9px; letter-spacing: 0.1em; }
.clubdetail { border-top: 5px solid var(--cc); margin: 12px 0; display: flex; flex-direction: column; gap: 10px; scroll-margin-top: 70px; }
.cd-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.cd-head h2 { font-size: 30px; margin: 0; }
.cd-head p { margin: 2px 0 0; }
.cd-reward { margin: 0; }
.cd-odds { display: flex; gap: 6px; flex-wrap: wrap; }
.cd-odds .chip { font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.cd-odds .gem { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.cd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; justify-items: center; }
.ccard { position: relative; }
.ccard.missing .card { filter: grayscale(0.9) brightness(0.55); }
.ccard .miss { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%) rotate(-8deg); background: var(--ink); color: var(--chalk); font-family: var(--f-ui); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 8px; border-radius: 3px; box-shadow: 0 0 0 1px var(--chalk-dim); pointer-events: none; }
.clubsel { width: auto; min-width: 160px; padding: 5px 8px; }
.modal .result .crest { margin: 0 4px; }

/* ---- Pick and Drive wordmark ---- */
.brand i { font-family: var(--f-ui); font-style: normal; font-weight: 600; font-size: 0.55em; color: var(--chalk-dim); letter-spacing: 0.06em; text-transform: lowercase; }
.card.back .logo { font-size: 1.55em; line-height: 0.95; text-align: center; }
.card.back .logo i, .pack .pl i { font-style: normal; font-size: 0.5em; vertical-align: middle; color: var(--chalk); letter-spacing: 0.06em; }
.pack .pl { text-align: center; }
@media (max-width: 1250px) { body.in-match .brand small { display: none; } }
@media (max-width: 700px) { .brand small { display: none; } }
