:root {
  --orange: #ff8a2a;
  --orange-2: #ffb347;
  --gold: #ffd23f;
  --cyan: #58c8ef;
  --red: #ff4d4d;
  --bg: #120a06;
  --panel: rgba(28, 16, 9, 0.86);
  --panel-2: rgba(48, 28, 14, 0.9);
  --line: rgba(255, 190, 120, 0.25);
  --line-strong: rgba(255, 190, 120, 0.6);
  --text: #fff4e4;
  --muted: #c9ae90;
  --p1: #ff8a2a;
  --p2: #58c8ef;
  --display: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --body: 'Rubik', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  user-select: none; -webkit-user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; transition: filter 0.4s; }
body.in-menu #game { filter: blur(3px) brightness(0.55) saturate(1.1); }
body.in-fight { cursor: none; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

kbd {
  display: inline-block;
  min-width: 1.7em;
  font-family: var(--body);
  font-weight: 700;
  font-size: 0.8em;
  text-align: center;
  padding: 2px 7px;
  margin: 0 2px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 6px;
  background: rgba(255, 190, 120, 0.1);
  color: var(--gold);
  vertical-align: middle;
}

/* ============ EKRANY ============ */
.screen {
  position: fixed; inset: 0; z-index: 2;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  padding: 24px 16px;
}
.screen.show { display: flex; animation: fadeIn 0.25s ease-out; }
.screen.overlay { background: rgba(10, 5, 2, 0.55); backdrop-filter: blur(2px); }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }

.scr-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: 0.02em;
  color: var(--gold);
  text-shadow: 0 4px 0 #6a2e00, 0 8px 24px rgba(0, 0, 0, 0.6);
  text-transform: uppercase;
}

/* ============ LOGO ============ */
.logo { text-align: center; line-height: 0.85; transform: rotate(-3deg); }
.logo-top, .logo-bottom {
  font-family: var(--display);
  font-size: clamp(64px, 12vw, 150px);
  letter-spacing: 0.02em;
  -webkit-text-stroke: 4px #2a1206;
  paint-order: stroke fill;
}
.logo-top {
  background: linear-gradient(#fff6c8, #ffb347 55%, #e0670f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 7px 0 #5a2400) drop-shadow(0 16px 24px rgba(0, 0, 0, 0.6));
}
.logo-bottom {
  font-size: clamp(76px, 14vw, 178px);
  background: linear-gradient(#ffe5e5, #ff5d4d 50%, #a8170c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 7px 0 #4a0800) drop-shadow(0 16px 24px rgba(0, 0, 0, 0.6));
  margin-top: -0.06em;
}
.logo-sub {
  font-family: var(--body); font-weight: 700;
  font-size: clamp(13px, 1.6vw, 18px);
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text); margin-top: 18px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}
.logo.small .logo-top { font-size: clamp(44px, 7vw, 84px); }
.logo.small .logo-bottom { font-size: clamp(52px, 8vw, 100px); }

.press {
  font-family: var(--display); font-size: clamp(20px, 2.6vw, 30px);
  margin-top: 40px; animation: blink 1.2s infinite;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
}
@keyframes blink { 50% { opacity: 0.35; } }
.title-foot { position: absolute; bottom: 22px; color: var(--muted); font-size: 14px; letter-spacing: 0.06em; text-align: center; }

/* ============ PRZYCISKI ============ */
.menu-list { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 92vw); }
.menu-list.row { flex-direction: row; flex-wrap: wrap; min-width: 0; }
.btn {
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0.03em;
  text-align: left;
  padding: 12px 22px;
  border-radius: 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.4);
  transition: transform 0.08s, border-color 0.12s, background 0.12s;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
}
.btn small { font-family: var(--body); font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.btn.big { font-size: 28px; padding: 14px 24px; }
.btn.focus, .btn:hover {
  border-color: var(--orange);
  background: linear-gradient(90deg, rgba(255, 138, 42, 0.32), var(--panel-2));
  transform: translateX(6px);
}
.btn.focus::before { content: '▶'; position: absolute; margin-left: -34px; color: var(--orange); font-size: 18px; }
.menu-list.row .btn.focus, .menu-list.row .btn:hover { transform: translateY(-3px); }
.menu-list.row .btn.focus::before { content: none; }

.menu-hint { color: var(--muted); font-size: 14px; text-align: center; text-shadow: 0 2px 4px #000; }

/* ============ WYBÓR POSTACI ============ */
#scr-select { justify-content: flex-start; padding-top: 22px; gap: 14px; }
.sel-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.sel-card {
  position: relative;
  width: 150px; height: 170px;
  border-radius: 16px;
  background: var(--panel);
  border: 3px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.1s;
}
.sel-card canvas { width: 100%; height: 100%; display: block; }
.sel-card .nm {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-family: var(--display); font-size: 16px; text-align: center;
  padding: 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}
.sel-card.c1 { border-color: var(--p1); box-shadow: 0 0 0 3px rgba(255, 138, 42, 0.35), 0 0 24px rgba(255, 138, 42, 0.5); transform: translateY(-4px); }
.sel-card.c2 { border-color: var(--p2); box-shadow: 0 0 0 3px rgba(88, 200, 239, 0.35), 0 0 24px rgba(88, 200, 239, 0.5); transform: translateY(-4px); }
.sel-card.c1.c2 { border-color: #fff; }
.sel-card .tag {
  position: absolute; top: 6px;
  font-family: var(--display); font-size: 15px; padding: 2px 8px; border-radius: 8px;
}
.sel-card .tag.t1 { left: 6px; background: var(--p1); color: #2a1206; }
.sel-card .tag.t2 { right: 6px; background: var(--p2); color: #062a36; }

.sel-panels { display: flex; align-items: stretch; gap: 18px; width: min(1180px, 96vw); }
.sel-vs {
  align-self: center;
  font-family: var(--display); font-size: 60px; color: var(--red);
  -webkit-text-stroke: 3px #2a0606; paint-order: stroke fill;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.7);
}
.sel-panel {
  flex: 1;
  display: flex; gap: 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  min-height: 250px;
}
.sel-panel.p1 { border-color: rgba(255, 138, 42, 0.6); }
.sel-panel.p2 { border-color: rgba(88, 200, 239, 0.6); flex-direction: row-reverse; text-align: right; }
.sel-panel.ready { box-shadow: 0 0 0 3px rgba(125, 255, 154, 0.5); }
.sel-panel canvas { width: 210px; height: 230px; flex: none; }
.sel-info { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sel-who { font-family: var(--display); font-size: 15px; letter-spacing: 0.08em; }
.p1 .sel-who { color: var(--p1); }
.p2 .sel-who { color: var(--p2); }
.sel-name { font-family: var(--display); font-size: 34px; line-height: 1; }
.sel-sub { color: var(--gold); font-weight: 700; font-size: 14px; }
.sel-desc { font-size: 14px; color: var(--muted); line-height: 1.45; }
.sel-meta { font-size: 13px; color: var(--text); }
.sel-meta b { color: var(--gold); }
.sel-ready {
  margin-top: auto; font-family: var(--display); font-size: 22px; color: #7dff9a;
  text-shadow: 0 2px 6px #000;
}
.sel-cpu { font-size: 14px; color: var(--cyan); }

.sel-stage { text-align: center; }
.sel-stage h2 { font-family: var(--display); font-weight: 400; font-size: 28px; color: var(--gold); margin-bottom: 10px; }
.stage-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.stage-card {
  width: 220px; border-radius: 14px; overflow: hidden; cursor: pointer;
  border: 3px solid var(--line); background: var(--panel);
}
.stage-card canvas { width: 100%; height: 124px; display: block; }
.stage-card div { font-family: var(--display); font-size: 17px; padding: 6px; }
.stage-card small { display: block; font-family: var(--body); font-size: 12px; color: var(--muted); }
.stage-card.focus { border-color: var(--gold); transform: translateY(-4px); box-shadow: 0 0 22px rgba(255, 210, 63, 0.45); }

/* ============ LISTA CIOSÓW ============ */
#scr-movelist { justify-content: flex-start; padding-top: 24px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tab {
  font-family: var(--display); font-size: 18px;
  padding: 8px 16px; border-radius: 12px;
  background: var(--panel); border: 2px solid var(--line);
}
.tab.on { border-color: var(--orange); background: rgba(255, 138, 42, 0.3); }
.ml-keys { font-size: 13px; color: var(--muted); text-align: center; }
.ml-body {
  width: min(1100px, 96vw);
  flex: 1; min-height: 0;
  overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 14px;
  align-content: start;
  padding: 4px 6px 12px;
}
.ml-sec { background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 12px 14px; }
.ml-sec h3 { font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--gold); margin-bottom: 8px; }
.ml-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid rgba(255, 190, 120, 0.12); align-items: baseline; }
.ml-row:first-of-type { border-top: none; }
.ml-name { font-weight: 700; font-size: 15px; }
.ml-desc { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.inp { font-weight: 700; font-size: 15px; color: var(--orange-2); white-space: nowrap; letter-spacing: 0.02em; }
.ml-sec.hl { border-color: rgba(255, 77, 77, 0.6); }
.ml-sec.hl h3 { color: #ff8a8a; }

/* ============ STEROWANIE ============ */
.ctrl-grid { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.ctrl-card { background: var(--panel); border: 2px solid var(--line); border-radius: 18px; padding: 16px 20px; min-width: 300px; }
.ctrl-card.p1 { border-color: rgba(255, 138, 42, 0.6); }
.ctrl-card.p2 { border-color: rgba(88, 200, 239, 0.6); }
.ctrl-card h3 { font-family: var(--display); font-weight: 400; font-size: 24px; margin-bottom: 10px; }
.ctrl-card.p1 h3 { color: var(--p1); }
.ctrl-card.p2 h3 { color: var(--p2); }
.ctrl-row { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; font-size: 15px; }
.ctrl-row span:first-child { color: var(--muted); }
.ctrl-notes { width: min(860px, 94vw); font-size: 14px; color: var(--muted); line-height: 1.5; display: grid; gap: 6px; }
.ctrl-notes b { color: var(--text); }

/* ============ OPCJE ============ */
.opt-list { display: flex; flex-direction: column; gap: 8px; width: min(560px, 94vw); }
.opt {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; border-radius: 14px;
  background: var(--panel); border: 2px solid var(--line);
  font-size: 17px; cursor: pointer;
}
.opt .val { font-family: var(--display); font-size: 20px; color: var(--gold); }
.opt .val::before { content: '◀ '; color: var(--muted); font-size: 14px; }
.opt .val::after { content: ' ▶'; color: var(--muted); font-size: 14px; }
.opt.focus { border-color: var(--orange); background: rgba(255, 138, 42, 0.22); }

/* ============ PAUZA I WYNIKI ============ */
.pause-box, .res-box {
  background: var(--panel); border: 2px solid var(--line-strong);
  border-radius: 24px; padding: 26px 34px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.res-box { flex-direction: row; gap: 26px; max-width: 96vw; }
.res-box canvas { width: 300px; height: 300px; }
.res-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.res-label { font-family: var(--display); color: var(--muted); letter-spacing: 0.12em; font-size: 16px; }
.res-name { font-family: var(--display); font-size: 48px; line-height: 1; }
.res-quote { font-style: italic; color: var(--gold); font-size: 17px; max-width: 460px; }
.res-stats { border-collapse: collapse; font-size: 14px; margin: 4px 0 6px; }
.res-stats th, .res-stats td { padding: 4px 12px; text-align: center; border-bottom: 1px solid rgba(255, 190, 120, 0.15); }
.res-stats th:first-child, .res-stats td:first-child { text-align: left; color: var(--muted); }
.res-stats th { font-family: var(--display); font-weight: 400; font-size: 16px; }

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: 12px; padding: 8px 16px; font-size: 14px;
  opacity: 0; transition: opacity 0.3s; z-index: 5; pointer-events: none;
}
#toast.show { opacity: 1; }

@media (max-width: 900px) {
  .sel-panels { flex-direction: column; }
  .sel-vs { font-size: 36px; }
  .sel-panel canvas { width: 140px; height: 160px; }
  .sel-card { width: 110px; height: 130px; }
  .res-box { flex-direction: column; }
}
@media (max-height: 760px) {
  .sel-panel { min-height: 0; }
  .sel-panel canvas { width: 160px; height: 176px; }
  .sel-card { width: 120px; height: 136px; }
  .sel-desc { display: none; }
}
