/* BU Ball shell styles. Palette tokens are shared with the in-game sprite colours; artwork is same-origin under assets/buball/. */
:root { --floor: #0b1426; --ink: #06101e; --rim: #f4fbff; --cyan: #19e6ff; --magenta: #ff3df2; --ball: #fff2b0; --amber: #ffb020; --violet: #8b7bff;
  --text: #eef4ff; --muted: #a9bce0; --line: rgba(139,123,255,0.32); --glass: rgba(8,15,32,0.78); --glass-strong: rgba(8,15,32,0.9);
  --radius: 18px; --ease: cubic-bezier(.2,.8,.2,1); --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050a14; color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--cyan); text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }
kbd { display: inline-block; min-width: 1.9em; padding: 1px 7px; border-radius: 6px; border: 1px solid #3a4d7d; border-bottom-width: 3px; background: #121d38;
  color: var(--text); font: 700 12px/1.5 var(--font); text-align: center; }

/* ---------- Screens + arena backdrop ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 24px; overflow: auto; overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(5,10,20,0.55) 0%, rgba(5,10,20,0.35) 40%, rgba(5,10,20,0.88) 100%),
    radial-gradient(ellipse 70% 60% at 50% 50%, rgba(5,10,20,0.15), rgba(5,10,20,0.75)),
    url("./assets/buball/menu-arena-1024.webp") center 55% / cover no-repeat, #050a14; }
.sub-screen { background:
    linear-gradient(180deg, rgba(5,10,20,0.78), rgba(5,10,20,0.92)),
    url("./assets/buball/menu-arena-1024.webp") center 55% / cover no-repeat, #050a14; }
.screen > .panel, .screen > .menu-stage { margin: auto; position: relative; z-index: 1; }

/* ---------- Main menu ---------- */
.menu-stage { width: min(1160px, 100%); display: grid; grid-template-columns: minmax(300px, 470px) minmax(0, 1fr); align-items: center; gap: 24px; }
.menu-card { padding: 34px 36px 26px; border-radius: 24px; background: linear-gradient(160deg, rgba(10,20,42,0.82), rgba(6,12,26,0.7));
  border: 1px solid var(--line); box-shadow: 0 24px 60px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter: blur(6px); animation: rise .55s var(--ease) both; }
.eyebrow { margin: 0 0 6px; display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; }
.eyebrow.small { font-size: 11px; margin-bottom: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-cyan { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.dot-magenta { background: var(--magenta); box-shadow: 0 0 10px var(--magenta); }
.logo { margin: 0; font-size: clamp(64px, 10vw, 112px); font-weight: 900; font-style: italic; letter-spacing: -0.035em; line-height: 0.9; color: var(--cyan);
  text-shadow: 0 0 22px rgba(25,230,255,0.55), 5px 5px 0 var(--ink), 6px 6px 0 rgba(25,230,255,0.35); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.logo span { color: var(--magenta); text-shadow: 0 0 22px rgba(255,61,242,0.55), 5px 5px 0 var(--ink), 6px 6px 0 rgba(255,61,242,0.35); }
.tagline { margin: 14px 0 24px; color: #d3def5; font-size: 16px; max-width: 34ch; }
.menu { display: grid; gap: 10px; }
.cta-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; }
.sub-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fine { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }
.touch-note { display: none; margin: 12px 0 0; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(255,176,32,0.55); background: rgba(255,176,32,0.1); color: var(--ball); font-size: 13px; }
.screen-footer { position: relative; z-index: 1; margin-top: 16px; text-align: center; color: var(--muted); font-size: 12px; text-shadow: 0 1px 2px #000; }

/* Mascots: waist-up cutouts, pivot bottom-centre, anchored flush to the bottom edge. */
.mascot-slot img { width: 100%; height: auto; filter: drop-shadow(0 0 18px rgba(25,230,255,0.33)) drop-shadow(0 0 30px rgba(255,61,242,0.18)); }
.mascot-slot.hero { position: fixed; z-index: 0; bottom: 0; right: max(0px, calc(50% - 600px)); width: min(46vw, 500px, 78vh); pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 82%, transparent); mask-image: linear-gradient(180deg, #000 82%, transparent); animation: rise-mascot .75s .1s var(--ease) both; }
.mascot-slot.side { position: fixed; z-index: 0; bottom: 0; right: max(0px, calc(50% - 720px)); width: min(30vw, 380px); pointer-events: none; opacity: 0.95;
  -webkit-mask-image: linear-gradient(180deg, #000 80%, transparent); mask-image: linear-gradient(180deg, #000 80%, transparent); animation: rise-mascot .6s var(--ease) both; }

/* ---------- Buttons + controls ---------- */
button { font: inherit; font-weight: 750; letter-spacing: 0.01em; color: var(--text); background: rgba(22,34,63,0.9); border: 1px solid #33467a; border-radius: 12px;
  padding: 12px 18px; min-height: 46px; cursor: pointer; transition: transform .15s var(--ease), border-color .15s, box-shadow .15s, background-color .15s; }
button:hover { border-color: var(--cyan); background: rgba(28,44,82,0.95); transform: translateY(-1px); }
button:active { transform: translateY(1px); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--ball); outline-offset: 2px; }
button.primary { position: relative; background: linear-gradient(100deg, #0aa8c2 0%, #6d47d9 55%, #c12bc4 100%); border: 1px solid rgba(255,255,255,0.22); color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45); box-shadow: 0 6px 22px rgba(25,230,255,0.22), 0 6px 22px rgba(255,61,242,0.18); }
button.primary:hover { border-color: rgba(255,255,255,0.55); box-shadow: 0 8px 30px rgba(25,230,255,0.35), 0 8px 30px rgba(255,61,242,0.3); }
button.cta { font-size: 17px; text-transform: uppercase; letter-spacing: 0.06em; }
button.secondary { border-color: rgba(25,230,255,0.55); color: #dffaff; }
button.ghost { background: rgba(10,18,36,0.6); border-color: #2b3a63; color: #d3def5; font-weight: 650; }
.actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.actions > button { flex: 1 1 auto; }
.actions.column { flex-direction: column; }

/* ---------- Panels + forms ---------- */
.panel { width: min(600px, 100%); padding: 26px 30px 28px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(25,230,255,0.06), inset 0 1px 0 rgba(255,255,255,0.05); backdrop-filter: blur(8px); animation: rise .4s var(--ease) both; }
.panel-head { margin-bottom: 8px; }
h2 { margin: 0 0 14px; font-size: 28px; font-weight: 850; letter-spacing: -0.01em; line-height: 1.15; }
.panel-head h2 { margin-bottom: 10px; }
h3 { margin: 18px 0 8px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--cyan); }
form label { display: grid; gap: 5px; margin: 10px 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
form label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; font-weight: 550; letter-spacing: 0; text-transform: none; cursor: pointer; }
select, input:not([type=checkbox]) { width: 100%; font: 500 15px/1.3 var(--font); letter-spacing: 0; text-transform: none; color: var(--text); background: #0d1730;
  border: 1px solid #2f4170; border-radius: 10px; padding: 10px 12px; min-height: 42px; }
select:hover, input:not([type=checkbox]):hover { border-color: #4a62a3; }
input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--cyan); }
.arena-field select { font-size: 16px; font-weight: 700; border-color: rgba(25,230,255,0.5); }
.arena-desc { margin: 0 0 6px; min-height: 1.5em; }
.grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.grid .check, .grid .wide { grid-column: 1 / -1; }
.checks { display: grid; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(139,123,255,0.18); }
.checks label.check { margin: 6px 0; }
form[data-kind=match] .practice-only, form[data-kind=practice] .match-only { display: none; }

/* ---------- Help ---------- */
.help { width: min(680px, 100%); }
.keys { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.keys > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 10px; border-radius: 10px; background: rgba(18,29,56,0.6); }
.keys dt { display: flex; gap: 4px; flex: 0 0 auto; order: 2; }
.keys dd { margin: 0; color: #d3def5; font-size: 14px; line-height: 1.3; }
.rules { margin: 0; padding-left: 20px; } .rules li { margin: 4px 0; color: #d3def5; font-size: 14px; } .rules li::marker { color: var(--magenta); }

/* ---------- Game + overlays ---------- */
.game-screen { padding: 0; background: #050a14; }
#game { width: 100vw; height: 100vh; display: block; outline: none; cursor: crosshair; background: #050a14; }
.overlay { position: absolute; inset: 0; display: flex; padding: 20px; overflow: auto; background: radial-gradient(ellipse at center, rgba(3,6,14,0.45), rgba(3,6,14,0.78)); backdrop-filter: blur(2px); }
.overlay > .panel { margin: auto; }
.panel.compact { width: min(340px, 100%); text-align: center; padding-top: 22px; }
.pause-panel .portrait { width: 132px; height: 132px; margin: -76px auto 4px; border-radius: 50%; overflow: hidden; border: 3px solid var(--ink);
  background: radial-gradient(circle at 50% 35%, #1b2b55, #0b1426); box-shadow: 0 0 0 2px var(--cyan), 0 0 24px rgba(25,230,255,0.4); }
.pause-panel .portrait img { width: 225%; max-width: none; margin: -12% 0 0 -64%; filter: none; }
#pause { padding-top: 96px; }
.pause-panel .fine { margin: 0 0 4px; }
.pause-panel .actions { margin-top: 16px; }
.hint { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); background: rgba(6,16,30,0.88); border: 1px solid var(--amber); color: var(--ball);
  padding: 9px 18px; border-radius: 999px; font-weight: 700; pointer-events: none; box-shadow: 0 0 20px rgba(255,176,32,0.25); animation: pulse 2.4s ease-in-out infinite; }

.results { width: min(720px, 100%); padding-top: 20px; }
.results-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 8px; }
.results .portrait { flex: 0 0 auto; width: 150px; height: 150px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 40%, rgba(255,61,242,0.25), rgba(25,230,255,0.08) 60%, transparent), #0b1426; }
.results .portrait img { filter: none; }
.results .art-loss, #results[data-outcome=loss] .art-win { display: none; }
#results[data-outcome=loss] .art-loss { display: block; }
.results-title-block { min-width: 0; padding-bottom: 6px; }
.results h2 { margin: 0 0 6px; font-size: 30px; }
.big-score { margin: 0; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; color: var(--ball); }
.table-wrap { overflow-x: auto; margin-top: 10px; border-radius: 12px; border: 1px solid rgba(139,123,255,0.2); }
.results table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.results th { padding: 8px 10px; text-align: left; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); background: rgba(18,29,56,0.85); }
.results td { padding: 8px 10px; border-top: 1px solid #1c2947; white-space: nowrap; }
.results th:nth-child(n+3), .results td:nth-child(n+3) { text-align: right; }
.results tbody tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.results tr.me td { color: var(--ball); font-weight: 800; background: rgba(255,176,32,0.08); }
.results tr.me td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes rise-mascot { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 12px rgba(255,176,32,0.18); } 50% { box-shadow: 0 0 26px rgba(255,176,32,0.45); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  button:hover, button:active { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .mascot-slot.side { display: none; } }
@media (max-width: 900px) {
  .menu-stage { grid-template-columns: 1fr; justify-items: center; gap: 0; }
  .mascot-slot.hero { position: relative; order: -1; right: auto; width: min(240px, 54vw); margin-bottom: -26px; }
  .menu-card { width: min(480px, 100%); }
}
@media (max-width: 900px), (pointer: coarse) { .touch-note { display: block; } }
@media (max-width: 560px) {
  .screen { padding: 14px; }
  .menu-card, .panel { padding: 22px 18px; }
  .cta-row, .sub-row, .grid, .keys { grid-template-columns: 1fr; }
  .results-head { align-items: center; }
  .results .portrait { width: 96px; height: 96px; }
  .results h2 { font-size: 22px; }
}
@media (max-height: 720px) { .panel { padding-top: 18px; padding-bottom: 20px; } h3 { margin-top: 12px; } .actions { margin-top: 16px; } form label { margin: 7px 0; } }
@media (max-height: 640px) and (min-width: 901px) { .mascot-slot.hero { width: min(40vw, 82vh); } .menu-card { padding-top: 24px; padding-bottom: 20px; } .tagline { margin-bottom: 16px; } }
