@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Nunito:wght@700;800;900&display=swap');
:root { --display: 'Lilita One', 'Arial Black', sans-serif; --body: 'Nunito', system-ui, sans-serif;
  --common: #b8c2cc; --rare: #3fa9ff; --epic: #b45cff; --legendary: #ffb52e; --gold: #ffd84a; --ink: #14102a; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6fb6ff; color: #fff; font-family: var(--body);
  user-select: none; -webkit-user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font-family: var(--display); font-size: 22px; letter-spacing: 1px; color: #fff; border: 0; border-radius: 16px; padding: 12px 22px;
  cursor: pointer; background: linear-gradient(180deg, #5b6cff, #3a3fd6); box-shadow: 0 5px 0 #24268f, 0 8px 18px rgba(0,0,0,0.25);
  text-shadow: 0 2px 0 rgba(0,0,0,0.25); transition: transform 0.08s, filter 0.15s; }
button:hover { filter: brightness(1.1); } button:active { transform: translateY(3px); box-shadow: 0 2px 0 #24268f; }
button.green { background: linear-gradient(180deg, #4ee06a, #1fa63c); box-shadow: 0 5px 0 #127028, 0 8px 18px rgba(0,0,0,0.25); }
button.gold { background: linear-gradient(180deg, #ffd84a, #ff9d1a); box-shadow: 0 5px 0 #b35f00, 0 8px 18px rgba(0,0,0,0.25); color: #4a2600; text-shadow: none; }
button.red { background: linear-gradient(180deg, #ff6a6a, #d6304a); box-shadow: 0 5px 0 #8a1a2c, 0 8px 18px rgba(0,0,0,0.25); }
button.small { font-size: 16px; padding: 8px 14px; border-radius: 12px; }
button:disabled { filter: grayscale(1) brightness(0.8); cursor: default; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; box-sizing: border-box; z-index: 10; }
.title { font-family: var(--display); font-size: clamp(54px, 10vw, 120px); line-height: 0.9; text-align: center; color: #fff;
  text-shadow: 0 6px 0 #3a2fb8, 0 10px 0 #22197a, 0 18px 30px rgba(0,0,0,0.35); transform: rotate(-3deg); }
.title small { display: block; font-size: 0.24em; letter-spacing: 6px; color: var(--gold); text-shadow: 0 3px 0 #8a5a00; }
.topbar { position: fixed; top: 12px; right: 14px; display: flex; gap: 10px; z-index: 12; }
.pill { background: rgba(20,16,42,0.6); border-radius: 999px; padding: 6px 16px 6px 10px; font-family: var(--display); font-size: 22px; display: flex; align-items: center; gap: 8px; }
.coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #ffc21a 55%, #c27a00); box-shadow: 0 0 0 2px #8a5200 inset; display: inline-block; }
.homeBtns { display: flex; flex-direction: column; gap: 14px; width: min(340px, 86vw); margin-top: 18px; }
.homeBtns button { font-size: 30px; padding: 16px; }
.homeBtns .row { display: flex; gap: 12px; } .homeBtns .row button { flex: 1; font-size: 20px; }
.hint { font-weight: 800; opacity: 0.9; text-shadow: 0 2px 6px rgba(0,0,0,0.4); text-align: center; }

/* cards */
.cards { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 980px; }
.card { width: 190px; border-radius: 18px; padding: 10px 10px 12px; background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(230,236,255,0.95));
  color: var(--ink); text-align: center; cursor: pointer; position: relative; box-shadow: 0 6px 0 var(--rc), 0 10px 24px rgba(0,0,0,0.25);
  border: 4px solid var(--rc); transition: transform 0.12s; }
.card:hover { transform: translateY(-4px) scale(1.03); }
.card img { width: 150px; height: 150px; display: block; margin: 0 auto; }
.card b { font-family: var(--display); font-size: 22px; display: block; font-weight: 400; }
.card .rar { font-family: var(--display); font-size: 14px; letter-spacing: 2px; color: var(--rc); }
.card .lvl { position: absolute; top: 8px; left: 10px; background: var(--rc); color: #fff; border-radius: 10px; padding: 2px 8px; font-family: var(--display); font-size: 15px; }
.card .pow { font-size: 13px; font-weight: 800; opacity: 0.8; margin-top: 2px; }
.card .pinfo { font-size: 11px; font-weight: 700; opacity: 0.75; margin: 1px 4px 0; line-height: 1.2; }
.card .stats { font-size: 12px; font-weight: 800; opacity: 0.65; }
.card.locked { filter: grayscale(1) brightness(0.55); cursor: default; } .card.locked:hover { transform: none; }
.r-common { --rc: var(--common); } .r-rare { --rc: var(--rare); } .r-epic { --rc: var(--epic); } .r-legendary { --rc: var(--legendary); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; width: min(900px, 94vw); max-height: 70vh; overflow-y: auto; padding: 8px; box-sizing: border-box; }
.grid .card { width: auto; } .grid .card img { width: 110px; height: 110px; }
h2 { font-family: var(--display); font-weight: 400; font-size: 44px; margin: 0; text-shadow: 0 4px 0 #3a2fb8, 0 8px 20px rgba(0,0,0,0.3); }

/* roll reveal */
#reveal .rname { font-family: var(--display); font-size: 54px; text-shadow: 0 4px 0 rgba(0,0,0,0.3); }
#reveal .rrar { font-family: var(--display); font-size: 26px; letter-spacing: 6px; }
#reveal .rnote { font-weight: 900; font-size: 18px; }
#reveal .spacer { height: 44vh; }

/* battle HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.bars { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; gap: 14px; }
.side { width: min(40vw, 420px); }
.side.r { text-align: right; }
.side .nm { font-family: var(--display); font-size: 24px; text-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.side .nm small { font-size: 15px; opacity: 0.85; margin: 0 6px; }
.hpbar { height: 20px; border-radius: 10px; background: rgba(20,16,42,0.55); overflow: hidden; border: 3px solid #fff; position: relative; }
.hpbar i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px; }
.side.r .hpbar i { left: auto; right: 0; }
.hpbar .lag { background: #fff; opacity: 0.7; } .hpbar .fill { background: linear-gradient(180deg, #7dff7d, #26c04a); }
.side.r .hpbar .fill { background: linear-gradient(180deg, #ff8a8a, #e0304a); }
.cdbar { height: 7px; margin-top: 5px; border-radius: 4px; background: rgba(20,16,42,0.45); overflow: hidden; width: 70%; display: inline-block; }
.cdbar i { display: block; height: 100%; background: linear-gradient(90deg, #6ad0ff, #fff); }
.vs { font-family: var(--display); font-size: 40px; align-self: center; text-shadow: 0 3px 0 #3a2fb8; }
#banner { position: absolute; top: 26%; left: 0; right: 0; text-align: center; font-family: var(--display); font-size: 64px; opacity: 0; transition: opacity 0.2s, transform 0.2s;
  text-shadow: 0 5px 0 #3a2fb8, 0 10px 30px rgba(0,0,0,0.35); transform: scale(0.8); }
#banner.show { opacity: 1; transform: scale(1); }
#powtext { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-family: var(--display); font-size: 34px; opacity: 0; transition: opacity 0.15s; text-shadow: 0 3px 0 rgba(0,0,0,0.4); }
#powtext.show { opacity: 1; }
#speed { position: absolute; right: 14px; bottom: 14px; pointer-events: auto; }
.dmg { position: absolute; font-family: var(--display); font-size: 30px; color: #fff; pointer-events: none; transform: translate(-50%, -50%);
  text-shadow: 0 3px 0 #000a, 0 0 6px #000; animation: pop 0.8s ease-out forwards; }
.dmg.crit { font-size: 44px; color: var(--gold); } .dmg.heal { color: #7dff7d; }
@keyframes pop { 0% { opacity: 1; margin-top: 0; transform: translate(-50%, -50%) scale(1.4); } 20% { transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; margin-top: -70px; } }
.result h1 { font-family: var(--display); font-weight: 400; font-size: 96px; margin: 0; text-shadow: 0 6px 0 #3a2fb8, 0 12px 30px rgba(0,0,0,0.35); }
.result h1.lose { text-shadow: 0 6px 0 #8a1a2c, 0 12px 30px rgba(0,0,0,0.35); }
.result .reward { font-family: var(--display); font-size: 30px; display: flex; gap: 10px; align-items: center; }
.panel { background: rgba(20,16,42,0.55); border-radius: 20px; padding: 16px 22px; backdrop-filter: blur(4px); }
.row2 { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.set { display: flex; align-items: center; gap: 12px; font-weight: 900; justify-content: space-between; min-width: 260px; margin: 6px 0; }
.set input { accent-color: var(--gold); }
.credits { max-width: 560px; font-size: 14px; line-height: 1.5; } .credits b { color: var(--gold); }
@media (max-height: 520px) {
  .title { font-size: 48px; } .homeBtns { margin-top: 4px; gap: 8px; } .homeBtns button { font-size: 22px; padding: 10px; }
  .card { width: 150px; } .card img { width: 100px; height: 100px; } h2 { font-size: 30px; }
  .result h1 { font-size: 60px; } #banner { font-size: 44px; }
}
@media (max-width: 640px) { .card { width: 44vw; } .card img { width: 110px; height: 110px; } .side .nm { font-size: 17px; } .vs { font-size: 26px; } }
