:root{
  --bg:#0b1220;
  --panel:#0f1724;
  --accent:#ff6b35;
  --muted:#9aa6b2;
}
*{box-sizing:border-box;font-family:Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial}
html,body{height:100%;margin:0;background:linear-gradient(180deg,var(--bg),#081019);color:#e6eef6}
body{display:flex;flex-direction:column}
header{padding:12px 18px;border-bottom:1px solid rgba(255,255,255,0.04)}
h1{margin:0;font-size:20px}
#main{display:flex;gap:12px;padding:12px}
#main{display:flex;gap:12px;padding:12px}
main{display:flex;flex-direction:column;gap:12px;padding:12px;flex:1;min-height:0}
#game-area{flex:1 1 auto;position:relative;background:linear-gradient(#89a,#012);border-radius:8px;overflow:hidden;min-height:0}
#world{width:100%;height:100%;display:block}
#hud{position:absolute;left:12px;top:12px;color:var(--muted)}
#hud{position:absolute;left:12px;top:12px;color:var(--muted)}
/* improved stats panel */
#hud .panel{background:rgba(4,8,15,0.7);backdrop-filter:blur(6px);padding:8px 10px;border-radius:8px;border:1px solid rgba(255,255,255,0.04)}
.panel{background:rgba(4,8,15,0.7);backdrop-filter:blur(6px);padding:8px 10px;border-radius:8px;border:1px solid rgba(255,255,255,0.04)}
#hud #stats{display:flex;gap:12px;align-items:center}
#hud #stats > div{font-weight:600;color:#e6eef6;padding:6px 10px;border-radius:6px;background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(0,0,0,0.12));box-shadow:0 2px 6px rgba(0,0,0,0.4)}
#hud #stats span{color:var(--accent);font-family:monospace}
/* round HUD (top-right) */
#roundHud{position:absolute;right:12px;top:12px;color:var(--muted)}
#roundHud > div{font-weight:600;color:#e6eef6;padding:6px 10px;border-radius:6px;background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(0,0,0,0.12));box-shadow:0 2px 6px rgba(0,0,0,0.4);margin-bottom:6px}
#roundHud span{color:var(--accent);font-family:monospace}

/* larger wind arrow next to the mph value */
#roundHud .wind-arrow{font-size:18px;font-weight:700;margin-left:8px;display:inline-block;transform:translateY(-1px);}

/* ensure all panels use consistent child styling */
.panel > div{font-weight:600;color:#e6eef6;padding:6px 10px;border-radius:6px;background:linear-gradient(180deg,rgba(255,255,255,0.02),rgba(0,0,0,0.12));box-shadow:0 2px 6px rgba(0,0,0,0.4);margin-bottom:6px}
.panel span{color:var(--accent);font-family:inherit}
#controls{width:100%;max-width:none;margin:0;background:rgba(0,0,0,0.25);padding:12px;border-radius:8px;overflow:hidden;display:flex;flex-direction:column;flex:0 0 36vh;min-height:0}
#controls h2{margin-top:0}
#commands{width:100%;height:100%;background:#031021;border:1px solid rgba(255,255,255,0.04);color:#e6eef6;padding:8px;border-radius:6px;font-family:monospace;min-height:0}
#commandsWrapper{position:relative;display:flex;flex-direction:column;flex:1;min-height:0}
#commands{width:100%;height:100%;background:transparent;border:1px solid #ffffff;color:#e6eef6;padding:8px;border-radius:6px;font-family:monospace;position:relative;z-index:2;resize:vertical;outline:none;transition:border-color 120ms linear;min-height:0}
#commands:focus{border-color:#ffffff;box-shadow:0 0 0 3px rgba(255,255,255,0.04);outline:none}

/* inline tooltip for command errors */
/* highlight layer and hint tooltip removed */
.buttons{display:flex;gap:8px;margin-top:8px}
button{background:var(--accent);border:none;padding:8px 12px;border-radius:6px;color:white;cursor:pointer}
button:active{transform:translateY(1px)}
#message{margin-top:8px;color:var(--muted)}
footer{margin-top:12px;color:var(--muted)}

/* simple responsive */
@media(max-width:900px){main{flex-direction:column}#controls{width:100%}}

/* Modal result dialog */
.modal{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;z-index:999;visibility:hidden;opacity:0}
.modal[aria-hidden="false"]{visibility:visible;opacity:1}
.modal-backdrop{position:absolute;inset:0;background:rgba(2,4,8,0.6);backdrop-filter:blur(2px)}
.modal-panel{position:relative;background:var(--panel);color:#e9eef6;padding:18px 20px;border-radius:10px;box-shadow:0 12px 40px rgba(3,8,16,0.8);min-width:320px;max-width:520px;z-index:1000}
.modal-text{font-size:16px;margin-bottom:14px}
.modal-actions{text-align:right}
.modal-actions button{background:var(--accent);padding:8px 14px;border-radius:8px;border:none;color:white}

/* Title / How-to screens */
.screen{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:linear-gradient(180deg,rgba(2,6,12,0.85),rgba(2,6,12,0.95));z-index:50}
.title-panel,.how-panel{background:var(--panel);padding:28px 30px;border-radius:12px;max-width:720px;text-align:center;color:#e8f0f4}
.title-panel h1{font-size:34px;margin:0 0 8px}
.tag{color:var(--muted);margin-bottom:14px}
.title-actions{display:flex;gap:12px;justify-content:center;margin-top:12px}
.title-actions button{padding:10px 18px;border-radius:8px;border:none;background:var(--accent);color:white;font-size:16px}
.how-panel h2{margin-top:0}
/* tighten list indentation in how-to panel */
.how-panel ul{text-align:left;padding-left:18px;margin:10px 0}
.how-panel li{margin-bottom:8px}

/* Transfer flash overlay (used to briefly flash the UI when a transfer arrives) */
#transferFlash{position:absolute;inset:0;pointer-events:none;z-index:1500;background:rgba(255,140,60,0.0);opacity:0;transition:opacity 120ms linear, background-color 120ms linear}
#transferFlash.flash-on{opacity:0.95;background:rgba(255,140,60,0.12)}
#transferFlash.flash-strong{opacity:1;background:rgba(255,140,60,0.22)}

/* Ownership HUD removed */

/* Score change bubble */
.score-bubble{position:fixed;transform:translate(-50%,0);pointer-events:none;padding:6px 10px;border-radius:8px;background:var(--accent);color:white;font-weight:700;z-index:2500;animation:scorePop 2000ms cubic-bezier(.2,.9,.2,1) forwards}
.score-bubble.score-negative{background:#c0392b}
/* centered bonus bubble styling */
.score-bubble.score-bonus{font-size:1.25em;padding:10px 14px}

@keyframes scorePop{
  0% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -36px) scale(1.05); }
}

@keyframes scorePopCenter{
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1.05); }
}

/* apply different animation for centered bonus bubbles */
.score-bubble.score-bonus{animation: scorePopCenter 2000ms cubic-bezier(.2,.9,.2,1) forwards}

/* Enemy Radar styles */
#enemyRadarPanel{display:flex;flex-direction:column}
#enemyRadar{background:linear-gradient(180deg,#04210a,#073217);border-radius:6px;border:1px solid rgba(255,255,255,0.04);box-shadow:inset 0 8px 24px rgba(0,0,0,0.45);width:100%;height:100%}
/* header removed; panel children inherit transparent background */

/* Commands + Radar should occupy the full bottom area beneath the world view */
.commandsRow{display:flex;gap:12px;align-items:stretch;flex:1;min-height:0}
.commandsRow > div{min-height:0}

/* Ensure radar panel and canvas fill available vertical space */
.radarPanel{display:flex;flex-direction:column;min-height:0}
.radarPanel > .panel{flex:1 1 0;display:flex;flex-direction:column;min-height:0}
#enemyRadarPanel{flex:1 1 0;display:flex;flex-direction:column;min-height:0;padding:8px}
#enemyRadarPanel > canvas{flex:1 1 0;min-height:0;width:100%;height:100%;display:block;border-radius:6px}

/* 50/50 split for commands and radar on wide screens */
.commandsRow .commandsPanel{flex:1 1 50%;display:flex;flex-direction:column;min-height:0}
.commandsRow .radarPanel{flex:1 1 50%;display:flex;flex-direction:column;min-height:0}

@media(max-width:900px){
  .commandsRow{flex-direction:column}
  .commandsRow .commandsPanel, .commandsRow .radarPanel{flex:initial;width:100%}
}

/* top controls row: align Commands and Radar headings */
.controlsTop{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.controlsTop h2{margin:0}
.radarTitle{font-size:1.25em;font-weight:700;color:inherit}

/* center the headings above each half of the controls row */
.controlsTop .controlsHeadLeft, .controlsTop .controlsHeadRight { display:flex; align-items:flex-start; justify-content:center }
.controlsTop .controlsHeadLeft h2, .controlsTop .controlsHeadRight h2 { margin:0 }
