/* =====================================================
   DODGEFIELD – LEVEL EDITOR  (v7)
   ===================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: 'Arial Black', 'Arial Bold', Arial, sans-serif;
  background: #d8e4f4;
  color: #222;
  user-select: none;
}

/* ── Checkerboard bg ── */
#home-bg {
  position: absolute; inset: 0;
  background-image: repeating-conic-gradient(#c8d8f0 0% 25%, #b0c0e0 0% 50%);
  background-size: 32px 32px;
}

/* ===================================================
   HUB SCREEN
   =================================================== */
#hub-screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: #c4d0e8;
  background-image: repeating-conic-gradient(#c8d8f0 0% 25%, #b8c8e0 0% 50%);
  background-size: 32px 32px;
}

#hub-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  height: 100%;
}

/* Hub header */
#hub-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  padding: 0 18px; height: 52px; flex-shrink: 0;
  border-bottom: 3px solid #1133aa;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
#hub-logo { display: flex; align-items: baseline; gap: 10px; }
#hub-logo-word {
  font-size: 22px; font-weight: 900; color: #fff;
  letter-spacing: 3px; text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}
#hub-logo-tag {
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.6);
  letter-spacing: 2px; text-transform: uppercase;
}
#hub-header-right { display: flex; align-items: center; gap: 8px; }

/* Hub account bar */
#hub-account-bar { display: flex; align-items: center; gap: 6px; }
#hub-account-name {
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.85);
  padding: 0 4px;
}

/* Hub buttons */
.hub-btn {
  font-family: inherit; font-size: 10px; font-weight: 700;
  padding: 5px 11px; border: 2px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.12); color: #fff;
  cursor: pointer; white-space: nowrap;
  transition: background 0.1s, border-color 0.1s;
  letter-spacing: 0.3px;
}
.hub-btn:hover { background: rgba(255,255,255,0.22); border-color: rgba(255,255,255,0.5); }
.hub-btn.hub-btn-accent { background: #28a845; border-color: #1a7a32; }
.hub-btn.hub-btn-accent:hover { background: #1e8c38; }
.hub-btn.hub-btn-danger { background: rgba(180,30,30,0.7); border-color: rgba(255,100,100,0.4); }
.hub-btn.hub-btn-danger:hover { background: rgba(200,40,40,0.9); }
.hub-btn.hub-btn-admin { background: rgba(100,60,160,0.5); border-color: rgba(180,140,255,0.4); }
.hub-btn.hub-btn-admin:hover { background: rgba(120,80,180,0.7); }
.hub-btn.hub-btn-upload { background: #28a845; border-color: #1a7a32; }
.hub-btn.hub-btn-upload:hover { background: #1e8c38; }
.hub-btn.hidden { display: none !important; }

/* Hub panels layout */
#hub-panels {
  flex: 1; display: flex; gap: 12px;
  padding: 12px 14px 6px 14px; overflow: hidden;
  min-height: 0;
}

.hub-panel {
  display: flex; flex-direction: column;
  background: #c8d8f0;
  border: 2px solid #7a90cc;
  box-shadow: 2px 2px 0 rgba(100,130,200,0.3);
  overflow: hidden;
  min-width: 0;
}

#hub-panel-create { flex: 0 0 340px; }
#hub-panel-online { flex: 1; }

.hub-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #2a44cc, #1a3acc);
  padding: 7px 12px; flex-shrink: 0;
  border-bottom: 2px solid #1133aa;
}
.hub-panel-title {
  font-size: 11px; font-weight: 900; color: #fff;
  letter-spacing: 1.5px; text-transform: uppercase;
}
.hub-panel-actions { display: flex; gap: 5px; }

/* My levels list */
#hub-my-levels-list {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
}
#hub-my-levels-list::-webkit-scrollbar { width: 5px; }
#hub-my-levels-list::-webkit-scrollbar-thumb { background: #6a80c8; }

.hub-level-card {
  display: flex; align-items: stretch;
  border-bottom: 1px solid #a0b4d8;
  cursor: pointer;
  transition: background 0.07s;
  background: #c8d8f0;
  min-height: 46px;
}
.hub-level-card:last-child { border-bottom: none; }
.hub-level-card:hover { background: #bccce4; }

.hub-level-num {
  width: 34px; flex-shrink: 0;
  background: #1a2a88; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900;
  border-right: 1px solid #8899cc;
}
.hub-level-info {
  flex: 1; min-width: 0;
  padding: 7px 10px; display: flex; flex-direction: column; justify-content: center;
}
.hub-level-name {
  font-size: 12px; font-weight: 900; color: #1a2a88;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hub-level-meta { font-size: 9px; color: #556; margin-top: 1px; font-family: Arial, sans-serif; }

.hub-level-btns { display: flex; border-left: 1px solid #a0b4d8; }
.hub-level-btn {
  background: #d8e4f8; border: none; border-left: 1px solid #a0b4d8;
  color: #223; font-size: 10px; font-weight: 700;
  padding: 0 9px; cursor: pointer; font-family: inherit;
  min-height: 46px;
  transition: background 0.07s;
}
.hub-level-btn:first-child { border-left: none; }
.hub-level-btn:hover { background: #c0d0f0; }
.hub-level-btn.btn-play { background: #2244cc; color: #fff; font-size: 12px; }
.hub-level-btn.btn-play:hover { background: #1a36bb; }
.hub-level-btn.btn-del:hover { background: #cc2222; color: #fff; }

#hub-btn-new-level {
  display: block; width: 100%; flex-shrink: 0;
  font-family: inherit; font-size: 12px; font-weight: 900;
  padding: 11px; border: none; border-top: 2px solid #6a80c8;
  background: #2244cc; color: #fff; cursor: pointer;
  letter-spacing: 1px; text-transform: uppercase;
  transition: background 0.1s;
}
#hub-btn-new-level:hover { background: #1a36bb; }

/* Online panel internals */
#hub-search-row {
  display: flex; padding: 8px 10px; gap: 6px;
  border-bottom: 1px solid #9aabd8; flex-shrink: 0;
  background: rgba(255,255,255,0.15);
}
#hub-search {
  flex: 1; border: 2px solid #8899cc; background: rgba(255,255,255,0.7);
  padding: 5px 10px; font-family: inherit; font-size: 12px; font-weight: 700;
  color: #1a2a88; outline: none;
}
#hub-search::placeholder { color: #6677aa; font-weight: 400; }
#hub-search:focus { border-color: #2244cc; background: rgba(255,255,255,0.9); }

#hub-filter-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 7px 10px; border-bottom: 1px solid #9aabd8;
  background: rgba(200,220,250,0.4); flex-shrink: 0;
}
.filter-group { display: flex; flex-direction: column; gap: 3px; }
.filter-label {
  font-size: 8px; font-weight: 900; color: #1a2a88;
  letter-spacing: 1px; text-transform: uppercase;
}
.filter-btn-row { display: flex; gap: 3px; }
.filter-btn {
  font-family: inherit; font-size: 9px; font-weight: 700;
  padding: 3px 8px; border: 2px solid #8899cc;
  background: rgba(255,255,255,0.5); color: #334;
  cursor: pointer; transition: background 0.1s;
  white-space: nowrap;
}
.filter-btn:hover { background: rgba(255,255,255,0.8); }
.filter-btn.active { background: #2244cc; color: #fff; border-color: #1133aa; }

.filter-diff-row { display: flex; align-items: center; gap: 4px; }
.diff-range-side { font-size: 9px; font-weight: 700; color: #f0a020; }
.diff-range-sep { font-size: 10px; color: #556; font-weight: 900; }
#filter-diff-min, #filter-diff-max { width: 70px; accent-color: #f0a020; cursor: pointer; }

/* Online count bar */
#hub-online-count-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 10px; border-bottom: 1px solid #9aabd8;
  background: rgba(200,215,245,0.5); flex-shrink: 0;
}
#hub-online-count { font-size: 9px; font-weight: 900; color: #1a2a88; letter-spacing: 1px; text-transform: uppercase; }

/* Online levels list */
#hub-online-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
}
#hub-online-list::-webkit-scrollbar { width: 6px; }
#hub-online-list::-webkit-scrollbar-track { background: #b8cce4; }
#hub-online-list::-webkit-scrollbar-thumb { background: #6a80c8; }

/* Online level cards */
.online-level-card {
  display: flex; align-items: stretch;
  border-bottom: 1px solid #a0b4d8;
  cursor: pointer;
  transition: background 0.07s;
  background: #c8d8f0;
}
.online-level-card:last-child { border-bottom: none; }
.online-level-card:hover { background: #bccce4; }
.online-level-card.is-featured {
  background: linear-gradient(90deg, #f8f0d0 0%, #c8d8f0 60%);
  border-left: 3px solid #d0a000;
}
.online-level-card.is-featured:hover { background: linear-gradient(90deg, #f0e8c0 0%, #bccce4 60%); }
.online-level-card.is-beaten {
  background: linear-gradient(90deg, #d4f0d8 0%, #c8d8f0 70%);
}
.online-level-card.is-beaten.is-featured {
  background: linear-gradient(90deg, #d4f0d8 0%, #f8f0d0 50%, #c8d8f0 100%);
}
.online-level-card.is-beaten:hover { background: linear-gradient(90deg, #c4e8cc 0%, #bccce4 70%); }

.online-level-num {
  width: 34px; flex-shrink: 0; align-self: stretch;
  background: #1a2a88; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 900;
  border-right: 1px solid #8899cc;
}
.online-level-card.is-featured .online-level-num { background: #a07800; }
.online-level-card.is-beaten .online-level-num { background: #1a6a30; }

.online-level-info { flex: 1; min-width: 0; padding: 7px 10px; }
.online-level-name {
  font-size: 12px; font-weight: 900; color: #1a2a88;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.online-level-meta { font-size: 9px; color: #556; margin-top: 2px; font-family: Arial, sans-serif; }

.featured-tag {
  font-size: 8px; font-weight: 900; color: #6a4a00;
  background: #f0c840; padding: 1px 5px;
  letter-spacing: 0.5px; text-transform: uppercase;
}
.beaten-tag {
  font-size: 8px; font-weight: 900; color: #1a5a28;
  background: #84e899; padding: 1px 5px;
  letter-spacing: 0.5px; text-transform: uppercase;
}

/* Difficulty row */
.online-level-extras {
  display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap;
}
.level-diff {
  display: flex; align-items: center; gap: 2px;
  font-size: 10px;
}
.diff-pip {
  width: 7px; height: 7px; border-radius: 1px;
  background: #ccc; display: inline-block;
}
.diff-pip.filled { background: #d09000; }
.diff-num-label { font-size: 8px; color: #778; font-weight: 700; margin-left: 2px; }

.admin-stars {
  font-size: 9px; font-weight: 900; color: #aa7700;
  letter-spacing: 1px;
}
.play-count { font-size: 8px; color: #667; font-family: Arial, sans-serif; }

.online-level-btns { display: flex; border-left: 1px solid #a0b4d8; }
.online-level-btn {
  background: #d8e4f8; border: none; border-left: 1px solid #a0b4d8;
  color: #223; font-size: 10px; font-weight: 700;
  padding: 0 9px; cursor: pointer; font-family: inherit;
  min-height: 48px; min-width: 46px;
  transition: background 0.07s;
}
.online-level-btn:first-child { border-left: none; }
.online-level-btn:hover { background: #c0d0f0; }
.online-level-btn.btn-play { background: #2244cc; color: #fff; font-size: 12px; min-width: 56px; }
.online-level-btn.btn-play:hover { background: #1a36bb; }
.online-level-btn.btn-admin-del { color: #cc2222; font-size: 11px; }
.online-level-btn.btn-admin-del:hover { background: #cc2222; color: #fff; }
.online-level-btn.btn-admin-rate { color: #aa7700; }
.online-level-btn.btn-admin-feat { color: #1a66aa; font-size: 9px; }

/* Empty / loading states */
.hub-empty { padding: 28px 18px; text-align: center; background: #c8d8f0; }
.hub-empty.hidden { display: none; }
.hub-empty-text { font-size: 11px; font-weight: 700; color: #445; font-family: Arial, sans-serif; line-height: 1.7; }

/* Hub footer */
#hub-footer {
  font-size: 9px; font-weight: 700; color: #556;
  letter-spacing: 1px; text-align: center;
  background: rgba(255,255,255,0.3);
  border-top: 2px solid #aabcd8;
  padding: 5px 20px; flex-shrink: 0;
}

/* ===================================================
   AUTH MODAL
   =================================================== */
#auth-modal {
  position: fixed; inset: 0;
  background: rgba(180,200,240,0.55);
  background-image: repeating-conic-gradient(rgba(200,220,255,0.4) 0% 25%, rgba(180,200,240,0.4) 0% 50%);
  background-size: 32px 32px;
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  backdrop-filter: blur(2px);
}
#auth-modal.hidden { display: none; }
#auth-box {
  background: #c4d4f0; border: 4px solid #6a80c8;
  width: min(420px, 94vw);
  box-shadow: 4px 4px 0 #7a90cc, 0 12px 40px rgba(0,0,80,0.3);
  overflow: hidden;
}
#auth-tabs {
  display: flex; background: #c0d0ec; border-bottom: 2px solid #8899cc;
}
.auth-tab {
  flex: 1; font-family: inherit; font-size: 10px; font-weight: 900;
  padding: 10px; border: none; background: none; color: #4466aa;
  cursor: pointer; border-right: 1px solid #a0b4d8; border-bottom: 3px solid transparent;
  letter-spacing: 0.5px; text-transform: uppercase;
  transition: color 0.15s;
}
.auth-tab:last-child { border-right: none; }
.auth-tab.active { color: #1a2a88; border-bottom-color: #2244cc; background: rgba(255,255,255,0.25); }
.auth-tab:hover:not(.active) { color: #2244cc; background: rgba(255,255,255,0.12); }

#auth-login-form, #auth-register-form {
  padding: 18px 22px; display: flex; flex-direction: column; gap: 9px;
  background: #c4d4f0;
}
#auth-register-form.hidden, #auth-login-form.hidden { display: none; }
.auth-section-title {
  font-size: 11px; font-weight: 900; color: #1a2a88;
  letter-spacing: 2px; text-transform: uppercase;
  margin-bottom: 4px; padding-bottom: 6px; border-bottom: 2px solid #8899cc;
}
.auth-label { font-size: 9px; font-weight: 900; color: #334; letter-spacing: 1px; text-transform: uppercase; }
#auth-email, #auth-password,
#auth-reg-username, #auth-reg-email, #auth-reg-password {
  width: 100%; padding: 9px 12px; font-family: inherit; font-size: 13px; font-weight: 700;
  border: 2px solid #8899cc; background: rgba(255,255,255,0.7); color: #112; outline: none;
}
#auth-email:focus, #auth-password:focus,
#auth-reg-username:focus, #auth-reg-email:focus, #auth-reg-password:focus {
  border-color: #2244cc; background: rgba(255,255,255,0.9);
}
.auth-error {
  background: rgba(200,30,30,0.12); border: 2px solid #cc3333;
  padding: 8px 12px; font-size: 11px; font-weight: 700;
  color: #880000; font-family: Arial, sans-serif;
}
.auth-error.hidden { display: none; }
.auth-submit-btn { width: 100%; padding: 11px; font-size: 12px; margin-top: 4px; }
.auth-guest-btn {
  width: 100%; padding: 9px; font-size: 10px;
  background: transparent; border: 2px solid #8899cc; color: #556;
  font-family: inherit; font-weight: 700; cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.auth-guest-btn:hover { background: rgba(34,68,204,0.1); color: #2244cc; border-color: #2244cc; }

/* ===================================================
   MY UPLOADS MODAL — see dark theme styles at bottom
   =================================================== */

/* ===================================================
   SHARED OLD-SCREEN STYLES (create-screen, home-screen placeholders)
   =================================================== */
#home-screen { display: none; }
#create-screen { display: none; }
#online-screen { display: none; }

/* ===================================================
   EDITOR
   =================================================== */
#editor-screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
#editor-screen.hidden { display: none; }

/* Top bar */
#topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #c4d4f0, #aabce8);
  border-bottom: 3px solid #6a80c8;
  padding: 0 12px; height: 50px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  z-index: 10; position: relative; gap: 10px;
}
#game-title { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.title-small { font-size: 9px; font-weight: 700; color: #445; letter-spacing: 1px; text-transform: uppercase; }
.title-big   { font-size: 18px; font-weight: 900; color: #1a2a88; text-shadow: 1px 1px 0 #8090cc; letter-spacing: 2px; }
#topbar-center { flex: 1; min-width: 0; }
#current-level-name-input {
  width: 100%; max-width: 260px; padding: 5px 10px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  border: 2px solid rgba(100,130,200,0.4);
  background: rgba(255,255,255,0.55); color: #1a2a88;
  outline: none; transition: border-color 0.15s, background 0.15s;
}
#current-level-name-input:focus { border-color: #2244cc; background: rgba(255,255,255,0.85); }
#topbar-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

#btn-home, #btn-sidebar-toggle {
  font-size: 17px; background: none; border: none; cursor: pointer;
  color: #334; padding: 4px 6px;
  transition: background 0.1s; line-height: 1;
}
#btn-home:hover, #btn-sidebar-toggle:hover { background: rgba(0,0,0,0.1); }

/* Buttons */
.action-btn {
  font-family: inherit; font-size: 11px; font-weight: 700;
  padding: 5px 11px; border: 2px solid #6677bb;
  background: #e8ecf8; color: #223;
  cursor: pointer; transition: background 0.1s, transform 0.06s;
  white-space: nowrap;
}
.action-btn:hover  { background: #ccd3f0; }
.action-btn:active { transform: scale(0.96); }
.action-btn.primary { background: #2244cc; color: #fff; border-color: #1133aa; }
.action-btn.primary:hover { background: #1a36bb; }
.action-btn.danger  { background: #cc2222; color: #fff; border-color: #991111; margin-top: 8px; width: 100%; }
.action-btn.danger:hover  { background: #aa1111; }
.action-btn.full-width { width: 100%; margin-top: 4px; }

/* Layout */
#main-layout { display: flex; flex: 1; overflow: hidden; }

/* Toolbar */
#toolbar {
  width: 174px; flex-shrink: 0;
  background: linear-gradient(180deg, #cad8f0, #beccec);
  border-right: 3px solid #7a90cc;
  overflow: hidden; display: flex; flex-direction: column;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
}
#toolbar.collapsed { width: 0; border-right-width: 0; }
#toolbar-inner {
  width: 174px; overflow-y: auto; overflow-x: hidden;
  padding: 8px 7px; display: flex; flex-direction: column; flex: 1;
}
#toolbar-inner::-webkit-scrollbar { width: 5px; }
#toolbar-inner::-webkit-scrollbar-thumb { background: #8899cc; }

.toolbar-section { margin-bottom: 2px; }
.toolbar-section-label {
  font-size: 8px; font-weight: 900; color: #446;
  letter-spacing: 1.5px; text-transform: uppercase;
  margin: 6px 0 4px;
}
.toolbar-divider { border: none; border-top: 2px solid #9aaad8; margin: 7px 0; }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.tool-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 7px 4px; min-height: 52px;
  background: #dde8fc; border: 2px solid #8899cc;
  cursor: pointer; font-family: inherit; color: #223;
  transition: background 0.1s, border-color 0.1s;
  position: relative;
}
.tool-btn:hover  { background: #c8d4f8; border-color: #5566aa; }
.tool-btn.active { background: #2244cc; color: #fff; border-color: #1133aa; }
.tool-label { font-size: 8px; font-weight: 700; }
.tool-shortcut {
  position: absolute; top: 3px; right: 4px;
  font-size: 8px; font-weight: 900; font-family: monospace;
  color: rgba(0,0,0,0.25);
}
.tool-btn.active .tool-shortcut { color: rgba(255,255,255,0.4); }
.tool-swatch { width: 18px; height: 18px; border: 2px solid rgba(0,0,0,0.12); flex-shrink: 0; }
.erase-swatch { background: #b0c0e0; border: 2px dashed #8899bb !important; }
.tool-circle { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.12); flex-shrink: 0; }
.tool-key-shape { width: 20px; height: 13px; background: #e8c200; border-radius: 7px 3px 3px 7px; flex-shrink: 0; }
.tool-select-icon, .tool-fill-icon { font-size: 14px; line-height: 1; flex-shrink: 0; }
.tool-btn.active .tool-select-icon, .tool-btn.active .tool-fill-icon { color: #fff; }

/* Context panel */
.panel-block { display: flex; flex-direction: column; gap: 2px; }
.panel-block.hidden { display: none; }
.panel-label { font-size: 9px; font-weight: 700; color: #334; margin-top: 7px; }
.hint-text { font-size: 9px; font-weight: 700; color: #b03000; line-height: 1.4; margin-top: 2px; }
.hint-text.hidden { display: none; }
.inst-text { font-size: 9px; font-weight: 400; font-family: Arial, sans-serif; color: #445; line-height: 1.65; }

.slider-number-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.panel-range { flex: 1; accent-color: #2244cc; cursor: pointer; height: 14px; min-width: 0; }
.num-input {
  width: 48px; flex-shrink: 0;
  padding: 2px 4px; font-family: inherit; font-size: 10px; font-weight: 700;
  border: 2px solid #8899cc; background: #f0f4ff; color: #112; text-align: center;
  outline: none; -moz-appearance: textfield;
}
.num-input::-webkit-outer-spin-button, .num-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.num-input:focus { border-color: #2244cc; background: #fff; }
.slider-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.panel-range-val { font-size: 10px; font-weight: 700; color: #1133aa; width: 34px; text-align: right; flex-shrink: 0; }
.btn-row { display: flex; gap: 3px; margin-top: 2px; }
.dir-btn, .choice-btn {
  flex: 1; font-family: inherit; font-size: 9px; font-weight: 700;
  padding: 4px 2px; border: 2px solid #8899cc;
  background: #dde8fc; color: #223;
  cursor: pointer; transition: background 0.1s;
}
.dir-btn.active, .choice-btn.active { background: #2244cc; color: #fff; border-color: #1133aa; }
.dir-btn:hover:not(.active), .choice-btn:hover:not(.active) { background: #c5d4f8; }
.tab-row { display: flex; gap: 3px; margin-bottom: 6px; }
.tab-btn {
  flex: 1; font-family: inherit; font-size: 9px; font-weight: 700;
  padding: 5px 3px; border: 2px solid #8899cc;
  background: #dde8fc; color: #223;
  cursor: pointer; transition: background 0.1s;
}
.tab-btn.active { background: #1a3acc; color: #fff; border-color: #1133aa; }
.tab-btn:hover:not(.active) { background: #c5d4f8; }
.info-row { display: flex; flex-direction: column; gap: 1px; padding: 4px 6px; background: #e4eaff; border: 1px solid #aabbd8; margin-top: 3px; }
.info-label { font-size: 8px; font-weight: 700; color: #556; }
.info-val { font-size: 9px; font-weight: 700; color: #112; font-family: monospace; }
.color-swatches { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.color-swatch { width: 22px; height: 22px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; transition: transform 0.1s, border-color 0.1s; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px #1133aa; }
.doors-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; max-height: 80px; overflow-y: auto; }
.door-entry { display: flex; align-items: center; justify-content: space-between; background: #dde8ff; padding: 2px 5px; font-size: 9px; font-weight: 700; color: #223; }
.door-entry button { background: none; border: none; cursor: pointer; font-size: 11px; color: #cc2222; padding: 0 2px; }
#keyframes-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; max-height: 80px; overflow-y: auto; }
.kf-entry { display: flex; align-items: center; justify-content: space-between; background: #ddf0ff; padding: 2px 5px; font-size: 9px; font-weight: 700; color: #223; }
.kf-entry button { background: none; border: none; cursor: pointer; font-size: 11px; color: #cc2222; padding: 0 2px; }

/* Canvas */
#canvas-area {
  flex: 1; position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #b8cce8 0%, #8098c0 100%);
  display: flex; align-items: center; justify-content: center;
}
#game-canvas {
  display: block; image-rendering: pixelated; cursor: crosshair;
  box-shadow: 0 0 0 4px #7a90cc, 0 6px 32px rgba(0,0,0,0.4);
}
#game-canvas.path-mode   { cursor: cell !important; }
#game-canvas.center-mode { cursor: crosshair !important; }

/* HUD */
#hud {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(176,200,240,0.94); border: 2px solid #7a90cc;
  padding: 5px 18px; display: flex; gap: 20px;
  font-size: 12px; font-weight: 700; color: #112;
  pointer-events: none; z-index: 5; white-space: nowrap;
}
#hud.hidden { display: none; }
#hud-msg { color: #28a845; }
#hud-keys.hidden { display: none; }
#hud-timer { color: #cc4400; }
#hud-timer.hidden { display: none; }
#hud-timer.urgent { color: #cc0000; animation: timerPulse 0.5s ease infinite alternate; }
@keyframes timerPulse { from { opacity:1; } to { opacity:0.35; } }

/* Win overlay */
#win-overlay {
  position: absolute; inset: 0;
  background: rgba(176,192,224,0.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 20; animation: fadeInOverlay 0.35s ease;
}
#win-overlay.hidden { display: none; }
@keyframes fadeInOverlay { from { opacity:0; } to { opacity:1; } }
#win-box {
  background: linear-gradient(180deg, #c4d4f0, #aabce8);
  border: 4px solid #6a80c8; text-align: center;
  box-shadow: 4px 4px 0 #7a90cc, 0 12px 40px rgba(0,0,0,0.35);
  animation: winBoxPop 0.4s cubic-bezier(0.34,1.56,0.64,1);
  min-width: 300px; overflow: hidden;
}
@keyframes winBoxPop { from { transform: scale(0.6); opacity:0; } to { transform: scale(1); opacity:1; } }
@keyframes winTitlePulse { from { filter: brightness(1); } to { filter: brightness(1.25); } }
#win-title {
  font-size: 20px; font-weight: 900; color: #fff; letter-spacing: 2px;
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  border-bottom: 3px solid #6a80c8; padding: 12px 24px; text-transform: uppercase;
  text-shadow: 1px 1px 0 #0a1044;
}
#win-level-name { font-size: 12px; color: #1a2a88; padding: 8px 24px 4px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
#win-stats { display: flex; margin: 12px 24px; border: 3px solid #6a80c8; }
.win-stat { flex: 1; display: flex; flex-direction: column; gap: 2px; background: #c8d8f0; padding: 10px 12px; border-right: 3px solid #6a80c8; }
.win-stat:last-child { border-right: none; }
.win-stat-label { font-size: 8px; color: #334; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; }
.win-stat span:last-child { font-size: 26px; font-weight: 900; color: #1a2a88; text-shadow: 1px 1px 0 #8090cc; }
#win-actions { display: flex; border-top: 3px solid #6a80c8; }
#win-actions .action-btn { flex: 1; border: none; border-right: 3px solid #6a80c8; padding: 11px 6px; font-size: 11px; }
#win-actions .action-btn:last-child { border-right: none; }

/* Death flash */
#death-flash { position: absolute; inset: 0; background: rgba(220,40,40,0.45); pointer-events: none; z-index: 15; opacity: 0; }
#death-flash.active { animation: deathFlash 0.5s ease forwards; }
@keyframes deathFlash { 0% { opacity: 0.75; } 100% { opacity: 0; } }

/* Status bar */
#statusbar {
  display: flex; align-items: center; gap: 20px;
  background: #a8b8d8; border-top: 2px solid #7a90cc;
  padding: 3px 14px; font-size: 10px; font-weight: 700;
  color: #334; height: 24px; flex-shrink: 0;
}
#status-msg { color: #c00; }

/* Modal */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,10,0.82);
  display: flex; align-items: center; justify-content: center; z-index: 300;
  backdrop-filter: blur(3px);
}
#modal-overlay.hidden { display: none; }
#modal-box {
  background: #0e1528; border: 2px solid #3a5acc; padding: 24px;
  width: min(560px, 90vw); display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 8px 40px rgba(0,0,40,0.9); border-radius: 6px;
}
#modal-box h2 { font-size: 15px; color: #a0c0ff; letter-spacing: 1px; }
#modal-body textarea {
  width: 100%; height: 200px; border: 1px solid #2a3a6a;
  padding: 10px; font-family: 'Courier New', monospace; font-size: 11px;
  background: #141c34; color: #c8d8f0; resize: vertical; border-radius: 3px; outline: none;
}
#modal-body textarea:focus { border-color: #3a5acc; }
#modal-body input[type="text"] {
  width: 100%; padding: 9px 12px; font-family: inherit; font-size: 13px; font-weight: 700;
  border: 1px solid #2a3a6a; background: #141c34; color: #c8d8f0; border-radius: 3px; outline: none;
}
#modal-body input[type="text"]:focus { border-color: #3a5acc; }
/* dark-themed inline inputs in modal body (admin login) */
#modal-body input[type="password"] {
  width: 100%; padding: 9px 12px; font-family: inherit; font-size: 13px; font-weight: 700;
  border: 1px solid #2a3a6a; background: #141c34; color: #c8d8f0; border-radius: 3px; outline: none;
}
#modal-body input[type="password"]:focus { border-color: #3a5acc; }
#modal-body label { font-size: 9px; font-weight: 900; color: #5577aa; letter-spacing: 1px; text-transform: uppercase; }
#modal-buttons { display: flex; gap: 10px; justify-content: flex-end; }
.resize-controls { display: flex; flex-direction: column; gap: 12px; }
.resize-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; color: #c8d8f0; }
.resize-row input[type="number"] {
  width: 70px; padding: 5px 8px; font-family: inherit; font-size: 13px; font-weight: 700;
  border: 1px solid #2a3a6a; background: #141c34; color: #c8d8f0; text-align: center;
  border-radius: 3px; outline: none;
}
.resize-row input[type="number"]:focus { border-color: #3a5acc; }
.resize-note { font-size: 11px; font-family: Arial, sans-serif; color: #5577aa; }

/* Upload wizard */
#upload-modal {
  position: fixed; inset: 0;
  background: rgba(180,200,240,0.55);
  background-image: repeating-conic-gradient(rgba(200,220,255,0.4) 0% 25%, rgba(180,200,240,0.4) 0% 50%);
  background-size: 32px 32px;
  display: flex; align-items: center; justify-content: center; z-index: 400;
  backdrop-filter: blur(2px);
}
#upload-modal.hidden { display: none; }
#upload-box {
  background: #c4d4f0; border: 4px solid #6a80c8;
  box-shadow: 4px 4px 0 #7a90cc, 0 12px 40px rgba(0,0,80,0.25);
  width: min(500px, 94vw); display: flex; flex-direction: column; overflow: hidden;
}
#upload-step-1, #upload-step-2, #upload-step-3, #upload-step-4, #upload-step-5, #upload-step-6 { display: flex; flex-direction: column; }
#upload-step-1.hidden, #upload-step-2.hidden, #upload-step-3.hidden, #upload-step-4.hidden, #upload-step-5.hidden, #upload-step-6.hidden { display: none; }
.upload-header {
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  color: #fff; font-size: 13px; font-weight: 900; letter-spacing: 2px;
  padding: 10px 16px; border-bottom: 3px solid #6a80c8;
  text-transform: uppercase; display: flex; align-items: center; gap: 10px;
}
.upload-step-tag { background: rgba(255,255,255,0.18); font-size: 8px; padding: 2px 7px; letter-spacing: 1px; }
.upload-body { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.upload-hint-top { font-size: 11px; font-family: Arial, sans-serif; color: #334; line-height: 1.6; margin-bottom: 4px; }
.upload-how-row { display: flex; gap: 12px; align-items: flex-start; background: #dde8f8; border: 2px solid #9aabd8; padding: 10px 12px; }
.upload-how-num {
  width: 24px; height: 24px; flex-shrink: 0; background: #2244cc; color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900;
}
.upload-how-text { font-size: 11px; font-family: Arial, sans-serif; color: #223; line-height: 1.6; flex: 1; }
.upload-how-text strong { font-weight: 900; color: #1a2a88; }
.upload-label { font-size: 10px; font-weight: 900; color: #334; letter-spacing: 1px; text-transform: uppercase; }
.upload-hint { font-size: 10px; font-family: Arial, sans-serif; color: #556; line-height: 1.6; }
#upload-textarea {
  width: 100%; height: 130px; border: 2px solid #8899cc;
  padding: 8px; font-family: 'Courier New', monospace; font-size: 11px;
  background: #f0f4ff; color: #223; resize: vertical;
}
#upload-textarea:focus { outline: none; border-color: #2244cc; }
#upload-preview { display: flex; align-items: center; gap: 10px; background: #d4ecd8; border: 2px solid #5aaa6a; padding: 10px 12px; }
#upload-preview.hidden { display: none; }
#upload-preview-icon { font-size: 18px; font-weight: 900; color: #1a5a22; }
#upload-preview-name { font-size: 12px; font-weight: 900; color: #1a4a22; }
#upload-preview-meta { font-size: 9px; color: #446; margin-top: 1px; }
#upload-error { background: #fce8e8; border: 2px solid #cc6666; padding: 8px 12px; font-size: 10px; font-weight: 700; color: #881111; font-family: Arial, sans-serif; line-height: 1.5; }
#upload-error.hidden { display: none; }
#upload-author {
  width: 100%; padding: 8px 10px; font-family: inherit; font-size: 12px; font-weight: 700;
  border: 2px solid #8899cc; background: #f0f4ff; color: #223; outline: none;
}
#upload-author:focus { border-color: #2244cc; }
.upload-actions { display: flex; border-top: 3px solid #6a80c8; }
.upload-actions .action-btn { flex: 1; border-radius: 0; border: none; border-right: 3px solid #6a80c8; padding: 12px; font-size: 12px; }
.upload-actions .action-btn:last-child { border-right: none; }
.difficulty-picker { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.diff-label { font-size: 12px; color: #aaa; font-weight: 700; }
.diff-val { font-size: 13px; color: #d09000; font-weight: 900; min-width: 30px; }
#upload-difficulty { accent-color: #d09000; }

/* Wall color palette */
#wall-color-panel { padding: 0 8px 4px 8px; }
.wall-color-swatches { display: flex; flex-wrap: wrap; gap: 5px; padding-bottom: 4px; }
.wall-color-swatch {
  width: 22px; height: 22px;
  border: 2px solid rgba(255,255,255,0.15); cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
}
.wall-color-swatch:hover { transform: scale(1.18); border-color: rgba(255,255,255,0.6); }
.wall-color-swatch.active { border-color: #fff; box-shadow: 0 0 0 2px #ff6600; transform: scale(1.12); }
.wall-color-swatch.custom-color-btn { background: #333 !important; }

/* Autosave indicator */
#autosave-indicator { font-size: 10px; font-weight: 700; color: #4caf50; opacity: 0; transition: opacity 0.4s; padding: 0 6px; align-self: center; }
#autosave-indicator.show { opacity: 1; }

/* Float exit button (online play) */
.online-float-exit-btn {
  position: fixed; top: 14px; left: 14px; z-index: 9999;
  background: rgba(20,30,70,0.92); color: #fff;
  border: 2px solid rgba(255,255,255,0.25);
  padding: 8px 18px; font-size: 14px; font-weight: 700;
  font-family: inherit; cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s;
}
.online-float-exit-btn:hover { background: rgba(40,60,140,0.97); }

/* Legacy placeholders */
#home-screen, #create-screen, #online-screen { display: none !important; }
/* ── LEVEL BADGES (featured / beaten / crazy) ─────────────────────────────── */
.level-badges-row {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin: 2px 0 3px;
  min-height: 0;
}
.level-badge {
  font-size: 8px; font-weight: 900;
  padding: 2px 6px; letter-spacing: 0.5px; text-transform: uppercase;
  border-radius: 2px; display: inline-block; line-height: 1.4;
}
.badge-featured {
  background: #f0c840; color: #5a3a00;
  border: 1px solid #c89000;
}
.badge-beaten {
  background: #3ecf68; color: #0a3a1a;
  border: 1px solid #1a9a40;
}
.badge-crazy {
  background: linear-gradient(90deg, #ff2200, #ff8800, #ff2200);
  background-size: 200% 100%;
  animation: crazy-shift 1.4s linear infinite alternate;
  color: #fff; border: 1px solid #cc1100;
  text-shadow: 0 0 6px rgba(255,80,0,0.9);
  box-shadow: 0 0 8px rgba(255,40,0,0.55);
}
@keyframes crazy-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* Card background combos — all three can coexist cleanly */
.online-level-card.is-featured {
  background: linear-gradient(90deg, #f8f0cc 0%, #c8d8f0 65%);
  border-left: 3px solid #c89000;
}
.online-level-card.is-beaten {
  background: linear-gradient(90deg, #c8f0d4 0%, #c8d8f0 70%);
  border-left: 3px solid #1a9a40;
}
.online-level-card.is-crazy {
  background: linear-gradient(90deg, #fde8d8 0%, #c8d8f0 70%);
  border-left: 3px solid #ff4400;
}
/* Two at once */
.online-level-card.is-featured.is-beaten {
  background: linear-gradient(90deg, #c8f0d4 0%, #f8f0cc 55%, #c8d8f0 100%);
  border-left: 3px solid #1a9a40;
  border-image: linear-gradient(#1a9a40, #c89000) 1;
  border-image-slice: 1;
}
.online-level-card.is-featured.is-crazy {
  background: linear-gradient(90deg, #fde8d8 0%, #f8f0cc 55%, #c8d8f0 100%);
  border-left: 3px solid #ff4400;
}
.online-level-card.is-beaten.is-crazy {
  background: linear-gradient(90deg, #c8f0d4 0%, #fde8d8 55%, #c8d8f0 100%);
  border-left: 3px solid #ff4400;
}
/* All three */
.online-level-card.is-featured.is-beaten.is-crazy {
  background: linear-gradient(90deg, #c8f0d4 0%, #fde8d8 40%, #f8f0cc 65%, #c8d8f0 100%);
  border-left: 3px solid #ff4400;
}
/* Num box colors: priority crazy > beaten > featured > default */
.online-level-card.is-featured .online-level-num { background: #a07800; }
.online-level-card.is-beaten   .online-level-num { background: #1a7a38; }
.online-level-card.is-crazy    .online-level-num {
  background: linear-gradient(180deg, #cc2200, #ff6600);
  animation: crazy-num 1.8s ease-in-out infinite alternate;
}
@keyframes crazy-num {
  from { background: linear-gradient(180deg, #cc2200, #ff5500); }
  to   { background: linear-gradient(180deg, #ff4400, #ff9900); }
}
/* hover states */
.online-level-card.is-featured:hover { background: linear-gradient(90deg, #f0e8c0 0%, #bccce4 65%); }
.online-level-card.is-beaten:hover   { background: linear-gradient(90deg, #b8eac8 0%, #bccce4 70%); }
.online-level-card.is-crazy:hover    { background: linear-gradient(90deg, #f8d8c8 0%, #bccce4 70%); }

/* play count */
.play-count {
  font-size: 8px; color: #667; font-family: Arial, sans-serif;
  background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 10px;
}

/* admin crazy button */
.online-level-btn.btn-admin-crazy { color: #cc2200; font-weight: 900; font-size: 9px; }
.online-level-btn.btn-admin-crazy:hover { background: #cc2200; color: #fff; }
.online-level-btn.btn-admin-feat  { color: #7a5500; font-size: 9px; }
.online-level-btn.btn-admin-feat:hover  { background: #f0c840; color: #5a3a00; }

/* ── VIRTUAL JOYSTICK ──────────────────────────────────────────────────────── */
#vjoystick-wrap {
  position: absolute;
  bottom: 24px; left: 24px;
  z-index: 200;
  pointer-events: none;
  display: none;
}
#vjoy-base {
  width: 110px; height: 110px; border-radius: 50%;
  background: rgba(30,50,120,0.28);
  border: 3px solid rgba(100,140,255,0.45);
  display: flex; align-items: center; justify-content: center;
  pointer-events: all;
  position: relative;
  backdrop-filter: blur(3px);
  touch-action: none;
}
#vjoy-stick {
  width: 48px; height: 48px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(160,190,255,0.9), rgba(40,70,200,0.75));
  border: 2px solid rgba(140,180,255,0.7);
  box-shadow: 0 2px 12px rgba(0,40,200,0.35);
  pointer-events: none;
  transition: transform 0.04s;
  touch-action: none;
}

/* joystick toggle button in HUD */
#btn-joystick-toggle { display: none !important; }
#btn-joystick-toggle_unused {
  background: rgba(20,30,80,0.5); border: 1px solid rgba(100,140,255,0.4);
  color: rgba(180,200,255,0.7); font-size: 14px; padding: 1px 7px;
  cursor: pointer; border-radius: 4px; line-height: 1;
  transition: background 0.15s, color 0.15s;
}
#btn-joystick-toggle:hover, #btn-joystick-toggle.active {
  background: rgba(60,90,200,0.7); color: #fff; border-color: rgba(160,190,255,0.8);
}

/* ── IMPORT MODAL FILE PICKER ─────────────────────────────────────────────── */
.import-modal-body { display: flex; flex-direction: column; gap: 8px; }
.import-file-label {
  display: inline-block; background: #2244cc; color: #fff;
  padding: 8px 18px; cursor: pointer; font-weight: 700;
  font-family: inherit; font-size: 12px;
  border: none; text-align: center;
  transition: background 0.15s;
}
.import-file-label:hover { background: #1a36bb; }
.import-file-name {
  font-size: 11px; color: #446; font-family: monospace;
  background: rgba(0,0,0,0.05); padding: 3px 8px; min-height: 18px;
}
.import-or-sep {
  font-size: 10px; color: #889; text-align: center; margin: 2px 0;
}

/* ── UPLOAD WIZARD FILE PICKER ────────────────────────────────────────────── */
.upload-file-label {
  display: block; background: #2244cc; color: #fff;
  padding: 12px 20px; cursor: pointer; font-weight: 700;
  font-family: inherit; font-size: 14px; text-align: center;
  border: none; transition: background 0.15s; margin-bottom: 8px;
}
.upload-file-label:hover { background: #1a36bb; }
.upload-file-chosen {
  font-size: 11px; color: #446; font-family: monospace;
  background: rgba(0,0,0,0.05); padding: 4px 10px;
  margin-bottom: 6px; word-break: break-all;
}
#upload-preview-2 {
  display: flex; align-items: center; gap: 14px;
  background: #d4f0d8; border: 1px solid #4caf50; padding: 12px 16px;
  margin: 4px 0;
}
#upload-preview-icon-2 {
  font-size: 22px; color: #1a6a30; font-weight: 900; flex-shrink: 0;
}
#upload-preview-name-2 { font-weight: 900; font-size: 13px; color: #1a3a22; }
#upload-preview-meta-2 { font-size: 10px; color: #446; margin-top: 2px; }

/* ── VOTE BUTTONS (likes / dislikes) ────────────────────────────────────── */
.online-level-votes {
  display: flex;
  flex-direction: column;
  border-left: 1px solid #a0b4d8;
  flex-shrink: 0;
}
.vote-btn {
  flex: 1;
  background: #d8e4f8;
  border: none;
  border-bottom: 1px solid #a0b4d8;
  color: #445;
  font-size: 11px;
  font-weight: 700;
  padding: 0 10px;
  cursor: pointer;
  font-family: inherit;
  min-width: 44px;
  transition: background 0.1s, color 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.vote-btn:last-child { border-bottom: none; }
.vote-btn.btn-like:hover   { background: #b8eac8; color: #0a5a20; }
.vote-btn.btn-dislike:hover{ background: #f8c8c8; color: #8a1010; }
.vote-btn.btn-like.voted   { background: #3ecf68; color: #fff; }
.vote-btn.btn-dislike.voted{ background: #e04040; color: #fff; }
/* ── SETTINGS MODAL ───────────────────────────────────────────────────────── */
#settings-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,10,0.72);
  display: flex; align-items: center; justify-content: center;
}
#settings-modal.hidden { display: none; }
#settings-box {
  background: #12152a; border: 2px solid #2a3a6a;
  box-shadow: 0 8px 40px rgba(0,0,0,0.7);
  min-width: 320px; max-width: 480px; width: 90vw;
  border-radius: 4px; overflow: hidden;
}
#settings-header {
  background: linear-gradient(135deg, #1a2a6e, #2244cc);
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 900; letter-spacing: 2px; color: #fff;
}
#settings-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 16px; }
.settings-section { display: flex; flex-direction: column; gap: 8px; }
.settings-section-title {
  font-size: 9px; font-weight: 900; letter-spacing: 2px; color: #6688cc;
  text-transform: uppercase; margin: 0; padding-bottom: 4px;
  border-bottom: 1px solid #2a3a5a;
}
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 0; gap: 12px; cursor: default;
}
.settings-label { font-size: 12px; color: #c8d8f0; }
.toggle-btn {
  background: #1a2a4a; border: 1px solid #334a7a; color: #667; font-size: 10px;
  font-weight: 900; letter-spacing: 1px; padding: 4px 12px; cursor: pointer;
  border-radius: 3px; font-family: inherit; min-width: 44px; text-align: center;
  transition: background 0.15s, color 0.15s;
}
.toggle-btn.active { background: #1a6a3a; border-color: #2acc60; color: #5eff99; }
.toggle-btn:hover { border-color: #6688cc; }

/* ── EXIT WARNING OVERLAY ─────────────────────────────────────────────────── */
#exit-warning {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,10,0.85);
  display: flex; align-items: center; justify-content: center;
}
#exit-warning.hidden { display: none; }
#exit-warning-box {
  background: #12152a; border: 2px solid #cc8800;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  max-width: 440px; width: 90vw; border-radius: 4px; overflow: hidden;
  padding: 24px;
}
#exit-warning-title {
  font-size: 18px; font-weight: 900; color: #ffcc44; letter-spacing: 1px;
  margin-bottom: 12px;
}
#exit-warning-msg {
  font-size: 13px; color: #c8d8f0; line-height: 1.6; margin-bottom: 16px;
}
#exit-warning-filename-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 16px;
}
#exit-warning-filename {
  flex: 1; background: #1a1a2e; border: 1px solid #334; color: #eef;
  padding: 6px 8px; font-size: 12px; border-radius: 3px; font-family: monospace;
}
#exit-warning-actions { display: flex; flex-direction: column; gap: 8px; }
#exit-warning-actions .action-btn { width: 100%; text-align: center; padding: 10px; font-size: 13px; }

/* ── MOBILE LAYOUT ────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  /* HUB */
  #hub-content { padding: 0 0 12px; }
  #hub-header { flex-direction: column; align-items: stretch; padding: 10px 10px 6px; gap: 8px; }
  #hub-logo { justify-content: center; }
  #hub-header-right { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 6px; }
  #hub-account-bar { flex-wrap: wrap; justify-content: center; gap: 4px; }
  #hub-panels { flex-direction: column; gap: 0; height: auto; }
  #hub-panel-create, #hub-panel-online { min-height: 220px; max-height: 50vh; border-right: none; border-bottom: 2px solid #2a3a6a; }
  #hub-footer { font-size: 9px; padding: 6px; }
  #hub-btn-new-level { padding: 10px; font-size: 12px; }

  /* EDITOR */
  #topbar { flex-wrap: wrap; padding: 6px 8px; gap: 4px; min-height: unset; }
  #game-title { order: 0; gap: 4px; }
  #topbar-center { order: 2; width: 100%; }
  #topbar-center input { width: 100%; font-size: 13px; }
  #topbar-actions { order: 1; gap: 4px; flex-wrap: wrap; }
  .action-btn { padding: 5px 8px; font-size: 11px; }
  #main-layout { flex-direction: column; height: auto; overflow: visible; }
  #toolbar { width: 100%; height: auto; max-height: 220px; overflow-y: auto; border-right: none; border-bottom: 2px solid #2a3a6a; }
  #toolbar.collapsed { max-height: 0; overflow: hidden; }
  #toolbar-inner { padding: 8px; }
  .tool-grid { grid-template-columns: repeat(6, 1fr); gap: 3px; }
  .tool-btn { padding: 4px 2px; font-size: 9px; }
  .tool-shortcut { display: none; }
  #canvas-area { height: 60vw; min-height: 220px; flex: 1; }
  #statusbar { font-size: 9px; padding: 2px 8px; }

  /* Panels collapse better */
  #context-panel { padding: 0 6px; }
  .toolbar-section-label { font-size: 8px; margin: 4px 0 2px; }
  .panel-range { height: 16px; }
  .num-input { width: 38px; font-size: 11px; }

  /* Settings & modals */
  #settings-box { width: 96vw; }
  #modal-box { width: 90vw; max-width: 360px; }
}

@media (max-width: 480px) {
  .tool-grid { grid-template-columns: repeat(4, 1fr); }
  #hub-logo-word { font-size: 20px; letter-spacing: 3px; }
  .hub-btn { padding: 5px 8px; font-size: 10px; }
  .online-level-card { flex-wrap: wrap; }
  .online-level-votes { flex-direction: row; border-left: none; border-top: 1px solid #a0b4d8; width: 100%; }
  .vote-btn { border-bottom: none; border-right: 1px solid #a0b4d8; }
}


/* ── CRAZY FILTER BUTTON ──────────────────────────────────────────────────── */
.filter-btn-crazy { color: #cc2200; font-weight: 900; }
.filter-btn-crazy.active {
  background: linear-gradient(90deg,#ff4400,#ff8800,#ff4400);
  background-size: 200% 100%;
  color: #fff; border-color: #ff4400;
  animation: crazy-shift 1.4s linear infinite alternate;
}

/* ── SUGGEST / INBOX HUB BUTTONS ──────────────────────────────────────────── */
#hub-suggest-bar { display: flex; align-items: center; gap: 6px; }
.hub-btn-suggest { background: rgba(255,180,0,0.2); border-color: rgba(255,200,60,0.5); color: #ffe066; }
.hub-btn-suggest:hover { background: rgba(255,180,0,0.35); }
.hub-btn-inbox { background: rgba(60,120,255,0.2); border-color: rgba(100,160,255,0.5); color: #a0c8ff; position: relative; }
.hub-btn-inbox:hover { background: rgba(60,120,255,0.35); }
.inbox-badge {
  position: absolute; top: -5px; right: -5px;
  background: #e03030; color: #fff; border-radius: 50%;
  font-size: 9px; font-weight: 900; min-width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}
.inbox-badge.hidden { display: none; }

/* ── SUGGEST MODAL ─────────────────────────────────────────────────────────── */
#suggest-modal, #inbox-modal {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
#suggest-modal.hidden, #inbox-modal.hidden { display: none; }

#suggest-box {
  background: #0e1528; border: 2px solid #3a5acc;
  box-shadow: 0 8px 40px rgba(0,0,40,0.8);
  width: min(520px, 94vw); border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column;
}
#suggest-header, #inbox-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  padding: 10px 14px; font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 1px;
}
#suggest-hint {
  font-size: 12px; color: #a0b8e0; padding: 14px 16px 8px; line-height: 1.5;
}
#suggest-text {
  margin: 0 16px; background: #141c34; border: 1px solid #2a3a6a;
  color: #e0ecff; font-family: Arial, sans-serif; font-size: 13px;
  padding: 10px; border-radius: 4px; resize: vertical;
  min-height: 120px; max-height: 280px; outline: none;
}
#suggest-text:focus { border-color: #3a5acc; }
#suggest-char-count { font-size: 10px; color: #556; text-align: right; padding: 4px 16px; }
#suggest-error { color: #e04040; font-size: 12px; padding: 0 16px 6px; }
#suggest-error.hidden { display: none; }
#suggest-actions { padding: 12px 16px 14px; display: flex; gap: 8px; }
#suggest-success {
  margin: 0 16px 14px; background: #1a3a1a; border: 1px solid #2a6a2a;
  color: #60d060; padding: 10px 14px; border-radius: 4px; font-size: 13px;
}
#suggest-success.hidden { display: none; }

/* ── INBOX MODAL ──────────────────────────────────────────────────────────── */
#inbox-box {
  background: #0e1528; border: 2px solid #3a5acc;
  box-shadow: 0 8px 40px rgba(0,0,40,0.8);
  width: min(600px, 96vw); max-height: 85vh;
  border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column;
}
#inbox-tabs {
  display: flex; background: #0a0f20; border-bottom: 1px solid #1a2a5a; flex-shrink: 0;
}
.inbox-tab {
  flex: 1; background: none; border: none; border-bottom: 3px solid transparent;
  color: #668; font-family: inherit; font-size: 11px; font-weight: 700;
  padding: 9px 12px; cursor: pointer; letter-spacing: 0.5px; text-transform: uppercase;
  transition: color 0.15s;
}
.inbox-tab.active { color: #a0c8ff; border-bottom-color: #3a7aff; }
.inbox-tab:hover:not(.active) { color: #889; }
.inbox-tab.hidden { display: none; }
#inbox-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
#inbox-loading, #inbox-empty { flex-shrink: 0; }

.suggestion-card {
  background: #121a30; border: 1px solid #1e2e60;
  border-radius: 5px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px;
}
.suggestion-card.has-reply { border-color: #2a5a2a; }
.suggestion-meta { display: flex; align-items: center; gap: 8px; font-size: 10px; color: #557; }
.suggestion-author { color: #8ab; font-weight: 700; }
.suggestion-date { color: #446; }
.suggestion-text { font-size: 13px; color: #c8d8f0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.suggestion-reply {
  background: #0e1e0e; border-left: 3px solid #28a845; padding: 8px 10px;
  border-radius: 3px; font-size: 12px; color: #80d080; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.suggestion-reply-label { font-size: 10px; color: #4a8a4a; font-weight: 700; margin-bottom: 4px; }
.suggestion-reply-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.suggestion-reply-area {
  width: 100%; background: #141c34; border: 1px solid #2a3a6a;
  color: #e0ecff; font-family: Arial, sans-serif; font-size: 12px;
  padding: 8px; border-radius: 4px; resize: vertical;
  min-height: 70px; outline: none; display: none;
}
.suggestion-reply-area.open { display: block; }

/* ── KILL BLOCK TOOL BUTTON ───────────────────────────────────────────────── */
.tool-kill-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: repeating-linear-gradient(
    45deg,
    #1a0808,
    #1a0808 3px,
    #cc1111 3px,
    #cc1111 6px
  );
  border: 1px solid #cc1111;
  color: transparent;
  font-size: 0;
}

/* ── REPORT BUTTON ON LEVEL CARDS ─────────────────────────────────────────── */
.online-level-btn.btn-report {
  color: #cc4444; font-size: 9px;
  border-top: 1px solid #a0b4d8;
}
.online-level-btn.btn-report:hover { background: #cc1111; color: #fff; }

/* ── REPORT MODAL ─────────────────────────────────────────────────────────── */
#report-modal {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
#report-modal.hidden { display: none; }
#report-box {
  background: #0e1528; border: 2px solid #3a5acc;
  box-shadow: 0 8px 40px rgba(0,0,40,0.8);
  width: min(480px, 94vw); border-radius: 6px; overflow: hidden;
  display: flex; flex-direction: column;
}
#report-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  padding: 10px 14px; font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 1px;
}
#report-hint {
  font-size: 12px; color: #a0b8e0; padding: 12px 16px 0; font-weight: 700;
}
#report-level-name { color: #fff; }
#report-hint2 {
  font-size: 11px; color: #886; padding: 4px 16px 8px; font-family: Arial, sans-serif; line-height: 1.5;
}
#report-text {
  margin: 0 16px; background: #141c34; border: 1px solid #3a1a1a;
  color: #e0ecff; font-family: Arial, sans-serif; font-size: 13px;
  padding: 10px; border-radius: 4px; resize: vertical;
  min-height: 100px; max-height: 220px; outline: none;
}
#report-text:focus { border-color: #cc3333; }
#report-char-count { font-size: 10px; color: #556; text-align: right; padding: 4px 16px; }
#report-error { color: #e04040; font-size: 12px; padding: 0 16px 6px; }
#report-error.hidden { display: none; }
#report-actions { padding: 12px 16px 14px; }
#report-actions .action-btn.primary { background: #8a1515; border-color: #cc2222; }
#report-actions .action-btn.primary:hover { background: #aa2020; }
#report-success {
  margin: 0 16px 14px; background: #1a3a1a; border: 1px solid #2a6a2a;
  color: #60d060; padding: 10px 14px; border-radius: 4px; font-size: 13px;
}
#report-success.hidden { display: none; }

/* ── MY UPLOADS MODAL – dark restyle ─────────────────────────────────────── */
#my-uploads-modal {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,10,0.82); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
#my-uploads-modal.hidden { display: none; }
#my-uploads-box {
  background: #0e1528; border: 2px solid #3a5acc;
  box-shadow: 0 8px 40px rgba(0,0,40,0.9);
  width: min(580px, 96vw); max-height: 82vh;
  border-radius: 6px; overflow: hidden; display: flex; flex-direction: column;
}
#my-uploads-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  padding: 10px 14px; font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 1px;
  flex-shrink: 0;
}
#my-uploads-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.my-upload-card {
  background: #121a30; border: 1px solid #1e2e60; border-radius: 4px;
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.my-upload-name { font-size: 13px; font-weight: 700; color: #c8d8f0; }
.my-upload-meta { font-size: 10px; color: #5577aa; margin-top: 3px; }
.my-upload-stats { display: flex; gap: 12px; flex-shrink: 0; }
.my-upload-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.my-upload-stat-val { font-size: 16px; font-weight: 900; color: #6699ff; }
.my-upload-stat-lbl { font-size: 9px; color: #5577aa; text-transform: uppercase; }

/* ── TELEPORT TILE TOOL BUTTON ─────────────────────────────────────────────── */
.tool-teleport-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: radial-gradient(circle at 50% 50%, rgba(200,100,255,0.6) 0%, #330055 70%);
  border: 1px solid #cc44ff;
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(180,60,255,0.6);
}

/* ── TELEPORT PANEL ─────────────────────────────────────────────────────────── */
#panel-teleport .info-row { margin-top: 8px; }

/* ── TRIGGER TILE TOOL BUTTON ─────────────────────────────────────────────── */
.tool-trigger-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  background: #3a1a00;
  border: 1px solid #ff6600;
  position: relative;
}
.tool-trigger-icon::before {
  content: '';
  display: block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 8px solid #ff9900;
  margin-bottom: 1px;
}
.tool-trigger-icon::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 0; height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 6px solid #ff9900;
}

/* ── AUTH MODAL GAME AESTHETIC ─────────────────────────────────────────────── */
#auth-box-logo {
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  border-bottom: 3px solid #1133aa;
  padding: 12px 22px 10px;
  display: flex; align-items: baseline; gap: 10px;
}
#auth-logo-word {
  font-size: 22px; font-weight: 900; color: #fff;
  letter-spacing: 3px; text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}
#auth-logo-sub {
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.6);
  letter-spacing: 2px; text-transform: uppercase;
}

/* ── UPLOAD MODAL GAME AESTHETIC ─────────────────────────────────────────────── */
.upload-game-header {
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  border-bottom: 3px solid #1133aa;
  padding: 12px 16px 10px;
  display: flex; align-items: baseline; gap: 10px;
}
.upload-game-title {
  font-size: 20px; font-weight: 900; color: #fff;
  letter-spacing: 3px; text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}
.upload-game-sub {
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.6);
  letter-spacing: 2px; text-transform: uppercase;
}
/* ── UNREAL BADGE ─────────────────────────────────────────────────────────── */
.badge-unreal {
  background: linear-gradient(90deg, #6600cc, #cc00ff, #6600cc);
  background-size: 200% 100%;
  animation: unreal-shift 1.2s linear infinite alternate;
  color: #fff; border: 1px solid #8800ee;
  text-shadow: 0 0 8px rgba(180,0,255,1);
  box-shadow: 0 0 10px rgba(140,0,255,0.7), 0 0 20px rgba(100,0,200,0.3);
  font-weight: 900;
}
@keyframes unreal-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
.online-level-card.is-unreal {
  background: linear-gradient(90deg, #e8d8ff 0%, #d4c0f0 40%, #c8d8f0 100%);
  border-left: 4px solid #9900ff;
  position: relative; overflow: hidden;
}
.online-level-card.is-unreal .online-level-num {
  background: linear-gradient(180deg, #6600cc, #cc00ff);
  animation: unreal-num 1.2s ease-in-out infinite alternate;
  color: #fff;
}
@keyframes unreal-num {
  from { background: linear-gradient(180deg, #6600cc, #cc00ff); box-shadow: 0 0 8px rgba(180,0,255,0.7); }
  to   { background: linear-gradient(180deg, #aa00ff, #ff44ff); box-shadow: 0 0 16px rgba(220,0,255,0.9); }
}
.online-level-card.is-unreal .online-level-name { color: #5500aa; }
.online-level-card.is-unreal .online-level-meta { color: #6633aa; }
.online-level-card.is-unreal:hover { background: linear-gradient(90deg, #ddc8ff 0%, #c8aae8 40%, #bccce4 100%); }
.online-level-card.is-unreal::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 10% 50%, rgba(140,0,255,0.08) 0%, transparent 55%);
}

/* ── UNREAL FILTER BUTTON ──────────────────────────────────────────────────── */
.filter-btn-unreal { color: #cc00ff; font-weight: 900; }
.filter-btn-unreal.active {
  background: linear-gradient(90deg, #6600cc, #cc00ff, #6600cc);
  background-size: 200% 100%;
  color: #fff; border-color: #9900ee;
  animation: unreal-shift 1.2s linear infinite alternate;
}

/* ── UPLOAD DESTINATION CHOICE ──────────────────────────────────────────────── */
.upload-dest-choices {
  display: flex; gap: 14px; padding: 8px 0;
}
.upload-dest-btn {
  flex: 1; background: #0d0d22; border: 2px solid #334;
  border-radius: 8px; padding: 16px 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center; color: #cde;
}
.upload-dest-btn:hover { border-color: #6699ff; background: #111830; }
.upload-dest-icon { font-size: 24px; margin-bottom: 6px; }
.upload-dest-label { font-size: 13px; font-weight: 900; color: #fff; letter-spacing: 1px; margin-bottom: 4px; }
.upload-dest-desc { font-size: 10px; color: #88aacc; font-family: Arial, sans-serif; font-weight: normal; }

/* ── LEVEL SHARE INBOX CARD ─────────────────────────────────────────────────── */
.level-share-card {
  border-left: 3px solid #aa44ff !important;
  background: linear-gradient(90deg, #160028 0%, #0d0d22 100%) !important;
}
.level-share-card .suggestion-author { color: #cc88ff !important; }

/* ── ENEMY TYPE LABEL ───────────────────────────────────────────────────────── */
.panel-enemy-type-label {
  font-size: 10px; font-weight: 900; letter-spacing: 2px;
  text-transform: uppercase; padding: 5px 8px 4px;
  margin: -1px -1px 8px; border-radius: 2px 2px 0 0;
  text-align: center;
}
.type-linear  { background: #1a3acc; color: #aabbff; border-bottom: 2px solid #2244ee; }
.type-orbit   { background: #6600aa; color: #ddaaff; border-bottom: 2px solid #aa22ee; }
.type-follower{ background: #881400; color: #ffbbaa; border-bottom: 2px solid #cc2200; }

/* ── UPLOAD TEXT INPUT ──────────────────────────────────────────────────────── */
.upload-text-input {
  width: 100%; box-sizing: border-box; margin-top: 6px;
  padding: 8px 10px; background: #0a0a18;
  border: 1px solid #334; color: #cde; border-radius: 4px; font-size: 14px;
}
.upload-text-input:focus { outline: none; border-color: #4466cc; }
.upload-private-error { color: #e04040; font-size: 12px; margin-top: 6px; }
/* ===== IMPOSSIBLE DIFFICULTY ===== */
.filter-btn-impossible { color: #ff0077; font-weight: 900; letter-spacing: 0.5px; }
.filter-btn-impossible.active {
  background: linear-gradient(135deg, #4a0020, #880044);
  color: #ff66aa; border-color: #cc2266;
}
.badge-impossible {
  background: linear-gradient(135deg, #880022, #cc0066);
  color: #fff; font-size: 9px; font-weight: 900;
  padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 1px;
  border: 1px solid #ff3388;
  text-shadow: 0 0 6px #ff0055;
  box-shadow: 0 0 8px rgba(255,0,80,0.5);
}
.online-level-card.is-impossible {
  background: linear-gradient(90deg, #ffd8e8 0%, #f0b8d0 40%, #c8d8f0 100%);
  border-left: 4px solid #cc0066;
  position: relative; overflow: hidden;
}
.online-level-card.is-impossible .online-level-name { color: #880033; }
.online-level-card.is-impossible .online-level-meta { color: #aa3366; }
.online-level-card.is-impossible:hover {
  background: linear-gradient(90deg, #ffcce0 0%, #e8a8c4 40%, #bccce4 100%);
}
.online-level-card.is-impossible .online-level-num {
  background: #880033; color: #ffaacc;
}
.online-level-card.is-impossible::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #ff0055, #880033, #ff0055);
  animation: impossiblePulse 1.5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes impossiblePulse {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.btn-admin-impossible {
  background: #550030 !important; color: #ff88bb !important;
  border-color: #880044 !important; font-weight: 900 !important;
}
.btn-admin-impossible:hover { background: #880044 !important; }

/* ===== FLOATING PAUSE BUTTON ===== */
#btn-pause-float {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 50;
  width: 36px; height: 36px;
  background: rgba(26,42,136,0.82);
  border: 2px solid rgba(100,130,220,0.7);
  color: #c8d8f0;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#btn-pause-float:hover { background: rgba(34,68,204,0.95); border-color: #7a90cc; color: #fff; }
#btn-pause-float.hidden { display: none; }

/* ===== PAUSE OVERLAY ===== */
#pause-overlay {
  position: absolute; inset: 0;
  background: rgba(180,200,235,0.65);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
#pause-overlay.hidden { display: none; }
#pause-box {
  background: linear-gradient(180deg, #c4d4f0, #aabce8);
  border: 4px solid #6a80c8;
  box-shadow: 4px 4px 0 #7a90cc, 0 12px 40px rgba(0,0,80,0.3);
  min-width: 260px;
  overflow: hidden;
  animation: winBoxPop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
#pause-header {
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  border-bottom: 3px solid #1133aa;
  padding: 7px 24px;
  font-size: 10px; font-weight: 900; letter-spacing: 5px;
  color: rgba(255,255,255,0.65); text-align: center; text-transform: uppercase;
}
#pause-title {
  font-size: 30px; font-weight: 900; letter-spacing: 5px;
  color: #1a2a88; text-align: center;
  padding: 14px 32px 10px;
  text-shadow: 1px 1px 0 #8090cc;
}
#pause-stats {
  display: flex; align-items: center; justify-content: center;
  background: #c8d8f0;
  border-top: 2px solid #6a80c8; border-bottom: 2px solid #6a80c8;
  padding: 10px 32px; gap: 24px;
}
.pause-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pause-stat-num { font-size: 26px; font-weight: 900; color: #1a2a88; text-shadow: 1px 1px 0 #8090cc; }
.pause-stat-lbl { font-size: 8px; font-weight: 900; color: #446; letter-spacing: 2px; text-transform: uppercase; }
.pause-stat-divider { width: 2px; height: 36px; background: #7a90cc; opacity: 0.5; }
#pause-actions {
  display: flex;
}
#pause-actions .action-btn {
  flex: 1; border: none; border-right: 3px solid #6a80c8;
  padding: 13px 8px; font-size: 12px; text-align: center; border-radius: 0;
  background: #c4d4f0;
}
#pause-actions .action-btn:last-child { border-right: none; }
#pause-actions .action-btn:hover { background: #b0c4e8; }
#pause-actions .action-btn.primary { background: #2244cc; color: #fff; }
#pause-actions .action-btn.primary:hover { background: #1a36bb; }

/* ===== D-PAD MOBILE CONTROLS ===== */
#dpad-wrap {
  position: absolute;
  bottom: 24px; left: 24px;
  z-index: 100;
  user-select: none;
  -webkit-user-select: none;
}
#dpad {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.dpad-middle-row {
  display: flex; flex-direction: row; align-items: center; gap: 2px;
}
.dpad-center {
  width: 44px; height: 44px;
  background: rgba(20,30,60,0.6);
  border-radius: 4px;
}
.dpad-btn {
  width: 44px; height: 44px;
  background: rgba(20,30,60,0.85);
  border: 2px solid rgba(80,120,200,0.5);
  border-radius: 6px;
  color: #c8d8f0;
  font-size: 18px; font-weight: 900; font-family: monospace;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s;
}
.dpad-btn:active, .dpad-btn.pressed {
  background: rgba(60,100,200,0.85);
  border-color: rgba(150,190,255,0.8);
}
#hub-btn-mobile-controls.active {
  background: #1a5a3a; border-color: #2a9a5a; color: #80ffaa;
}

/* ===== REMOVE ONLINE LEVEL NUMBERS ===== */
/* online-level-num hidden by removing it from HTML */
/* ===== MULTIPLAYER ONLINE SECTION ===== */
#hub-mp-bar {
  flex-shrink: 0;
  border-top: 3px solid #1133aa;
  overflow: hidden;
}
#hub-mp-header {
  background: linear-gradient(180deg, #1a2a88, #2a44cc);
  border-bottom: 3px solid #1133aa;
  padding: 10px 16px;
  display: flex; align-items: baseline; gap: 10px;
}
#hub-mp-title {
  font-size: 18px; font-weight: 900; color: #fff;
  letter-spacing: 3px; text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}
#hub-mp-sub {
  font-size: 9px; font-weight: 700; color: rgba(255,255,255,0.6);
  letter-spacing: 2px; text-transform: uppercase;
}
#hub-mp-body {
  background: #c8d4ec;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; gap: 12px;
}
#hub-mp-btns { display: flex; gap: 8px; }
#hub-mp-status { font-size: 11px; color: #4466aa; font-weight: 700; }
.hub-btn-mp-exit {
  background: #c4d4f0 !important;
  border: 3px solid #8899cc !important;
  color: #882222 !important;
  font-family: inherit !important; font-size: 11px !important;
  font-weight: 700 !important; padding: 5px 14px !important; cursor: pointer;
}
.hub-btn-mp-exit:hover { background: #f0c4c4 !important; border-color: #cc4444 !important; }

/* LOBBY */
#hub-lobby {
  flex: 1; display: flex; gap: 12px;
  padding: 12px 14px 6px 14px;
  overflow: hidden;
  min-height: 0;
}
.hub-lobby-panel {
  display: flex; flex-direction: column;
  background: #c8d8f0;
  border: 2px solid #7a90cc;
  box-shadow: 2px 2px 0 rgba(100,130,200,0.3);
  overflow: hidden;
  min-width: 0;
}
#hub-lobby-players { flex: 0 0 260px; }
.hub-lobby-right { flex: 1; }
.hub-lobby-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, #1a3a88, #112266);
  padding: 7px 12px; flex-shrink: 0;
  border-bottom: 2px solid #1133aa;
  font-size: 10px; font-weight: 900; color: #fff; letter-spacing: 1.5px;
}
#hub-lobby-host-tag {
  background: #e0a000; color: #1a1000;
  font-size: 9px; font-weight: 900; letter-spacing: 1px;
  padding: 2px 7px; border-radius: 2px;
}
#hub-lobby-player-list {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column;
}
.lobby-player-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #a0b4d8;
  font-size: 12px; font-weight: 700; color: #1a2a6a;
}
.lobby-player-row:last-child { border-bottom: none; }
.lobby-player-cube {
  width: 16px; height: 16px; flex-shrink: 0;
  border: 2px solid rgba(0,0,0,0.25);
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.3);
}
.lobby-player-host-badge {
  font-size: 8px; font-weight: 900; color: #e0a000;
  background: #1a2a44; padding: 1px 5px; border-radius: 2px;
  letter-spacing: 0.5px; flex-shrink: 0;
}
#hub-lobby-status-bar {
  padding: 8px 12px; background: #b8ccec;
  border-bottom: 1px solid #8899cc;
  flex-shrink: 0; display: flex; align-items: center; gap: 10px;
}
#hub-lobby-status-text { font-size: 11px; font-weight: 700; color: #1a2a6a; }
#hub-lobby-countdown {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: #1a3acc; border-radius: 50%;
  flex-shrink: 0;
}
#hub-lobby-countdown-num {
  font-size: 18px; font-weight: 900; color: #fff; line-height: 1;
}
.hub-lobby-section-label {
  font-size: 9px; font-weight: 900; color: #5566aa; letter-spacing: 1.5px;
  padding: 6px 12px 4px 12px; text-transform: uppercase;
  border-bottom: 1px solid #c0d0e8;
}
#hub-lobby-levels-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
#hub-lobby-my-levels { display: flex; flex-direction: column; }
.lobby-level-card {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #a0b4d8;
  cursor: pointer; background: #c8d8f0;
  transition: background 0.07s;
}
.lobby-level-card:hover { background: #b8c8e0; }
.lobby-level-card-name { font-size: 12px; font-weight: 700; color: #1a2a6a; }
.lobby-level-card-meta { font-size: 10px; color: #5566aa; margin-top: 1px; }
#hub-lobby-selected-level { padding: 10px 12px; flex: 1; }
.hub-lobby-sel-name {
  font-size: 14px; font-weight: 900; color: #1a2a88;
  padding: 8px; background: #b8ccec; border: 1.5px solid #7a90cc;
  margin-top: 4px;
}
#hub-lobby-actions {
  padding: 8px 12px; display: flex; gap: 8px; align-items: center;
  border-top: 1px solid #a0b4d8; flex-shrink: 0;
}
.hub-btn-start {
  background: linear-gradient(180deg, #20aa40, #178030) !important;
  border-color: #20cc40 !important;
}
.hub-btn-start:hover { background: linear-gradient(180deg, #30cc50,#22aa40) !important; }
.hub-btn-start:disabled {
  background: #7a8a9a !important; border-color: #556677 !important;
  color: #aab8c8 !important; cursor: not-allowed !important;
}

/* MP Win results overlay */
#mp-results-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(10,16,44,0.88);
  display: flex; align-items: center; justify-content: center;
}
#mp-results-box {
  background: linear-gradient(180deg, #1a2a6a, #0e1844);
  border: 3px solid #4466cc; padding: 32px 40px;
  min-width: 320px; max-width: 480px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
  display: flex; flex-direction: column; gap: 16px;
  text-align: center;
}
#mp-results-title {
  font-size: 22px; font-weight: 900; color: #fff;
  letter-spacing: 3px; text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(80,160,255,0.6);
}
#mp-results-list { display: flex; flex-direction: column; gap: 8px; }
.mp-result-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.07); padding: 8px 14px;
  border: 1px solid rgba(100,140,255,0.3);
}
.mp-result-rank {
  font-size: 16px; font-weight: 900; color: #f0c040;
  width: 24px; flex-shrink: 0; text-align: center;
}
.mp-result-cube { width: 16px; height: 16px; flex-shrink: 0; border: 2px solid rgba(0,0,0,0.3); }
.mp-result-name { flex: 1; font-size: 13px; font-weight: 700; color: #ddeeff; text-align: left; }
.mp-result-status { font-size: 11px; color: #88aacc; }
#mp-results-returning { font-size: 11px; color: #7a9acc; letter-spacing: 1px; }

/* Join room modal */
#join-room-modal.hidden { display: none; }
#hub-lobby.hidden { display: none; }
#mp-results-overlay.hidden { display: none; }
#hub-lobby-countdown.hidden { display: none; }
#hub-lobby-levels-list.hidden { display: none; }
#hub-lobby-selected-level.hidden { display: none; }
#hub-lobby-host-tag.hidden { display: none; }
#hub-btn-start-game.hidden { display: none; }

#join-room-modal {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(10,16,44,0.85);
  display: flex; align-items: center; justify-content: center;
}
#join-room-box {
  background: linear-gradient(180deg, #1a2a6a, #0e1844);
  border: 3px solid #4466cc; padding: 28px 36px;
  min-width: 300px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8);
  display: flex; flex-direction: column; gap: 12px;
}
#join-room-box h2 {
  font-size: 14px; font-weight: 900; color: #fff;
  letter-spacing: 2px; text-transform: uppercase; margin: 0;
}
#join-room-code-input {
  background: #0e1844; border: 2px solid #4466cc;
  color: #fff; font-size: 22px; font-weight: 900;
  padding: 8px 14px; text-align: center;
  letter-spacing: 6px; text-transform: uppercase;
  font-family: inherit; width: 100%; box-sizing: border-box;
}
#join-room-error { font-size: 11px; color: #ff8888; min-height: 14px; }
.join-room-actions { display: flex; gap: 8px; }
/* ===== ROOM CODE - big and visible ===== */
#hub-lobby-room-code {
  font-size: 22px; font-weight: 900; letter-spacing: 4px;
  color: #ffffff; text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
  background: rgba(0,0,0,0.2); padding: 2px 10px;
  border-radius: 2px;
}
#hub-lobby-room-code-label {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

/* ===== LEVELS LIST in lobby uses online-level-card styles ===== */
#hub-lobby-levels-list { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#hub-lobby-my-levels { flex: 1; overflow-y: auto; }
#hub-lobby-my-levels .online-level-card { cursor: pointer; }
#hub-lobby-my-levels .online-level-card:hover { filter: brightness(1.04); }
#hub-lobby-my-levels .mp-select-btn {
  background: #2244cc !important; color: #fff !important; border: none !important; font-weight: 700 !important;
}