/* =============================================================
   Froggy's Conquest 2: styling
   Dark ops-room look: deep ocean map, amber accents, clean HUD.
   ============================================================= */

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

:root {
  --ocean: #0c1622;
  --panel: #131e2c;
  --panel-2: #1a2738;
  --line: #2a3b52;
  --text: #d7e3ee;
  --dim: #8aa0b5;
  --amber: #ffd84d;
  --blue: #2e9edf;
  --red: #e0604f;
  --green: #6fbf73;
}

html, body { height: 100%; overflow: hidden; }
body {
  background: var(--ocean);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------------- HUD ---------------- */
#hud {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 5;
  flex-wrap: wrap;
}
.hud-left { display: flex; align-items: baseline; gap: 12px; }
#hud-logo { font-weight: 800; letter-spacing: 1px; color: var(--amber); white-space: nowrap; }
#hud-day { color: var(--dim); font-variant-numeric: tabular-nums; }

.hud-bars { display: flex; gap: 18px; flex: 1; min-width: 320px; align-items: center; flex-wrap: wrap; }
.bar-group { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 150px; }
.bar-label { font-size: 12px; color: var(--dim); white-space: nowrap; }
.bar {
  flex: 1; height: 12px; min-width: 60px;
  background: #0a121d; border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden;
}
.bar-fill { height: 100%; width: 0; transition: width .4s; }
.bar.adoption .bar-fill { background: linear-gradient(90deg, #3a8f4e, #6fbf73); }
.bar.retro .bar-fill { background: linear-gradient(90deg, #9c4dcc, #e0604f); }
.bar.detect .bar-fill { background: linear-gradient(90deg, #b89b2c, #e0a14f); }
.bar-pct { font-size: 12px; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }
.bar-group.small { max-width: 200px; }

.hud-right { display: flex; align-items: center; gap: 10px; }
#hud-deliv-wrap { font-weight: 700; color: var(--amber); font-variant-numeric: tabular-nums; }
#methodology-btn {
  background: var(--amber); color: #1d1700; border: 0;
  padding: 6px 14px; border-radius: 6px; font-weight: 700;
}
#methodology-btn:hover { filter: brightness(1.1); }
#speed-controls { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
#speed-controls button, #mute-btn {
  background: var(--panel-2); color: var(--text); border: 0; padding: 5px 10px;
}
#speed-controls button.active { background: var(--blue); color: #fff; }
#mute-btn { border: 1px solid var(--line); border-radius: 6px; }

#music-controls {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 8px 2px 6px; background: var(--panel-2);
}
#music-note { color: var(--dim); font-size: 13px; }
#music-controls button {
  background: none; border: 0; color: var(--dim);
  padding: 3px 7px; border-radius: 4px; font-size: 12px; font-weight: 700;
}
#music-controls button.active { background: var(--amber); color: #1d1700; }
#vol-slider {
  width: 70px; height: 4px; margin-left: 4px;
  accent-color: var(--amber); cursor: pointer;
}

/* ---------------- MAP ---------------- */
#map-wrap { position: relative; flex: 1; min-height: 0; }
#map { width: 100%; height: 100%; display: block; background: radial-gradient(ellipse at 50% 40%, #11202f 0%, var(--ocean) 75%); }

#tooltip {
  position: fixed; z-index: 30; pointer-events: none;
  background: rgba(10, 18, 28, 0.95); border: 1px solid var(--line);
  padding: 8px 10px; border-radius: 6px; font-size: 12.5px; line-height: 1.45;
  max-width: 280px; min-width: 0;
}
.tip-head { font-weight: 700; color: var(--amber); margin-bottom: 5px; }
.tip-row { display: flex; justify-content: space-between; gap: 14px; padding: 1px 0; }
.tip-row span:last-child { color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tip-sub {
  margin-top: 5px; padding-top: 4px; border-top: 1px solid var(--line);
  font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--dim);
}
.tip-hint { margin-top: 5px; font-style: italic; color: var(--dim); font-size: 11.5px; }
.bar-group { cursor: help; }
#hud-deliv-wrap { cursor: help; }

#choose-prompt {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border: 1px solid var(--amber);
  padding: 8px 16px; border-radius: 10px; z-index: 6;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
  animation: pulse-border 1.6s infinite;
}
#choose-prompt img { width: 36px; height: 36px; object-fit: contain; }
@keyframes pulse-border { 50% { box-shadow: 0 0 14px rgba(255,216,77,.45); } }

/* ---------------- region panel ---------------- */
#side-panel {
  position: absolute; top: 12px; right: 12px; width: 300px; max-height: calc(100% - 24px);
  overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; z-index: 7;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
#panel-close {
  position: absolute; top: 8px; right: 8px;
  background: none; border: 0; color: var(--dim); font-size: 14px;
}
#panel-name { font-size: 18px; color: var(--amber); margin-bottom: 2px; padding-right: 20px; }
#panel-sector { font-size: 12px; color: var(--blue); margin-bottom: 8px; }
#panel-intro { font-size: 12.5px; color: var(--dim); font-style: italic; margin-bottom: 10px; line-height: 1.45; }
#panel-stats { border-top: 1px solid var(--line); padding-top: 8px; margin-bottom: 10px; }
.stat-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.stat-row span:last-child { color: var(--amber); font-variant-numeric: tabular-nums; }
.waterfalled-tag { text-align: center; color: var(--green); font-weight: 800; letter-spacing: 1px; padding: 6px 0; }

/* ---------------- advisor ---------------- */
#advisor {
  position: absolute; left: 12px; bottom: 12px; width: 360px; max-width: calc(100% - 24px);
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 10px; padding: 10px 12px; z-index: 8;
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .35s, transform .35s;
  cursor: pointer;
}
#advisor.show { opacity: 1; transform: none; pointer-events: auto; }
#advisor img { width: 52px; height: 52px; object-fit: contain; flex-shrink: 0; }
.advisor-name { font-size: 10.5px; letter-spacing: 1px; color: var(--green); margin-bottom: 3px; }
#advisor-text { font-size: 13px; line-height: 1.45; font-style: italic; }

/* ---------------- Snooty ---------------- */
#snoot {
  position: absolute; top: 18%; left: 50%; transform: translate(-50%, 14px) scale(0.9);
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 2px solid var(--green);
  border-radius: 14px; padding: 12px 18px; z-index: 9;
  max-width: 420px;
  box-shadow: 0 8px 30px rgba(0,0,0,.55), 0 0 22px rgba(111,191,115,.35);
  opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
}
#snoot.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
#snoot-elephant { font-size: 38px; flex-shrink: 0; }
#snoot-text { font-size: 14px; line-height: 1.5; font-weight: 600; color: var(--green); }

/* ---------------- news ticker ---------------- */
#news-ticker {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 6px 12px; font-size: 12.5px; z-index: 5;
}
.ticker-tag { color: var(--red); font-weight: 800; font-size: 10.5px; letter-spacing: 1px; white-space: nowrap; }
.ticker-clip { overflow: hidden; white-space: nowrap; flex: 1; }
#ticker-text { display: inline-block; color: var(--dim); animation: ticker-fade .5s; }
@keyframes ticker-fade { from { opacity: 0; } }

/* ---------------- modals ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(5, 10, 16, 0.75);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.modal-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.6);
  text-align: center;
}
.modal-box.wide { max-width: 860px; text-align: left; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h2 { font-size: 17px; color: var(--amber); }
#upgrade-close { background: none; border: 0; color: var(--dim); font-size: 16px; }

.event-portrait { width: 96px; height: 96px; object-fit: contain; margin-bottom: 6px; mix-blend-mode: screen; }
#event-title { color: var(--amber); font-size: 19px; margin-bottom: 10px; }
#event-body, #event-outcome { font-size: 14px; line-height: 1.55; margin-bottom: 14px; }
#event-outcome { color: var(--green); font-style: italic; }
#event-choices { display: flex; flex-direction: column; gap: 8px; }
.choice-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 14px; border-radius: 8px; font-size: 14px;
}
.choice-btn:hover { border-color: var(--amber); color: var(--amber); }
#event-continue {
  background: var(--amber); color: #1d1700; border: 0;
  padding: 8px 22px; border-radius: 8px; font-weight: 700;
}

/* ---------------- upgrades ---------------- */
#upgrade-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
#upgrade-tabs button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--dim);
  padding: 6px 16px; border-radius: 20px; font-size: 13px;
}
#upgrade-tabs button.active { background: var(--amber); color: #1d1700; font-weight: 700; border-color: var(--amber); }

#upgrade-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 10px; }
.upg-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; display: flex; flex-direction: column; gap: 6px;
}
.upg-card.owned { border-color: var(--green); opacity: .8; }
.upg-card.buyable { border-color: var(--amber); }
.upg-card.locked { opacity: .55; }
.upg-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.upg-name { font-weight: 700; font-size: 13.5px; }
.upg-cost { color: var(--amber); font-size: 12.5px; white-space: nowrap; }
.upg-card.owned .upg-cost { color: var(--green); }
.upg-desc { font-size: 12.5px; line-height: 1.4; }
.upg-flavour { font-size: 11.5px; color: var(--dim); font-style: italic; line-height: 1.4; }
.upg-req { font-size: 11px; color: var(--red); }
.use-btn {
  margin-top: auto;
  background: var(--amber); color: #1d1700; border: 0;
  padding: 6px 12px; border-radius: 6px; font-weight: 700; font-size: 12.5px;
}
.use-btn:disabled { background: var(--panel); color: var(--dim); border: 1px solid var(--line); cursor: not-allowed; }

/* ---------------- title & end screens ---------------- */
#title-screen, #end-screen {
  position: fixed; inset: 0; z-index: 50;
  background: radial-gradient(ellipse at 50% 30%, #14283d 0%, var(--ocean) 80%);
  display: flex; align-items: center; justify-content: center;
  overflow-y: auto; padding: 20px;
}
#title-inner, #end-inner { max-width: 660px; text-align: center; padding: 20px 0; }
#title-art { display: flex; justify-content: center; align-items: flex-end; gap: 26px; margin-bottom: 14px; }
#title-art img, #title-art video { width: 110px; height: 110px; object-fit: contain; filter: drop-shadow(0 6px 16px rgba(0,0,0,.6)); }
#title-art video { width: 140px; height: 140px; mix-blend-mode: screen; }
#title-screen h1, #end-screen h1 {
  font-size: 42px; letter-spacing: 3px; color: var(--amber);
  text-shadow: 0 4px 0 rgba(0,0,0,.4); margin-bottom: 4px;
}
#title-sub { color: var(--blue); letter-spacing: 2px; font-size: 13px; text-transform: uppercase; margin-bottom: 8px; }
#title-tagline { color: var(--dim); font-style: italic; margin-bottom: 18px; }
#intro-text { text-align: left; font-size: 14px; line-height: 1.6; color: var(--text); }
#intro-text p { margin-bottom: 10px; }
#start-btn, #restart-btn {
  margin-top: 16px;
  background: var(--amber); color: #1d1700; border: 0;
  font-size: 17px; font-weight: 800; letter-spacing: 1px;
  padding: 12px 36px; border-radius: 10px;
  box-shadow: 0 5px 0 #8a6d00;
}
#start-btn:active, #restart-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a6d00; }
#title-hint { margin-top: 16px; font-size: 12px; color: var(--dim); line-height: 1.6; }

#end-art { width: 130px; height: 130px; object-fit: contain; margin-bottom: 10px; }
#end-video { width: 180px; height: 180px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 6px 16px rgba(0,0,0,.6)); }
#end-body { font-size: 14.5px; line-height: 1.65; margin: 14px 0; text-align: left; }
#end-quote { color: var(--green); font-style: italic; font-size: 13.5px; line-height: 1.55; text-align: left; }

/* ---------------- responsive ---------------- */
@media (max-width: 760px) {
  #hud { gap: 8px; padding: 6px 8px; }
  #hud-logo { font-size: 13px; }
  .hud-bars { min-width: 100%; order: 3; }
  #side-panel { width: calc(100% - 24px); max-height: 55%; }
  #title-screen h1, #end-screen h1 { font-size: 30px; }
  #title-art img, #title-art video { width: 80px; height: 80px; }
  #title-art video { width: 100px; height: 100px; }
  #advisor { width: calc(100% - 24px); }
}
