@import url('https://fonts.googleapis.com/css2?family=Lilita+One&family=Nunito:wght@500;700;800;900&display=swap');

/* ═══════════════════════════════════════════════
   Variables
═══════════════════════════════════════════════ */
:root {
  --yellow: #FFD700;
  --pink:   #ff4ecd;
  --green:  #3dff8f;
  --purple: #9b4dff;
  --blue:   #4ecbff;

  --card-bg:     rgba(255,255,255,0.07);
  --card-border: rgba(255,255,255,0.13);

  --r-lg: 20px;
  --r-md: 13px;
  --r-sm: 8px;
}

/* ═══════════════════════════════════════════════
   Reset
═══════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

html {
  font-size: 15px;
  /* stop iOS from auto-zooming inputs */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Nunito', sans-serif;
  color: #fff;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* ═══════════════════════════════════════════════
   Background
═══════════════════════════════════════════════ */
.bg-base {
  position: fixed; inset: 0; z-index: -10;
  background: linear-gradient(140deg,
    #0d0528 0%, #130d4a 35%, #230857 60%, #0d1b6e 100%);
  animation: bgPulse 14s ease-in-out infinite alternate;
}
@keyframes bgPulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.2); }
}

.bg-blob {
  position: fixed; z-index: -9;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  animation: blobDrift 20s ease-in-out infinite alternate;
}
.blob1 { width: 70vw; height: 70vw; top: -20%; left: -15%;
  background: radial-gradient(circle, rgba(155,77,255,0.65) 0%, transparent 70%);
  animation-duration: 20s; }
.blob2 { width: 65vw; height: 65vw; bottom: -15%; right: -10%;
  background: radial-gradient(circle, rgba(78,203,255,0.55) 0%, transparent 70%);
  animation-duration: 17s; animation-delay: -5s; }
.blob3 { width: 50vw; height: 50vw; top: 40%; left: 25%;
  background: radial-gradient(circle, rgba(255,78,205,0.45) 0%, transparent 70%);
  animation-duration: 22s; animation-delay: -9s; }
.blob4 { width: 45vw; height: 45vw; top: 5%; right: -5%;
  background: radial-gradient(circle, rgba(255,215,0,0.28) 0%, transparent 70%);
  animation-duration: 25s; animation-delay: -13s; }
@keyframes blobDrift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(4%,6%) scale(1.1); }
  100% { transform: translate(-3%,-4%) scale(0.93); }
}

.bg-grid {
  position: fixed; inset: 0; z-index: -8; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ═══════════════════════════════════════════════
   Layout wrapper
═══════════════════════════════════════════════ */
.wrapper {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 12px 64px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ═══════════════════════════════════════════════
   Header
═══════════════════════════════════════════════ */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px 0 2px;
  animation: slideDown .6s cubic-bezier(.22,1,.36,1) both;
}
@keyframes slideDown {
  from { opacity:0; transform:translateY(-20px); }
  to   { opacity:1; transform:translateY(0); }
}

.brawl-logo {
  /* fill width but never exceed 260px */
  width: min(72vw, 260px);
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 20px rgba(0,0,0,0.65));
  animation: logoBob 3.5s ease-in-out infinite;
}
@keyframes logoBob {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-5px); }
}

.header-sub {
  font-size: 0.68rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
}

/* ═══════════════════════════════════════════════
   Cards
═══════════════════════════════════════════════ */
.card, .results-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 18px 14px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 6px 30px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.07);
  animation: fadeUp .55s cubic-bezier(.22,1,.36,1) both;
}
.card:nth-of-type(2) { animation-delay:.05s; }
.card:nth-of-type(3) { animation-delay:.10s; }
.results-card { animation-delay:.15s;
  background: linear-gradient(135deg, rgba(255,215,0,0.07), rgba(78,203,255,0.07));
  border-color: rgba(255,215,0,0.18); }

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

.card-title {
  font-family: 'Lilita One', cursive;
  font-size: 1rem;
  color: var(--yellow);
  letter-spacing: .6px;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 7px;
}

/* ═══════════════════════════════════════════════
   Level Section  —  VERTICAL stack per box
═══════════════════════════════════════════════ */
.level-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.level-box {
  /* each box takes equal space but never more than 160px */
  flex: 1;
  max-width: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.level-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: rgba(255,255,255,0.42);
  margin-bottom: 10px;
  white-space: nowrap;
}

/* Vertical layout: INC on top, number in middle, DEC on bottom */
.level-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.level-btn {
  /* big tap target: 54×54 */
  width: 54px; height: 54px;
  border-radius: 50%;
  border: 2.5px solid;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, box-shadow .12s;
  touch-action: manipulation;
  flex-shrink: 0;
}
.level-btn svg { width: 28px; height: 28px; display: block; }
.level-btn.dec { border-color: var(--pink);  color: var(--pink); }
.level-btn.inc { border-color: var(--green); color: var(--green); }
.level-btn:active { transform: scale(0.87); }
.level-btn.dec:active { box-shadow: 0 0 14px var(--pink); }
.level-btn.inc:active { box-shadow: 0 0 14px var(--green); }

.level-value {
  font-family: 'Lilita One', cursive;
  /* scales from 2.8rem on tiny phones to 3.4rem on bigger ones */
  font-size: clamp(2.8rem, 11vw, 3.4rem);
  line-height: 1;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 24px rgba(255,215,0,.5);
  /* fixed width so layout doesn't jump between 1 and 2 digit numbers */
  width: 68px;
}

.level-sub {
  font-size: 0.62rem;
  color: rgba(255,255,255,0.25);
  margin-top: 6px;
  letter-spacing: .5px;
}

/* Arrow divider between the two boxes */
.level-arrow {
  font-size: 1.4rem;
  color: rgba(255,255,255,0.2);
  flex-shrink: 0;
  animation: arrowPulse 2.2s ease-in-out infinite;
}
@keyframes arrowPulse {
  0%,100% { color: rgba(255,255,255,0.15); }
  50%     { color: rgba(255,215,0,0.45); }
}

/* Warning */
.warning {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(255,90,40,0.18);
  border: 1px solid rgba(255,100,50,0.38);
  font-size: 0.78rem;
  color: #ffb89a;
  text-align: center;
}
.warning.show { display: block; }

/* ═══════════════════════════════════════════════
   Utilities Grid
═══════════════════════════════════════════════ */
.items-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Buffie spans full width */
.item-wide { grid-column: 1 / -1; }

/* ── Regular item card ── */
.item-card {
  background: rgba(255,255,255,0.055);
  border: 1.5px solid rgba(255,255,255,0.09);
  border-radius: var(--r-md);
  padding: 14px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color .2s, box-shadow .2s;
}
.item-card.active-item {
  border-color: rgba(255,215,0,0.48);
  box-shadow: 0 0 18px rgba(255,215,0,0.13), inset 0 0 10px rgba(255,215,0,0.05);
}

.item-icon {
  width: 56px; height: 56px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5));
}

.item-name {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.55);
  text-align: center;
}

.item-counter {
  display: flex; align-items: center; gap: 8px;
}

.item-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform .11s, box-shadow .11s;
  touch-action: manipulation;
  flex-shrink: 0;
}
.item-btn.minus { border-color: var(--pink);  color: var(--pink); }
.item-btn.plus  { border-color: var(--green); color: var(--green); }
.item-btn:active { transform: scale(0.84); }
.item-btn.minus:active { box-shadow: 0 0 10px var(--pink); }
.item-btn.plus:active  { box-shadow: 0 0 10px var(--green); }
.item-btn:disabled { opacity: .2; pointer-events: none; }

.item-val {
  font-family: 'Lilita One', cursive;
  font-size: 1.5rem;
  min-width: 24px;
  text-align: center;
  color: #fff;
}

.item-meta {
  font-size: 0.60rem;
  color: rgba(255,255,255,0.28);
  text-align: center;
  line-height: 1.4;
}

/* ── Buffie wide card  —  image left, content right ── */
.item-wide {
  flex-direction: row;
  padding: 14px 14px;
  gap: 12px;
  align-items: center;
}
.item-wide .item-icon {
  width: 64px; height: 64px;
  flex-shrink: 0;
}
/* stack name / counter / meta vertically on the right */
.item-wide .item-right {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}
.item-wide .item-name   { text-align: left; }
.item-wide .item-meta   { text-align: left; }
.item-wide .item-counter { justify-content: flex-start; }

/* Hypercharge icon — slightly larger to match visually */
#item-card-hypercharge .item-icon {
  width: 68px; height: 68px;
  margin: -6px 0;          /* absorb extra transparent space */
}

/* ═══════════════════════════════════════════════
   Results card
═══════════════════════════════════════════════ */
.results-title {
  font-family: 'Lilita One', cursive;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 14px;
  color: #fff;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.result-box {
  border-radius: var(--r-md);
  padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.result-box.coins {
  background: linear-gradient(135deg, rgba(255,215,0,0.15), rgba(255,159,28,0.07));
  border: 1.5px solid rgba(255,215,0,0.32);
}
.result-box.pp {
  background: linear-gradient(135deg, rgba(255,78,205,0.15), rgba(150,50,255,0.07));
  border: 1.5px solid rgba(255,78,205,0.32);
}

.result-label {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.45);
}

.res-icon {
  width: 24px; height: 24px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 5px rgba(0,0,0,0.4));
}

.result-value {
  font-family: 'Lilita One', cursive;
  font-size: clamp(1.9rem, 8vw, 2.6rem);
  line-height: 1;
}
.result-box.coins .result-value { color: var(--yellow); text-shadow: 0 0 20px rgba(255,215,0,.5); }
.result-box.pp    .result-value { color: var(--pink);   text-shadow: 0 0 20px rgba(255,78,205,.5); }

.result-value.bump { animation: bump .27s cubic-bezier(.22,1,.36,1); }
@keyframes bump {
  0%  { transform: scale(1); }
  55% { transform: scale(1.22); }
  100%{ transform: scale(1); }
}

/* Breakdown */
.breakdown-wrap {
  background: rgba(0,0,0,0.2);
  border-radius: var(--r-md);
  padding: 12px 10px;
  margin-bottom: 14px;
}
.breakdown-title {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(255,255,255,0.28);
  text-align: center;
  margin-bottom: 9px;
}
.breakdown { display: flex; flex-direction: column; gap: 4px; }
.breakdown-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.82rem;
  padding: 7px 9px;
  border-radius: 7px;
  color: rgba(255,255,255,0.60);
}
.breakdown-row:active { background: rgba(255,255,255,0.05); }
.breakdown-row .row-cost { font-weight: 800; color: rgba(255,255,255,0.82); }
.breakdown-empty {
  text-align: center; color: rgba(255,255,255,0.22);
  font-size: 0.78rem; padding: 4px; line-height: 1.5;
}

.bd-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
  margin-bottom: 2px;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.4));
}

/* Reset button */
.btn-reset {
  display: block; width: 100%;
  padding: 16px;
  border-radius: var(--r-md);
  border: none; cursor: pointer;
  font-family: 'Lilita One', cursive;
  font-size: 1rem; letter-spacing: .6px;
  background: linear-gradient(135deg, #ff4ecd, #9b4dff);
  color: #fff;
  box-shadow: 0 5px 20px rgba(155,77,255,0.38);
  transition: transform .13s, box-shadow .13s;
  touch-action: manipulation;
}
.btn-reset:active {
  transform: scale(0.96);
  box-shadow: 0 3px 10px rgba(155,77,255,0.5);
}

/* ═══════════════════════════════════════════════
   Footer
═══════════════════════════════════════════════ */
.footer {
  text-align: center;
  font-size: 0.70rem; letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.16);
}
.footer span { color: var(--pink); font-weight: 900; font-size: 0.78rem; }

/* ═══════════════════════════════════════════════
   Slightly larger screens  (tablet / desktop)
═══════════════════════════════════════════════ */
@media (min-width: 420px) {
  html { font-size: 16px; }
  .wrapper { padding: 22px 16px 72px; gap: 16px; }
  .card, .results-card { padding: 22px 18px; }
  .item-icon { width: 60px; height: 60px; }
  .item-wide .item-icon { width: 68px; height: 68px; }
  .res-icon  { width: 28px; height: 28px; }
  .level-btn { width: 56px; height: 56px; }
  .level-btn svg { width: 30px; height: 30px; }
}


