:root {
  --ink: #140c08;
  --sand: #e7c28a;
  --gold: #f0c14b;
  --blood: #ff5a3c;
  --ok: #6ee7a8;
  --panel: rgba(12, 8, 6, 0.62);
  --line: rgba(240, 193, 75, 0.28);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #070504;
  color: #f6ead7;
  font-family: Rajdhani, system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
canvas#game { position: fixed; inset: 0; display: block; }
#overlay2d { position: fixed; inset: 0; pointer-events: none; z-index: 5; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 520px at 50% 18%, rgba(255, 140, 60, 0.18), transparent 60%),
    rgba(6, 3, 2, 0.55);
  backdrop-filter: blur(6px);
}
.screen.hidden { display: none; }

.card {
  width: min(760px, 92vw);
  padding: 28px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(42, 24, 14, 0.88), rgba(12, 8, 6, 0.92));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.kicker {
  letter-spacing: 0.28em;
  font-weight: 700;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 6px;
}
h1 {
  font-family: Cinzel, serif;
  font-weight: 900;
  font-size: clamp(34px, 7vw, 64px);
  margin: 0 0 6px;
  line-height: 0.95;
  background: linear-gradient(180deg, #fff4d2, #e0a24a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sub { opacity: 0.88; margin: 0 0 18px; font-size: 18px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
  margin: 12px 0 18px;
}
.glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  line-height: 1.45;
  font-size: 14px;
}
kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  font-weight: 700;
  font-size: 12px;
}

.btn {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 800;
  font-family: inherit;
  font-size: 16px;
}
.btn.primary {
  background: linear-gradient(90deg, #ffd36a, #ff8a2a);
  color: #1a0e04;
}
.btn.ghost {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.16);
  margin-left: 8px;
}

#hud {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  display: none;
}
#hud.show { display: block; }

.bar-wrap {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  width: min(560px, 86vw);
}
.bar {
  height: 16px;
  border-radius: 999px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.18);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7dff9a, #1faa5a);
  transform-origin: left center;
  transition: transform 0.08s linear;
}
.specials {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.sbar {
  flex: 1;
  height: 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.14);
  position: relative;
  overflow: hidden;
}
.sbar > i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
}
.sbar.rush > i { background: linear-gradient(90deg, #7ad7ff, #2b7cff); }
.sbar.spin > i { background: linear-gradient(90deg, #ffd36a, #ff8a2a); }
.sbar.pound > i { background: linear-gradient(90deg, #ff8a6a, #ff3b3b); }
.sbar.roar > i { background: linear-gradient(90deg, #e2b0ff, #9b5cff); }
.sbar .tag {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.sbar.ready { box-shadow: 0 0 14px rgba(255, 210, 90, 0.55); }

.pills {
  position: absolute;
  left: 12px;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pill {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 800;
  backdrop-filter: blur(8px);
  font-size: 14px;
}
.combo {
  position: absolute;
  right: 16px;
  top: 18px;
  text-align: right;
  text-shadow: 0 8px 18px #000;
}
.combo .n {
  font-family: Cinzel, serif;
  font-size: 42px;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}
.combo .rank {
  font-size: 18px;
  letter-spacing: 0.2em;
  font-weight: 800;
}
.hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  opacity: 0.7;
  font-size: 13px;
  letter-spacing: 0.06em;
}

#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9;
  background: #fff;
  opacity: 0;
}

.joy {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 122px;
  height: 122px;
  border-radius: 50%;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.16);
  z-index: 12;
  display: none;
  pointer-events: auto;
  touch-action: none;
}
.joy .stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,.28);
  border: 2px solid rgba(255,255,255,.55);
}
.abtn {
  position: fixed;
  z-index: 12;
  display: none;
  pointer-events: auto;
  border: 0;
  color: #1a0e04;
  font-weight: 900;
  font-family: inherit;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
}
.abtn.punch {
  right: 18px;
  bottom: 18px;
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at 30% 30%, #ffe08a, #ff7a1a);
}
.abtn.rush { right: 122px; bottom: 22px; width: 58px; height: 58px; background: #7ad7ff; font-size: 12px; }
.abtn.spin { right: 108px; bottom: 86px; width: 58px; height: 58px; background: #ffd36a; font-size: 12px; }
.abtn.pound { right: 22px; bottom: 122px; width: 58px; height: 58px; background: #ff8a6a; font-size: 12px; }
.abtn.roar { right: 168px; bottom: 70px; width: 50px; height: 50px; background: #d9a6ff; font-size: 11px; }

body.mobile .joy, body.mobile .abtn { display: flex; }
body.mobile .hint { display: none; }

.loadbar {
  width: min(420px, 80vw);
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
  margin: 18px auto 0;
}
.loadbar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd36a, #ff8a2a);
}

@media (max-width: 900px) {
  body.mobile .pills { top: 70px; }
  body.mobile .combo { top: 70px; }
  .grid { grid-template-columns: 1fr; }
}
