:root {
  /* 2UP-inspired palette */
  --bg:#3a35a0;               /* deep purple background */
  --bg-2:#2f2a8e;             /* darker purple for depth */
  --card:rgba(255,255,255,0.06); /* translucent panels on purple */
  --muted:#d6d6e8;            /* soft white for labels */
  --text:#ffffff;             /* primary text */
  --accent:#a78bfa;           /* lavender accent */
  --bad:#fecaca;              /* soft red */
  --good:#c7f9cc;             /* soft green */
  --brand1:#ffd166;           /* 2UP yellow */
  --brand2:#a78bfa;           /* 2UP lavender */
}
body {
  margin:0;
  font-family: Inter, ui-sans-serif, system-ui, Segoe UI, Arial;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255,255,255,0.06), transparent 60%),
    radial-gradient(800px 400px at -10% 30%, rgba(0,0,0,0.12), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color:var(--text);
}
* { touch-action: manipulation; }
.wrap { max-width:1100px; margin:24px auto; padding:0 16px; position: relative; }
.brand { display:flex; align-items:center; gap:10px; margin-bottom: 8px; }
.brand-logo { height:28px; width:auto; }
.setup-grid { display:grid; grid-template-columns: 1.5fr 1fr; gap:16px; }
.game-grid { display:grid; grid-template-columns: 1.5fr 2.5fr; gap:16px; }
.card { background:var(--card); border-radius:16px; padding:12px; border:1px solid rgba(255,255,255,0.12); backdrop-filter: blur(3px); }
textarea { width:100%; background:rgba(255,255,255,0.06); color:var(--text); border:1px solid rgba(255,255,255,0.18); border-radius:10px; padding:10px; }
input[type="text"], select { width:100%; background:rgba(255,255,255,0.06); color:var(--text); border:1px solid rgba(255,255,255,0.18); border-radius:10px; padding:8px 10px; }
button { position:relative; background:rgba(255,255,255,0.10); color:#fff; border:1px solid rgba(255,255,255,0.24); border-radius:14px; padding:10px 14px; cursor:pointer; font-size:14px; transition: transform 0.1s ease, filter 0.2s ease; overflow: hidden; }
button.primary { background: linear-gradient(90deg, var(--brand1), var(--brand2)); border-color:rgba(255,255,255,0.18); color:#1e1b4b; font-weight: 800; }
button.primary:hover { filter: brightness(1.06); }
button:disabled { opacity:0.6; cursor:not-allowed; }
button:active:not(:disabled) { transform: scale(0.96); }
.label { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.06em; margin-bottom: 6px; }
.muted { color: var(--muted); }
.res { padding:8px; background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.18); border-radius:10px; }
.res-header { display: flex; justify-content: space-between; align-items: center; }
.res-val { font-size: 18px; font-weight: bold; min-width: 60px; text-align: right; }
.res-income { font-size: 12px; color: var(--good); text-align: right; height: 14px; }
.upg { border:1px solid rgba(255,255,255,0.20); border-radius:14px; padding:10px; background:rgba(255,255,255,0.08); transition: background-color 0.1s ease; }
.upgrades-container { display: grid; gap: 16px; }
.upg-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.item-reward { font-size: 14px; font-weight: bold; color: var(--good); }
.action-btn { background: linear-gradient(90deg, var(--brand1), var(--brand2)); border-color: rgba(255,255,255,0.18); width:100%; display:flex; flex-direction:column; align-items:stretch; text-align:center; padding: 8px; color:#0b0b0b; font-weight:800; }
.action-btn strong { color:#0b0b0b; }
.action-btn .muted { color: rgba(0,0,0,0.70); }
.action-btn .cost { color: rgba(0,0,0,0.85); }
.action-content { position:relative; width:100%; display:flex; flex-direction:column; flex-grow:1; justify-content:space-between; }
.action-progress { position:absolute; top:0; left:0; height:100%; background:rgba(255,255,255,0.2); width:0%; transition: width 0.1s linear; }
.cost { color:#cbd5e1; font-size:14px; }
.win-overlay { position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.7); display:none; align-items:center; justify-content:center; z-index:100; }
.hidden { display: none !important; }
.menu-item { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16); border-radius: 14px; padding: 12px; cursor: pointer; transition: background-color 0.2s ease, transform 0.05s ease; display:flex; gap:12px; align-items:flex-start; }
.menu-item:hover { background-color: rgba(255,255,255,0.12); transform: translateY(-1px); }
#stickyResources { display:none; }

/* Thumbnails on menu */
.menu-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border:1px solid rgba(255,255,255,0.22); background:rgba(255,255,255,0.06); flex-shrink:0; }
.menu-meta { display:flex; flex-direction:column; gap:4px; }

/* Cover + meta layout inside game */
.meta-header { display:flex; gap:12px; align-items:center; margin: 6px 0 10px 0; }
.game-cover { width: 96px; height: 96px; object-fit: cover; border-radius: 12px; border:1px solid rgba(255,255,255,0.22); background:rgba(255,255,255,0.06); flex-shrink:0; }
.meta-info h2 { margin: 0 0 4px 0; }
.meta-info a { display:inline-block; margin-bottom:4px; }

/* --- NEW STYLES --- */
.upg.owned { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.14); }
.upg.locked { background: rgba(0,0,0,0.15); } /* Slightly darker for locked */
.upg.locked button { font-size: 24px; padding: 4px 10px; } /* Larger lock icon */
/* --- END NEW STYLES --- */

@media (max-width: 768px) {
  .main-title { display: none; }
  .setup-grid, .game-grid { grid-template-columns: 1fr; }
  #backBtn { padding: 8px 12px; font-size: 12px; }
  #stickyResources { display: flex; gap: 24px; padding: 8px 12px; background: var(--bg); position: sticky; top: 0; z-index: 10; border-bottom: 1px solid #1f242b; margin: -12px -12px 12px -12px; }
  .sticky-res-item { display:flex; align-items:center; gap: 6px; font-size: 16px; font-weight: bold; }
  #resources-container { display: none; }
}

@keyframes flash-red { 50% { background-color: #581c22; } }
@keyframes flash-green { 50% { background-color: #14532d; } }
.flash-red { animation: flash-red 0.2s ease-out; }
.flash-green { animation: flash-green 0.2s ease-out; }
.floating-text { position: absolute; font-size: 18px; font-weight: bold; pointer-events: none; animation: float-up 1s ease-out forwards; z-index: 100; }
@keyframes float-up { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-40px); opacity: 0; } }

/* Footer */
.site-footer { border-top:1px solid rgba(255,255,255,0.18); color: var(--muted); font-size:12px; padding:12px 0; margin-top:24px; }
.site-footer .content { max-width:1100px; margin:0 auto; padding:0 16px; display:flex; align-items:center; gap:8px; }
.site-footer img { height:20px; width:auto; opacity:0.95; }

/* Brand title accent */
.brand .main-title { color:#ffffff; }

/* 2UP hero heading */
.hero {
  background: transparent; /* body already purple */
  margin: 8px 0 16px 0;
}
.hero-title {
  font-family: 'Baloo 2', Inter, ui-sans-serif, system-ui, Segoe UI, Arial;
  font-weight: 800;
  color: #ffffff;
  font-size: clamp(32px, 7vw, 64px);
  line-height: 1.02;
  letter-spacing: .5px;
  margin: 8px 0 4px 0;
}
.hero-sub {
  color: rgba(255,255,255,0.85);
  font-size: clamp(14px, 2.2vw, 20px);
  max-width: 900px;
  margin: 0;
}

/* Headings use display font */
h1, h2, .main-title { font-family: 'Baloo 2', Inter, ui-sans-serif, system-ui, Segoe UI, Arial; }
