:root {
  --bg: #0d0f1a;
  --bg2: #141828;
  --panel: #1a2036;
  --panel2: #212a47;
  --line: #2e3a63;
  --text: #e8ecff;
  --dim: #8b96c4;
  --gold: #ffd75e;
  --teal: #4de3d0;
  --violet: #b07cff;
  --red: #ff5e6c;
  --green: #6dff8f;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}
#app { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
#hud-top {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; gap: 10px; align-items: flex-start;
}
.hud-panel {
  background: rgba(20, 24, 40, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  min-width: 110px;
  backdrop-filter: blur(4px);
}
.hud-label { font-size: 10px; letter-spacing: 2px; color: var(--dim); }
.hud-value { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
#dust-val { color: var(--gold); }
#shard-val { color: var(--violet); }
.hud-sub { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.hud-buttons { margin-left: auto; display: flex; gap: 8px; pointer-events: auto; }
.hud-btn {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background .12s, transform .06s;
}
.hud-btn:hover { background: var(--panel2); }
.hud-btn:active { transform: scale(0.96); }
#hud-bottom {
  position: absolute; bottom: 10px; left: 10px; right: 10px;
  display: flex; gap: 10px; align-items: flex-end;
}
#ball-type-panel .hud-value { color: var(--teal); font-size: 18px; }
.hud-hint {
  margin-left: auto; align-self: center;
  font-size: 11px; color: var(--dim);
  background: rgba(20,24,40,.6); padding: 6px 10px; border-radius: 6px;
}

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(8, 10, 18, 0.92);
  backdrop-filter: blur(6px);
  display: flex; flex-direction: column;
}
.panel-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg2);
}
.panel-header h2 { font-size: 20px; letter-spacing: 3px; }
.shard-chip {
  margin-left: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 6px 14px;
  font-weight: 700;
  color: var(--violet);
  font-variant-numeric: tabular-nums;
}
.panel-header .hud-btn { margin-left: 0; }

/* ---------- Main menu ---------- */
#menu { align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 40%, #1a2036 0%, #0d0f1a 70%); }
.menu-box { text-align: center; max-width: 520px; width: 92%; }
.menu-box.small { max-width: 420px; }
.game-title {
  font-size: 64px; line-height: 0.95; letter-spacing: 8px; font-weight: 900;
  background: linear-gradient(180deg, #fff 20%, var(--gold) 60%, #ff9d3c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(255, 215, 94, 0.25);
  margin-bottom: 6px;
}
.game-tag { color: var(--dim); letter-spacing: 3px; font-size: 13px; margin-bottom: 30px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; }
.menu-btn {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 15px; font-weight: 700; letter-spacing: 2px;
  padding: 14px; border-radius: 10px; cursor: pointer;
  transition: background .12s, transform .06s, border-color .12s;
}
.menu-btn:hover { background: var(--panel2); border-color: #41528f; }
.menu-btn:active { transform: scale(0.98); }
.menu-btn.primary {
  background: linear-gradient(180deg, #ffe28a, #ffb547);
  color: #241a05; border-color: #ffd75e;
  font-size: 18px;
}
.menu-btn.primary:hover { filter: brightness(1.08); }
.menu-btn.danger { border-color: var(--red); color: var(--red); }
.menu-btn.danger:hover { background: rgba(255, 94, 108, 0.12); }
.menu-stats {
  margin-top: 26px; font-size: 12px; color: var(--dim);
  display: flex; justify-content: center; gap: 18px; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.menu-stats b { color: var(--text); }
.menu-foot { margin-top: 14px; font-size: 11px; color: #4a5480; }

/* ---------- Skill tree ---------- */
#skill-tabs { display: flex; gap: 6px; padding: 10px 20px 0; }
.skill-tab {
  background: var(--panel); border: 1px solid var(--line); color: var(--dim);
  border-radius: 8px 8px 0 0; padding: 8px 16px; font-size: 12px; font-weight: 700;
  letter-spacing: 1px; cursor: pointer;
}
.skill-tab.active { background: var(--panel2); color: var(--text); border-bottom-color: var(--panel2); }
.skill-tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
#skill-viewport { flex: 1; overflow: hidden; position: relative; background: var(--bg2); }
#skill-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#skill-tip {
  min-height: 64px; padding: 12px 20px;
  background: var(--bg2); border-top: 1px solid var(--line);
  font-size: 13px; line-height: 1.5;
}
#skill-tip b { color: var(--gold); }
#skill-tip .cost { color: var(--gold); font-weight: 700; }
#skill-tip .owned { color: var(--green); font-weight: 700; }

/* ---------- Meta / quests list ---------- */
#meta-list, #quest-list { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px;
}
.list-item .li-icon { font-size: 26px; width: 40px; text-align: center; }
.list-item .li-body { flex: 1; }
.list-item .li-title { font-weight: 700; font-size: 14px; }
.list-item .li-desc { font-size: 12px; color: var(--dim); margin-top: 2px; }
.list-item .li-prog { height: 6px; background: #0c0f1c; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.list-item .li-prog > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); border-radius: 3px; }
.list-item .li-right { text-align: right; min-width: 110px; }
.list-item .li-reward { font-size: 12px; color: var(--violet); font-weight: 700; }
.list-item .li-status { font-size: 11px; color: var(--dim); margin-top: 3px; }
.list-item.done { opacity: 0.55; }
.list-item.done .li-status { color: var(--green); }
.list-item .hud-btn { min-width: 90px; }
.list-item.maxed .hud-btn { opacity: 0.5; pointer-events: none; }
.list-item.affordable { border-color: var(--gold); }

/* ---------- Help ---------- */
.help-body { flex: 1; overflow-y: auto; padding: 20px 28px; line-height: 1.7; font-size: 14px; }
.help-body p { margin-bottom: 12px; color: var(--dim); max-width: 760px; }
.help-body b { color: var(--text); }

/* ---------- Confirm ---------- */
#confirm { align-items: center; justify-content: center; z-index: 30; }
#confirm h2 { margin-bottom: 10px; }
#confirm p { color: var(--dim); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }

/* ---------- Toasts ---------- */
#toasts {
  position: absolute; top: 70px; right: 14px; z-index: 40;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: rgba(26, 32, 54, 0.95);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  animation: toastIn .25s ease-out, toastOut .4s ease-in 3.2s forwards;
  max-width: 320px;
}
.toast.violet { border-left-color: var(--violet); }
.toast.green { border-left-color: var(--green); }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(30px); opacity: 0; } }

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
