/* =========================================================
   Tower Parkour — interface styles
   Editorial look on a warm dark ground: Geist type, solid
   panels with hairline borders, small corners, one accent.
   No gradients, glows or frosted glass. Layout (positions,
   sizes, stacking) is the same as the original game's.
   ========================================================= */
:root {
  --tp-bg: #191715;          /* page ground */
  --tp-panel: #211e1b;       /* solid panel */
  --tp-raised: #2a2623;      /* rows inside panels */
  --tp-sunken: #131210;      /* inputs */
  --tp-hud: rgba(25, 23, 21, .9);
  --tp-line: #3b3835;
  --tp-line-soft: #2e2b28;
  --tp-line-strong: #56514d;
  --tp-ink: #ece8e2;
  --tp-ink-soft: #c9c3bb;
  --tp-mute: #9f9993;
  --tp-mute-soft: #7a726c;
  --tp-accent: #3cdda2;      /* the one accent */
  --tp-danger: #e0776a;
  --tp-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --tp-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --tp-ease: cubic-bezier(.16, 1, .3, 1);
}

/* =========================================================
   Reset & base
   ========================================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--tp-sans);
  background: var(--tp-bg);
  color: var(--tp-ink);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
button, input { font-family: inherit; }

/* =========================================================
   LOGIN PAGE (kept for the old /login route)
   ========================================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tp-bg);
}
.login-card {
  background: var(--tp-panel);
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  padding: 40px 36px;
  width: 360px;
}
.game-title {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--tp-ink);
  margin-bottom: 4px;
}
.game-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--tp-mute);
  margin-bottom: 24px;
}
.tab-bar {
  display: flex;
  margin-bottom: 20px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--tp-line);
}
.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--tp-mute);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background .2s var(--tp-ease), color .2s var(--tp-ease);
}
.tab-btn.active { background: var(--tp-raised); color: var(--tp-ink); font-weight: 600; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--tp-sunken);
  border: 1px solid var(--tp-line);
  border-radius: 4px;
  color: var(--tp-ink);
  font-size: 0.95rem;
  outline: none;
}
.login-card input:focus { border-color: var(--tp-accent); }
.login-card input::placeholder { color: var(--tp-mute-soft); }
.error-msg {
  border: 1px solid var(--tp-danger);
  border-radius: 4px;
  padding: 10px 14px;
  color: var(--tp-danger);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn-primary {
  display: block;
  width: 100%;
  padding: 11px 34px;
  background: var(--tp-ink);
  border: 1px solid var(--tp-ink);
  border-radius: 4px;
  color: var(--tp-bg);
  font: 600 15px var(--tp-sans);
  cursor: pointer;
  transition: background .2s var(--tp-ease), transform .2s var(--tp-ease);
}
.btn-primary:hover { background: #fff; }
.btn-primary:active { transform: scale(.99); }

.btn-secondary,
.btn-rebirth,
.btn-prestige {
  display: block;
  width: 100%;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  color: var(--tp-ink);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background .2s var(--tp-ease), border-color .2s var(--tp-ease);
  margin-top: 8px;
  text-align: center;
}
.btn-secondary:hover,
.btn-rebirth:hover,
.btn-prestige:hover { background: var(--tp-raised); border-color: var(--tp-mute-soft); }

/* =========================================================
   PANELS (shop, abilities, leaderboard, levels, controls,
   editor, admin) — one solid surface, one hairline
   ========================================================= */
.panel {
  background: var(--tp-panel);
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  color: var(--tp-ink);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .6);
}
.panel h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--tp-ink);
  margin-bottom: 12px;
}
.panel h2::before {
  content: "";
  display: block;
  width: 26px;
  height: 1px;
  margin-bottom: 12px;
  background: var(--tp-accent);
}
.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tp-mute);
  padding: 8px 0;
  margin-bottom: 12px;
  border-top: 1px solid var(--tp-line-soft);
  border-bottom: 1px solid var(--tp-line-soft);
}
.panel-row b {
  font-family: var(--tp-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--tp-ink);
  font-variant-numeric: tabular-nums;
}
.panel input[type="text"],
.panel input:not([type]) {
  background: var(--tp-sunken);
  border: 1px solid var(--tp-line);
  border-radius: 4px;
  color: var(--tp-ink);
  outline: none;
}
.panel input:focus { border-color: var(--tp-accent); }
.panel input::placeholder { color: var(--tp-mute-soft); }

/* =========================================================
   ADMIN PANEL
   ========================================================= */
#admin-panel {
  position: fixed;
  top: 120px;
  right: 20px;
  width: 340px;
  background: var(--tp-panel);
  border: 1px solid var(--tp-line-strong);
  border-radius: 8px;
  padding: 0 0 10px 0;
  z-index: 9999;
  user-select: none;
  font-family: var(--tp-sans);
  font-size: 0.82rem;
  color: var(--tp-ink);
}
#admin-panel-header {
  font-family: var(--tp-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--tp-mute);
  padding: 11px 44px 10px 14px;
  border-bottom: 1px solid var(--tp-line);
  border-radius: 8px 8px 0 0;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
#admin-panel-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--tp-mute);
  cursor: pointer;
  line-height: 1;
}
#admin-panel-close:hover { color: var(--tp-ink); border-color: var(--tp-line); }
.admin-row,
.ap-row {
  display: flex;
  gap: 6px;
  padding: 3px 12px;
  align-items: center;
}
.admin-row input,
.ap-input {
  flex: 1;
  min-width: 0;
  background: var(--tp-sunken);
  border: 1px solid var(--tp-line);
  border-radius: 4px;
  color: var(--tp-ink);
  padding: 6px 8px;
  font-size: 0.8rem;
  outline: none;
}
.admin-row input:focus,
.ap-input:focus { border-color: var(--tp-accent); }
.admin-row input::placeholder { color: var(--tp-mute-soft); }
.admin-row button,
.ap-btn {
  flex: none;
  min-width: 84px;
  background: transparent;
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  color: var(--tp-ink);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s var(--tp-ease), border-color .15s var(--tp-ease);
}
.admin-row button:hover,
.ap-btn:hover { background: var(--tp-raised); border-color: var(--tp-mute-soft); }
#btn-god { flex: 1; }
.ap-section {
  font-family: var(--tp-mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--tp-mute);
  letter-spacing: .18em;
  padding: 8px 12px 2px;
}
.ap-num { max-width: 72px; flex: none; }
.ap-wide { flex: 2; }
.ap-danger { border-color: var(--tp-danger); color: var(--tp-danger); }
.ap-danger:hover { background: var(--tp-danger); color: var(--tp-bg); }
.ap-toggle { width: 100%; }
.ap-toggle.god-on,
#btn-god.god-on { border-color: var(--tp-accent); color: var(--tp-accent); }

/* =========================================================
   GAME PAGE
   ========================================================= */
.game-page { overflow: hidden; background: #000; }

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

/* Hide all game HUD/hotbars when chat is open */
body.chat-active #hud-left,
body.chat-active #hud-health,
body.chat-active #hud-reward,
body.chat-active #controls-hint,
body.chat-active #crosshair,
body.chat-active #hotbar,
body.chat-active #ability-hotbar,
body.chat-active #carpet-timer,
body.chat-active #admin-panel {
  visibility: hidden;
  pointer-events: none;
}

/* Crosshair — a small plus sign drawn in CSS */
#crosshair {
  position: fixed;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
  z-index: 10;
  user-select: none;
}
#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, .85);
}
#crosshair::before { left: 6px; top: 0; width: 2px; height: 14px; }
#crosshair::after  { top: 6px; left: 0; width: 14px; height: 2px; }

/* HUD chips share one quiet surface */
#hud-left,
#hud-health,
#hud-reward,
#carpet-timer {
  background: var(--tp-hud);
  border: 1px solid var(--tp-line);
  border-radius: 6px;
}

/* HUD Left */
#hud-left {
  position: fixed;
  top: 16px; left: 16px;
  padding: 12px 16px;
  display: none;
  z-index: 10;
  min-width: 170px;
}
#hud-user {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--tp-ink);
  margin-bottom: 7px;
}
#hud-title {
  display: inline-block;
  font-family: var(--tp-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--tp-ink-soft);
  border: 1px solid var(--tp-line-strong);
  border-radius: 2px;
  padding: 2px 6px;
  margin-bottom: 8px;
}
#hud-title:empty { display: none; }
#hud-left .hud-row,
#hud-weather,
#hud-streak {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--tp-mute);
  margin-top: 3px;
}
#hud-left .hud-row b { color: var(--tp-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
#hud-weather::before { content: "Weather"; }
#hud-weather { color: var(--tp-ink); }
#hud-weather:empty { display: none; }
#hud-streak { color: var(--tp-accent); margin-top: 8px; }
#hud-streak:empty { display: none; }
#hud-currency { font-size: 0.84rem; margin-bottom: 3px; }
#hud-rebirth  { font-size: 0.84rem; margin-bottom: 3px; color: var(--tp-ink-soft); }
#hud-towers   { font-size: 0.84rem; color: var(--tp-ink-soft); }
#hud-currency:empty, #hud-rebirth:empty, #hud-towers:empty { display: none; }

#hud-online {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--tp-line);
  font-family: var(--tp-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tp-mute);
}
#hud-online::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tp-accent);
  margin-right: 7px;
  vertical-align: 1px;
}
#hud-online:empty { display: none; }

/* HUD Right — health bar */
#hud-health {
  position: fixed;
  top: 16px; right: 16px;
  padding: 10px 16px;
  display: none;
  z-index: 10;
  min-width: 160px;
}
#hp-bar {
  width: 100%;
  height: 6px;
  background: var(--tp-sunken);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
#hp-bar-fill {
  height: 100%;
  width: 100%;
  background: #4caf50;
  border-radius: 2px;
  transition: width 0.2s, background 0.3s;
}
#hp-text {
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--tp-ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* HUD Right — active reward (below health) */
#hud-reward {
  position: fixed;
  top: 82px; right: 16px;
  padding: 10px 16px;
  text-align: right;
  display: none;
  z-index: 10;
  min-width: 160px;
}
#reward-label { font-size: 0.86rem; font-weight: 600; color: var(--tp-ink); }
#reward-uses  {
  font-family: var(--tp-mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--tp-mute);
  margin-top: 3px;
}

/* Shop upgrade rows (the shop panel holds them) */
#stat-sliders { display: none; }
.stat-slider-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.stat-slider-row:last-child { margin-bottom: 0; }
.stat-slider-label { font-size: 0.78rem; color: var(--tp-mute); width: 54px; flex-shrink: 0; }
.stat-slider-val { font-size: 0.78rem; color: var(--tp-ink); width: 32px; text-align: right; flex-shrink: 0; }
#stat-sliders input[type=range] { flex: 1; height: 4px; accent-color: var(--tp-accent); cursor: pointer; }

/* Controls hint */
#controls-hint {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%);
  background: var(--tp-hud);
  border: 1px solid var(--tp-line);
  border-radius: 4px;
  padding: 7px 16px;
  font-size: 0.74rem;
  color: var(--tp-mute);
  display: none;
  z-index: 10;
  white-space: nowrap;
  pointer-events: none;
}
#controls-hint:empty { display: none !important; }

/* =========================================================
   OVERLAY (start screen)
   ========================================================= */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 13, 12, .84);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.overlay-card {
  background: var(--tp-panel);
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  padding: 34px 38px;
  text-align: center;
  width: 340px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, .55);
  animation: tp-in .6s var(--tp-ease) both;
}
.overlay-card h1,
.overlay-card h2 {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  color: var(--tp-ink);
  margin: 8px 0 10px;
}
.overlay-card p { color: var(--tp-ink-soft); font-size: 0.9rem; margin-bottom: 28px; }
.overlay-card .btn-primary { margin-bottom: 10px; }
.tp-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  font-family: var(--tp-mono);
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--tp-mute) !important;
  margin: 0 !important;
}
.tp-kicker::before,
.tp-kicker::after {
  content: "";
  width: 14px;
  height: 1px;
  background: var(--tp-line-strong);
}
#overlay-who { color: var(--tp-ink-soft); font-size: 14px; margin: 0 0 22px; }
#controls-hint-overlay {
  margin: 20px 0 0;
  color: var(--tp-mute-soft);
  font-size: 12.5px;
  line-height: 1.9;
  max-width: 44ch;
}
#controls-hint-overlay b {
  font-family: var(--tp-mono);
  font-weight: 500;
  color: var(--tp-ink-soft);
  font-size: 10.5px;
  border: 1px solid var(--tp-line);
  border-radius: 2px;
  padding: 1px 5px;
}

/* =========================================================
   SHOP PANEL
   ========================================================= */
#shop-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  width: 440px;
  z-index: 50;
}
#shop-panel h2 { text-align: left; }
#shop-panel #stat-sliders {
  position: static;
  background: none;
  border: 0;
  padding: 0;
  min-width: 0;
}
#shop-currency {
  color: var(--tp-mute);
  font-size: 0.88rem;
}
#shop-currency:empty { display: none; }
#shop-val-currency { color: var(--tp-ink); font-weight: 600; }
.shop-row {
  display: grid;
  grid-template-columns: 1fr 52px 104px 92px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--tp-line-soft);
  font-size: 0.9rem;
}
.shop-row > span:first-child { font-weight: 500; color: var(--tp-ink); }
.shop-row > span:nth-child(2) {
  font-family: var(--tp-mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--tp-mute);
}
.shop-row > span:nth-child(2)::before { content: "Lv "; }
.shop-row > span:nth-child(3) {
  font-size: 0.8rem;
  color: var(--tp-ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.shop-item {
  background: var(--tp-raised);
  border: 1px solid var(--tp-line);
  border-radius: 6px;
  padding: 14px 10px;
  text-align: center;
}
.shop-icon { font-size: 1.8rem; margin-bottom: 4px; }
.shop-name { font-size: 0.84rem; font-weight: 600; color: var(--tp-ink); margin-bottom: 2px; }
.shop-level { font-size: 0.74rem; color: var(--tp-mute); margin-bottom: 4px; }
.shop-cost  { font-size: 0.74rem; color: var(--tp-ink-soft); margin-bottom: 8px; }

/* one button style for every buy / upgrade / play action */
.btn-upgrade,
.btn-buy-ab,
.btn-play-level {
  padding: 6px 12px;
  background: var(--tp-ink);
  border: 1px solid var(--tp-ink);
  border-radius: 4px;
  color: var(--tp-bg);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s var(--tp-ease), color .2s var(--tp-ease), border-color .2s var(--tp-ease);
}
.btn-upgrade { width: 100%; }
.btn-upgrade:hover,
.btn-buy-ab:hover,
.btn-play-level:hover { background: #fff; border-color: #fff; }
.btn-upgrade:disabled,
.btn-buy-ab:disabled {
  background: transparent;
  border-color: var(--tp-line);
  color: var(--tp-mute-soft);
  cursor: not-allowed;
}
.shop-msg,
#shop-msg {
  text-align: center;
  min-height: 20px;
  font-size: 0.82rem;
  margin-top: 10px;
  color: var(--tp-accent);
}

/* =========================================================
   CARPET TIMER
   ========================================================= */
#carpet-timer {
  position: fixed;
  bottom: 80px;
  right: 16px;
  padding: 10px 20px;
  text-align: center;
  z-index: 15;
  min-width: 90px;
  pointer-events: none;
}
#carpet-time {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--tp-ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.carpet-label {
  font-family: var(--tp-mono);
  font-size: 10px;
  color: var(--tp-mute);
  margin-top: 4px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* =========================================================
   TOAST NOTIFICATION
   ========================================================= */
.toast,
#toast {
  position: fixed;
  bottom: 128px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tp-panel);
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  padding: 10px 20px;
  color: var(--tp-ink);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 200;
  transition: opacity 0.4s;
  white-space: nowrap;
  pointer-events: none;
}
#toast:empty { display: none; }

/* =========================================================
   CHAT
   ========================================================= */
#chat-log {
  position: fixed;
  bottom: 80px;
  left: 16px;
  width: 340px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 20;
  pointer-events: none;
}
.chat-line {
  background: var(--tp-hud);
  border: 1px solid var(--tp-line-soft);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.84rem;
  color: var(--tp-ink-soft);
  word-break: break-word;
}
.chat-self { border-color: var(--tp-line-strong); }
.chat-user {
  font-weight: 600;
  color: var(--tp-ink);
  margin-right: 4px;
}
.chat-self .chat-user { color: var(--tp-accent); }
#chat-input-wrap {
  position: fixed;
  bottom: 40px;
  left: 16px;
  width: 340px;
  z-index: 25;
}
#chat-input-box {
  width: 100%;
  padding: 9px 14px;
  background: var(--tp-panel);
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  color: var(--tp-ink);
  font-size: 0.9rem;
  outline: none;
}
#chat-input-box:focus { border-color: var(--tp-accent); }
#chat-input-box::placeholder { color: var(--tp-mute-soft); }

/* =========================================================
   KEYBINDS PANEL
   ========================================================= */
#keybinds-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  width: 420px;
  z-index: 55;
}
#keybinds-list {
  display: flex;
  flex-direction: column;
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 4px;
}
.keybind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 2px;
  border-bottom: 1px solid var(--tp-line-soft);
}
.keybind-action { font-size: 0.86rem; color: var(--tp-ink-soft); }
.keybind-btn {
  padding: 4px 12px;
  min-width: 84px;
  background: var(--tp-sunken);
  border: 1px solid var(--tp-line);
  border-radius: 4px;
  color: var(--tp-ink);
  font-size: 0.78rem;
  font-family: var(--tp-mono);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s var(--tp-ease);
}
.keybind-btn:hover { border-color: var(--tp-line-strong); }
.keybind-btn.rebinding {
  border-color: var(--tp-accent);
  color: var(--tp-accent);
  animation: kb-pulse 0.8s infinite;
}
@keyframes kb-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}
.keybinds-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* =========================================================
   EDITOR PANEL
   ========================================================= */
#editor-panel {
  position: fixed;
  top: 50%; right: 16px;
  transform: translateY(-50%);
  padding: 18px 20px;
  width: 230px;
  z-index: 50;
}
#editor-panel label {
  display: block;
  font-family: var(--tp-mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tp-mute);
}
#editor-size,
#editor-count {
  display: flex;
  justify-content: space-between;
  font-family: var(--tp-mono);
  font-size: 12px;
  color: var(--tp-ink);
  padding: 6px 0;
  border-top: 1px solid var(--tp-line-soft);
}
#editor-size::before  { content: "Platform size"; color: var(--tp-mute); font-size: 11px; }
#editor-count::before { content: "Placed"; color: var(--tp-mute); font-size: 11px; }
.editor-hint {
  font-size: 0.78rem;
  color: var(--tp-mute);
  background: var(--tp-raised);
  border-radius: 4px;
  padding: 5px 8px;
  margin-bottom: 8px;
}
.editor-stats { font-size: 0.84rem; color: var(--tp-ink); margin-bottom: 6px; }
.editor-note { font-size: 0.74rem; color: var(--tp-mute-soft); margin-bottom: 10px; font-style: italic; }
#editor-level-name {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 7px 10px;
  background: var(--tp-sunken);
  border: 1px solid var(--tp-line);
  border-radius: 4px;
  color: var(--tp-ink);
  font: 400 0.85rem var(--tp-sans);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 10px;
  outline: none;
}
#editor-level-name:focus { border-color: var(--tp-accent); }
.editor-slots { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.slot-group { display: flex; align-items: center; gap: 5px; }
.slot-group span { flex: 1; font-size: 0.8rem; color: var(--tp-mute); }
.slot-group button {
  padding: 4px 10px;
  font-size: 0.78rem;
  background: transparent;
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  color: var(--tp-ink);
  cursor: pointer;
}
.slot-group button:hover { background: var(--tp-raised); }

/* =========================================================
   LOBBY (levels) PANEL
   ========================================================= */
#lobby-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  width: 460px;
  z-index: 50;
  display: flex;
  flex-direction: column;
}
.lobby-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.lobby-refresh {
  background: transparent;
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  color: var(--tp-ink);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}
.lobby-refresh:hover { background: var(--tp-raised); }
#lobby-list {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  min-height: 80px;
  max-height: 50vh;
}
.lobby-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--tp-line-soft);
  padding: 10px 2px;
}
.lobby-info { display: flex; flex-direction: column; gap: 2px; }
.lobby-name   { font-size: 0.92rem; font-weight: 500; color: var(--tp-ink); }
.lobby-author { font-size: 0.76rem; color: var(--tp-mute); }
.lobby-empty, .lobby-loading { text-align: center; color: var(--tp-mute); font-size: 0.86rem; padding: 20px 0; }

/* =========================================================
   HOTBAR
   ========================================================= */
#hotbar {
  position: fixed;
  bottom: 55px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 15;
  pointer-events: none;
}
.hb-slot {
  width: 56px;
  height: 56px;
  background: var(--tp-hud);
  border: 1px solid var(--tp-line);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  position: relative;
  transition: border-color 0.1s;
}
.hb-active { border-color: var(--tp-accent); }
.hb-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-family: var(--tp-mono);
  font-size: 0.6rem;
  color: var(--tp-mute-soft);
  line-height: 1;
}
/* item names written in small caps-style mono instead of pictures */
.hb-icon {
  font-family: var(--tp-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--tp-ink);
  line-height: 1;
  text-align: center;
}
.hb-count {
  font-family: var(--tp-mono);
  font-size: 10px;
  color: var(--tp-mute);
  line-height: 1;
}
.hb-count:empty { display: none; }

/* =========================================================
   ABILITY HOTBAR
   ========================================================= */
#ability-hotbar {
  position: fixed;
  bottom: 55px;
  left: 50%;
  transform: translateX(calc(-50% + 296px)); /* just right of the item bar, 16px apart */
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 15;
  pointer-events: none;
}
.ah-divider {
  width: 1px;
  height: 40px;
  background: var(--tp-line-strong);
  margin-right: 4px;
}
.ah-slot {
  width: 48px;
  height: 48px;
  background: var(--tp-hud);
  border: 1px solid var(--tp-line);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.1s;
}
.ah-active { border-color: var(--tp-ink); }
.ah-icon {
  font-family: var(--tp-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: .03em;
  color: var(--tp-ink-soft);
  line-height: 1.25;
  text-align: center;
  max-width: 44px;
}
.ah-hint {
  font-family: var(--tp-mono);
  font-size: 0.7rem;
  color: var(--tp-mute);
  padding: 2px 5px;
  border: 1px solid var(--tp-line);
  border-radius: 2px;
  margin-left: 2px;
}

/* =========================================================
   LEADERBOARD PANEL
   ========================================================= */
#leaderboard-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  width: 400px;
  z-index: 55;
}
#leaderboard-list {
  display: flex;
  flex-direction: column;
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 4px;
}
.lb-item {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--tp-line-soft);
  padding: 9px 2px;
  font-size: 0.88rem;
}
.lb-rank  { font-family: var(--tp-mono); font-size: 12px; color: var(--tp-mute); }
.lb-item:first-child .lb-rank { color: var(--tp-accent); }
.lb-name  { color: var(--tp-ink); font-weight: 500; }
.lb-coins { color: var(--tp-ink-soft); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.lb-rebirth {
  font-family: var(--tp-mono);
  font-size: 10.5px;
  letter-spacing: .04em;
  color: var(--tp-mute);
  min-width: 64px;
  text-align: right;
}
.lb-empty, .lb-loading { text-align: center; color: var(--tp-mute); font-size: 0.86rem; padding: 16px 0; }

/* =========================================================
   ABILITIES SHOP PANEL
   ========================================================= */
#abilities-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 24px 28px;
  width: 440px;
  z-index: 55;
}
.ab-currency { font-size: 0.86rem; color: var(--tp-mute); margin-bottom: 14px; text-align: center; }
.ab-currency span { color: var(--tp-ink); font-weight: 600; }
#abilities-list {
  display: flex;
  flex-direction: column;
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 4px;
}
.ab-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--tp-line-soft);
  padding: 10px 2px;
}
.ab-icon  { display: none; } /* the name already says what it is */
.ab-info  { display: flex; flex-direction: column; gap: 2px; }
.ab-name  { font-size: 0.9rem; font-weight: 500; color: var(--tp-ink); }
.ab-desc  { font-size: 0.76rem; color: var(--tp-mute); }
.ab-cost  { font-size: 0.8rem; color: var(--tp-ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.btn-buy-ab { min-width: 58px; }
.ab-msg,
#ab-msg {
  text-align: center;
  min-height: 18px;
  font-size: 0.82rem;
  color: var(--tp-danger);
  margin-top: 8px;
}

/* =========================================================
   SKIN ROW (inside shop panel)
   ========================================================= */
.shop-section-title {
  font-family: var(--tp-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--tp-mute);
  letter-spacing: .14em;
  margin: 12px 0 6px;
}
.skin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  font-size: 0.9rem;
  font-weight: 500;
}
.skin-row input[type="color"] {
  width: 44px;
  height: 30px;
  padding: 2px;
  border: 1px solid var(--tp-line-strong);
  border-radius: 4px;
  background: var(--tp-sunken);
  cursor: pointer;
  flex-shrink: 0;
}
.skin-row .btn-upgrade { flex: 1; }

/* =========================================================
   MOTION + UTILITY
   ========================================================= */
@keyframes tp-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .overlay-card { animation: none; } }

.hidden { display: none !important; }
