:root {
  --bg: #05020d;
  --ink: #fff8ff;
  --muted: #b9a8d9;
  --hot: #ff2fb3;
  --hot-2: #ff7adf;
  --blue: #35d6ff;
  --violet: #7b3dff;
  --lime: #aaff5f;
  --gold: #ffd86b;
  --bad: #ff5574;
  --good: #4dffbf;
  --glass: rgba(255,255,255,0.09);
  --glass-2: rgba(255,255,255,0.16);
  --line: rgba(255,255,255,0.18);
  --shadow: 0 28px 90px rgba(0,0,0,0.5);
  --radius: 28px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  min-height: 100vh;
  font-family: ui-rounded, "Nunito", "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 16%, rgba(255,47,179,0.44), transparent 22rem),
    radial-gradient(circle at 92% 6%, rgba(53,214,255,0.34), transparent 26rem),
    radial-gradient(circle at 48% 95%, rgba(123,61,255,0.34), transparent 28rem),
    linear-gradient(180deg, #070313 0%, #130626 52%, #04010b 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, black, transparent 82%);
}

.stage-lights {
  position: fixed;
  inset: -20% -10% auto;
  height: 80vh;
  pointer-events: none;
  background:
    conic-gradient(from 220deg at 20% 0%, transparent 0 12%, rgba(255,47,179,0.22) 13% 18%, transparent 20% 100%),
    conic-gradient(from 140deg at 80% 0%, transparent 0 12%, rgba(53,214,255,0.18) 13% 18%, transparent 20% 100%);
  filter: blur(4px);
  animation: lights 7s ease-in-out infinite alternate;
}

@keyframes lights {
  from { transform: translateX(-2vw) rotate(-1deg); opacity: 0.75; }
  to { transform: translateX(2vw) rotate(1deg); opacity: 1; }
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 56px;
  position: relative;
  z-index: 1;
}

h1, h2, h3, p { margin-top: 0; }

.game-hero {
  min-height: 440px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 360px;
  gap: 22px;
  align-items: stretch;
  padding: clamp(22px, 4vw, 42px);
  border-radius: 38px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.05)),
    radial-gradient(circle at 70% 30%, rgba(255,216,107,0.18), transparent 18rem);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 0 80px rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
}

.game-hero::after {
  content: "✦ ✧ ✦ ✧ ✦";
  position: absolute;
  right: 24px;
  bottom: 18px;
  font-size: 2.8rem;
  letter-spacing: 0.28em;
  color: rgba(255,255,255,0.1);
  transform: rotate(-7deg);
}

.hero-copy { align-self: center; }

.eyebrow, .kicker {
  margin: 0 0 9px;
  color: var(--lime);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 950;
  font-size: 0.78rem;
}

h1 {
  font-size: clamp(3.4rem, 11vw, 8.2rem);
  line-height: 0.78;
  letter-spacing: -0.09em;
  margin: 0 0 22px;
  text-shadow: 0 0 34px rgba(255,47,179,0.58), 0 8px 0 rgba(0,0,0,0.22);
}

.subtitle {
  color: #f0ddff;
  max-width: 660px;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  line-height: 1.45;
  margin-bottom: 24px;
}

.hero-actions, .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  border: 0;
  cursor: pointer;
  color: var(--ink);
  font-weight: 950;
  font-family: inherit;
}

.primary, .secondary, .ghost {
  border-radius: 18px;
  padding: 13px 18px;
  transform: translateZ(0);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.primary {
  background: linear-gradient(135deg, var(--hot), var(--violet));
  box-shadow: 0 14px 34px rgba(255,47,179,0.28), inset 0 1px 0 rgba(255,255,255,0.35);
}

.secondary {
  background: rgba(255,255,255,0.13);
  border: 1px solid var(--line);
}

.ghost {
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--line);
}

.big { font-size: 1rem; padding: 16px 22px; }

.primary:hover, .secondary:hover, .ghost:hover, .choice:hover, .world:hover, .reward:hover {
  transform: translateY(-2px) scale(1.01);
  filter: saturate(1.12);
}

.idol-card {
  position: relative;
  border-radius: 34px;
  min-height: 360px;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255,216,107,0.30), transparent 7rem),
    linear-gradient(160deg, rgba(255,47,179,0.28), rgba(53,214,255,0.12));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  text-align: center;
  overflow: hidden;
}

.idol-aura {
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: conic-gradient(from 20deg, var(--hot), var(--blue), var(--gold), var(--hot));
  filter: blur(18px);
  opacity: 0.58;
  animation: spin 9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.idol-face {
  position: relative;
  z-index: 1;
  width: 150px;
  height: 150px;
  border-radius: 46px;
  display: grid;
  place-items: center;
  font-size: 4rem;
  background: rgba(0,0,0,0.32);
  border: 1px solid rgba(255,255,255,0.24);
  box-shadow: inset 0 0 44px rgba(255,255,255,0.08), 0 20px 60px rgba(0,0,0,0.35);
}

.idol-info {
  position: relative;
  z-index: 1;
  width: 100%;
}

.rank-label {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(170,255,95,0.15);
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 950;
  margin-bottom: 8px;
}

.idol-info strong {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.power-bars {
  display: grid;
  gap: 8px;
}

.power-bars span {
  display: flex;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 13px;
  background: rgba(0,0,0,0.22);
  color: #f7e9ff;
}

.tabs {
  position: sticky;
  top: 10px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 24px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(5,2,13,0.65);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.11);
}

.tab {
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
  border: 1px solid transparent;
}

.tab.active {
  background: linear-gradient(135deg, rgba(255,47,179,0.95), rgba(53,214,255,0.75));
  box-shadow: 0 12px 28px rgba(255,47,179,0.22);
}

.master-tab { opacity: 0.74; }

.screen { display: none; }
.screen.active { display: block; animation: screenIn 0.35s ease both; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin: 10px 0 18px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  letter-spacing: -0.045em;
}

.section-title p { color: var(--muted); margin-bottom: 0; max-width: 520px; }
.section-title.compact { align-items: center; margin-top: 28px; }

.world-grid, .reward-grid, .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 16px;
}

.world, .reward, .stat, .mission-card, .lab-form, .error-item, .side-quest-panel {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.world {
  min-height: 245px;
  border-radius: 30px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.world::before {
  content: "";
  position: absolute;
  inset: -40% -30% auto auto;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: var(--world-glow, rgba(255,47,179,0.35));
  filter: blur(4px);
}

.world .crystal {
  position: relative;
  z-index: 1;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  border-radius: 24px;
  background: rgba(0,0,0,0.27);
  border: 1px solid rgba(255,255,255,0.16);
  margin-bottom: 16px;
}

.world h3 { font-size: 1.35rem; margin-bottom: 8px; }
.world p, .reward p, .stat p, .side-quest-panel p { color: var(--muted); }
.world button { align-self: flex-start; }

.battle-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 18px;
  align-items: start;
}

.battle-card {
  border-radius: 34px;
  padding: clamp(18px, 4vw, 30px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,216,107,0.16), transparent 18rem),
    linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
}

.mission-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--lime);
  font-weight: 950;
  margin-bottom: 18px;
}

.versus-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.fighter {
  min-height: 112px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.14);
}

.fighter-icon { font-size: 2.8rem; }
.fighter strong { font-size: 0.95rem; }

.vs {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #12051f;
  background: var(--gold);
  font-weight: 1000;
  box-shadow: 0 0 34px rgba(255,216,107,0.5);
}

.combo-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(0,0,0,0.22);
  margin-bottom: 18px;
  color: var(--muted);
}

.combo-strip strong {
  color: var(--gold);
  font-size: 1.35rem;
}

.challenge-prompt {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  color: #f3e6ff;
  margin-bottom: 18px;
}

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.choice {
  min-height: 86px;
  border-radius: 22px;
  padding: 20px;
  font-size: clamp(1.35rem, 4vw, 2.1rem);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08));
  border: 1px solid rgba(255,255,255,0.17);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.choice:active { transform: scale(0.98); }

.feedback {
  min-height: 48px;
  font-size: 1.08rem;
  font-weight: 950;
  display: flex;
  align-items: center;
}
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.feedback.pop { animation: pop 0.45s ease both; }

@keyframes pop {
  0% { transform: scale(0.94); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.side-quest-panel {
  border-radius: 28px;
  padding: 22px;
  position: sticky;
  top: 100px;
}

.mini-reward {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,216,107,0.12);
  border: 1px solid rgba(255,216,107,0.28);
}

.reward {
  min-height: 210px;
  border-radius: 28px;
  padding: 18px;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05)),
    radial-gradient(circle at 50% 0%, rgba(255,216,107,0.16), transparent 11rem);
}

.reward::before {
  content: "";
  position: absolute;
  inset: -40% -80%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
  transform: rotate(24deg);
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 55% { transform: translateX(-35%) rotate(24deg); opacity: 0; }
  70% { opacity: 1; }
  100% { transform: translateX(35%) rotate(24deg); opacity: 0; }
}

.reward.locked { opacity: 0.42; filter: grayscale(0.3); }
.reward .icon { font-size: 3rem; margin-bottom: 14px; }
.reward .rarity { color: var(--gold); letter-spacing: 0.08em; font-weight: 1000; }
.reward h3 { font-size: 1.45rem; margin-bottom: 6px; }

.master-screen { opacity: 0.96; }

.lab-form {
  border-radius: 30px;
  padding: 22px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lab-form label {
  display: grid;
  gap: 7px;
  color: #dfd2f4;
  font-weight: 850;
}

.lab-form label:nth-child(4), .lab-form button { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0,0,0,0.24);
  color: var(--ink);
  font: inherit;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(53,214,255,0.12);
}

.error-list { display: grid; gap: 12px; }
.error-item { border-radius: 22px; padding: 16px; }
.error-item strong { color: var(--gold); }

.stat {
  border-radius: 26px;
  padding: 20px;
}
.stat .big {
  font-size: 2.55rem;
  font-weight: 1000;
  color: var(--gold);
}

.confetti {
  position: fixed;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 999;
  animation: confettiFall 1.2s ease-in forwards;
}

@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(420deg); opacity: 0; }
}

@media (max-width: 900px) {
  .game-hero, .battle-layout { grid-template-columns: 1fr; }
  .idol-card { min-height: 280px; }
  .side-quest-panel { position: static; }
}

@media (max-width: 680px) {
  .app-shell { width: min(100% - 18px, 1180px); padding-top: 10px; }
  .game-hero { border-radius: 26px; min-height: auto; }
  .tabs { position: static; }
  .section-title { flex-direction: column; align-items: stretch; }
  .versus-row { grid-template-columns: 1fr; }
  .vs { margin: -4px auto; }
  .lab-form { grid-template-columns: 1fr; }
  h1 { font-size: clamp(3.1rem, 16vw, 5.4rem); }
}
