* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Courier New', monospace; background: #0a0a0a; color: #00ff41; overflow: hidden; }

/* Auth screen */
#auth-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 16px;
}
#auth-screen h1 { font-size: 48px; color: #ff3333; text-shadow: 0 0 20px #ff0000; letter-spacing: 8px; }
#auth-screen input {
  background: #111; border: 1px solid #333; color: #00ff41; padding: 12px 16px;
  font-family: inherit; font-size: 16px; width: 280px; outline: none;
}
#auth-screen input:focus { border-color: #00ff41; }
#auth-screen .btn-row { display: flex; gap: 8px; }
.btn {
  background: #1a1a1a; border: 1px solid #00ff41; color: #00ff41; padding: 10px 20px;
  font-family: inherit; font-size: 14px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 2px; transition: all 0.2s;
}
.btn:hover { background: #00ff41; color: #0a0a0a; }
.btn.danger { border-color: #ff3333; color: #ff3333; }
.btn.danger:hover { background: #ff3333; color: #0a0a0a; }
#auth-error { color: #ff3333; font-size: 14px; min-height: 20px; }

/* Game screen */
#game-screen { display: none; height: 100vh; }
#map { width: 100%; height: 100%; }

/* Loading overlay */
#loading-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: #0a0a0a; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
  transition: opacity 0.4s ease;
}
#loading-overlay.fade-out { opacity: 0; pointer-events: none; }
#loading-overlay h2 {
  color: #ff3333; font-size: 36px; text-transform: uppercase;
  letter-spacing: 6px; text-shadow: 0 0 15px #ff0000;
}
#loading-overlay .status {
  color: #00ff41; font-size: 14px; text-transform: uppercase;
  letter-spacing: 3px; animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes buildPulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
@keyframes dronePulse { 0%,100% { transform: scale(1); opacity: 0.7; } 50% { transform: scale(1.3); opacity: 1; } }

/* HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; background: rgba(10, 10, 10, 0.9); border-bottom: 1px solid #333;
}
#hud .gold { color: #ffd700; font-size: 18px; font-weight: bold; }
#hud .player-name { color: #00ff41; font-size: 14px; }
#hud .gps-status { font-size: 12px; margin-left: 8px; }
.gps-on { color: #00ff41; }
.gps-off { color: #ff3333; }

/* Top toolbar (below HUD) */
#toolbar {
  position: fixed; top: 38px; left: 0; right: 0; z-index: 1000;
  display: flex; align-items: stretch;
  background: #0a0a0a; border-bottom: 1px solid #333;
}
.tb {
  -webkit-appearance: none; appearance: none; outline: none;
  flex: 1; background: #0a0a0a; border: none; border-right: 1px solid #222;
  color: #00ff41; padding: 11px 0; font-family: 'Courier New', monospace; font-size: 12px;
  cursor: pointer; text-transform: uppercase; letter-spacing: 2px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.tb:last-child { border-right: none; }
.tb:active { background: #111; }
.tb.gold { color: #ffd700; }
.tb.red { color: #ff3333; }
#menu-btn { flex: 0 0 52px; border-right: none; border-left: 1px solid #222; }
#menu-btn svg { display: block; width: 20px; height: 14px; }

/* Menu overlay + panel */
#menu-overlay {
  position: fixed; inset: 0; z-index: 1200; background: rgba(0, 0, 0, 0.65);
  display: none;
}
#menu-overlay.open { display: block; }
#menu-panel {
  position: absolute; top: 72px; right: 0; width: 220px;
  background: #0a0a0a; border-left: 1px solid #333;
  border-bottom: 1px solid #333;
}
.menu-header {
  padding: 10px 16px; font-size: 10px; color: #444;
  letter-spacing: 3px; text-transform: uppercase; border-bottom: 1px solid #222;
}
.menu-item {
  -webkit-appearance: none; appearance: none; outline: none;
  display: block; width: 100%; background: #0a0a0a; border: none;
  border-bottom: 1px solid #181818; color: #00ff41; font-family: 'Courier New', monospace;
  font-size: 13px; padding: 16px; text-align: left; cursor: pointer;
  text-transform: uppercase; letter-spacing: 2px;
  -webkit-tap-highlight-color: transparent;
}
.menu-item:last-child { border-bottom: none; }
.menu-item:active { background: #111; }

/* Action banner */
#action-banner {
  position: fixed; top: 72px; left: 0; right: 0; z-index: 1001;
  background: #ff3333; color: #0a0a0a; padding: 10px 24px; font-weight: bold;
  text-transform: uppercase; letter-spacing: 2px; text-align: center;
  font-size: 14px; display: none; cursor: pointer;
}
#action-banner .banner-btns {
  display: inline-flex; gap: 12px; margin-left: 16px; vertical-align: middle;
}
#action-banner .banner-btn {
  background: #0a0a0a; color: #ff3333; border: 2px solid #0a0a0a; padding: 4px 16px;
  font-family: inherit; font-size: 13px; font-weight: bold; cursor: pointer;
  text-transform: uppercase; letter-spacing: 2px; border-radius: 2px;
}
#action-banner .banner-btn.confirm {
  background: #0a0a0a; color: #00ff41; border-color: #0a0a0a;
}
#action-banner .banner-btn:hover { opacity: 0.8; }

/* Zoom buttons */
#zoom-controls {
  position: fixed; left: 10px; top: 50%; transform: translateY(-50%); z-index: 1000;
  display: flex; flex-direction: column; gap: 6px;
}
#zoom-controls button {
  width: 40px; height: 40px; background: rgba(10, 10, 10, 0.9); border: 1px solid #00ff41;
  color: #00ff41; font-family: inherit; font-size: 12px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 1px; transition: all 0.2s;
}
#zoom-controls button:hover { background: #00ff41; color: #0a0a0a; }
#follow-toggle { font-size: 18px !important; letter-spacing: 0 !important; }
#follow-toggle.active { background: #00ff41; color: #0a0a0a; box-shadow: 0 0 8px #00ff41; }

/* Combat log overlay */
#combat-log {
  position: fixed; left: 0; top: 72px; width: 300px; z-index: 999;
  display: none; padding: 0;
  background: rgba(10, 10, 10, 0.85);
}
#combat-log-entries {
  max-height: 160px; overflow: hidden; padding: 8px 8px 0;
}
#combat-log-expand {
  display: block; width: 100%; background: none; border: none; border-top: 1px solid #222;
  color: #888; font-size: 11px; cursor: pointer; padding: 6px; letter-spacing: 1px;
  text-align: center; font-family: inherit;
}
#combat-log-expand:hover { color: #fff; background: rgba(255,255,255,0.05); }
.log-entry { font-size: 11px; padding: 3px 0; border-bottom: 1px solid #1a1a1a; }
.log-entry.attack { color: #ff3333; }
.log-entry.defend { color: #00aaff; }
.log-entry.gold { color: #ffd700; }

/* Full combat log modal */
#full-combat-log {
  display: none; position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.92); overflow-y: auto;
  padding: 20px; font-family: inherit;
}
#full-combat-log.active { display: flex; flex-direction: column; }
#full-combat-log .fcl-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 12px; border-bottom: 1px solid #222; margin-bottom: 12px;
}
#full-combat-log h2 { margin: 0; color: #ff3333; font-size: 18px; letter-spacing: 2px; }
#full-combat-log .fcl-close {
  background: none; border: 1px solid #555; color: #aaa; font-size: 14px;
  padding: 4px 12px; cursor: pointer; font-family: inherit; letter-spacing: 1px;
}
#full-combat-log .fcl-close:hover { color: #fff; border-color: #fff; }
#full-combat-log .fcl-list { flex: 1; overflow-y: auto; }
#full-combat-log .fcl-day {
  color: #555; font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  padding: 12px 0 4px; border-bottom: 1px solid #1a1a1a; margin-bottom: 4px;
}
#full-combat-log .fcl-entry {
  padding: 6px 0; border-bottom: 1px solid #111; font-size: 12px; display: flex; gap: 8px;
}
#full-combat-log .fcl-time { color: #444; min-width: 50px; flex-shrink: 0; }
#full-combat-log .fcl-msg { flex: 1; }
#full-combat-log .fcl-entry.hit .fcl-msg { color: #ff3333; }
#full-combat-log .fcl-entry.destroyed .fcl-msg { color: #ff1111; font-weight: bold; }
#full-combat-log .fcl-entry.intercepted .fcl-msg { color: #00aaff; }
#full-combat-log .fcl-empty { color: #444; text-align: center; padding: 40px 0; }

/* Tutorial */
#tutorial-overlay {
  display: none; position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.95); overflow-y: auto;
  padding: 0; font-family: inherit;
}
#tutorial-overlay.active { display: block; }
#tutorial-content {
  max-width: 600px; margin: 0 auto; padding: 20px 24px 60px;
}
#tutorial-content .tut-close {
  position: sticky; top: 0; z-index: 1; text-align: right; padding: 8px 0;
  background: rgba(0,0,0,0.9);
}
#tutorial-content .tut-close button {
  background: none; border: 1px solid #555; color: #aaa; font-size: 14px;
  padding: 4px 16px; cursor: pointer; font-family: inherit; letter-spacing: 1px;
}
#tutorial-content .tut-close button:hover { color: #fff; border-color: #fff; }
#tutorial-content h1 { color: #ff3333; font-size: 22px; letter-spacing: 3px; margin: 20px 0 8px; }
#tutorial-content h2 { color: #ff3333; font-size: 16px; letter-spacing: 2px; margin: 28px 0 10px; border-bottom: 1px solid #222; padding-bottom: 6px; }
#tutorial-content h3 { color: #00ff41; font-size: 13px; letter-spacing: 1px; margin: 16px 0 6px; }
#tutorial-content p, #tutorial-content li { color: #bbb; font-size: 13px; line-height: 1.6; }
#tutorial-content p { margin: 0 0 10px; }
#tutorial-content ul { padding-left: 16px; margin: 0 0 10px; }
#tutorial-content li { margin-bottom: 4px; }
#tutorial-content .tut-tip {
  border-left: 3px solid #ffd700; padding: 8px 12px; margin: 12px 0;
  background: rgba(255,215,0,0.05); color: #ffd700; font-size: 12px;
}
#tutorial-content .tut-table { width: 100%; border-collapse: collapse; margin: 8px 0 16px; font-size: 12px; }
#tutorial-content .tut-table th { color: #888; text-align: left; padding: 4px 8px; border-bottom: 1px solid #333; font-weight: normal; text-transform: uppercase; letter-spacing: 1px; font-size: 10px; }
#tutorial-content .tut-table td { color: #ccc; padding: 4px 8px; border-bottom: 1px solid #1a1a1a; }
#tutorial-content .tut-table .val { color: #fff; }
#tutorial-content .clr-silo { color: #ff3333; }
#tutorial-content .clr-sam { color: #00aaff; }
#tutorial-content .clr-turret { color: #00ff41; }
#tutorial-content .clr-mine { color: #ffd700; }
#tutorial-content .clr-gold { color: #ffd700; }

/* Patch Notes */
#patchnotes-overlay {
  display: none; position: fixed; inset: 0; z-index: 5000;
  background: rgba(0,0,0,0.95); overflow-y: auto; font-family: inherit;
}
#patchnotes-overlay.active { display: block; }
#patchnotes-content { max-width: 600px; margin: 0 auto; padding: 20px 24px 60px; }
#patchnotes-content .pn-close { position: sticky; top: 0; z-index: 1; text-align: right; padding: 8px 0; background: rgba(0,0,0,0.9); }
#patchnotes-content .pn-close button { background: none; border: 1px solid #555; color: #aaa; font-size: 14px; padding: 4px 16px; cursor: pointer; font-family: inherit; letter-spacing: 1px; }
#patchnotes-content .pn-close button:hover { color: #fff; border-color: #fff; }
#patchnotes-content h1 { color: #ff3333; font-size: 22px; letter-spacing: 3px; margin: 20px 0 16px; }
#patchnotes-content .pn-version { color: #ff3333; font-size: 15px; letter-spacing: 2px; margin: 24px 0 4px; border-bottom: 1px solid #222; padding-bottom: 4px; }
#patchnotes-content .pn-date { color: #555; font-size: 11px; margin-bottom: 8px; }
#patchnotes-content .pn-tag { display: inline-block; font-size: 9px; padding: 2px 6px; border-radius: 3px; margin-right: 4px; letter-spacing: 1px; font-weight: bold; }
#patchnotes-content .pn-tag.new { background: #1a3a1a; color: #00ff41; }
#patchnotes-content .pn-tag.fix { background: #3a2a1a; color: #ffd700; }
#patchnotes-content .pn-tag.balance { background: #1a1a3a; color: #00aaff; }
#patchnotes-content .pn-tag.perf { background: #2a1a2a; color: #cc66ff; }

/* Leaflet marker overrides */
.nuki-marker { background: none !important; border: none !important; }
.leaflet-marker-icon { overflow: visible; }
#patchnotes-content ul { padding-left: 16px; margin: 0 0 10px; }
#patchnotes-content li { color: #bbb; font-size: 12px; line-height: 1.6; margin-bottom: 3px; }

/* Structure Modal */
#modal-overlay {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.8);
  display: none; align-items: center; justify-content: center;
}
#modal-overlay.active { display: flex; }
#modal {
  background: #111; border: 1px solid #00ff41; border-radius: 4px;
  width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto;
  padding: 20px; position: relative;
}
#modal h2 {
  color: #ff3333; font-size: 20px; text-transform: uppercase;
  letter-spacing: 3px; margin-bottom: 4px;
}
#modal .modal-sub { color: #888; font-size: 12px; margin-bottom: 16px; }
#modal .modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: #ff3333; font-size: 24px; cursor: pointer; font-family: inherit;
}
.modal-section { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #222; }
.modal-section:last-child { border-bottom: none; }
.modal-section h3 {
  color: #00ff41; font-size: 13px; text-transform: uppercase;
  letter-spacing: 2px; margin-bottom: 8px;
}
.modal-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; font-size: 13px; border-bottom: 1px solid #1a1a1a;
}
.modal-row:last-child { border-bottom: none; }
.modal-row .label { color: #ccc; }
.modal-row .value { color: #00ff41; }
.modal-row .cost { color: #ffd700; }
.btn-modal {
  background: #1a1a1a; border: 1px solid #00ff41; color: #00ff41; padding: 6px 14px;
  font-family: inherit; font-size: 12px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 1px;
}
.btn-modal:hover { background: #00ff41; color: #0a0a0a; }
.btn-modal.fire { border-color: #ff3333; color: #ff3333; }
.btn-modal.fire:hover { background: #ff3333; color: #0a0a0a; }
.hp-bar { width: 100%; height: 8px; background: #333; border-radius: 2px; margin-top: 4px; }
.hp-bar-fill { height: 100%; background: #00ff41; border-radius: 2px; transition: width 0.3s; }
.hp-bar-fill.low { background: #ff8800; }
.hp-bar-fill.critical { background: #ff3333; }
.missile-buy-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px; margin: 4px 0; background: #0a0a0a; border: 1px solid #222; border-radius: 2px;
}
.missile-buy-row .info { display: flex; flex-direction: column; gap: 2px; }
.missile-buy-row .name { color: #ccc; font-size: 13px; }
.missile-buy-row .details { color: #666; font-size: 10px; }
.missile-load-time { color: #ff8800; font-size: 11px; }
.missile-ready { color: #00ff41; font-size: 11px; }
.countdown { color: #ff8800; font-weight: bold; }

/* Slot grid */
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; }
.slot-cell {
  background: #0a0a0a; border: 1px solid #333; border-radius: 3px; padding: 10px 6px;
  text-align: center; cursor: pointer; transition: all 0.2s; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.slot-cell:hover { border-color: #00ff41; }
.slot-cell.loaded { border-color: #ff3333; background: rgba(255,51,51,0.08); }
.slot-cell.loaded:hover { border-color: #ff6666; background: rgba(255,51,51,0.15); }
.slot-cell.empty { border-style: dashed; }
.slot-cell .slot-num { color: #555; font-size: 9px; text-transform: uppercase; }
.slot-cell .slot-missile { color: #ff3333; font-size: 11px; font-weight: bold; }
.slot-cell .slot-empty { color: #444; font-size: 18px; }
.slot-label { color: #888; font-size: 11px; margin-bottom: 4px; }

/* Side panels */
.side-panel {
  position: fixed; right: 0; top: 72px; bottom: 0; width: 300px; z-index: 1000;
  background: rgba(10, 10, 10, 0.95); border-left: 1px solid #333;
  overflow-y: auto; padding: 12px; display: none;
}
.side-panel h3 {
  color: #ff3333; margin-bottom: 8px; font-size: 14px;
  text-transform: uppercase; letter-spacing: 2px;
}

.nearby-item:hover { background: rgba(255,255,255,0.05); }

.silo-card {
  background: #0a0a0a; border: 1px solid #333; border-radius: 2px;
  padding: 10px; margin: 6px 0; cursor: pointer; transition: border-color 0.2s;
}
.silo-card:hover { border-color: #ff3333; }
.silo-card .silo-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;
}
.silo-card .silo-name { color: #ff3333; font-size: 14px; font-weight: bold; text-transform: uppercase; }
.silo-card .silo-level { color: #888; font-size: 12px; }
.silo-card .silo-status { font-size: 12px; margin-bottom: 6px; }
.silo-card .silo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.silo-card .silo-actions .btn-modal { font-size: 11px; padding: 4px 10px; }
.silo-card .cooldown-bar {
  width: 100%; height: 4px; background: #222; border-radius: 2px; margin-top: 4px; overflow: hidden;
}
.silo-card .cooldown-bar-fill {
  height: 100%; background: #ff8800; border-radius: 2px; transition: width 1s linear;
}
.silo-card .cooldown-text { color: #ff8800; font-size: 11px; }
.arsenal-filters {
  display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap;
}
.arsenal-filter {
  background: #0a0a0a; border: 1px solid #333; color: #888; padding: 4px 10px;
  font-family: inherit; font-size: 11px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 1px; border-radius: 2px; transition: all 0.2s;
}
.arsenal-filter:hover { border-color: #00ff41; color: #ccc; }
.arsenal-filter.active { border-color: #00ff41; color: #00ff41; background: rgba(0,255,65,0.08); }
.fire-picker { margin-top: 8px; }
.fire-picker-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 8px; margin: 3px 0; background: #111; border: 1px solid #333;
  border-radius: 2px; cursor: pointer; transition: border-color 0.2s;
}
.fire-picker-item:hover { border-color: #ff3333; }
.fire-picker-item .fp-name { color: #ff3333; font-size: 12px; font-weight: bold; }
.fire-picker-item .fp-count { color: #888; font-size: 11px; }
.fire-picker-item .fp-stats { color: #666; font-size: 10px; }

/* Bookmarks */
.bookmark-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px; margin: 4px 0; background: #0a0a0a; border: 1px solid #222;
  border-radius: 2px; cursor: pointer; transition: border-color 0.2s;
}
.bookmark-item:hover { border-color: #00ff41; }
.bookmark-item .bm-name { color: #ccc; font-size: 13px; }
.bookmark-item .bm-coords { color: #555; font-size: 10px; }
.bookmark-item .bm-del {
  background: none; border: none; color: #ff3333; font-size: 16px;
  cursor: pointer; font-family: inherit; padding: 0 4px;
}
.bookmark-item .bm-del:hover { color: #ff6666; }
.bookmark-add {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.bookmark-add input {
  flex: 1; background: #0a0a0a; border: 1px solid #333; color: #00ff41;
  padding: 6px 8px; font-family: inherit; font-size: 12px; outline: none;
}
.bookmark-add input:focus { border-color: #00ff41; }
.silo-card .silo-hp {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.silo-card .silo-hp .hp-bar { flex: 1; height: 6px; }
.silo-card .silo-hp span { color: #888; font-size: 10px; white-space: nowrap; }

/* Map themes panel */
.theme-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.theme-card {
  background: #0a0a0a; border: 1px solid #333; border-radius: 2px;
  padding: 8px; cursor: pointer; transition: border-color 0.2s; text-align: center;
}
.theme-card:hover { border-color: #00ff41; }
.theme-card.active { border-color: #00ff41; background: rgba(0,255,65,0.08); }
.theme-card .theme-name { color: #ccc; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.theme-card .theme-tag { color: #666; font-size: 9px; margin-top: 2px; }
.theme-category { color: #ff3333; font-size: 11px; text-transform: uppercase; letter-spacing: 2px; margin: 10px 0 6px; }
.theme-category:first-child { margin-top: 0; }
.build-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 8px; margin: 4px 0; background: #0a0a0a; border: 1px solid #222;
  border-radius: 2px; cursor: pointer; transition: border-color 0.2s;
}
.build-item:hover { border-color: #00ff41; }
.build-item .name { color: #ccc; font-size: 13px; }
.build-item .cost { color: #ffd700; font-size: 13px; }

/* Missile flight popup */
.flight-popup { font-family: 'Courier New', monospace; font-size: 12px; min-width: 180px; }
.flight-popup .title { color: #ff3333; font-weight: bold; font-size: 13px; margin-bottom: 4px; }
.flight-popup .eta { color: #ff8800; font-size: 16px; font-weight: bold; margin: 4px 0; }
.flight-popup .stat { color: #aaa; }
.flight-popup .jump-btn {
  display: inline-block; margin-top: 6px; padding: 5px 12px; background: #1a1a1a;
  border: 1px solid #ff3333; color: #ff3333; cursor: pointer; font-family: inherit;
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
}
.flight-popup .jump-btn:hover { background: #ff3333; color: #0a0a0a; }

/* Other player labels */
.player-label {
  background: rgba(10,10,10,0.8); border: 1px solid #ff8800;
  color: #ff8800; font-family: 'Courier New', monospace;
  font-size: 11px; padding: 2px 6px; border-radius: 2px;
  white-space: nowrap; pointer-events: none;
  position: absolute; transform: translate(-50%, -100%); margin-top: -8px;
}

/* Match-3 boost game */
#boost-game {
  position: fixed; inset: 0; z-index: 3000; background: #0a0a0a;
  display: none; flex-direction: column; align-items: center; justify-content: center;
}
#boost-game.active { display: flex; }
#boost-shader-canvas {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
#boost-game .game-header {
  display: flex; justify-content: space-between; align-items: center;
  width: min(90vw, 420px); margin-bottom: 12px; z-index: 1;
}
#boost-game .game-score { color: #ff8800; font-size: 20px; font-weight: bold; }
#boost-game .game-moves { color: #888; font-size: 14px; }
#boost-game .game-title { color: #ff8800; font-size: 16px; text-transform: uppercase; letter-spacing: 3px; }
#boost-timer-bar {
  width: min(90vw, 420px); height: 22px; background: #111; border: 1px solid #333;
  border-radius: 3px; margin-bottom: 14px; position: relative; overflow: hidden; z-index: 1;
}
#boost-timer-fill {
  height: 100%; background: #ff8800; transition: width 0.3s; position: absolute; left: 0; top: 0;
}
#boost-timer-reduction {
  height: 100%; background: #00ff41; position: absolute; top: 0;
  transition: width 0.3s, left 0.3s; opacity: 0.85;
}
#boost-timer-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #ccc; letter-spacing: 1px; text-transform: uppercase; z-index: 1;
  text-shadow: 0 0 4px #000, 0 0 8px #000;
}
#boost-board {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  width: min(90vw, 420px); height: min(90vw, 420px); background: #111; border: 2px solid #333;
  border-radius: 4px; padding: 4px; touch-action: none; position: relative; z-index: 1;
}
.gem {
  width: 100%; aspect-ratio: 1; border-radius: 4px; cursor: grab;
  display: flex; align-items: center; justify-content: center;
  font-size: min(7vw, 34px); transition: transform 0.2s ease, opacity 0.2s, box-shadow 0.2s;
  user-select: none; -webkit-user-select: none;
  position: relative; z-index: 1;
}
.gem.selected { transform: scale(1.15); box-shadow: 0 0 12px rgba(255,255,255,0.5); }
.gem.matched { animation: mushroomCloud 0.5s ease forwards; }
@keyframes mushroomCloud {
  0% { transform: scale(1); opacity: 1; filter: brightness(1); }
  15% { transform: scale(1.6); opacity: 1; filter: brightness(2.5); box-shadow: 0 0 25px var(--gem-color, #ff8800), 0 0 50px var(--gem-color, #ff8800); }
  30% { transform: scale(1.8) translateY(-8%); opacity: 0.9; filter: brightness(3); box-shadow: 0 0 35px var(--gem-color, #ff8800), 0 0 60px var(--gem-color, #ff8800); border-radius: 50%; }
  50% { transform: scale(1.4) translateY(-4%); opacity: 0.7; filter: brightness(2); box-shadow: 0 0 20px var(--gem-color, #ff8800); border-radius: 50% 50% 30% 30%; }
  75% { transform: scale(0.6); opacity: 0.3; filter: brightness(1.2); box-shadow: 0 0 8px var(--gem-color, #ff8800); }
  100% { transform: scale(0); opacity: 0; filter: brightness(0.5); }
}
.gem.falling {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.gem.dragging {
  z-index: 10; transform: scale(1.2); box-shadow: 0 0 20px rgba(255,255,255,0.6);
  cursor: grabbing; transition: none;
}
.gem.swap-target { transform: scale(0.9); opacity: 0.7; }
.gem.swap-anim { transition: transform 0.2s ease; }
.gem.bad-move { animation: badShake 0.4s ease; }
@keyframes badShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px) rotate(-2deg); }
  30% { transform: translateX(6px) rotate(2deg); }
  45% { transform: translateX(-4px) rotate(-1deg); }
  60% { transform: translateX(4px) rotate(1deg); }
  75% { transform: translateX(-2px); }
}
#boost-board.board-flash { animation: boardFlash 0.4s ease; }
@keyframes boardFlash {
  0%, 100% { border-color: #333; box-shadow: none; }
  25% { border-color: #ff3333; box-shadow: 0 0 20px rgba(255,51,51,0.4); }
  50% { border-color: #ff0000; box-shadow: 0 0 30px rgba(255,0,0,0.5); }
  75% { border-color: #ff3333; box-shadow: 0 0 15px rgba(255,51,51,0.3); }
}
.penalty-text {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #ff3333; font-size: 28px; font-weight: bold; pointer-events: none;
  z-index: 20; text-shadow: 0 0 10px #ff0000; animation: penaltyFade 0.8s ease forwards;
}
@keyframes penaltyFade {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(0.8); }
}
#boost-game .game-footer {
  margin-top: 16px; display: flex; gap: 12px; align-items: center; z-index: 1;
}
#boost-game .game-done {
  background: #1a1a1a; border: 2px solid #ff8800; color: #ff8800; padding: 10px 28px;
  font-family: inherit; font-size: 14px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 2px;
}
#boost-game .game-done:hover { background: #ff8800; color: #0a0a0a; }
.boost-result { color: #00ff41; font-size: 14px; text-align: center; margin-top: 8px; z-index: 1; }

/* Bonus celebration overlay */
#boost-bonus-text {
  position: fixed; inset: 0; z-index: 3100; display: none;
  align-items: center; justify-content: center; pointer-events: none;
  flex-direction: column; gap: 8px;
}
#boost-bonus-text.active { display: flex; }
#boost-bonus-text .bonus-main {
  font-size: min(12vw, 64px); font-weight: bold; color: #00ff41;
  text-shadow: 0 0 20px #00ff41, 0 0 40px #00ff41, 0 0 80px #00aa22;
  text-transform: uppercase; letter-spacing: 6px;
  animation: bonusBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
#boost-bonus-text .bonus-sub {
  font-size: min(5vw, 28px); color: #ffd700;
  text-shadow: 0 0 15px #ffd700, 0 0 30px #ff8800;
  text-transform: uppercase; letter-spacing: 4px;
  animation: bonusBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}
@keyframes bonusBounce {
  0% { transform: scale(0) rotate(-5deg); opacity: 0; }
  50% { transform: scale(1.3) rotate(2deg); opacity: 1; }
  70% { transform: scale(0.9) rotate(-1deg); }
  85% { transform: scale(1.1) rotate(0.5deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes bonusFadeOut {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* Profile modal */
#profile-overlay {
  position: fixed; inset: 0; z-index: 2500; background: rgba(0,0,0,0.85);
  display: none; align-items: center; justify-content: center;
}
#profile-overlay.active { display: flex; }
#profile-modal {
  background: #111; border: 1px solid #00ff41; border-radius: 4px;
  width: 90%; max-width: 420px; max-height: 85vh; overflow-y: auto;
  padding: 24px; position: relative;
}
#profile-modal h2 {
  color: #ff3333; font-size: 20px; text-transform: uppercase;
  letter-spacing: 3px; margin-bottom: 16px;
}
.profile-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  color: #ff3333; font-size: 24px; cursor: pointer; font-family: inherit;
}
.profile-avatar-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px;
}
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; border: 2px solid #00ff41;
  object-fit: cover; background: #0a0a0a; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar .avatar-placeholder {
  color: #333; font-size: 40px; line-height: 1;
}
.profile-avatar:hover { border-color: #ff8800; }
.profile-avatar-hint { color: #555; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.profile-field { margin-bottom: 16px; }
.profile-field label {
  display: block; color: #888; font-size: 11px; text-transform: uppercase;
  letter-spacing: 2px; margin-bottom: 4px;
}
.profile-field input, .profile-field textarea {
  width: 100%; background: #0a0a0a; border: 1px solid #333; color: #00ff41;
  padding: 8px 10px; font-family: inherit; font-size: 13px; outline: none;
  resize: vertical;
}
.profile-field input:focus, .profile-field textarea:focus { border-color: #00ff41; }
.profile-field textarea { min-height: 60px; max-height: 120px; }
.profile-field .char-count { color: #555; font-size: 10px; text-align: right; margin-top: 2px; }
.profile-actions { display: flex; gap: 8px; margin-top: 16px; }
.profile-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px;
  padding: 10px; background: #0a0a0a; border: 1px solid #222; border-radius: 2px;
}
.profile-stat-label { color: #555; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; }
.profile-stat-value { color: #00ff41; font-size: 14px; font-weight: bold; }
.wipe-section {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid #331111;
}
.wipe-section h3 {
  color: #ff3333; font-size: 12px; text-transform: uppercase;
  letter-spacing: 2px; margin-bottom: 8px;
}
.wipe-section p { color: #666; font-size: 11px; margin-bottom: 10px; line-height: 1.4; }
.wipe-input {
  width: 100%; background: #0a0a0a; border: 1px solid #331111; color: #ff3333;
  padding: 8px 10px; font-family: inherit; font-size: 13px; outline: none;
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: 2px; text-align: center;
}
.wipe-input:focus { border-color: #ff3333; }
.wipe-input::placeholder { color: #331111; text-transform: uppercase; }

/* Cluster markers */
.cluster-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: rgba(20,20,20,0.95);
  border: 2px solid #00ff41; border-radius: 50%; color: #00ff41;
  font-family: 'Courier New', monospace; font-size: 16px; font-weight: bold;
  box-shadow: 0 0 10px rgba(0,255,65,0.3);
}
.cluster-list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 8px; margin: 4px 0; background: #0a0a0a; border: 1px solid #222;
  border-radius: 2px; cursor: pointer; transition: border-color 0.2s;
}
.cluster-list-item:hover { border-color: #00ff41; }
.cluster-list-item .cl-type { font-size: 13px; font-weight: bold; text-transform: uppercase; }
.cluster-list-item .cl-info { color: #888; font-size: 11px; }

/* Code Breaker game */
#codebreaker-game {
  position: fixed; inset: 0; z-index: 3000; background: #0a0a0a;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px;
}
#codebreaker-game.active { display: flex; }
#codebreaker-game .game-header {
  display: flex; justify-content: space-between; align-items: center;
  width: min(90vw, 380px); margin-bottom: 10px;
}
#codebreaker-game .game-title { color: #00aaff; font-size: 16px; text-transform: uppercase; letter-spacing: 3px; }
#codebreaker-game .game-score { color: #ff8800; font-size: 20px; font-weight: bold; }
#codebreaker-game .game-moves { color: #888; font-size: 14px; }
.cb-legend {
  display: flex; gap: 16px; margin-bottom: 10px; font-size: 11px; color: #666;
}
.cb-leg-item { display: flex; align-items: center; gap: 4px; }
#cb-board {
  width: min(90vw, 380px); display: flex; flex-direction: column; gap: 4px;
  background: #111; border: 2px solid #333; border-radius: 4px; padding: 8px;
}
.cb-row {
  display: flex; align-items: center; gap: 6px;
}
.cb-cell {
  width: 48px; height: 48px; border: 2px solid #333; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: bold; color: #fff; background: #1a1a1a;
  cursor: default; transition: all 0.2s; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.cb-cell.filled { border-width: 2px; }
.cb-cell.active { border-color: #00aaff; box-shadow: 0 0 8px rgba(0,170,255,0.4); animation: cbPulse 1.2s ease-in-out infinite; }
.cb-cell.dim { opacity: 0.2; }
.cb-cell.reveal { animation: cbReveal 0.5s ease; }
@keyframes cbPulse { 0%,100% { box-shadow: 0 0 4px rgba(0,170,255,0.2); } 50% { box-shadow: 0 0 12px rgba(0,170,255,0.6); } }
@keyframes cbReveal { 0% { transform: scale(0.5) rotateY(90deg); } 50% { transform: scale(1.2) rotateY(0); } 100% { transform: scale(1); } }
.cb-feedback {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-left: auto; width: 40px;
}
.cb-peg {
  width: 14px; height: 14px; border-radius: 50%; border: 1px solid #444;
}
.cb-peg.exact { background: #00ff41; border-color: #00ff41; box-shadow: 0 0 4px #00ff41; }
.cb-peg.misplaced { background: #ffd700; border-color: #ffd700; box-shadow: 0 0 4px #ffd700; }
.cb-peg.empty { background: #222; }
#cb-secret {
  display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 12px;
}
.cb-reveal-label {
  color: #00ff41; font-size: 14px; text-transform: uppercase; letter-spacing: 3px; font-weight: bold;
  text-shadow: 0 0 10px #00ff41;
}
.cb-reveal-row { display: flex; gap: 6px; }
#cb-picker {
  display: flex; gap: 8px; margin-top: 14px; justify-content: center; flex-wrap: wrap;
}
.cb-color-btn {
  width: 48px; height: 48px; border: 2px solid; border-radius: 8px;
  cursor: pointer; font-family: inherit; font-size: 18px; font-weight: bold;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  transition: transform 0.15s, box-shadow 0.15s;
}
.cb-color-btn:hover { transform: scale(1.15); box-shadow: 0 0 12px currentColor; }
.cb-color-btn:active { transform: scale(0.95); }
.cb-submit {
  background: #00aaff; border: 2px solid #00aaff; color: #0a0a0a; padding: 10px 28px;
  font-family: inherit; font-size: 14px; font-weight: bold; cursor: pointer;
  text-transform: uppercase; letter-spacing: 2px; border-radius: 4px;
}
.cb-submit:hover { background: #33bbff; }
#codebreaker-game .game-footer {
  margin-top: 14px; display: flex; gap: 12px; align-items: center;
}
#codebreaker-game .game-done {
  background: #1a1a1a; border: 2px solid #ff8800; color: #ff8800; padding: 10px 28px;
  font-family: inherit; font-size: 14px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 2px;
}
#codebreaker-game .game-done:hover { background: #ff8800; color: #0a0a0a; }

/* Chess Tactics game */
#chess-tactics {
  position: fixed; inset: 0; z-index: 3000; background: #0a0a0a;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px; gap: 8px;
}
#chess-tactics.active { display: flex; }
#chess-tactics .game-header {
  display: flex; justify-content: space-between; align-items: center;
  width: min(92vw, 400px); margin-bottom: 2px;
}
#chess-tactics .game-title { color: #ffd700; font-size: 16px; text-transform: uppercase; letter-spacing: 3px; }
#chess-tactics .game-score { color: #ff8800; font-size: 20px; font-weight: bold; }
.chess-info-row {
  display: flex; justify-content: space-between; align-items: center;
  width: min(92vw, 400px); gap: 8px;
}
.chess-turn {
  font-size: 13px; text-transform: uppercase; letter-spacing: 2px; font-weight: bold;
}
.chess-turn.white { color: #fff; text-shadow: 0 0 6px rgba(255,255,255,0.5); }
.chess-turn.black { color: #aaa; }
.chess-diff { font-size: 14px; }
.chess-diff.diff-1 { color: #00ff41; }
.chess-diff.diff-2 { color: #ffd700; }
.chess-diff.diff-3 { color: #ff3333; }
#chess-theme {
  font-size: 10px; color: #666; text-transform: uppercase; letter-spacing: 2px;
  background: #1a1a1a; padding: 2px 8px; border-radius: 3px; border: 1px solid #333;
}
#chess-board {
  display: grid; grid-template-columns: repeat(8, 1fr);
  width: min(92vw, 400px); height: min(92vw, 400px);
  border: 2px solid #555; border-radius: 2px; overflow: hidden;
}
.chess-sq {
  position: relative; display: flex; align-items: center; justify-content: center;
  cursor: pointer; user-select: none;
  aspect-ratio: 1;
}
.chess-sq.light { background: #b8a47c; }
.chess-sq.dark { background: #6d5d3f; }
.chess-sq.selected { background: #7b9f35 !important; }
.chess-sq.correct { background: #4caf50 !important; animation: correctFlash 0.4s ease; }
.chess-sq.hint-sq { background: #e65100 !important; animation: hintPulse 1s ease infinite; }
@keyframes correctFlash { 0% { background: #8bc34a; } 100% { background: #4caf50; } }
@keyframes hintPulse { 0%,100% { opacity: 0.7; } 50% { opacity: 1; } }

.chess-piece {
  font-size: min(10vw, 44px); line-height: 1; pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.chess-piece.white-piece { color: #fff; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.6)); }
.chess-piece.black-piece { color: #1a1a1a; filter: drop-shadow(0 1px 2px rgba(255,255,255,0.15)); }

.chess-move-dot {
  position: absolute; width: 25%; height: 25%; border-radius: 50%;
  background: rgba(0,0,0,0.25); pointer-events: none;
}
.chess-capture-ring {
  position: absolute; width: 85%; height: 85%; border-radius: 50%;
  border: 3px solid rgba(0,0,0,0.25); pointer-events: none;
}
.chess-label {
  position: absolute; font-size: 9px; font-weight: bold; pointer-events: none;
  opacity: 0.7;
}
.chess-label.rank { top: 1px; left: 2px; }
.chess-label.file { bottom: 1px; right: 2px; }
.chess-sq.light .chess-label { color: #6d5d3f; }
.chess-sq.dark .chess-label { color: #b8a47c; }

.chess-hint-row {
  display: flex; align-items: center; gap: 8px; width: min(92vw, 400px);
}
#chess-hint-btn {
  background: #1a1a1a; border: 1px solid #ffd700; color: #ffd700; padding: 6px 14px;
  font-family: inherit; font-size: 12px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 1px; border-radius: 3px; white-space: nowrap;
}
#chess-hint-btn:hover:not(:disabled) { background: #ffd700; color: #0a0a0a; }
#chess-hint-btn:disabled { opacity: 0.3; cursor: default; }
#chess-hint-text {
  color: #ffd700; font-size: 12px; font-style: italic; opacity: 0;
  transition: opacity 0.3s;
}
#chess-hint-text.visible { opacity: 1; }

#chess-result {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  display: none; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(10,10,10,0.9); border: 2px solid #333; border-radius: 8px;
  padding: 16px 28px; z-index: 10; pointer-events: none;
}
#chess-result.active { display: flex; }
.cr-correct { color: #00ff41; font-size: 20px; font-weight: bold; text-transform: uppercase; letter-spacing: 3px; }
.cr-wrong { color: #ff3333; font-size: 20px; font-weight: bold; text-transform: uppercase; letter-spacing: 3px; }
.cr-points { color: #ff8800; font-size: 16px; }
.cr-streak { color: #ffd700; font-size: 13px; }
.cr-answer { color: #ff8800; font-size: 14px; font-style: italic; }

#chess-tactics .game-footer {
  margin-top: 6px; display: flex; gap: 12px; align-items: center;
}
#chess-tactics .game-done {
  background: #1a1a1a; border: 2px solid #ff8800; color: #ff8800; padding: 10px 28px;
  font-family: inherit; font-size: 14px; cursor: pointer; text-transform: uppercase;
  letter-spacing: 2px; border-radius: 3px;
}
#chess-tactics .game-done:hover { background: #ff8800; color: #0a0a0a; }

/* MapLibre overrides */
.maplibregl-canvas { outline: none; }
.maplibregl-popup-content {
  background: #111 !important; border: 1px solid #333 !important;
  color: #ccc !important; font-family: 'Courier New', monospace !important;
  border-radius: 4px !important; padding: 10px !important;
}
.maplibregl-popup-tip { border-top-color: #333 !important; }
.maplibregl-popup-close-button { color: #ff3333 !important; font-size: 18px !important; }

/* Minimap Globe */
#minimap-container {
  position: fixed; bottom: 12px; right: 12px; z-index: 1050;
  transition: all 0.3s ease;
}
#minimap-container.collapsed #minimap-svg { display: none; }

#minimap-toggle {
  background: rgba(10,10,10,0.9); border: 1px solid #333; border-radius: 2px;
  color: #00ff41; font-family: 'Courier New', monospace; font-size: 10px;
  font-weight: bold; letter-spacing: 2px; text-align: center;
  padding: 4px 12px; cursor: pointer; user-select: none;
  text-transform: uppercase;
}
#minimap-toggle:hover { border-color: #00ff41; }

#minimap-svg {
  width: 200px; height: 120px; border: 1px solid #333; border-radius: 2px;
  margin-top: 4px; cursor: crosshair; display: block;
  background: #0a0a0a;
}
#minimap-svg circle:hover { opacity: 1 !important; }

@media (max-width: 480px) {
  #minimap-svg { width: 160px; height: 96px; }
}
