/* ===== Goal Defenders v2 — floodlit night match UI =====
 * Deep pine greens, glassy panels, gold trophy accents. Mobile-first. */
:root {
    color-scheme: dark;
    --bg: #06130c;
    --panel: rgba(10, 32, 20, .82);
    --panel-solid: #0b2416;
    --line: rgba(95, 213, 146, .28);
    --line-strong: rgba(95, 213, 146, .55);
    --ink: #f2f7f3;
    --ink-dim: #9fd9b6;
    --gold: #ffd34d;
    --gold-deep: #f5a623;
    --danger: #ff6b6b;
    --ice: #8fd3ff;
    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    margin: 0; padding: 0;
    background:
        radial-gradient(1200px 700px at 50% -10%, #14492c 0%, rgba(20, 73, 44, 0) 60%),
        radial-gradient(900px 600px at 85% 110%, #0d3a22 0%, rgba(13, 58, 34, 0) 55%),
        var(--bg);
    color: var(--ink);
    font-family: system-ui, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: none; user-select: none;
    touch-action: manipulation;
}
button { font-family: inherit; }
.hidden { display: none !important; }
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding-top: var(--sat); padding-bottom: var(--sab); }

/* ---------- Overlays ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 50;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 25% 15%, rgba(255, 244, 200, .07), transparent 34%),
        radial-gradient(circle at 75% 12%, rgba(255, 244, 200, .07), transparent 34%),
        radial-gradient(circle at 50% 30%, #14492c, #050f0a 72%);
    padding: 1rem; padding-top: calc(1rem + var(--sat)); padding-bottom: calc(1rem + var(--sab));
    animation: overlayGlow 7s ease-in-out infinite alternate;
}
.overlay.modal { background: rgba(3, 10, 6, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 60; animation: none; }
@keyframes overlayGlow { from { filter: brightness(1); } to { filter: brightness(1.1); } }
.panel {
    background: linear-gradient(170deg, rgba(22, 58, 37, .92), var(--panel) 45%);
    border: 1px solid var(--line); border-radius: 22px;
    padding: 1.5rem 1.6rem 1.8rem; max-width: 680px; width: 100%;
    max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem - var(--sat) - var(--sab)); overflow-y: auto; text-align: center;
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .09), 0 0 0 6px rgba(95, 213, 146, .05);
    animation: panelIn .35s cubic-bezier(.2, .9, .3, 1.2);
    scrollbar-width: thin; scrollbar-color: #2c6b45 transparent;
}
.panel.small { max-width: 560px; text-align: left; }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.panel h1, .gold {
    margin: .2rem 0 .3rem; font-size: 2.1rem; letter-spacing: .5px; font-weight: 900; line-height: 1.1;
    background: linear-gradient(180deg, #fff3c4 5%, var(--gold) 55%, #e08f1f 95%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: var(--gold);
    filter: drop-shadow(0 3px 10px rgba(245, 166, 35, .35));
}
.logo { display: flex; align-items: center; justify-content: center; gap: .6rem; }
.logo .ball { font-size: 2rem; animation: spin 6s linear infinite; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
@keyframes spin { to { transform: rotate(360deg); } }
.tagline { margin: 0 0 1rem; color: var(--ink-dim); letter-spacing: .3px; }
.muted { color: var(--ink-dim); font-size: .85rem; }

/* mode cards */
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .4rem 0 1rem; }
.mode-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; text-align: left;
    background: linear-gradient(180deg, rgba(20, 56, 36, .85), rgba(11, 34, 21, .85));
    border: 1px solid var(--line); border-radius: 14px; padding: .75rem .85rem; cursor: pointer; color: var(--ink);
    transition: border-color .15s, transform .12s, box-shadow .15s;
}
.mode-card:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.mode-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 22px rgba(255, 211, 77, .25); background: linear-gradient(180deg, rgba(60, 50, 20, .6), rgba(11, 34, 21, .9)); }
.m-ico { font-size: 1.5rem; }
.m-name { font-weight: 800; font-size: 1rem; }
.m-desc { font-size: .78rem; color: var(--ink-dim); }

.matchup { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: .6rem 0; flex-wrap: wrap; }
.vs-team {
    flex: 1 1 200px; min-width: 160px;
    background: linear-gradient(180deg, rgba(20, 56, 36, .85), rgba(11, 34, 21, .85));
    border: 1px solid var(--line); border-radius: 14px; padding: .7rem;
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 6px 18px rgba(0, 0, 0, .3);
}
.kit-preview { width: 96px; height: 96px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .5)); }
.vs-team .flag { font-size: 2rem; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45)); }
.vs-team .tname { font-weight: 800; font-size: 1.05rem; }
.vs-team .tstar { color: #cfe9d8; font-size: .85rem; }
.vs-mid { font-weight: 900; color: var(--gold); font-size: 1.35rem; letter-spacing: .1em; text-shadow: 0 0 18px rgba(255, 211, 77, .55); }
.matchup.big .vs-team .flag { font-size: 3rem; }
.boss-note { margin: .2rem 0 .6rem; color: #ffb84d; font-size: .85rem; }

.link-btn { background: none; border: none; color: #7fd0a0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; padding: .4rem .5rem; transition: color .15s; }
.link-btn:hover { color: #aef0c8; }
.link-btn.danger { color: #ff9a8a; }
.link-btn.open { color: #aef0c8; }
.badge { background: rgba(255, 211, 77, .18); color: var(--gold); border-radius: 999px; padding: .05rem .45rem; font-size: .75rem; font-weight: 800; text-decoration: none; display: inline-block; }
.menu-links { display: flex; justify-content: center; flex-wrap: wrap; gap: .2rem; margin-top: .8rem; }

.select-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: .6rem 0; text-align: left; }
.select-col h3 { margin: 0 0 .5rem; font-size: 1rem; }
.select-col .sub { color: #8fbfa3; font-weight: 400; font-size: .8rem; }
.team-list { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 180px; overflow-y: auto; padding: 2px; scrollbar-width: thin; }
.team-chip {
    background: rgba(13, 44, 29, .85); border: 1px solid var(--line); color: #eaf4ee;
    border-radius: 999px; padding: .35rem .7rem .35rem .4rem; cursor: pointer; font-size: .84rem;
    display: inline-flex; align-items: center; gap: .35rem;
    transition: border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.team-chip .kit { width: 14px; height: 14px; border-radius: 4px 4px 3px 3px; background: linear-gradient(90deg, var(--v) 0 22%, var(--s) 22% 78%, var(--v) 78%); box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.team-chip:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.team-chip.active { background: linear-gradient(180deg, #38835a, #2c6b45); border-color: #5fd592; font-weight: 700; box-shadow: 0 0 14px rgba(95, 213, 146, .35), inset 0 1px 0 rgba(255, 255, 255, .18); }
.player-pick { display: block; margin-top: .7rem; font-size: .85rem; color: #cfe9d8; }
.player-pick select { display: block; width: 100%; margin-top: .25rem; padding: .45rem; background: rgba(13, 44, 29, .9); color: #fff; border: 1px solid var(--line); border-radius: 9px; font-size: .95rem; }

.diff-row { display: flex; align-items: center; justify-content: center; gap: .5rem; margin: .8rem 0; }
.diff-btn { background: rgba(13, 44, 29, .85); border: 1px solid var(--line); color: #eaf4ee; border-radius: 10px; padding: .45rem .9rem; cursor: pointer; font-weight: 600; transition: border-color .15s, transform .1s, box-shadow .15s; }
.diff-btn:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.diff-btn.active { background: linear-gradient(180deg, #ffe07a, var(--gold-deep)); color: #241a05; border-color: var(--gold); font-weight: 800; box-shadow: 0 0 16px rgba(255, 211, 77, .4), inset 0 1px 0 rgba(255, 255, 255, .5); }

.big-btn {
    position: relative; overflow: hidden; display: block; width: 100%;
    background: linear-gradient(180deg, #ffe07a, var(--gold) 45%, var(--gold-deep)); color: #241a05;
    border: none; border-radius: 14px; padding: .9rem 1.7rem; font-size: 1.1rem; font-weight: 900; letter-spacing: .04em; cursor: pointer; margin-top: .6rem;
    box-shadow: 0 8px 24px rgba(245, 166, 35, .4), inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(0, 0, 0, .18);
    transition: transform .12s, box-shadow .12s, filter .12s;
}
.big-btn::after { content: ""; position: absolute; top: -20%; bottom: -20%; width: 34%; left: -50%; background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .5), transparent); transform: skewX(-18deg); animation: sheen 3.2s ease-in-out infinite; }
@keyframes sheen { 0%, 55% { left: -50%; } 85%, 100% { left: 130%; } }
.big-btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
.big-btn:active { transform: translateY(0); }
.big-btn.alt { background: linear-gradient(180deg, #4ecb86, #2c9c5c 50%, #1f7a46); color: #06130c; box-shadow: 0 8px 24px rgba(46, 160, 95, .4), inset 0 1px 0 rgba(255, 255, 255, .4); }
.icon-btn { background: rgba(13, 44, 29, .85); border: 1px solid var(--line); color: #eaf4ee; border-radius: 9px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; }

/* modal content */
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.howto { margin: 0; padding-left: 1.1rem; line-height: 1.5; font-size: .9rem; }
.howto li { margin-bottom: .45rem; }
.trophy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.trophy { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .15rem; background: rgba(13, 44, 29, .7); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .4rem; opacity: .55; }
.trophy.got { opacity: 1; border-color: rgba(255, 211, 77, .5); background: linear-gradient(180deg, rgba(70, 58, 20, .5), rgba(13, 44, 29, .7)); box-shadow: 0 0 14px rgba(255, 211, 77, .18); }
.trophy.small { flex-direction: row; display: inline-flex; padding: .35rem .6rem; margin: .2rem; gap: .4rem; }
.t-ico { font-size: 1.6rem; }
.trophy.small .t-ico { font-size: 1.1rem; }
.t-name { font-weight: 800; font-size: .85rem; }
.t-desc { font-size: .72rem; color: var(--ink-dim); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: .5rem; margin: .9rem 0; }
.stat { background: rgba(13, 44, 29, .7); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .4rem; display: flex; flex-direction: column; align-items: center; }
.stat b { font-size: 1.2rem; color: var(--gold); }
.stat span { font-size: .72rem; color: var(--ink-dim); }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid rgba(95, 213, 146, .14); font-size: .95rem; cursor: pointer; }
.setting input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--gold); }
.setting select { background: rgba(13, 44, 29, .9); color: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .35rem; }
.end-trophies h3 { margin: .2rem 0 .3rem; font-size: .95rem; color: var(--gold); }

/* match intro + perks */
.panel.intro .round { font-size: .85rem; letter-spacing: .25em; text-transform: uppercase; color: var(--ink-dim); }
.panel.intro .round-sub { font-size: 1.4rem; font-weight: 900; margin-bottom: .4rem; }
.panel.intro .weather { background: rgba(13, 44, 29, .7); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; font-size: .9rem; margin: .4rem 0; }
.panel.intro .notes { color: #ffb84d; font-size: .85rem; margin: .2rem 0 .4rem; }
.perk-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: .6rem; }
.perk { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; color: var(--ink); cursor: pointer;
    background: linear-gradient(180deg, rgba(20, 56, 36, .9), rgba(11, 34, 21, .95)); border: 1px solid var(--line); border-radius: 16px; padding: 1rem .7rem;
    transition: transform .15s, border-color .15s, box-shadow .15s; animation: panelIn .4s both; }
.perk:hover { transform: translateY(-3px) scale(1.02); border-color: var(--gold); box-shadow: 0 10px 30px rgba(0, 0, 0, .4), 0 0 18px rgba(255, 211, 77, .25); }
.p-ico { font-size: 2.2rem; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
.p-name { font-weight: 800; }
.p-desc { font-size: .78rem; color: var(--ink-dim); }
#endScreen.cup .panel { box-shadow: 0 24px 70px rgba(0, 0, 0, .6), 0 0 0 6px rgba(255, 211, 77, .15), 0 0 80px rgba(255, 211, 77, .25); }

/* ---------- Game layout ---------- */
#game { width: 100%; max-width: 1100px; padding: .5rem; display: flex; flex-direction: column; align-items: center; }
#stageWrap { position: relative; display: flex; justify-content: center; align-items: flex-start; gap: .6rem; width: 100%; }
#stage { position: relative; flex: 0 1 auto; width: min(100%, calc((100vh - 150px) * 540 / 860)); width: min(100%, calc((100dvh - 150px - var(--sat) - var(--sab)) * 540 / 860)); }
#canvas {
    width: 100%; aspect-ratio: 540 / 860; height: auto; display: block;
    background: #157137; border-radius: 16px; border: 1px solid rgba(95, 213, 146, .35);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 0 40px rgba(31, 140, 73, .25), inset 0 0 0 2px rgba(0, 0, 0, .25);
    touch-action: none; cursor: crosshair;
}

/* HUD */
#hud {
    width: 100%; max-width: 760px;
    background: linear-gradient(180deg, rgba(13, 38, 24, .94), rgba(7, 20, 13, .94));
    border: 1px solid var(--line); border-radius: 14px; padding: .4rem .6rem .35rem; margin-bottom: .45rem;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.hud-row { display: flex; align-items: center; gap: .55rem; flex-wrap: nowrap; }
.hud-row.sub { justify-content: space-between; font-size: .74rem; color: var(--ink-dim); margin-top: .15rem; }
.hud-row.sub .status { color: var(--gold); font-weight: 700; text-shadow: 0 0 12px rgba(255, 211, 77, .35); white-space: nowrap; }
.match-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-item { font-weight: 700; font-size: .95rem; white-space: nowrap; display: inline-flex; align-items: center; gap: .3rem; }
.hud-item small { font-size: .7rem; color: var(--ink-dim); font-weight: 600; }
.hud-item.money.bump b { animation: bump .35s ease; display: inline-block; }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.25); color: var(--gold); } 100% { transform: scale(1); } }
.hud-item.lives { flex-direction: column; align-items: flex-start; gap: .1rem; }
.lives-bar { display: block; width: 64px; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.lives-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4ecb86, #9be7b4); border-radius: 99px; transition: width .3s; }
.lives.danger .lives-bar i { background: linear-gradient(90deg, #ff6b6b, #ffb3a7); }
.lives.danger { animation: pulseDanger 1s ease-in-out infinite; }
@keyframes pulseDanger { 50% { color: var(--danger); } }
.hud-item.combo { color: #ff9a3c; background: rgba(255, 150, 60, .14); border: 1px solid rgba(255, 150, 60, .4); border-radius: 999px; padding: .05rem .55rem; animation: bump .3s ease; }
.hud-item.combo.hot { color: #ffd34d; border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 211, 77, .45); }
.hud-grow { flex: 1; }
.hud-btn { background: linear-gradient(180deg, #276044, #1c4630); border: 1px solid #3f9061; color: #fff; border-radius: 9px; padding: .35rem .6rem; cursor: pointer; font-weight: 700; min-width: 38px; min-height: 34px; transition: border-color .15s, transform .1s, box-shadow .15s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.hud-btn:hover { border-color: #5fd592; transform: translateY(-1px); }
.bar { position: relative; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); margin-top: .35rem; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #5fd592, #ffd34d); transition: width .25s; }
.bar.boss { height: 14px; background: rgba(90, 10, 10, .6); border: 1px solid rgba(255, 94, 94, .5); }
.bar.boss i { background: linear-gradient(90deg, #ff3b3b, #ff8a5c); width: 100%; }
.bar.boss.enraged i { background: linear-gradient(90deg, #ff1e1e, #ffb347); animation: enrage .5s linear infinite alternate; }
@keyframes enrage { to { filter: brightness(1.5); } }
.bar.boss span { position: absolute; inset: 0; font-size: .66rem; font-weight: 800; color: #fff; text-align: center; line-height: 12px; text-shadow: 0 1px 2px #000; z-index: 1; }

/* over-pitch widgets */
.place-hint {
    position: absolute; left: 8px; right: 8px; top: 8px; z-index: 12;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    background: rgba(8, 26, 17, .94); border: 1px solid #5fd592; border-radius: 12px; padding: .45rem .6rem; font-size: .85rem; color: #eaf4ee;
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 8px 22px rgba(0, 0, 0, .45), 0 0 16px rgba(95, 213, 146, .25);
}
#toasts { position: absolute; left: 10px; right: 10px; top: 54px; z-index: 14; display: flex; flex-direction: column; gap: .35rem; align-items: center; pointer-events: none; }
.toast { background: rgba(8, 26, 17, .92); border: 1px solid var(--line-strong); color: #eaf4ee; border-radius: 12px; padding: .45rem .75rem; font-size: .82rem; max-width: 100%; text-align: center; box-shadow: 0 8px 22px rgba(0, 0, 0, .45); animation: toastIn .3s ease; }
.toast.trophy { border-color: var(--gold); background: linear-gradient(180deg, rgba(70, 58, 20, .95), rgba(8, 26, 17, .95)); box-shadow: 0 8px 22px rgba(0, 0, 0, .45), 0 0 18px rgba(255, 211, 77, .35); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.abilities { position: absolute; left: 0; right: 0; bottom: 10px; z-index: 11; display: flex; justify-content: center; gap: .55rem; pointer-events: none; }
.ab {
    pointer-events: auto; position: relative; width: 58px; height: 58px; border-radius: 16px; overflow: hidden; cursor: pointer;
    background: linear-gradient(180deg, rgba(20, 56, 36, .92), rgba(8, 26, 17, .95)); border: 2px solid rgba(95, 213, 146, .5);
    box-shadow: 0 8px 20px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .1); color: #fff;
    transition: transform .1s, border-color .15s, box-shadow .15s; touch-action: manipulation;
}
.ab:active { transform: scale(.94); }
.ab .ab-ico { font-size: 1.5rem; line-height: 54px; display: block; }
.ab .ab-key { position: absolute; top: 3px; left: 5px; font-size: .62rem; font-weight: 800; color: var(--ink-dim); }
.ab .ab-cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, .62); transition: height .1s linear; }
.ab .ab-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: .9rem; text-shadow: 0 1px 3px #000; }
.ab.locked { opacity: .55; filter: grayscale(.6); }
.ab.ready { border-color: var(--gold); box-shadow: 0 8px 20px rgba(0, 0, 0, .5), 0 0 16px rgba(255, 211, 77, .5); animation: readyPop .3s ease; }
@keyframes readyPop { 50% { transform: scale(1.12); } }

.pause { position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(3, 10, 6, .62); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); border-radius: 16px; }
.pause-card { background: linear-gradient(170deg, rgba(22, 58, 37, .96), rgba(10, 32, 20, .96)); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem 1.3rem; width: min(92%, 320px); text-align: center; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); }
.pause-card h2 { margin: 0 0 .4rem; }
.pause-links { display: flex; justify-content: space-between; margin-top: .6rem; }

/* ---------- Shop sheet ---------- */
.sheet {
    background: linear-gradient(180deg, rgba(18, 48, 31, .97), rgba(9, 26, 16, .98));
    border: 1px solid var(--line); border-radius: 16px; padding: .7rem .8rem .9rem;
    display: flex; flex-direction: column; gap: .5rem;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.sheet-head { display: flex; align-items: center; gap: .5rem; }
.sheet-head h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.shop-money { font-size: 1.1rem; font-weight: 800; color: var(--gold); text-shadow: 0 0 14px rgba(255, 211, 77, .4); white-space: nowrap; }
.tabs { display: flex; gap: .3rem; background: rgba(0, 0, 0, .25); padding: .25rem; border-radius: 12px; }
.tab { flex: 1; background: transparent; border: 1px solid transparent; color: var(--ink-dim); border-radius: 9px; padding: .45rem .3rem; cursor: pointer; font-weight: 700; font-size: .85rem; transition: background .15s, color .15s; }
.tab.active { background: linear-gradient(180deg, #2c6b45, #1c4630); color: #fff; border-color: #3f9061; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); }
.shop-grid { display: grid; grid-template-columns: 1fr; gap: .45rem; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: #2c6b45 transparent; flex: 1 1 auto; min-height: 0; }
.shop-grid::-webkit-scrollbar { width: 8px; }
.shop-grid::-webkit-scrollbar-thumb { background: #2c6b45; border-radius: 99px; }
.up-card {
    background: linear-gradient(180deg, rgba(19, 52, 34, .9), rgba(11, 32, 20, .9)); border: 1px solid var(--line); border-radius: 14px;
    padding: .55rem .65rem; text-align: left; cursor: pointer; display: flex; gap: .6rem; align-items: center; color: var(--ink);
    transition: transform .1s, border-color .15s, box-shadow .15s; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.up-card:hover { border-color: #5fd592; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 0, 0, .3), 0 0 12px rgba(95, 213, 146, .18); }
.up-card:active { transform: scale(.985); }
.up-card.maxed, .up-card.owned { opacity: .6; cursor: default; transform: none; }
.up-card.owned { border-color: rgba(255, 211, 77, .45); opacity: .85; }
.up-card.cant { opacity: .5; cursor: not-allowed; transform: none; }
.up-card.place { border-color: rgba(95, 213, 146, .5); }
.up-ico { font-size: 1.45rem; line-height: 1; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .14), rgba(0, 0, 0, .25)); border: 1px solid rgba(95, 213, 146, .22); border-radius: 12px; width: 2.5rem; height: 2.5rem; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .4)); }
.up-body { flex: 1; min-width: 0; }
.up-name { font-weight: 700; font-size: .9rem; display: block; }
.up-desc { font-size: .74rem; color: var(--ink-dim); display: block; }
.up-lvl { font-size: .7rem; color: #7fd0a0; display: block; }
.pips { display: flex; gap: 2px; margin-top: 3px; }
.pips i { width: 8px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .15); }
.pips i.on { background: var(--gold); box-shadow: 0 0 4px rgba(255, 211, 77, .6); }
.up-cost { font-weight: 800; color: var(--gold); white-space: nowrap; font-size: .88rem; }
.shop-hint { text-align: center; color: var(--ink-dim); font-size: .78rem; margin: 0; min-height: 1.1em; }
#readyBtn { margin-top: 0; }

/* wide: shop beside the pitch */
@media (min-width: 900px) {
    .sheet { width: 340px; flex: 0 0 340px; max-height: calc(100vh - 150px); max-height: calc((100dvh - 150px - var(--sat) - var(--sab))); position: sticky; top: .5rem; }
    .sheet.collapsed .shop-grid, .sheet.collapsed .tabs, .sheet.collapsed .shop-hint { display: none; }
    #shopCollapse { display: none; }
}
/* narrow: shop as a bottom sheet over the lower pitch */
@media (max-width: 899px) {
    #stageWrap { flex-direction: column; align-items: center; }
    .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 18px 18px 0 0; max-height: min(62dvh, 560px); padding-bottom: calc(.9rem + var(--sab)); animation: sheetUp .3s cubic-bezier(.2, .9, .3, 1); }
    .sheet.collapsed { max-height: none; }
    .sheet.collapsed .shop-grid, .sheet.collapsed .tabs, .sheet.collapsed .shop-hint { display: none; }
    #shopCollapse { transform: rotate(0); transition: transform .2s; }
    .sheet.collapsed #shopCollapse { transform: rotate(180deg); }
    @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
    #game.shopping #stage { margin-bottom: 0; }
}
@media (max-width: 640px) {
    #game { padding: .35rem; }
    #hud { padding: .35rem .5rem .3rem; border-radius: 12px; position: sticky; top: var(--sat); z-index: 5; }
    .hud-row { flex-wrap: wrap; gap: .35rem .5rem; }
    .hud-item { font-size: .84rem; }
    .hud-btn { padding: .35rem .5rem; font-size: .95rem; min-width: 36px; min-height: 34px; }
    .lives-bar { width: 48px; }
    .panel { padding: 1rem .9rem 1.2rem; border-radius: 16px; }
    .panel h1, .gold { font-size: 1.6rem; }
    .tagline { font-size: .9rem; }
    .select-grid { grid-template-columns: 1fr; }
    .matchup { gap: .5rem; }
    .vs-team { flex-basis: 45%; min-width: 0; padding: .5rem; }
    .vs-team .tname { font-size: .9rem; }
    .kit-preview { width: 72px; height: 72px; }
    .mode-row { grid-template-columns: 1fr; }
    .perk-row { grid-template-columns: 1fr; }
    .perk { flex-direction: row; text-align: left; align-items: center; padding: .7rem .8rem; }
    .perk .p-ico { font-size: 1.7rem; }
    .perk .p-name { display: block; }
    .perk .p-desc { flex: 1 1 100%; }
    .ab { width: 52px; height: 52px; }
    .ab .ab-ico { font-size: 1.3rem; line-height: 48px; }
    #stage { width: min(100%, calc((100vh - 128px) * 540 / 860)); width: min(100%, calc((100dvh - 128px - var(--sat) - var(--sab)) * 540 / 860)); }
    .hud-row.sub { font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) {
    .big-btn::after, .logo .ball, .lives.danger, .bar.boss.enraged i { animation: none; }
}

/* feedback widget: keep it, but stay out of the way of the pitch and the shop sheet */
body:has(#game:not(.hidden)) .mf-fab { width: 40px; height: 40px; font-size: 18px; opacity: .55; bottom: calc(14px + var(--sab)); right: 12px; }
body:has(#game:not(.hidden)) .mf-fab:hover { opacity: 1; }
body:has(#game.shopping) .mf-fab { display: none; }
body:has(.pause:not(.hidden)) .mf-fab { display: none; }
