:root{
  --bg:#0b1016;
  --panel: rgba(18, 27, 37, .78);
  --panel2: rgba(15, 22, 32, .75);
  --border: rgba(255,255,255,.08);
  --border2: rgba(120,160,210,.18);
  --text:#e8f1ff;
  --muted:#9bb0c9;
  --good:#72ff9b;
  --bad:#ff6b6b;
  --warn:#ffdd57;
  --accent:#6bb6ff;

  --shadow: 0 14px 40px rgba(0,0,0,.42);
  --shadow2: 0 10px 22px rgba(0,0,0,.34);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

/* Canvas */
#game{
  width: 100%;
  height: 100%;
  display: block;
  background: radial-gradient(1200px 700px at 50% 40%, #0e1927 0%, #070b10 70%, #05070a 100%);
}

/* UI Layer */
.ui{
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

/* Cards */
.card{
  background: var(--panel);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
}

.card h1{
  margin: 0 0 8px 0;
  font-size: 12px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Layout top and bottom */
.topbar{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
}

.bottom{
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 14px;
}

/* Responsive: stack cards on small screens */
@media (max-width: 900px){
  .topbar, .bottom { flex-direction: column; align-items: stretch; }
  .card { min-width: 0 !important; }
}

/* Pills */
.row{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill{
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--panel2);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.pill b{ color: #fff; }

/* Status dot */
.dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}

/* Stat rows */
.statRow{
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.statLabel{
  width: 52px;
  font-size: 12px;
  color: var(--muted);
}

.statValue{
  width: 50px;
  text-align: right;
  font-size: 12px;
  color: #fff;
}

.bar{
  width: 180px;
  height: 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.bar > i{
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4ee3ff, #6bb6ff);
  transition: width 120ms linear;
}

.bar.red > i{
  background: linear-gradient(90deg, #ff6b6b, #ff9b9b);
}

.bar.blue > i{
  background: linear-gradient(90deg, rgba(191,230,255,.9), rgba(107,182,255,.9));
}

/* Objective + Intel text */
.objectiveText{
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.objectiveText b{ color: #fff; }

.intelText{
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.intelText b{ color: #fff; }
.intelStrong{
  display: inline-block;
  margin-left: 6px;
  color: rgba(255,255,255,.85);
}

/* Center hint */
.centerHint{
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: none;
  max-width: 560px;

  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.40);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);

  font-size: 14px;
  color: var(--text);
  text-align: center;
}
.centerHint b{ color: #fff; }

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  pointer-events: none;
  display: none;

  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow2);

  font-size: 12px;
  color: rgba(255,255,255,.92);
}

/* Overlay */
.overlay{
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;

  background: radial-gradient(1200px 800px at 50% 40%, rgba(20,30,45,.72), rgba(3,5,7,.92));
}

.modal{
  width: min(860px, 96vw);
  max-height: 92vh;
  overflow: auto;

  background: rgba(11,16,22,.82);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0,0,0,.58);
  backdrop-filter: blur(12px);
}

/* Modal sections */
.modalHeader{
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.titleBlock{ min-width: 0; }
.badge{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.90);
  font-size: 11px;
  letter-spacing: .6px;
}
.modalTitle{
  margin: 10px 0 4px;
  font-size: 22px;
  letter-spacing: .6px;
}
.subtitle{
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
}

.rightMeta{
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.metaChip{
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.05);
}
.metaLabel{
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.metaValue{
  font-size: 12px;
  color: rgba(255,255,255,.92);
  font-weight: 700;
}

.modalBody{
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px){
  .modalBody{ grid-template-columns: 1fr; }
  .rightMeta{ align-items: flex-start; }
  .modalHeader{ flex-direction: column; }
}

.panel{
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 12px 12px 10px;
}
.panelTitle{
  margin: 0 0 8px 0;
  font-size: 12px;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: rgba(255,255,255,.80);
}
.panelText{
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}
.panelText b{ color:#fff; }
.smallNote{ margin-top: 10px; font-size: 12px; }

/* Brief grid */
.briefGrid{
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 650px){
  .briefGrid{ grid-template-columns: 1fr; }
}
.briefItem{
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.20);
}
.briefKey{
  font-size: 12px;
  color: rgba(255,255,255,.9);
  margin-bottom: 4px;
  font-weight: 700;
}
.briefVal{
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* KBD blocks */
.kbd{
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  font-size: 12px;
}

.kbdGrid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
  margin-top: 6px;
}
@media (max-width: 650px){
  .kbdGrid{ grid-template-columns: 1fr; }
}
.kbdRow{
  font-size: 13px;
  color: var(--muted);
}
.kbdRow .kbd{
  margin-right: 8px;
}

/* Tips list */
.tips{
  margin: 10px 0 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.tips b{ color: rgba(255,255,255,.92); }

/* Settings row buttons */
.settingsRow{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* Footer */
.modalFooter{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}

.leftFooter{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.statusPill{
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  font-size: 12px;
}
.statusDot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(255,255,255,.04);
}

.muted{
  color: var(--muted);
  font-size: 12px;
}

/* Buttons */
.btnRow{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button{
  pointer-events: auto;
  cursor: pointer;
  border-radius: 14px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.95);
  font-weight: 800;
  letter-spacing: .2px;

  background: linear-gradient(180deg, rgba(107,182,255,.26), rgba(107,182,255,.10));
  box-shadow: 0 12px 26px rgba(0,0,0,.35);
  transition: transform .08s ease, filter .18s ease, background .18s ease;
}

button:hover{ filter: brightness(1.08); }
button:active{ transform: translateY(1px) scale(.99); }

button.secondary{
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.06));
  font-weight: 700;
}

button:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(107,182,255,.22), 0 12px 26px rgba(0,0,0,.35);
}
