/* Bit Defender. Page chrome follows the light/dark theme.
   The circuit stays #050805 in both themes. */

.bd-shell {
  --bd-ink: #d8ffe4;
  --bd-lime: #39ff14;
  --bd-dim: #6a9a6a;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  color: var(--bd-ink);
  background: #050805;
  border: 1px solid rgba(57, 255, 20, 0.4);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(57, 255, 20, 0.12);
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.bd-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  justify-content: space-between;
  padding: 0.45rem 0.7rem 0.35rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: #7cff6b;
  background: #050805;
}

.bd-hud strong {
  color: #39ff14;
  font-weight: 700;
}

.bd-corebar {
  flex: 1 1 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(57, 255, 20, 0.15);
  overflow: hidden;
}

.bd-corebar > span {
  display: block;
  height: 100%;
  width: 100%;
  background: #39ff14;
  box-shadow: 0 0 8px rgba(57, 255, 20, 0.7);
}

.bd-layout {
  display: flex;
  flex-direction: column;
  background: #050805;
}

.bd-stage {
  position: relative;
  background: #050805;
  padding: 0.35rem 0.45rem 0.55rem;
}

.bd-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  aspect-ratio: 7 / 9;
  width: 100%;
  background:
    linear-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 255, 20, 0.05) 1px, transparent 1px),
    #050805;
  background-size: calc(100% / 7) 100%, 100% calc(100% / 9), auto;
  border: 1px solid rgba(57, 255, 20, 0.28);
  border-radius: 8px;
  overflow: hidden;
}

.bd-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9a9aa0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(0.48rem, 2.1vw, 0.68rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.bd-cell--build {
  background: radial-gradient(circle at center, rgba(57, 255, 20, 0.16) 0 1px, transparent 1.6px);
}

.bd-cell--h::after,
.bd-cell--v::after,
.bd-cell--core::after {
  content: "";
  position: absolute;
  background: #39ff14;
  box-shadow: 0 0 8px #39ff14;
  pointer-events: none;
}

.bd-cell--h::after {
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  margin-top: -1.5px;
}

.bd-cell--v::after {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
}

.bd-cell--core {
  color: #041004;
  font-size: clamp(0.42rem, 1.7vw, 0.58rem);
  z-index: 1;
}

.bd-cell--core::after {
  width: 62%;
  height: 62%;
  left: 19%;
  top: 19%;
  border-radius: 50%;
  background: #7cff6b;
  box-shadow: 0 0 12px #39ff14;
}

.bd-cell.is-range {
  background-color: rgba(57, 255, 20, 0.08);
}

.bd-cell.is-selected {
  box-shadow: inset 0 0 0 2px #e8ffe4;
  z-index: 2;
}

.bd-cell.is-firing {
  background-color: rgba(57, 255, 20, 0.28);
}

.bd-cell[data-bd-tower="firewall"] { color: #7cf7ff; }
.bd-cell[data-bd-tower="antivirus"] { color: #39ff14; }
.bd-cell[data-bd-tower="filter"] { color: #8ab4ff; }
.bd-cell[data-bd-tower="cannon"] { color: #ffd15c; }

.bd-bugs {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.bd-bug {
  position: absolute;
  width: 1.15rem;
  height: 1.15rem;
  margin: -0.58rem 0 0 -0.58rem;
  border: 2px solid #041004;
  border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
}

.bd-bug--worm { color: #39ff14; background: #39ff14; border-radius: 40% 60% 50% 50%; }
.bd-bug--trojan { color: #ffb020; background: #ffb020; }
.bd-bug--ransomware { color: #ff4d4d; background: #ff4d4d; border-radius: 3px; width: 0.95rem; height: 0.95rem; }
.bd-bug--botnet { color: #d56bff; background: #d56bff; width: 0.55rem; height: 0.55rem; margin: -0.28rem 0 0 -0.28rem; }
.bd-bug--boss { color: #ff4dff; background: #2a0828; border: 2px solid #ff4dff; width: 1.25rem; height: 1.25rem; margin: -0.62rem 0 0 -0.62rem; }
.bd-bug.is-hit { filter: brightness(1.8); }

.bd-bug__bar {
  position: absolute;
  left: 50%;
  top: -5px;
  width: 0.9rem;
  height: 2px;
  margin-left: -0.45rem;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  overflow: hidden;
}

.bd-bug__bar > span {
  display: block;
  height: 100%;
  background: #e8ffe4;
}

.bd-overlay {
  position: absolute;
  inset: 0.35rem 0.45rem 0.55rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1rem 0.8rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.78);
  color: #d8ffe4;
  border-radius: 8px;
}

.bd-overlay[hidden] {
  display: none !important;
}

.bd-overlay h2 {
  margin: 0;
  color: #39ff14;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  letter-spacing: 0.04em;
  text-shadow: 0 0 12px rgba(57, 255, 20, 0.45);
}

.bd-overlay p {
  margin: 0;
  max-width: 26rem;
  color: #c8f5c4;
  font-size: 0.9rem;
  line-height: 1.35;
}

.bd-overlay .muted {
  color: #6a9a6a;
  font-size: 0.78rem;
}

.bd-overlay .score-line {
  color: #7cff6b;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.95rem;
}

.bd-side {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.15rem 0.55rem 0.7rem;
  background: #050805;
}

.bd-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.bd-tool,
.bd-actions button,
.bd-inspector button,
.bd-overlay .game-btn {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(57, 255, 20, 0.45);
  background: #0d1f0e;
  color: #d8ffe4;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
}

.bd-tool {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  gap: 0.1rem;
}

.bd-tool small,
.bd-tool [data-bd-price] {
  color: #7cff6b;
  font-size: 0.68rem;
  font-weight: 600;
}

.bd-tool.is-selected {
  border-color: #39ff14;
  box-shadow: inset 0 0 0 1px #39ff14, 0 0 12px rgba(57, 255, 20, 0.25);
  color: #39ff14;
}

.bd-tool:disabled,
.bd-actions button:disabled,
.bd-inspector button:disabled {
  opacity: 0.45;
  cursor: default;
}

.bd-inspector {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid rgba(57, 255, 20, 0.35);
  border-radius: 10px;
  background: #071207;
}

.bd-inspector[hidden] {
  display: none !important;
}

.bd-inspector p {
  margin: 0;
  color: #c8f5c4;
  font-size: 0.8rem;
}

.bd-inspector strong {
  color: #39ff14;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.bd-inspect-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.bd-actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 0.4rem;
}

#bd-start,
.bd-overlay .game-btn {
  background: #39ff14;
  color: #041004;
  border-color: #39ff14;
}

#bd-start:disabled {
  background: #143016;
  color: #6a9a6a;
  border-color: rgba(57, 255, 20, 0.3);
}

.bd-next {
  margin: 0;
  min-height: 1.2em;
  color: #7cff6b;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
}

.bd-status {
  margin: 0.45rem 0 0;
  min-height: 1.2em;
  text-align: center;
  color: #7cff6b;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.78rem;
}

html[data-theme="light"] .bd-status {
  color: #0f5c12;
}

.bd-howto {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  color: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
}

.bd-howto li + li {
  margin-top: 0.35rem;
}

@media (min-width: 860px) {
  .bd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    align-items: start;
  }

  .bd-side {
    padding: 0.35rem 0.7rem 0.8rem 0.15rem;
  }

  .bd-tools,
  .bd-actions,
  .bd-inspect-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bd-cell--core::after {
    box-shadow: none;
  }
}
