:root {
  --bg: #0c0a12;
  --strip: #14111d;
  --panel: #1a1626;
  --panel-2: #221d33;
  --border: #322a48;
  --text: #e8e4f2;
  --dim: #9a92b0;
  --gold: #f2d24b;
  --accent: #8b5cff;
  --accent-2: #ff3b6b;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 50% -10%, #1a1530 0%, transparent 60%),
    var(--bg);
  overflow: hidden;
}

/* Desktop backdrop hint (the "you're at your desk" vibe) */
#desktop-hint {
  position: absolute;
  top: 0; left: 0; right: 0;
  bottom: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  user-select: none;
}
#desktop-hint h1 { font-size: 52px; margin: 0 0 8px; letter-spacing: 1px; }
#desktop-hint p { margin: 4px 0; font-size: 18px; color: var(--text); }
#desktop-hint .sub { color: var(--dim); font-size: 14px; margin-top: 14px; line-height: 1.6; }

/* ---- The pinned game strip ---- */
#deskbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #1b1728, #100d18);
  border-top: 2px solid var(--border);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.5);
  z-index: 20;
}
#topline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
#chip-gold { color: var(--gold); }
#chip-shard { color: var(--accent-2); }
#chip-dps { color: #8be9fd; }
.spacer { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  position: relative;
}
.tab:hover { background: var(--panel-2); border-color: var(--accent); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge {
  background: var(--accent-2);
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  padding: 0 5px;
  margin-left: 3px;
}

#strip-wrap { position: relative; }
#strip {
  display: block;
  width: 100%;
  height: 180px;
}
#lvlbar {
  position: relative;
  height: 20px;
  background: #0c0a14;
  border-top: 1px solid var(--border);
  overflow: hidden;
}
#lvlfill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s ease;
}
#lvltext {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text);
  text-shadow: 0 1px 2px #000;
}

/* ---- Slide-up panels ---- */
#panel-host { position: fixed; inset: 0; z-index: 30; }
#panel-host.hidden { display: none; }
#panel-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
#panel {
  position: absolute;
  left: 0; right: 0; bottom: 220px;
  max-height: calc(100vh - 200px);
  margin: 0 auto;
  max-width: 900px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.panel-head h3 { margin: 0; font-size: 17px; }
.panel-close {
  background: transparent; border: none; color: var(--dim);
  font-size: 18px; cursor: pointer;
}
.panel-close:hover { color: var(--text); }
.panel-body { padding: 16px; overflow-y: auto; }

.hero-summary { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.big-emoji { font-size: 40px; }
.hero-name { font-size: 18px; font-weight: 700; }
.dim { color: var(--dim); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.stat-row {
  display: flex; justify-content: space-between;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 11px; font-size: 13px;
}
.stat-row.big { padding: 12px; font-size: 15px; margin-top: 8px; }
.section-h { margin: 18px 0 8px; }

.equip-grid, .bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.item-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 8px 10px;
}
.item-card.empty { opacity: 0.55; }
.item-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.ilvl { color: var(--dim); font-weight: 500; font-size: 11px; }
.item-affixes { display: flex; flex-direction: column; gap: 2px; }
.affix { font-size: 12px; color: #b8f0c0; }
.affix.dim { color: var(--dim); }
.item-actions { display: flex; gap: 6px; margin-top: 6px; }

.mini-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: 6px;
  padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.mini-btn:hover { filter: brightness(1.12); }
.mini-btn.danger { background: #6b2740; }

.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toggle { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.empty-note { color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 13px; margin-bottom: 8px; }
.empty-note.dim { color: var(--dim); }

.minion-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.minion-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; text-align: center; font-size: 12px; }
.minion-card.boss { border-color: var(--accent-2); box-shadow: 0 0 12px rgba(255,59,107,0.25); }
.minion-card.inactive { opacity: 0.55; }
.minion-card .item-actions { justify-content: center; flex-wrap: wrap; }
.memoji { font-size: 28px; }

.big-btn {
  display: block; width: 100%; margin-top: 14px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff; border: none; border-radius: 10px;
  padding: 14px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.big-btn.disabled { background: #2a2440; color: var(--dim); cursor: not-allowed; }

/* ---- Class chooser ---- */
#chooser { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(6,4,12,0.85); }
#chooser.hidden { display: none; }
.chooser-inner { text-align: center; padding: 20px; }
.chooser-inner h2 { font-size: 28px; margin-bottom: 20px; }
#hero-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.hero-card {
  width: 220px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 20px 16px;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.hero-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 12px 30px rgba(139,92,255,0.3); }
.hemoji { font-size: 46px; }
.hname { font-size: 20px; font-weight: 700; margin: 8px 0; }
.hblurb { font-size: 13px; color: var(--dim); min-height: 54px; }
.hstats { font-size: 12px; margin-top: 10px; color: var(--text); }

/* ---- Toasts ---- */
#toast-host { position: fixed; bottom: 230px; right: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  max-width: 340px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  opacity: 0; transform: translateX(20px);
  transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: none; }

/* ---- Town Panel ---- */
.town-tier-badge {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2);
  border: 2px solid var(--border);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 16px;
}
.tier-emoji { font-size: 24px; }
.tier-name { flex: 1; color: var(--text); }
.tier-levels { color: var(--dim); font-size: 13px; font-weight: 600; }

.town-building-card { transition: opacity .2s, border-color .2s; }
.town-building-card.maxed { opacity: 0.7; }
.town-building-card.unaffordable { opacity: 0.85; }

.affix.current-effect { color: #b8f0c0; font-weight: 500; }
.affix.next-effect { color: #8be9fd; font-weight: 500; }

.mini-btn.maxed-btn {
  background: #3a3452; color: var(--dim); cursor: not-allowed;
}
.mini-btn.maxed-btn:hover { filter: none; }

.mini-btn.unaffordable-btn {
  background: #4a3a5a; color: #b8c0cc; cursor: not-allowed;
}
.mini-btn.unaffordable-btn:hover { filter: none; }

.hidden { display: none !important; }
