:root{
  --field-w: 480px;
  --field-h: 640px;
  --hud-w: 230px;
  --accent: #ff5d8f;
  --accent2: #7cf6ff;
  --gold: #ffd86b;
  --ink: #e9ecff;
}

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

html,body{
  width:100%; height:100%;
  background:
    radial-gradient(1200px 800px at 20% -10%, #2a1a4a 0%, transparent 60%),
    radial-gradient(1000px 700px at 110% 120%, #15324a 0%, transparent 55%),
    #07060f;
  color: var(--ink);
  font-family: "Segoe UI", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  overflow:hidden;
  display:flex; align-items:center; justify-content:center;
  -webkit-font-smoothing:antialiased;
}

#stage{
  display:flex; align-items:center; justify-content:center;
  width:100%; height:100%;
  padding:16px;
}

#frame{
  position:relative;
  width: calc(var(--field-w) + var(--hud-w));
  height: var(--field-h);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.01));
  box-shadow:
    0 0 0 1px rgba(255,255,255,.08),
    0 30px 80px rgba(0,0,0,.6),
    0 0 60px rgba(120,80,200,.25);
  padding: 14px;
  display:flex; gap:14px;
}

#game{
  width: var(--field-w);
  height: var(--field-h);
  border-radius: 8px;
  background:#05030c;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 0 30px rgba(0,0,0,.6);
  image-rendering: auto;
  display:block;
}

/* ---- HUD ---- */
#hud{
  width: calc(var(--hud-w) - 14px);
  display:flex; flex-direction:column;
  padding: 6px 4px;
  font-variant-numeric: tabular-nums;
}
.hud-row{
  display:flex; justify-content:space-between; align-items:center;
  padding: 5px 8px;
  font-size: 15px;
  letter-spacing:.5px;
}
.hud-row .lbl{
  font-size: 11px; letter-spacing: 2px;
  color: #9aa0c8; font-weight:700;
}
#score, #high{ color: var(--gold); font-weight:700; font-size:18px; text-shadow:0 0 10px rgba(255,216,107,.4);}
#power{ color: var(--accent2); font-weight:700;}
#graze{ color: var(--accent2);}
#gems{ color: var(--gold);}
#value{ color:#cdb6ff; font-weight:700; }
#combo{ color:#ff9ec4; font-weight:700; }

/* trance gauge */
.trance-row{ align-items:center; }
.gauge{
  position:relative; display:inline-block; width:116px; height:10px;
  border-radius:6px; background:rgba(255,255,255,.10);
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.08); overflow:hidden;
}
#trance-fill{
  position:absolute; left:0; top:0; height:100%; width:0%;
  background:linear-gradient(90deg,#7cf6ff,#b48cff);
  box-shadow:0 0 8px #a07cff; transition:width .12s linear;
}
.gauge .gauge-label{
  position:absolute; inset:0; text-align:center; font-size:7.5px; line-height:10px;
  letter-spacing:1.5px; color:#fff; opacity:0; transition:opacity .2s;
}
.gauge.ready{ box-shadow:inset 0 0 0 1px rgba(180,140,255,.7), 0 0 10px rgba(160,124,255,.6); }
.gauge.ready .gauge-label{ opacity:1; animation:tpulse 1s ease-in-out infinite; }
@keyframes tpulse{ 0%,100%{opacity:.55;} 50%{opacity:1;} }
.hud-divider{ height:1px; background:linear-gradient(90deg,transparent,rgba(255,255,255,.18),transparent); margin:7px 4px;}
.icons{ letter-spacing:2px; font-size:16px; }

#ctrlhelp{
  margin-top:auto;
  font-size:11.5px; line-height:1.9;
  color:#aab0d8;
  background: rgba(0,0,0,.25);
  border:1px solid rgba(255,255,255,.06);
  border-radius:8px;
  padding:10px 12px;
}
#ctrlhelp b{ color: var(--accent2); font-weight:700; }

/* ---- Boss banner ---- */
#bossbanner{
  position:absolute;
  top: 24px; left: 14px;
  width: var(--field-w);
  text-align:center;
  pointer-events:none;
  transition: opacity .4s;
}
#bossbanner.hidden{ opacity:0; }
#bossname{
  font-size: 26px; font-weight:800; letter-spacing:6px;
  color:#fff; text-shadow: 0 0 18px var(--accent), 0 2px 4px #000;
}
#spellname{
  margin-top:4px; font-size:15px; letter-spacing:3px;
  color: var(--gold); text-shadow:0 0 12px rgba(255,216,107,.6), 0 1px 2px #000;
}

/* ---- Overlay / title ---- */
#overlay{
  position:absolute; inset:14px;
  width: var(--field-w); height: var(--field-h);
  border-radius:8px;
  background: radial-gradient(700px 500px at 50% 30%, rgba(40,20,70,.86), rgba(5,3,12,.96));
  display:flex; align-items:center; justify-content:center;
  text-align:center;
  z-index:5;
  transition: opacity .5s;
}
#overlay.gone{ opacity:0; pointer-events:none; }

#ov-card{ width: 86%; }
.game-title{
  font-size: 72px; letter-spacing: 16px; font-weight:900;
  background: linear-gradient(180deg,#fff, var(--accent) 70%, #b13a6a);
  -webkit-background-clip:text; background-clip:text; color:transparent;
  text-shadow: 0 0 50px rgba(255,93,143,.45);
  margin-left:16px;
}
.game-sub{
  font-size:16px; letter-spacing:11px; color: var(--accent2);
  margin-top:2px; margin-left:11px; font-weight:700;
}
.tagline{ margin-top:18px; color:#c9cdf0; font-size:14px; letter-spacing:2px;}
#ov-body{ margin:22px 0 8px; color:#e7e9ff; font-size:14px; line-height:1.8; min-height:20px;}
#ov-body .big{ font-size:30px; color:var(--gold); font-weight:800; letter-spacing:2px; display:block; margin:6px 0;}
#ov-body .res-row{ display:flex; justify-content:space-between; max-width:260px; margin:6px auto; padding:0 8px; border-bottom:1px dashed rgba(255,255,255,.12);}
#ov-body .res-row span:last-child{ color:var(--gold); font-weight:700;}

#startbtn{
  margin-top:18px;
  font-size:18px; font-weight:800; letter-spacing:4px;
  color:#1b0b16;
  padding: 13px 34px;
  border:none; border-radius:40px; cursor:pointer;
  background: linear-gradient(180deg,#ffd0e0,var(--accent));
  box-shadow: 0 8px 26px rgba(255,93,143,.5), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .12s ease, box-shadow .12s;
}
#startbtn:hover{ transform: translateY(-2px) scale(1.03); box-shadow:0 12px 34px rgba(255,93,143,.65);}
#startbtn:active{ transform: translateY(0) scale(.98); }

.ov-hint{ margin-top:22px; font-size:12px; color:#9aa0c8; line-height:1.7; letter-spacing:1px;}

/* ---- difficulty / character menus ---- */
.menu-panel{ width:90%; }
.menu-h{ font-size:18px; letter-spacing:4px; color:var(--accent2); margin-bottom:18px; font-weight:800; }
.card-grid{ display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }
.menu-card{
  width:132px; padding:14px 12px; border-radius:12px; cursor:pointer;
  background:rgba(255,255,255,.05); border:1px solid rgba(255,255,255,.12);
  transition:transform .12s, box-shadow .12s, border-color .12s;
}
.menu-card:hover, .menu-card.sel{
  transform:translateY(-3px);
  border-color:var(--accent); box-shadow:0 10px 30px rgba(255,93,143,.4);
  background:rgba(255,255,255,.08);
}
.menu-card .mc-name{ font-size:19px; font-weight:800; letter-spacing:1px; }
.menu-card .mc-sub{ font-size:11px; color:var(--accent2); letter-spacing:1.5px; margin-top:2px; }
.menu-card .mc-blurb{ font-size:11px; color:#aab0d8; margin-top:8px; line-height:1.6; }
.menu-card canvas{ display:block; margin:4px auto 6px; }
.menu-back{
  margin-top:20px; background:none; border:1px solid rgba(255,255,255,.2);
  color:#c9cdf0; padding:8px 20px; border-radius:30px; cursor:pointer;
  font-size:14px; letter-spacing:2px; transition:border-color .12s, color .12s;
}
.menu-back:hover{ border-color:var(--accent); color:#fff; }

#atk{ color:#7cf6a0; font-weight:700; }

/* secondary ghost button on the title card */
.ghost-btn{
  display:block; margin:12px auto 0;
  background:none; border:1px solid rgba(255,255,255,.22);
  color:#c9cdf0; padding:8px 22px; border-radius:30px; cursor:pointer;
  font-size:13px; letter-spacing:2px; transition:border-color .12s, color .12s, transform .12s;
}
.ghost-btn:hover{ border-color:var(--accent2); color:#fff; transform:translateY(-1px); }

/* spell-card gallery */
#spell-list{ max-height:420px; overflow-y:auto; padding:2px 6px; }
.spell-boss{ margin-bottom:14px; }
.spell-boss-name{ font-size:14px; font-weight:800; letter-spacing:2px; margin:6px 0 8px; }
.spell-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:7px 12px; margin:5px 0; border-radius:9px;
  background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08);
  font-size:13px;
}
.spell-row .sp-status{ font-size:15px; width:24px; text-align:center; }
.spell-row .sp-name{ flex:1; text-align:left; padding:0 10px; }
.spell-row .sp-sub{ font-size:10px; color:#9aa0c8; letter-spacing:1px; }
.spell-row.captured{ border-color:rgba(255,216,107,.5); background:rgba(255,216,107,.07); }
.spell-row.seen{ border-color:rgba(124,246,255,.3); }
.spell-row.locked{ opacity:.5; }
.spell-row.captured .sp-name{ color:var(--gold); }
.practice-btn{
  background:none; border:1px solid rgba(124,246,255,.4); color:var(--accent2);
  padding:5px 14px; border-radius:20px; cursor:pointer; font-size:12px; letter-spacing:1px;
  transition:border-color .12s, background .12s;
}
.practice-btn:hover{ background:rgba(124,246,255,.12); border-color:var(--accent2); }
.menu-card .mc-best{ font-size:10.5px; color:var(--gold); margin-top:6px; letter-spacing:.5px; }
.menu-card.locked{ cursor:default; }
.menu-card.locked:hover{ transform:none; border-color:rgba(255,255,255,.12); box-shadow:none; background:rgba(255,255,255,.05); }
.menu-card.locked .mc-name{ color:#8a8aa8; }
.menu-card.locked .mc-blurb{ color:#9aa0c8; }

.hidden{ display:none; }
