/* NEAR FUTURE — dark neon arcade menus, muddy/smoky battlefield HUD */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: #050607; overflow: hidden; }
body { font-family: "Courier New", ui-monospace, monospace; color: #cfd4d8; user-select: none; -webkit-user-select: none; }

#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #050607; }
#game { background: #0a0c0e; touch-action: none; }
.hidden { display: none !important; }

/* ---------- rotate hint ---------- */
#rotate-hint {
  position: absolute; top: 0; left: 0; right: 0; z-index: 60;
  background: rgba(10, 12, 14, 0.92); color: #ffd24a; text-align: center;
  font-size: 12px; letter-spacing: 2px; padding: 6px; border-bottom: 1px solid #ffd24a55;
}

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 8, 0.72); padding: 12px; overflow-y: auto;
}
.panel {
  background: linear-gradient(180deg, #10151a 0%, #0a0e12 100%);
  border: 1px solid #2de2e6; box-shadow: 0 0 24px #2de2e633, inset 0 0 40px #000;
  padding: 22px 26px; max-width: 640px; width: 100%; text-align: center;
}
.panel.wide { max-width: 760px; }
.panel h2 { color: #2de2e6; letter-spacing: 4px; margin: 0 0 10px; text-shadow: 0 0 12px #2de2e6aa; font-size: 26px; }
.op-label { color: #8a939b; letter-spacing: 3px; font-size: 12px; margin-bottom: 8px; }

/* ---------- title ---------- */
#screen-title { background: #050607; }
#title-bg { position: absolute; inset: 0; background:
  radial-gradient(ellipse at 62% 30%, #e8a34f33 0%, transparent 55%),
  linear-gradient(180deg, #232b33 0%, #12161b 55%, #08090b 100%); }
#title-bg img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.title-inner { position: relative; z-index: 2; text-align: center; padding: 16px; max-width: 700px; }
.logo {
  font-size: clamp(44px, 9vw, 96px); margin: 0; letter-spacing: 10px; color: #f2f4f6;
  text-shadow: 0 0 18px #2de2e6, 0 0 60px #2de2e655, 3px 3px 0 #0a2a2c;
}
.tagline { color: #ff5a4a; letter-spacing: 4px; font-size: clamp(10px, 2vw, 15px); margin: 8px 0 26px; text-shadow: 0 0 10px #ff5a4a88; }
#faction-select { display: flex; gap: 14px; justify-content: center; margin-bottom: 18px; flex-wrap: wrap; }
.fac-btn {
  min-width: 200px; min-height: 88px; cursor: pointer; border: 2px solid;
  background: #0b0f13ee; color: #fff; font-family: inherit; padding: 12px 18px;
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.fac-btn.humans { border-color: #5aa9ff; box-shadow: 0 0 16px #5aa9ff44; }
.fac-btn.skydyne { border-color: #ff4a3d; box-shadow: 0 0 16px #ff4a3d44; }
.fac-btn:active { transform: scale(0.97); }
.fac-name { font-size: 22px; letter-spacing: 4px; }
.fac-sub { font-size: 11px; color: #9aa2a8; letter-spacing: 2px; }

/* ---------- buttons ---------- */
.menu-btn {
  font-family: inherit; font-size: 16px; letter-spacing: 2px; cursor: pointer;
  background: #0d1418; color: #2de2e6; border: 1px solid #2de2e6;
  padding: 12px 22px; min-height: 48px; margin: 6px;
  box-shadow: 0 0 10px #2de2e633;
}
.menu-btn:active { background: #2de2e6; color: #061014; }
.menu-btn.big { font-size: 19px; border-width: 2px; padding: 14px 34px; }
.menu-btn.small { font-size: 13px; padding: 10px 16px; min-height: 44px; }
.menu-btn:disabled { opacity: 0.35; cursor: default; }
.menu-row { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.menu-col { display: flex; flex-direction: column; align-items: stretch; }
.menu-col .menu-btn { width: 100%; margin: 6px 0; }

/* ---------- briefing ---------- */
.brief-head { display: flex; gap: 16px; align-items: center; text-align: left; margin-bottom: 12px; }
.portrait {
  width: 120px; height: 120px; min-width: 120px; border: 2px solid #2de2e6;
  background: linear-gradient(135deg, #1b2a33, #0a0e12); overflow: hidden;
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.fallback-humans { background:
  radial-gradient(circle at 50% 38%, #8a6f56 0 22%, transparent 23%),
  linear-gradient(180deg, transparent 55%, #4a4a38 56%, #2e2e28 100%),
  linear-gradient(135deg, #1b2a33, #0a0e12); }
.portrait.fallback-skydyne { background:
  radial-gradient(circle at 50% 42%, #ff443355 0 12%, transparent 13%),
  radial-gradient(circle at 50% 42%, #ff4433 0 5%, transparent 6%),
  linear-gradient(180deg, #14161a 0%, #23262c 60%, #0a0c0e 100%); }
.brief-titles h2 { color: #ffd24a; letter-spacing: 3px; margin: 4px 0; font-size: 24px; text-shadow: 0 0 10px #ffd24a66; }
.fac-tag { font-size: 12px; letter-spacing: 3px; }
.fac-tag.humans { color: #5aa9ff; } .fac-tag.skydyne { color: #ff5a4a; }
.brief-text { text-align: left; line-height: 1.65; font-size: 15px; color: #d7dce0; background: #00000055; padding: 14px; border-left: 3px solid #ffd24a; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.chip {
  font-family: inherit; min-width: 48px; min-height: 44px; cursor: pointer;
  background: #0d1418; color: #9aa2a8; border: 1px solid #3a444c; font-size: 14px;
}
.chip.active { color: #0a0e12; background: #ffd24a; border-color: #ffd24a; }
.chip:disabled { opacity: 0.3; }

/* ---------- result / stats ---------- */
#result-title.win { color: #7dff9a; text-shadow: 0 0 14px #7dff9a88; }
#result-title.lose { color: #ff5a4a; text-shadow: 0 0 14px #ff5a4a88; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px auto; max-width: 420px; text-align: left; }
.stats div { background: #00000066; padding: 10px 12px; border: 1px solid #2a343c; font-size: 14px; }
.stats b { color: #ffd24a; }

/* ---------- upgrades ---------- */
#upg-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 46vh; overflow-y: auto; }
.upg-row { display: flex; align-items: center; gap: 10px; background: #00000055; border: 1px solid #2a343c; padding: 8px 10px; text-align: left; }
.upg-info { flex: 1; min-width: 0; }
.upg-info b { color: #e8ecf0; font-size: 14px; letter-spacing: 1px; }
.upg-info span { display: block; color: #8a939b; font-size: 12px; }
.pips { color: #ffd24a; letter-spacing: 2px; font-size: 13px; white-space: nowrap; }
.upg-buy { font-family: inherit; min-width: 96px; min-height: 44px; cursor: pointer; background: #0d1418; color: #7dff9a; border: 1px solid #7dff9a; font-size: 13px; }
.upg-buy:disabled { opacity: 0.3; color: #8a939b; border-color: #3a444c; }
.upg-buy:active { background: #7dff9a; color: #061014; }

/* ---------- overlays ---------- */
.overlay { position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(3,5,7,0.8); padding: 12px; overflow-y: auto; }
.howto { text-align: left; font-size: 14px; line-height: 1.6; max-height: 52vh; overflow-y: auto; }
.howto b { color: #ffd24a; }
.howto p { margin: 8px 0; }

/* ---------- HUD (muddy / smoky battlefield) ---------- */
#hud { position: absolute; inset: 0; z-index: 30; pointer-events: none; font-size: 13px; }
#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px;
  background: linear-gradient(180deg, rgba(12,10,8,0.88) 0%, rgba(12,10,8,0.55) 70%, transparent 100%);
  pointer-events: auto;
}
.side-panel { flex: 1; max-width: 300px; }
.side-panel.right { text-align: right; }
.bar-label { color: #b8a888; font-size: 10px; letter-spacing: 2px; margin: 2px 0; text-shadow: 1px 1px 0 #000; }
.bar { height: 12px; background: #14100bcc; border: 1px solid #4a4038; position: relative; }
.fill { height: 100%; width: 100%; transition: width 0.25s; }
.fill.morale { background: linear-gradient(90deg, #7dff9a, #3fae5a); }
.fill.morale.e { background: linear-gradient(90deg, #ff7a6a, #c23a2a); float: right; }
.fill.hq { background: linear-gradient(90deg, #6aa9ff, #2a5fc2); }
.fill.hq.e { background: linear-gradient(90deg, #c26a5a, #7a2a1a); float: right; }
.fill.cp { background: linear-gradient(90deg, #ffd24a, #b8862a); }
#hud-mid { text-align: center; min-width: 150px; }
#timer { font-size: 20px; color: #e8ecf0; letter-spacing: 3px; text-shadow: 1px 1px 0 #000; }
#cp-wrap .bar.cpb { height: 10px; }
#hud-btns { display: flex; gap: 6px; margin-left: auto; }
.hbtn {
  font-family: inherit; min-width: 48px; min-height: 44px; cursor: pointer;
  background: #14100bee; color: #ffd24a; border: 1px solid #6a5f4a; font-size: 15px;
}
.hbtn:active { background: #ffd24a; color: #14100b; }

#pending-hint {
  position: absolute; top: 86px; left: 50%; transform: translateX(-50%);
  background: rgba(10,12,8,0.9); border: 1px solid #7dff9a; color: #7dff9a;
  padding: 8px 16px; font-size: 13px; letter-spacing: 1px; pointer-events: none;
  white-space: nowrap; max-width: 94vw; overflow: hidden; text-overflow: ellipsis;
}

#hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(0deg, rgba(14,11,8,0.94) 0%, rgba(14,11,8,0.6) 75%, transparent 100%);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); pointer-events: auto;
  display: flex; flex-direction: column; gap: 6px;
}
#deploy-bar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
#support-bar { display: flex; gap: 6px; overflow-x: auto; }
.ucard {
  position: relative; font-family: inherit; cursor: pointer; flex: 0 0 auto;
  min-width: 92px; min-height: 64px; padding: 6px 8px; text-align: left;
  background: linear-gradient(180deg, #1c1a14, #100e0a); color: #e8dcc0;
  border: 1px solid #6a5f4a;
}
.ucard .nm { font-size: 12px; letter-spacing: 1px; display: block; }
.ucard .ct { font-size: 12px; color: #ffd24a; display: block; margin-top: 2px; }
.ucard .cdov {
  position: absolute; inset: 0; background: rgba(0,0,0,0.72); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.ucard.poor { opacity: 0.55; }
.ucard.armed { border-color: #7dff9a; box-shadow: 0 0 10px #7dff9a66; }
.pwbtn {
  position: relative; font-family: inherit; cursor: pointer; flex: 0 0 auto;
  min-width: 104px; min-height: 48px; padding: 6px 10px;
  background: linear-gradient(180deg, #241a10, #120d08); color: #ffb066;
  border: 1px solid #8a5a2a; font-size: 12px; letter-spacing: 1px;
}
.pwbtn.barr { color: #cfe08a; border-color: #6a7a3a; background: linear-gradient(180deg, #1c2013, #0e1008); }
.pwbtn .cdov {
  position: absolute; inset: 0; background: rgba(0,0,0,0.72); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.pwbtn.armed { border-color: #7dff9a; box-shadow: 0 0 10px #7dff9a66; }

/* ---------- toast ---------- */
#toast {
  position: absolute; bottom: 170px; left: 50%; transform: translateX(-50%); z-index: 55;
  background: rgba(8,10,12,0.94); border: 1px solid #ff5a4a; color: #ffb0a6;
  padding: 10px 20px; font-size: 14px; letter-spacing: 1px; pointer-events: none;
  max-width: 90vw; text-align: center;
}

/* small screens */
@media (max-width: 700px) {
  .panel { padding: 14px; }
  .panel h2 { font-size: 20px; }
  .portrait { width: 84px; height: 84px; min-width: 84px; }
  #hud-mid { min-width: 110px; }
  #timer { font-size: 16px; }
  .ucard { min-width: 80px; min-height: 60px; }
}
