*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0c08;
  color: #b8c878;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
}

.ds-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(40, 50, 20, 0.2) 0%, transparent 50%),
    linear-gradient(180deg, #0c0e0a 0%, #060804 100%);
}

.ds-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(140, 160, 80, 0.2);
  background: rgba(0, 0, 0, 0.5);
}

.ds-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ds-brand h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.28em;
  color: #d4e888;
}

.ds-rec {
  font-size: 0.7rem;
  color: #ff4040;
  animation: ds-blink 1.2s step-end infinite;
}

@keyframes ds-blink {
  50% { opacity: 0.3; }
}

.ds-credit {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(180, 200, 120, 0.45);
}

.ds-exit {
  font-size: 0.75rem;
  color: rgba(180, 200, 120, 0.55);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(140, 160, 80, 0.25);
  border-radius: 3px;
}

.ds-exit:hover { color: #d4e888; border-color: rgba(180, 200, 120, 0.5); }

.ds-desk {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr min(280px, 32vw);
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.ds-monitor-wrap {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #020302;
  border: 3px solid #1a2010;
  border-radius: 6px;
  box-shadow:
    inset 0 0 40px rgba(0, 0, 0, 0.8),
    0 0 24px rgba(80, 100, 40, 0.15);
  overflow: hidden;
}

.ds-main-label {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: #d4e888;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
  pointer-events: none;
}

.ds-grid {
  list-style: none;
  margin: 0;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 5px;
  padding: 34px 8px 8px;
}

.ds-grid-cell {
  position: relative;
  margin: 0;
  padding: 0;
  border: 2px solid #2a3018;
  border-radius: 3px;
  background: #020302;
  overflow: hidden;
  min-height: 0;
}

.ds-grid-cell canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 80px;
  image-rendering: pixelated;
}

.ds-grid-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 6px;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: #d4e888;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82));
  pointer-events: none;
}

.ds-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  z-index: 2;
}

.ds-alert {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 4vw, 2rem);
  letter-spacing: 0.2em;
  color: #ff5050;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
  background: rgba(40, 0, 0, 0.35);
  animation: ds-flash 0.4s ease 2;
}

@keyframes ds-flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ds-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  justify-content: center;
}

.ds-stats {
  padding: 10px;
  border: 1px solid rgba(140, 160, 80, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.ds-stat { margin-bottom: 10px; }
.ds-stat-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(180, 200, 120, 0.6);
  margin-bottom: 4px;
}

.ds-bar {
  height: 8px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 2px;
  overflow: hidden;
}

.ds-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.ds-bar-breach { background: linear-gradient(90deg, #802020, #ff4040); width: 0%; }
.ds-bar-focus { background: linear-gradient(90deg, #606820, #a8c848); width: 100%; }

.ds-stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: rgba(180, 200, 120, 0.75);
}

.ds-stat-row strong { color: #d4e888; }

.ds-log-btn {
  width: 100%;
  padding: 14px;
  font-family: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: #0a0c08;
  background: linear-gradient(180deg, #c8e868 0%, #809030 100%);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}

.ds-log-btn:hover { filter: brightness(1.08); }
.ds-log-btn:active { transform: scale(0.98); }

.ds-log-btn kbd {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 0.65rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.ds-hint {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.5;
  color: rgba(140, 160, 80, 0.5);
  letter-spacing: 0.04em;
}

.ds-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 6, 2, 0.94);
}

.ds-screen[hidden] { display: none !important; }

.ds-title-box {
  max-width: 440px;
  text-align: center;
}

.ds-title-badge {
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: #ff6060;
  margin: 0 0 12px;
}

.ds-title-box h2 {
  margin: 0 0 16px;
  font-size: clamp(2rem, 8vw, 3rem);
  letter-spacing: 0.2em;
  color: #d4e888;
  text-shadow: 0 0 30px rgba(140, 180, 60, 0.3);
}

.ds-title-desc {
  margin: 0 0 16px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: rgba(180, 200, 120, 0.8);
}

.ds-title-rules {
  text-align: left;
  margin: 0 0 24px;
  padding-left: 20px;
  font-size: 0.78rem;
  line-height: 1.8;
  color: rgba(160, 180, 100, 0.7);
}

.ds-title-rules kbd {
  padding: 1px 5px;
  background: rgba(80, 100, 40, 0.35);
  border-radius: 3px;
}

.ds-title-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.2em;
  color: #0a0c08;
  background: #a8c848;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

.ds-btn--ghost {
  color: #b8c878;
  background: transparent;
  border: 1px solid rgba(140, 160, 80, 0.35);
}

.ds-btn--ghost:hover {
  border-color: rgba(180, 200, 120, 0.55);
  filter: none;
}

.ds-btn:hover { filter: brightness(1.1); }
.ds-btn--ghost:hover { filter: none; color: #d4e888; }

.ds-screen--end {
  flex-direction: column;
  text-align: center;
  gap: 16px;
}

.ds-screen--end h2 {
  margin: 0;
  font-size: clamp(1.4rem, 5vw, 2rem);
  letter-spacing: 0.15em;
  color: #d4e888;
}

.ds-screen--end p {
  margin: 0;
  max-width: 400px;
  line-height: 1.6;
  color: rgba(180, 200, 120, 0.75);
}

@media (max-width: 720px) {
  .ds-desk {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .ds-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
}
