/* Quebra Pau! — festival-print UI. No external fonts or assets. */
:root {
  --plum: #1a1016; --plum2: #2a1424; --ink: #1a1016;
  --sun: #ffd23f; --orange: #ff7a2e; --red: #e8392f; --green: #1d9a4a; --leaf: #3fd16b; --blue: #2856c8; --sky: #3b9bff; --pink: #ff4fa3; --cream: #fff3c4;
  --font: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0b060c; color: var(--cream); font-family: var(--font); overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; background:
  radial-gradient(circle at 20% 20%, rgba(255,210,63,0.05) 0 2px, transparent 3px) 0 0 / 18px 18px,
  radial-gradient(circle at 70% 60%, rgba(63,209,107,0.05) 0 2px, transparent 3px) 0 0 / 22px 22px, #0b060c; }
#box { position: absolute; overflow: hidden; background: #000; box-shadow: 0 0 0 3px #1a1016, 0 0 40px rgba(0,0,0,0.8); }
#game { position: absolute; left: 0; top: 0; width: 100%; height: 100%; image-rendering: auto; }
body.pixelated #game { image-rendering: pixelated; image-rendering: crisp-edges; }
#ui { position: absolute; left: 0; top: 0; width: 960px; height: 540px; transform-origin: 0 0; pointer-events: none; }
#ui > .screen { position: absolute; inset: 0; pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- common widgets ---------- */
.panel { background: rgba(26,16,22,0.88); border: 4px solid var(--ink); box-shadow: 0 0 0 3px var(--sun), 6px 6px 0 3px var(--ink); }
.ribbon { display: inline-block; background: var(--sun); color: var(--ink); font-weight: 900; padding: 6px 18px 5px; transform: skew(-8deg); box-shadow: 4px 4px 0 var(--ink); letter-spacing: 0.5px; }
.ribbon > span { display: inline-block; transform: skew(8deg); }
.title-h { position: absolute; left: 0; right: 0; top: 18px; text-align: center; font-size: 30px; }
.btn { display: block; width: 100%; margin: 0 0 8px; padding: 9px 16px; font: 800 19px var(--font); color: var(--cream); text-align: left; cursor: pointer;
  background: linear-gradient(90deg, rgba(40,86,200,0.55), rgba(26,16,22,0.6)); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn small { display: block; font-weight: 600; font-size: 12px; opacity: 0.85; margin-top: 2px; white-space: normal; }
.btn.focus, .btn:focus-visible { background: linear-gradient(90deg, var(--sun), var(--orange)); color: var(--ink); transform: translateX(6px); box-shadow: 3px 3px 0 var(--ink), -6px 0 0 var(--green); }
.btn.focus small { opacity: 1; }
.btn[disabled] { opacity: 0.45; }
.hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 13px; font-weight: 700; color: #f1e3ff; text-shadow: 2px 2px 0 var(--ink); }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 2px solid var(--ink); background: var(--cream); color: var(--ink); font-weight: 900; font-size: 12px; border-radius: 3px; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- loading / title ---------- */
#loading { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--plum); }
#loading .bar { width: 520px; height: 26px; border: 4px solid var(--ink); box-shadow: 0 0 0 3px var(--sun); background: #3a1420; }
#loading .fill { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--sun) 0 16px, var(--orange) 16px 32px); }
#loading .lbl { margin-top: 18px; font-weight: 900; font-size: 20px; }
#loading .err { margin-top: 18px; max-width: 760px; max-height: 260px; overflow: auto; color: #ffb3a8; font: 13px/1.4 monospace; white-space: pre-wrap; pointer-events: auto; user-select: text; }
.loading-logo { font-weight: 900; font-size: 54px; color: var(--sun); text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--ink); margin-bottom: 28px; }
#title .press { position: absolute; left: 0; right: 0; bottom: 34px; text-align: center; }
#title .press .ribbon { font-size: 22px; animation: blink 1.2s steps(2, jump-none) infinite; }
body.reduced-motion #title .press .ribbon, body.reduced-flash #title .press .ribbon { animation: none; }
#title .tag { position: absolute; left: 0; right: 0; top: 136px; text-align: center; font-weight: 900; font-size: 18px; color: var(--cream); text-shadow: 3px 3px 0 var(--ink); letter-spacing: 1px; }
#title .sub { margin-top: 10px; font-size: 13px; font-weight: 700; text-shadow: 2px 2px 0 var(--ink); }
@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- main menu ---------- */
#menu .list { position: absolute; left: 60px; top: 150px; width: 400px; }
#menu .side { position: absolute; right: 50px; top: 170px; width: 380px; padding: 16px 20px; font-size: 15px; line-height: 1.45; }
#menu .side h3 { margin: 0 0 6px; color: var(--sun); font-size: 20px; }
.ver { position: absolute; right: 12px; bottom: 8px; font-size: 11px; opacity: 0.6; }

/* ---------- character select ---------- */
#select .grid { position: absolute; left: 50%; transform: translateX(-50%); bottom: 38px; display: grid; grid-template-columns: repeat(6, 84px); gap: 8px; }
.tile { position: relative; width: 84px; height: 84px; border: 4px solid var(--ink); background: linear-gradient(160deg, #3a2050, #1a1016); cursor: pointer; overflow: hidden; }
.tile canvas { position: absolute; left: 2px; top: 2px; width: 72px; height: 72px; image-rendering: pixelated; }
.tile .q { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 900; color: var(--sun); text-shadow: 3px 3px 0 var(--ink); }
.tile.c1 { box-shadow: 0 0 0 4px var(--sun); }
.tile.c2 { box-shadow: 0 0 0 4px var(--sky); }
.tile.c1.c2 { box-shadow: 0 0 0 4px var(--sun), 0 0 0 8px var(--sky); }
.tile .tag1, .tile .tag2 { position: absolute; top: 0; font: 900 11px var(--font); padding: 1px 4px; color: var(--ink); }
.tile .tag1 { left: 0; background: var(--sun); } .tile .tag2 { right: 0; background: var(--sky); }
.tile.locked1::after, .tile.locked2::after { content: ''; position: absolute; inset: 0; background: rgba(255,210,63,0.18); }
.info { position: absolute; top: 74px; width: 300px; padding: 10px 14px; font-size: 13px; line-height: 1.35; }
.info.p1 { left: 24px; } .info.p2 { right: 24px; text-align: right; }
.info h2 { margin: 0; font-size: 22px; color: var(--sun); line-height: 1.1; }
.info .nick { font-weight: 800; color: var(--leaf); margin: 2px 0 6px; }
.info .sp { margin-top: 6px; color: #ffd0f0; font-weight: 700; }
.info .lock { margin-top: 6px; font-weight: 900; color: var(--leaf); }

/* ---------- stage select / difficulty ---------- */
#stage .list, #diff .list { position: absolute; left: 40px; top: 90px; width: 330px; }
#stage .btn, #diff .btn { padding: 7px 14px; font-size: 17px; margin-bottom: 6px; }
#stage .preview { position: absolute; right: 40px; top: 110px; width: 480px; height: 270px; border: 4px solid var(--ink); box-shadow: 0 0 0 3px var(--sun); background: #000; }
#stage .preview img { width: 480px; height: 270px; image-rendering: pixelated; display: block; }
#stage .blurb { position: absolute; right: 40px; top: 396px; width: 480px; padding: 8px 12px; font-size: 13px; line-height: 1.35; }

/* ---------- versus card / bracket ---------- */
#vs .names { position: absolute; left: 0; right: 0; bottom: 34px; display: flex; justify-content: space-between; padding: 0 40px; font-size: 26px; font-weight: 900; text-shadow: 3px 3px 0 var(--ink); }
#vs .names span { background: rgba(26,16,22,0.8); padding: 4px 14px; border: 3px solid var(--ink); box-shadow: 0 0 0 3px var(--sun); }
#vs .vsmark { position: absolute; left: 0; right: 0; top: 210px; text-align: center; font-size: 84px; font-weight: 900; color: var(--sun); text-shadow: 5px 5px 0 var(--red), 10px 10px 0 var(--ink); }
#vs .bracket { position: absolute; left: 50%; transform: translateX(-50%); top: 72px; display: flex; gap: 6px; }
#vs .bracket .b { width: 132px; padding: 4px; font-size: 12px; font-weight: 800; text-align: center; border: 3px solid var(--ink); background: rgba(26,16,22,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#vs .bracket .b.done { background: var(--green); color: var(--cream); }
#vs .bracket .b.cur { background: var(--sun); color: var(--ink); }
#vs .bracket .b.final { border-color: var(--red); }
#vs .boutlbl { position: absolute; left: 0; right: 0; top: 18px; text-align: center; font-size: 22px; }

/* ---------- pause / results / options ---------- */
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 420px; padding: 18px 22px 12px; }
.modal h2 { margin: 0 0 12px; text-align: center; font-size: 28px; color: var(--sun); text-shadow: 3px 3px 0 var(--ink); }
.modal .btn { font-size: 17px; padding: 7px 14px; margin-bottom: 6px; }
.dimbg { position: absolute; inset: 0; background: rgba(10,4,14,0.55); }
#results .stats, #ending .stats { text-align: center; font-size: 14px; margin: -4px 0 12px; line-height: 1.5; }
#ending .modal { left: auto; right: 40px; top: 120px; transform: none; width: 440px; }
#ending .champ { position: absolute; left: 0; right: 0; top: 30px; text-align: center; font-size: 42px; font-weight: 900; color: var(--sun); text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--ink); }
#options .cols, #howto .cols { position: absolute; left: 30px; right: 30px; top: 74px; bottom: 40px; display: flex; gap: 20px; }
#options .col, #howto .col { flex: 1; padding: 12px 16px; overflow: hidden; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 10px; margin-bottom: 4px; font-weight: 800; font-size: 15px; border: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.opt .lbl { overflow: hidden; text-overflow: ellipsis; }
.opt .val { flex: none; min-width: 120px; text-align: right; color: var(--sun); }
.opt.focus { border-color: var(--ink); background: linear-gradient(90deg, var(--sun), var(--orange)); color: var(--ink); }
.opt.focus .val { color: var(--ink); }
.opt .slider { display: inline-block; width: 110px; height: 12px; border: 2px solid var(--ink); background: #3a1420; vertical-align: middle; margin-left: 8px; }
.opt .slider i { display: block; height: 100%; background: var(--leaf); }
h3.sec { margin: 4px 0 6px; font-size: 14px; color: var(--leaf); text-transform: uppercase; letter-spacing: 1px; }
.binds { width: 100%; border-collapse: collapse; font-size: 13px; }
.binds td { padding: 2px 4px; white-space: nowrap; }
.binds td.k { text-align: center; cursor: pointer; }
.binds td.k.focus .kbd { background: var(--sun); }
.binds td.k.wait .kbd { background: var(--pink); }
#howto p { margin: 0 0 8px; font-size: 13px; line-height: 1.4; }
#howto .btn { font-size: 15px; padding: 5px 12px; margin-bottom: 5px; }
#moves .movegrid { position: absolute; left: 30px; right: 30px; top: 74px; bottom: 90px; padding: 12px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; align-content: start; overflow: hidden; }
#moves .mv { font-size: 12px; line-height: 1.3; }
#moves .mv b { color: var(--sun); } #moves .mv i { color: #ffd0f0; font-style: normal; font-weight: 800; }
#moves .moveback { position: absolute; left: 50%; bottom: 40px; width: 240px; transform: translateX(-50%); }

/* ---------- training / misc HUD ---------- */
.toast { position: absolute; left: 50%; top: 120px; transform: translateX(-50%); padding: 6px 14px; font-weight: 800; font-size: 14px; }

/* ---------- accessibility ---------- */
body.high-contrast .btn { background: #000; color: #fff; border-color: #fff; }
body.high-contrast .btn.focus { background: #ffe600; color: #000; }
body.high-contrast .panel { background: #000; box-shadow: 0 0 0 3px #fff; }
body.high-contrast .hint, body.high-contrast .info { color: #fff; }
body.reduced-motion .btn.focus { transform: none; }

/* ---------- touch controls ---------- */
#touch { position: fixed; left: 0; right: 0; bottom: 0; height: 0; pointer-events: none; display: none; }
body.touch-on #touch { display: block; }
#dpad { position: fixed; width: 150px; height: 150px; border-radius: 50%; background: rgba(26,16,22,0.55); border: 3px solid rgba(255,210,63,0.8); pointer-events: auto; touch-action: none; }
#dpad .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: rgba(255,210,63,0.75); border: 3px solid #1a1016; }
#dpad .arrow { position: absolute; color: rgba(255,243,196,0.85); font-size: 18px; font-weight: 900; }
#dpad .up { left: 50%; top: 6px; transform: translateX(-50%); } #dpad .down { left: 50%; bottom: 6px; transform: translateX(-50%); }
#dpad .left { left: 8px; top: 50%; transform: translateY(-50%); } #dpad .right { right: 8px; top: 50%; transform: translateY(-50%); }
#tbuttons { position: fixed; width: 190px; height: 150px; pointer-events: none; }
.tb { position: absolute; width: 70px; height: 70px; border-radius: 50%; font: 900 22px var(--font); color: #1a1016; border: 3px solid #1a1016; pointer-events: auto; touch-action: none; opacity: 0.88; }
.tb[data-btn="lp"] { left: 0; bottom: 0; background: var(--sun); }
.tb[data-btn="hk"] { left: 80px; bottom: 30px; background: var(--orange); }
.tb[data-btn="sp"] { left: 30px; bottom: 78px; background: var(--sky); }
.tb[data-btn="th"] { left: 112px; bottom: 100px; width: 60px; height: 60px; font-size: 18px; background: var(--leaf); }
.tb.down { filter: brightness(1.35); transform: scale(0.94); }
#tpause { position: fixed; width: 48px; height: 36px; font: 900 16px var(--font); background: rgba(26,16,22,0.7); color: var(--cream); border: 3px solid var(--sun); pointer-events: auto; touch-action: none; }
