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

html, body {
  height: 100%;
  background: #0a0f1c;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#stage {
  position: relative;
  width: 540px;
  height: 960px;
  /* Bright fallback so the frame never reads black before the canvas paints. */
  background: linear-gradient(180deg, #2a3d6b 0%, #1b2748 55%, #131c36 100%);
  border: 1px solid #34406e;
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), inset 0 0 60px rgba(0,0,0,0.25);
  overflow: hidden;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* ---------- HUD overlay ---------- */
#hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 96px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px 0;
  background: linear-gradient(180deg, rgba(4,8,20,0.72), rgba(4,8,20,0));
}

.team-summary { width: 192px; }
.t-mid { flex: 1; text-align: center; padding-top: 6px; }

.t-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.t-ember .t-head { flex-direction: row; }

.t-name {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 3px;
}
.t-alive {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  transition: transform 0.12s ease;
}
.t-alive.bump { transform: scale(1.4); }

.t-azure .t-name, .t-azure .t-alive { color: #59e1ff; text-shadow: 0 0 14px rgba(89,225,255,0.8); }
.t-ember .t-name, .t-ember .t-alive { color: #ff9a44; text-shadow: 0 0 14px rgba(255,154,68,0.8); }

.t-bar {
  margin-top: 6px;
  height: 7px;
  border-radius: 4px;
  background: rgba(255,255,255,0.14);
  overflow: hidden;
}
.t-fill { height: 100%; width: 100%; border-radius: 4px; transition: width 0.25s ease; }
.t-azure .t-fill { background: linear-gradient(90deg, #2fb6e6, #7fecff); box-shadow: 0 0 12px rgba(89,225,255,0.9); }
.t-ember .t-fill { background: linear-gradient(90deg, #e6661f, #ffc07a); box-shadow: 0 0 12px rgba(255,154,68,0.9); }

.t-roles {
  margin-top: 7px;
  display: flex;
  gap: 5px;
}
.t-ember .t-roles { justify-content: flex-end; }
.role-chip {
  width: 24px; height: 24px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 900;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  transition: opacity 0.3s ease, filter 0.3s ease;
}
.role-chip.dead { opacity: 0.22; filter: grayscale(1); }
.t-azure .role-chip { color: #a6ecff; }
.t-ember .role-chip { color: #ffce9e; }

.t-title {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 5px;
  opacity: 0.95;
}
.t-sub {
  font-size: 10px;
  letter-spacing: 3px;
  opacity: 0.6;
  margin-top: 3px;
}

/* ---------- Dome countdown ---------- */
#dome-readout {
  position: absolute;
  top: 100px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(10,16,36,0.55);
  border: 1px solid rgba(150,180,255,0.30);
}
.dome-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #c2cdff;
}
.dome-track {
  width: 150px; height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.16);
  overflow: hidden;
}
.dome-prog {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #b388ff, #ff74cf);
  box-shadow: 0 0 12px rgba(255,116,207,0.8);
  transition: width 0.2s linear;
}
.dome-time {
  font-family: "SF Mono", Menlo, monospace;
  font-size: 12px;
  font-weight: 800;
  color: #ffd9ef;
  min-width: 34px;
  text-align: right;
}
#dome-readout.urgent { animation: domePulse 0.7s ease-in-out infinite; }
@keyframes domePulse {
  0%,100% { box-shadow: 0 0 0 rgba(255,116,207,0); }
  50% { box-shadow: 0 0 22px rgba(255,116,207,0.6); border-color: rgba(255,140,220,0.8); }
}

/* ---------- Victory banner ---------- */
#victory-banner {
  position: absolute;
  top: 44%; left: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  text-align: center;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(.2,1.3,.4,1);
}
#victory-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#victory-banner.hidden { display: none; }
.vb-sub {
  font-size: 12px;
  letter-spacing: 6px;
  font-weight: 700;
  opacity: 0.85;
}
.vb-name {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 4px;
  line-height: 1;
  margin: 6px 0;
}
.vb-tag {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 14px;
  opacity: 0.95;
}
.vb-azure .vb-name, .vb-azure .vb-tag { color: #7fecff; text-shadow: 0 0 30px rgba(89,225,255,0.95); }
.vb-ember .vb-name, .vb-ember .vb-tag { color: #ffc07a; text-shadow: 0 0 30px rgba(255,154,68,0.95); }

/* ---------- Watermark / ticker ---------- */
#watermark {
  position: absolute;
  bottom: 30px; right: 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
.ticker {
  position: absolute;
  left: 0; right: 0;
  bottom: 8px;
  text-align: center;
  font-family: "SF Mono", "Menlo", "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.6;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#boot-error {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  font-size: 14px;
  line-height: 1.6;
  color: #ff8a8a;
  background: rgba(8,10,20,0.95);
}
.hidden { display: none; }

#stage.shaking { animation: quake 0.3s linear infinite; }
@keyframes quake {
  0%,100% { transform: translate(0,0); }
  25% { transform: translate(-3px, 2px); }
  50% { transform: translate(3px, -2px); }
  75% { transform: translate(-2px, -2px); }
}
