:root {
  --bg: #0c0a12;
  --panel: #1a1424;
  --text: #f3e8ff;
  --muted: #a78bb8;
  --accent: #f59e0b;
  --accent2: #fb7185;
  --line: rgba(255, 200, 140, 0.18);
  --hp: #ef4444;
  --mp: #3b82f6;
  --awake: #fbbf24;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(1000px 500px at 50% -5%, #2a1838 0%, var(--bg) 55%);
  color: var(--text);
  overflow-x: hidden;
}
body { display: flex; flex-direction: column; min-height: 100vh; }

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 8px;
  width: 100%;
}
.screen.active { display: flex; }

#screen-play.active {
  padding: 0;
  justify-content: stretch;
  align-items: stretch;
}
#screen-play.active ~ .site-footer,
body:has(#screen-play.active) .site-footer { display: none; }

.hero { text-align: center; max-width: 720px; }
.logo-mark {
  width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 18px;
  background: conic-gradient(from 210deg, #ff6428, #3c8cff, #a07846, #8ce6b4, #ff6428);
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.35); position: relative;
}
.logo-mark::after {
  content: "AB"; position: absolute; inset: 6px; border-radius: 14px;
  background: #1a1024; display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.05em; color: var(--accent);
}
h1 {
  font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 8px; letter-spacing: 0.02em;
  text-shadow: 0 2px 24px rgba(251, 113, 133, 0.35);
}
.tagline { color: var(--muted); font-size: 1.05rem; margin: 0 0 28px; line-height: 1.5; }
.controls-hint { margin-top: 18px; color: var(--muted); font-size: 0.85rem; }

.btn {
  appearance: none; border: 1px solid transparent; border-radius: 12px;
  padding: 12px 28px; font-size: 1rem; font-weight: 700; cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a0a10; box-shadow: 0 8px 28px rgba(245, 158, 11, 0.35);
}
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,0.06); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; border-radius: 8px; }

.select-wrap { width: min(1100px, 100%); }
.select-wrap h2 { text-align: center; margin: 0 0 16px; }
.select-layout {
  display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start;
}
@media (max-width: 840px) {
  .select-layout { grid-template-columns: 1fr; }
  #preview-canvas { display: none; }
}
#preview-canvas {
  width: 100%; height: 420px; border-radius: 16px;
  background: linear-gradient(180deg, #1e1630, #0e0a14);
  border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
#kit-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.kit-card {
  text-align: left; background: var(--panel); border: 2px solid transparent;
  border-radius: 14px; padding: 14px; color: inherit; cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}
.kit-card:hover { transform: translateY(-2px); border-color: var(--kit, var(--accent)); }
.kit-card.selected { border-color: var(--kit, var(--accent)); box-shadow: 0 0 0 1px var(--kit); }
.kit-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.kit-card .role { margin: 0; color: var(--muted); font-size: 0.8rem; }
.kit-card .desc { margin: 8px 0; font-size: 0.85rem; color: #d4c4e0; }
.kit-card .stats { display: flex; gap: 10px; list-style: none; padding: 0; margin: 0 0 8px; font-size: 0.75rem; color: var(--muted); }
.kit-card .skills { list-style: none; padding: 0; margin: 0; font-size: 0.78rem; }
.kit-card .skills li { margin: 2px 0; }
.kit-card kbd {
  display: inline-block; min-width: 28px; text-align: center;
  background: rgba(0,0,0,0.35); border-radius: 4px; padding: 1px 4px; margin-right: 4px;
  font-size: 0.7rem;
}
.kit-card .pick {
  display: inline-block; margin-top: 8px; font-size: 0.75rem; font-weight: 700;
  color: var(--kit, var(--accent));
}
.select-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }

.play-shell {
  position: relative; flex: 1; width: 100%; height: 100vh; min-height: 100dvh;
  background: #000; overflow: hidden;
}
#game-canvas {
  display: block; width: 100%; height: 100%; touch-action: none;
  cursor: crosshair;
}

.hud {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px 16px 20px;
}
.hud:not([hidden]) { display: flex !important; }
.hud .btn, .hud button { pointer-events: auto; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hud-brand {
  flex: 1; text-align: center; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,220,160,0.55);
  text-shadow: 0 1px 4px #000; padding-top: 8px;
}
.hud-kills {
  background: rgba(10,8,16,0.7); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 14px; text-align: center; backdrop-filter: blur(8px);
}
.hud-kills span { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.hud-kills strong { font-size: 1.4rem; color: var(--accent); }
.hud-center-hint {
  align-self: center; background: rgba(0,0,0,0.55); padding: 10px 18px;
  border-radius: 999px; font-size: 0.9rem; color: #eee; border: 1px solid var(--line);
  transition: opacity 0.3s;
}
.hud-center-hint.hidden { opacity: 0; pointer-events: none; }

.hud-bottom {
  display: flex; flex-direction: column; gap: 10px;
  max-width: 640px; width: 100%; align-self: center;
}
.bars { display: flex; flex-direction: column; gap: 5px; }
.bar {
  position: relative; height: 20px; border-radius: 5px; background: rgba(0,0,0,0.62);
  border: 1px solid rgba(255,255,255,0.14); overflow: hidden;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.4);
}
.bar.awake { height: 14px; border-color: rgba(251, 191, 36, 0.35); }
.bar-fill { height: 100%; width: 100%; transition: width 0.1s linear; }
.bar.hp .bar-fill { background: linear-gradient(90deg, #7f1d1d, var(--hp), #fca5a5); }
.bar.mp .bar-fill { background: linear-gradient(90deg, #1e3a8a, var(--mp), #93c5fd); }
.bar.awake .bar-fill {
  background: linear-gradient(90deg, #92400e, var(--awake), #fde68a);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.45);
}
.bar span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 700; text-shadow: 0 1px 2px #000;
}
.bar.awake span { font-size: 0.62rem; letter-spacing: 0.06em; }

.skill-row {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(18,14,28,0.55), rgba(8,6,14,0.78));
  border: 1px solid rgba(255,200,140,0.2);
  box-shadow: 0 8px 28px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(10px);
}
.skill-slot {
  position: relative; width: 78px; height: 72px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(40,32,52,0.9), rgba(16,12,24,0.95));
  border: 2px solid rgba(255,210,150,0.22);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; gap: 1px;
  box-shadow: inset 0 0 12px rgba(0,0,0,0.35);
}
.skill-slot kbd {
  font-size: 0.78rem; font-weight: 800; color: var(--accent);
  background: rgba(0,0,0,0.35); border-radius: 4px; padding: 1px 6px; min-width: 20px; text-align: center;
}
.skill-slot .sk-keyhint {
  font-size: 0.55rem; color: rgba(200,180,220,0.55); text-transform: uppercase; letter-spacing: 0.04em;
}
.skill-slot .sk-name {
  font-size: 0.62rem; color: #eee; text-align: center; padding: 0 4px;
  line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.skill-slot .cd {
  position: absolute; inset: 0; background: rgba(0,0,0,0.6);
  transform-origin: bottom; transform: scaleY(0); pointer-events: none;
}
.skill-slot.skill-awaken {
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(180deg, rgba(60,40,10,0.9), rgba(20,12,4,0.95));
}
.skill-slot.skill-awaken.ready {
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.55), inset 0 0 10px rgba(251, 191, 36, 0.2);
  border-color: #fbbf24;
  animation: awakePulse 1s ease-in-out infinite;
}
@keyframes awakePulse {
  0%, 100% { box-shadow: 0 0 10px rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 22px rgba(251, 191, 36, 0.75); }
}

.mobile-controls {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
}
.joy-zone {
  pointer-events: auto; position: absolute; left: 20px; bottom: 28px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,0.07); border: 2px solid rgba(255,255,255,0.22);
  touch-action: none; box-shadow: inset 0 0 20px rgba(0,0,0,0.35);
}
.joy-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  margin: -26px 0 0 -26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd080, rgba(245, 158, 11, 0.85));
  border: 2px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.mob-btns {
  pointer-events: auto; position: absolute; right: 14px; bottom: 20px;
  display: grid; grid-template-columns: repeat(3, 58px); gap: 10px;
  justify-items: center;
}
.mob-btn {
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.28);
  background: radial-gradient(circle at 35% 30%, rgba(60,48,80,0.9), rgba(16,12,28,0.88));
  color: #fff; font-weight: 800; font-size: 0.85rem;
  touch-action: manipulation; box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.mob-btn:active { background: rgba(245,158,11,0.6); transform: scale(0.94); }
.mob-btn.mob-atk {
  width: 68px; height: 68px; font-size: 1.2rem;
  border-color: rgba(251,113,133,0.55); grid-column: 3; grid-row: 1 / 3; align-self: center;
}
.mob-btn.mob-dash { border-color: rgba(59,130,246,0.5); }
.mob-btn.mob-jump { border-color: rgba(140,230,180,0.5); }
.mob-btn.mob-ult {
  border-color: rgba(251,191,36,0.65); color: #fbbf24;
  grid-column: 1 / 3; width: 100%; border-radius: 14px; height: 48px;
}

.site-footer {
  text-align: center; padding: 10px; font-size: 0.75rem; color: var(--muted);
}

@media (pointer: fine) {
  .mobile-controls { display: none !important; }
}

@media (max-width: 560px) {
  .skill-slot { width: 58px; height: 62px; }
  .skill-slot .sk-name { font-size: 0.52rem; }
  .hud-brand { display: none; }
}
