:root {
  color-scheme: dark;
  --bg: #080711;
  --ink: #090713;
  --obsidian: #15111f;
  --panel: rgba(17, 14, 28, 0.96);
  --panel-hard: #1d1428;
  --ember: #ff7a1a;
  --venom: #b6ff5c;
  --arcane: #9b5cff;
  --gold: #ffd166;
  --cyan: #62e6ff;
  --rose: #ff4fa3;
  --text: #fff8e8;
  --muted: rgba(255,248,232,.66);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,122,26,.26), transparent 32%),
    radial-gradient(circle at 82% 8%, rgba(98,230,255,.20), transparent 30%),
    linear-gradient(180deg, #170d21 0, var(--bg) 62%, #05040a 100%);
  color: var(--text);
  font-family: Inter, ui-rounded, system-ui, sans-serif;
  overflow: hidden;
}
body { display: block; padding: 0; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255,255,255,.035) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
  opacity: .34;
}
.phone {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  padding: max(5px, env(safe-area-inset-top)) 7px max(5px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 5px;
  overflow: hidden;
}

.hud { min-width: 0; }
.boss-card {
  min-width: 0;
  position: relative;
  background:
    linear-gradient(90deg, rgba(255,122,26,.22), transparent 26%),
    linear-gradient(135deg, rgba(98,230,255,.13), rgba(255,79,163,.08)),
    var(--panel);
  border: 1px solid rgba(255,209,102,.26);
  border-left: 4px solid var(--ember);
  border-right: 4px solid rgba(98,230,255,.58);
  border-radius: 18px 26px 18px 26px;
  padding: 5px 10px 5px 7px;
  box-shadow:
    0 12px 30px rgba(0,0,0,.40),
    inset 0 0 0 1px rgba(255,255,255,.06),
    inset 0 -12px 22px rgba(0,0,0,.18);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  overflow: hidden;
}
.boss-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 48%, rgba(255,255,255,.10) 49%, transparent 52% 100%);
  opacity: .55;
}
.boss-card canvas {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255,209,102,.40);
  background: radial-gradient(circle at 50% 42%, rgba(255,209,102,.24), rgba(0,0,0,.30));
  box-shadow: inset 0 0 18px rgba(255,255,255,.08), 0 0 18px rgba(255,122,26,.18);
  image-rendering: pixelated;
}
.boss-copy { position: relative; z-index: 1; min-width: 0; }
.boss-card span {
  display: block;
  width: fit-content;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0,0,0,.24);
  color: var(--cyan);
  font-size: 8px;
  opacity: .92;
  text-transform: uppercase;
  letter-spacing: .13em;
  line-height: 1;
  font-weight: 950;
}
.boss-card strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(18px, 5.4vw, 26px);
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 0 16px rgba(255,122,26,.18);
}
.boss-progress {
  display: grid;
  grid-template-columns: minmax(0, .48fr) minmax(0, 1.52fr);
  gap: 5px;
  margin-top: 4px;
}
.boss-progress span {
  width: auto;
  min-width: 0;
  display: block;
  padding: 3px 6px;
  border-radius: 9px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.18);
  color: rgba(255,248,232,.62);
  letter-spacing: 0;
  text-transform: none;
}
.boss-progress small {
  display: block;
  color: var(--cyan);
  font-size: 8px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}
.boss-progress b {
  display: block;
  min-width: 0;
  color: var(--gold);
  font-size: clamp(9px, 2.85vw, 11px);
  font-weight: 950;
  line-height: 1.18;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.game-wrap {
  position: relative;
  min-height: 0;
  width: 100%;
  height: 100%;
}

#game {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  border-radius: 22px;
  border: 2px solid rgba(255,209,102,.30);
  box-shadow:
    0 18px 52px rgba(0,0,0,.52),
    0 0 0 1px rgba(98,230,255,.18),
    inset 0 0 0 1px rgba(255,255,255,.10);
  background: #130b1d;
  touch-action: none;
}
.game-overlay {
  position: absolute;
  inset: 10px;
  z-index: 30;
  display: grid;
  align-items: end;
  justify-items: center;
  padding-bottom: clamp(14px, 5.2vh, 42px);
  pointer-events: auto;
}
.game-overlay[hidden] { display: none; }
.overlay-panel {
  width: min(86%, 322px);
  padding: 14px 14px;
  border-radius: 22px;
  border: 1px solid rgba(255,209,102,.34);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,209,102,.24), transparent 42%),
    linear-gradient(135deg, rgba(255,122,26,.18), rgba(98,230,255,.10)),
    rgba(9, 7, 16, .92);
  box-shadow: 0 22px 60px rgba(0,0,0,.62), inset 0 1px 0 rgba(255,255,255,.12);
  text-align: center;
  backdrop-filter: blur(3px);
}
.overlay-panel span {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.overlay-panel strong {
  display: block;
  margin: 6px 0 5px;
  color: var(--text);
  font-size: clamp(24px, 7.2vw, 34px);
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 20px rgba(255,209,102,.22);
}
.overlay-panel p {
  margin: 0 0 10px;
  color: rgba(255,248,232,.76);
  font-size: 12px;
  font-weight: 750;
}
.overlay-panel button,
.fusion-button {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  min-height: 40px;
  background: linear-gradient(135deg, var(--venom), var(--gold));
  color: #140d18;
  font-size: 14px;
  font-weight: 950;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.20), 0 0 26px rgba(255,209,102,.30);
}
.overlay-panel button.secondary {
  margin-top: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--arcane));
  color: #fff8e8;
}
.fusion-button {
  position: absolute;
  z-index: 25;
  left: 50%;
  top: 50%;
  width: min(68%, 260px);
  transform: translate(-50%, -50%);
  animation: fusionPulse 1.1s ease-in-out infinite;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.fusion-button[hidden] { display: none; }
@keyframes fusionPulse {
  0%, 100% { filter: brightness(1); box-shadow: 0 0 18px rgba(255,209,102,.45), inset 0 -3px 0 rgba(0,0,0,.2); }
  50% { filter: brightness(1.32); box-shadow: 0 0 38px rgba(182,255,92,.70), 0 0 70px rgba(98,230,255,.24), inset 0 -3px 0 rgba(0,0,0,.2); }
}

.controls {
  min-width: 0;
  position: relative;
  background:
    linear-gradient(90deg, rgba(255,122,26,.16), rgba(182,255,92,.08) 54%, rgba(98,230,255,.08)),
    rgba(12, 9, 18, .94);
  border: 1px solid rgba(255,209,102,.16);
  border-left: 3px solid rgba(255,122,26,.72);
  border-radius: 15px 20px 15px 20px;
  padding: 5px 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  box-shadow:
    0 10px 22px rgba(0,0,0,.32),
    inset 0 1px 0 rgba(255,255,255,.08);
}
.run-info {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 3px;
}
.run-info span {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  color: rgba(255,248,232,.62);
  font-size: clamp(8px, 2.35vw, 10px);
  font-weight: 900;
  line-height: 1.02;
  text-transform: uppercase;
  letter-spacing: .04em;
  overflow: hidden;
}
.run-info b {
  min-width: 0;
  color: var(--text);
  font-size: clamp(10px, 3.2vw, 13px);
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.help, .status, .next { display: none; }
.micro-actions {
  position: relative;
  display: flex;
  justify-content: flex-end;
}
.menu-toggle {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(98,230,255,.95), rgba(182,255,92,.92));
  color: #120d18;
  font-size: 18px;
  line-height: 1;
}
.action-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 7px);
  width: max-content;
  min-width: 154px;
  padding: 6px;
  display: grid;
  gap: 5px;
  border-radius: 15px;
  border: 1px solid rgba(255,209,102,.22);
  background:
    linear-gradient(135deg, rgba(255,122,26,.13), rgba(98,230,255,.08)),
    rgba(10, 7, 16, .98);
  box-shadow: 0 18px 40px rgba(0,0,0,.50), inset 0 1px 0 rgba(255,255,255,.08);
  z-index: 20;
}
.action-menu[hidden] { display: none; }
.action-menu button {
  width: 100%;
  justify-content: center;
  background: linear-gradient(135deg, var(--rose), var(--gold));
}
.action-menu #newGameBtn { background: linear-gradient(135deg, var(--cyan), var(--arcane)); color: #fff8e8; }
.action-menu #skipFusionBtn { background: linear-gradient(135deg, var(--venom), var(--gold)); color: #120d18; }
.action-menu .technical-action {
  min-height: 28px;
  padding: 5px 8px;
  border-top: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(135deg, rgba(255,255,255,.13), rgba(98,230,255,.18));
  color: rgba(255,248,232,.72);
  font-size: clamp(9px, 2.8vw, 11px);
}
button {
  border: 0;
  border-radius: 11px;
  padding: 7px 9px;
  min-height: 34px;
  color: #1a1021;
  font-size: clamp(11px, 3.4vw, 13px);
  font-weight: 950;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.18), 0 6px 12px rgba(0,0,0,.22);
}
button:disabled { opacity: .72; cursor: wait; filter: grayscale(.25); }
.legal-footer {
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255,209,102,.12);
  border-radius: 999px;
  background: rgba(8, 7, 17, .62);
  color: rgba(255,248,232,.70);
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
  font-size: clamp(8px, 2.6vw, 10px);
  line-height: 1;
  text-align: center;
  overflow: hidden;
}
.legal-footer strong { color: var(--gold); font-size: inherit; white-space: nowrap; }
.legal-footer span { display: none; }
.legal-footer nav { display: flex; justify-content: center; gap: 7px; flex-wrap: nowrap; min-width: 0; }
.legal-footer a { color: var(--cyan); text-decoration: none; font-weight: 850; white-space: nowrap; }
.legal-footer a:hover { text-decoration: underline; }

.legal-page {
  min-height: 100%;
  display: block;
  padding: 18px 12px 28px;
  overflow: auto;
}
.legal-shell {
  width: min(100%, 760px);
  margin: 0 auto;
  background:
    radial-gradient(circle at 8% 0%, rgba(255,122,26,.22), transparent 34%),
    radial-gradient(circle at 92% 10%, rgba(98,230,255,.16), transparent 32%),
    linear-gradient(135deg, rgba(255,255,255,.08), rgba(255,255,255,.025)),
    rgba(12, 9, 20, .96);
  border: 1px solid rgba(255,209,102,.18);
  border-radius: 22px;
  box-shadow: 0 28px 90px rgba(0,0,0,.52), inset 0 1px 0 rgba(255,255,255,.09);
  overflow: hidden;
}
.legal-hero {
  padding: 24px 22px 18px;
  border-bottom: 1px solid rgba(255,209,102,.14);
  background: linear-gradient(135deg, rgba(255,122,26,.14), rgba(98,230,255,.07));
}
.legal-hero a,
.legal-content a { color: var(--cyan); font-weight: 850; text-decoration: none; }
.legal-hero a:hover,
.legal-content a:hover { text-decoration: underline; }
.legal-eyebrow {
  color: var(--gold);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .16em;
}
.legal-hero h1 { margin: 8px 0 8px; font-size: clamp(30px, 8vw, 48px); line-height: .96; }
.legal-hero p { margin: 0; color: var(--muted); line-height: 1.45; }
.legal-content { padding: 18px 22px 24px; display: grid; gap: 14px; }
.legal-content section {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,209,102,.10);
}
.legal-content h2 { margin: 0 0 8px; font-size: 18px; color: var(--gold); }
.legal-content p,
.legal-content li { color: rgba(255,248,232,.82); line-height: 1.5; }
.legal-content p { margin: 0 0 8px; }
.legal-content p:last-child { margin-bottom: 0; }
.legal-content ul { margin: 0; padding-left: 20px; }
.legal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.legal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--cyan), var(--venom));
  color: #12101a !important;
  font-weight: 950;
}
.legal-button.secondary { background: rgba(255,255,255,.08); color: var(--text) !important; border: 1px solid rgba(255,209,102,.18); }

@media (min-width: 560px) {
  body { display: grid; place-items: start center; }
  .phone { max-width: 520px; }
}

@media (max-width: 360px) {
  .phone { padding-left: 5px; padding-right: 5px; gap: 4px; }
  .boss-card { grid-template-columns: 44px minmax(0, 1fr); padding: 5px 8px; }
  .boss-card canvas { width: 44px; height: 44px; }
  .button-row { width: 42vw; }
  .legal-footer { gap: 5px; }
  .legal-footer nav { gap: 5px; }
}
