* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #04070d;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-user-select: none; user-select: none;
}
[hidden] { display: none !important; }

canvas#game { position: fixed; inset: 0; display: block; cursor: crosshair; }

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 12, 0.55));
}

/* ---------- HUD ---------- */
#hud {
  position: fixed; top: 14px; left: 18px; z-index: 5;
  display: flex; gap: 18px; align-items: baseline;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px; letter-spacing: 0.12em; color: #7e93bd;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}
#hud .stat b { color: #eaf2ff; font-size: 16px; margin-left: 5px; letter-spacing: 0.02em; }

#buffbar {
  position: fixed; top: 52px; left: 18px; z-index: 5;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.buff {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  color: #fff; padding: 3px 12px; border-radius: 999px;
  background: rgba(16, 26, 48, 0.75);
  border: 1px solid var(--c, #4a5f8a);
  box-shadow: 0 0 12px -2px var(--c, transparent);
}

#toast {
  position: fixed; top: 13%; left: 50%; transform: translateX(-50%); z-index: 6;
  padding: 10px 26px; border-radius: 999px;
  background: rgba(12, 20, 40, 0.88); border: 1px solid #3b82f6;
  color: #dbeafe; font-size: 14px; letter-spacing: 0.22em; font-weight: 600;
  opacity: 0; transition: opacity 0.35s, transform 0.35s; pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(6px); }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 22px; text-align: center;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
}
.title {
  margin: 0; font-size: clamp(44px, 8vw, 88px); font-weight: 800;
  letter-spacing: 0.32em; text-indent: 0.32em;
  background: linear-gradient(180deg, #b8e4ff 0%, #4b7bff 55%, #b96bff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(75, 123, 255, 0.35));
}
.title.small { font-size: clamp(30px, 5vw, 54px); }
.sub { margin: 0; color: #8ea3c8; font-size: 16px; line-height: 1.7; }
.controls { display: flex; flex-direction: column; gap: 10px; color: #b8c6e6; font-size: 14px; }
.controls .hint, .overlay .hint { color: #64748f; font-size: 13px; line-height: 1.6; }
kbd {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  border: 1px solid #3a4a6e; background: #101a2e; border-radius: 5px;
  padding: 1px 7px; color: #cfe0ff;
}
button {
  padding: 14px 40px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 15px; font-weight: 800; letter-spacing: 0.18em; text-indent: 0.18em;
  color: #fff; background: linear-gradient(90deg, #2563eb, #7c3aed);
  box-shadow: 0 0 30px -4px rgba(88, 101, 242, 0.7);
  transition: transform 0.12s, filter 0.12s;
}
button:hover { filter: brightness(1.2); transform: scale(1.04); }
.best { color: #86efac; font-size: 14px; letter-spacing: 0.14em; margin: 0; }

.btnrow { display: flex; gap: 14px; align-items: center; }
button.secondary {
  background: rgba(24, 34, 58, 0.9);
  box-shadow: none;
  border: 1px solid #3a4a6e;
}

/* ---------- settings ---------- */
.setblock { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.setblock h3 { margin: 0; color: #8ea3c8; font-size: 13px; letter-spacing: 0.25em; font-weight: 600; }
.setblock h3 .hint { letter-spacing: 0.05em; font-weight: 400; }
.schemes { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; max-width: 920px; }
button.scheme {
  display: flex; flex-direction: column; gap: 9px; width: 262px;
  padding: 16px 18px; border-radius: 14px; text-align: left;
  background: rgba(13, 20, 38, 0.9); border: 1px solid #2a3550; box-shadow: none;
  font-size: 12px; font-weight: 400; letter-spacing: 0.02em; text-indent: 0;
  color: #b8c6e6;
}
button.scheme:hover { transform: none; filter: brightness(1.25); }
.scheme b { font-size: 14px; letter-spacing: 0.12em; color: #fff; }
.scheme span { line-height: 1.65; color: #8195bb; }
.scheme.sel {
  border-color: #7c3aed;
  background: rgba(34, 26, 66, 0.9);
  box-shadow: 0 0 24px -6px rgba(124, 58, 237, 0.8);
}
.slider { display: flex; align-items: center; gap: 14px; color: #b8c6e6; font-size: 13px; letter-spacing: 0.15em; }
.slider input { width: 240px; accent-color: #7c3aed; }

/* ---------- upgrades shop ---------- */
.dust { margin: 0; color: #fbbf24; font-size: 15px; letter-spacing: 0.18em; }
.dust b { font-size: 18px; }
.dusty { color: #fbbf24 !important; }
.shopgrid {
  display: grid; grid-template-columns: repeat(3, 262px); gap: 14px;
  justify-content: center; max-width: 920px;
}
@media (max-width: 900px) { .shopgrid { grid-template-columns: repeat(2, 262px); } }
.upgrade {
  display: flex; flex-direction: column; gap: 8px;
  padding: 15px 17px; border-radius: 14px; text-align: left;
  background: rgba(13, 20, 38, 0.9); border: 1px solid #2a3550;
  font-size: 12px; color: #8195bb; line-height: 1.5;
}
.upgrade b { font-size: 13px; letter-spacing: 0.1em; color: #fff; }
.upgrade.maxed { border-color: #b4830f; box-shadow: 0 0 20px -8px rgba(251, 191, 36, 0.7); }
.pips { color: #fbbf24; font-size: 13px; letter-spacing: 4px; }
button.buy {
  margin-top: 2px; padding: 8px 0; width: 100%;
  font-size: 11px; letter-spacing: 0.12em; text-indent: 0.12em; border-radius: 8px;
  background: linear-gradient(90deg, #2563eb, #7c3aed); box-shadow: none;
}
button.buy:disabled {
  background: #1a2338; color: #556285; cursor: default;
  filter: none; transform: none;
}
.upgrade.maxed button.buy:disabled { color: #b4830f; }
button.danger { border-color: #7f1d1d; color: #fca5a5; }
.overlay.scrolly { justify-content: flex-start; overflow-y: auto; padding: 44px 16px; gap: 18px; }
.skinicon { font-size: 20px; margin-right: 4px; }
.upgrade.skin b { display: flex; align-items: center; }
.upgrade.equipped { border-color: #22d3ee; box-shadow: 0 0 20px -8px rgba(34, 211, 238, 0.8); }
.upgrade.equipped button.buy:disabled, .upgrade.equipped button.buy { color: #22d3ee; background: #10202e; }

/* ---------- ascension ---------- */
.ascendbox {
  width: 540px; max-width: 92vw; text-align: center; align-items: center;
  border-color: #b4830f; box-shadow: 0 0 26px -8px rgba(251, 191, 36, 0.5);
}
.ascendbox .cores { margin: 0; color: #fbbf24; font-size: 15px; letter-spacing: 0.14em; font-weight: 700; }
.ascendbox span b { color: #fde68a; }
button.ascend {
  background: linear-gradient(90deg, #b45309, #eab308);
  color: #1c1917; font-weight: 800;
}
button.ascend:disabled { background: #1a2338; color: #556285; }

/* ---------- multiplayer ---------- */
.mprow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; }
.mprow input {
  background: #0d1526; border: 1px solid #2a3550; border-radius: 999px;
  color: #dbeafe; padding: 11px 16px; width: 150px;
  font: 13px ui-monospace, Menlo, monospace;
  letter-spacing: 0.12em; text-transform: uppercase; text-align: center; outline: none;
}
.mprow input:focus { border-color: #7c3aed; }
.mprow input.wide { width: 340px; text-transform: none; }

.galrow { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.galchip {
  padding: 9px 16px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-indent: 0;
  background: rgba(13, 20, 38, 0.85); border: 1px solid #2a3550; color: #b8c6e6;
  box-shadow: none;
}
.galchip.sel { border-color: #7c3aed; color: #fff; box-shadow: 0 0 16px -6px rgba(124, 58, 237, 0.9); }
.galchip.locked { opacity: 0.45; }
.galchip:hover { transform: none; filter: brightness(1.3); }

.tip { max-width: 560px; line-height: 1.7; font-size: 14px !important; color: #8ea3c8 !important; min-height: 3em; }
#loadBarWrap { width: 280px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.1); overflow: hidden; margin-top: 6px; }
#loadBar { height: 100%; width: 0; background: linear-gradient(90deg, #4b7bff, #b96bff); }

.pausebtn {
  position: fixed; right: 18px; bottom: 18px; z-index: 6;
  width: 54px; height: 54px; padding: 0; border-radius: 50%;
  font-size: 17px; letter-spacing: 0; text-indent: 0;
  background: rgba(16, 26, 48, 0.7); border: 1px solid #3a4a6e; color: #cfe0ff;
  box-shadow: none;
}
.pausebtn:hover { filter: brightness(1.3); transform: none; }
.mprow input::placeholder { color: #4a5a7d; }
.mprow button { padding: 11px 22px; font-size: 12px; }
.mprow select {
  background: #0d1526; border: 1px solid #2a3550; border-radius: 999px;
  color: #b8c6e6; padding: 9px 14px;
  font: 12px ui-monospace, Menlo, monospace; letter-spacing: 0.08em;
  outline: none; cursor: pointer;
}
.mprow select:focus { border-color: #7c3aed; }

.cause { margin: 0; color: #ff8a8a; letter-spacing: 0.12em; font-size: 15px; }
.stats {
  display: grid; grid-template-columns: auto auto; gap: 8px 30px;
  font-size: 14px; color: #93a7cd; text-align: left;
}
.stats b { color: #fff; text-align: right; font-family: ui-monospace, Menlo, monospace; }
