/* =========================================================
   Breach Point — game-specific styles
   ========================================================= */

.game-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.5rem 0; flex-wrap: wrap;
}
.back { color: var(--muted); text-decoration: none; font-size: .9rem; }
.back:hover { color: var(--accent); }

/* ---------------- start ---------------- */

.start-inner { padding: clamp(1.5rem, 6vw, 4rem) 0 2rem; max-width: 62ch; }

.rules { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.75rem; }
.rule { color: var(--muted); font-size: .96rem; display: flex; gap: .7rem; align-items: baseline; }
.rule-n {
  flex: none;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-hi); border: 1px solid var(--line-hi);
  color: var(--accent); font-size: .75rem; font-weight: 800;
}

/* ---------------- HUD ---------------- */

.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.hud-cell {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: .55rem .8rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.hud-label { font-size: .62rem; text-transform: uppercase; letter-spacing: .16em; color: var(--dim); font-weight: 700; }
.hud-val   { font-size: clamp(1.1rem, 3vw, 1.5rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-cell.is-danger .hud-val { color: var(--danger); }
.hud-cell.is-good   .hud-val { color: var(--ok); }

/* ---------------- board ---------------- */

.board-wrap { overflow-x: auto; padding-bottom: .5rem; }

.board {
  min-width: 720px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(90deg, rgba(52,211,153,.07), rgba(244,63,94,.10));
  backdrop-filter: blur(3px);
  padding: .75rem;
}

.stage-head { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin-bottom: .5rem; }
.stage-cell { text-align: center; padding: .3rem .2rem; }
.stage-name { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.stage-note { font-size: .66rem; color: var(--dim); margin-top: .12rem; }
/* Green (early, cheap to stop) shading to red (late, expensive). */
.stage-cell:nth-child(1) .stage-name { color: #34d399; }
.stage-cell:nth-child(2) .stage-name { color: #a3e635; }
.stage-cell:nth-child(3) .stage-name { color: #f59e0b; }
.stage-cell:nth-child(4) .stage-name { color: #fb7185; }
.stage-cell:nth-child(5) .stage-name { color: #f43f5e; }

.lanes { display: flex; flex-direction: column; gap: .4rem; }

.lane {
  position: relative;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem;
  height: 92px;
}

.slot {
  border: 1px dashed var(--line);
  border-radius: var(--r);
  background: rgba(255,255,255,.015);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s ease, background .15s ease;
  cursor: default;
}
.slot.is-valid {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(53,210,245,.1);
  cursor: pointer;
  animation: slot-pulse 1.4s ease-in-out infinite;
}
.slot.is-valid:hover { background: rgba(53,210,245,.22); }

@keyframes slot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(53,210,245,.28); }
  50%      { box-shadow: 0 0 0 5px rgba(53,210,245,0); }
}

.node {
  width: 100%; height: 100%;
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 1px solid var(--line-hi);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; cursor: pointer;
  animation: pop-in .22s ease both;
}
.node:hover { border-color: var(--danger); }
.node-icon { font-size: 1.3rem; line-height: 1; }
.node-name { font-size: .6rem; font-weight: 800; letter-spacing: .1em; color: var(--muted); }

@keyframes pop-in { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* firing flash */
.node.is-firing { border-color: var(--ok); box-shadow: 0 0 0 3px rgba(47,227,166,.35); }

/* ---------------- threats ---------------- */

.threat {
  position: absolute; top: 50%;
  transform: translate(0, -50%);
  display: flex; align-items: center; gap: .35rem;
  padding: .28rem .55rem .28rem .35rem;
  border-radius: 999px;
  background: rgba(8,13,23,.92);
  border: 1px solid currentColor;
  font-size: .68rem; font-weight: 700; white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  will-change: transform;
}
.threat-icon { font-size: .95rem; }
.threat.is-blocked { animation: blocked .4s ease both; }
.threat.is-through { animation: breached .5s ease both; }

@keyframes blocked {
  to { transform: translate(0, -50%) scale(1.6); opacity: 0; filter: blur(3px); }
}
@keyframes breached {
  0%   { transform: translate(0,-50%) scale(1); }
  40%  { transform: translate(0,-50%) scale(1.3); }
  to   { transform: translate(30px,-50%) scale(.8); opacity: 0; }
}

.board.is-hit { animation: shake .35s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}

/* floating score popups */
.pop {
  position: absolute; top: 50%;
  font-size: .8rem; font-weight: 800; color: var(--ok);
  pointer-events: none; z-index: 4;
  animation: pop-up .9s ease both;
}
.pop.bad { color: var(--danger); }
@keyframes pop-up {
  from { transform: translate(0,-50%); opacity: 1; }
  to   { transform: translate(0,-190%); opacity: 0; }
}

/* ---------------- wave banner ---------------- */

.wave-banner {
  margin: 1rem 0 0;
  padding: .8rem 1.1rem;
  border-left: 3px solid var(--accent);
  background: var(--panel);
  border-radius: 0 var(--r) var(--r) 0;
  animation: fade-up .3s ease both;
}
.wave-banner strong { display: block; font-size: 1.02rem; margin-bottom: .2rem; }
.wave-banner span { color: var(--muted); font-size: .9rem; }

/* ---------------- palette ---------------- */

.palette {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  margin-top: 1.25rem;
}

.def {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
  padding: .65rem .75rem;
  cursor: pointer;
  color: var(--text);
  font: inherit;
  transition: border-color .15s ease, transform .12s ease, background .15s ease;
}
.def:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.def.is-selected { border-color: var(--accent); background: rgba(53,210,245,.14); }
.def:disabled { opacity: .35; cursor: not-allowed; }

.def-top { display: flex; align-items: center; gap: .45rem; }
.def-icon { font-size: 1.1rem; }
.def-name { font-weight: 800; font-size: .88rem; }
.def-cost {
  margin-left: auto; font-size: .78rem; font-weight: 800;
  color: var(--warn); font-variant-numeric: tabular-nums;
}
.def-desc { font-size: .72rem; color: var(--dim); margin-top: .3rem; line-height: 1.4; }

.palette-hint { margin-top: .7rem; }

/* ---------------- end screen ---------------- */

.result-head { text-align: center; padding: 2rem 0 2.25rem; }
.result-head .title { font-size: clamp(3rem, 11vw, 5.5rem); font-variant-numeric: tabular-nums; }

.result-grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: 1.35fr 1fr;
  align-items: start; margin-bottom: 1.5rem;
}
@media (max-width: 820px) { .result-grid { grid-template-columns: 1fr; } }

.stage-chart { margin-top: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.chart-row { display: grid; grid-template-columns: 8.5rem 1fr 2.5rem; align-items: center; gap: .6rem; font-size: .84rem; }
.chart-label { color: var(--muted); }
.chart-bar { height: 12px; background: var(--panel-hi); border-radius: 99px; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.chart-num { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-row.is-breach .chart-label { color: var(--danger); }

.lesson-list { margin-top: 1.1rem; display: flex; flex-direction: column; gap: .8rem; }
.lesson { border-left: 3px solid var(--line-hi); padding-left: .8rem; }
.lesson-name { font-weight: 700; font-size: .92rem; }
.lesson-text { color: var(--muted); font-size: .87rem; line-height: 1.5; margin-top: .2rem; }

.mapping { margin-top: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.map-row { display: flex; gap: .6rem; font-size: .9rem; flex-wrap: wrap; }
.map-cap { color: var(--muted); min-width: 12rem; }
.map-prod { font-weight: 700; }

/* ---------------- responsive ---------------- */

@media (max-width: 560px) {
  .hud { grid-template-columns: repeat(2, 1fr); }
  .palette { grid-template-columns: repeat(2, 1fr); }
  .def-desc { display: none; }
}
