:root {
  color-scheme: dark;
  --bg: radial-gradient(circle at 20% 20%, #432104 0%, #150903 55%);
  --bg-panel: rgba(44, 18, 0, 0.75);
  --bg-card: rgba(68, 28, 0, 0.85);
  --accent: #ff7a18;
  --accent-soft: rgba(255, 153, 0, 0.2);
  --accent-strong: #ff9d2f;
  --text: #ffeedd;
  --text-muted: rgba(255, 238, 221, 0.6);
  --danger: #ff3f3f;
  --shadow: rgba(0, 0, 0, 0.45);
  --glow: rgba(255, 122, 24, 0.45);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

.crt-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0.12) 1px, rgba(0, 0, 0, 0) 3px),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%);
  opacity: 0.25;
  mix-blend-mode: screen;
  z-index: 1;
}

.masthead {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 1.5rem clamp(1.5rem, 2vw, 3rem);
  gap: 1.5rem;
  background: linear-gradient(120deg, rgba(56, 22, 0, 0.95), rgba(30, 12, 0, 0.9));
  border-bottom: 1px solid rgba(255, 122, 24, 0.4);
  box-shadow: 0 16px 32px var(--shadow);
}

.masthead__lamp {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffcb6b 0%, #ff7a18 60%, #7a2f00 100%);
  box-shadow: 0 0 18px rgba(255, 180, 80, 0.8);
}

.masthead__title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.masthead__unit {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.masthead__subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.4em;
  text-transform: uppercase;
}

.masthead__status {
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.masthead__status[data-variant="success"] {
  color: #9dff9d;
}

.masthead__status[data-variant="error"] {
  color: var(--danger);
}

.console {
  position: relative;
  z-index: 2;
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(2rem, 4vw, 4.5rem) clamp(1.5rem, 3vw, 5rem);
  width: 100%;
}

.console__gate,
.console__panel {
  width: min(640px, calc(100vw - 3rem));
  max-width: calc(100vw - 3rem);
  margin-inline: auto;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 153, 0, 0.35);
  border-radius: 28px;
  padding: clamp(2rem, 4vw, 3.5rem);
  box-shadow: 0 24px 48px var(--shadow), inset 0 0 0 1px rgba(255, 122, 24, 0.25);
  backdrop-filter: blur(16px);
}

.gate__title {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: clamp(1rem, 1.5vw, 1.3rem);
  color: var(--text-muted);
  text-align: center;
}

.gate__hint {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--accent-strong);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.pin-form {
  margin: 2.5rem auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  width: min(360px, 100%);
}

.pin-form input {
  height: 3.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 122, 24, 0.4);
  background: rgba(0, 0, 0, 0.35);
  padding: 0 1.5rem;
  font-size: 1.8rem;
  text-align: center;
  color: var(--text);
  letter-spacing: 0.4em;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.pin-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.2);
}

.pin-form input::placeholder {
  color: rgba(255, 238, 221, 0.35);
}

.pin-form__submit {
  height: 3.75rem;
  width: 3.75rem;
  border-radius: 24px;
  border: none;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #1b0700;
  cursor: pointer;
  box-shadow: 0 18px 28px rgba(255, 122, 24, 0.35);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.pin-form__submit:focus-visible,
.pin-form__submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 32px rgba(255, 122, 24, 0.45);
}

.pin-error {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--danger);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.panel__header h2 {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: clamp(0.95rem, 1.4vw, 1.2rem);
  color: var(--accent-strong);
}

.panel__status {
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 122, 24, 0.18);
  border-radius: 999px;
  padding: 0.35rem 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.panel__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
}

.panel__card {
  position: relative;
  border: none;
  border-radius: 24px;
  padding: 2rem 1.5rem;
  background: var(--bg-card);
  color: var(--text);
  display: grid;
  gap: 1.2rem;
  justify-items: center;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, border 180ms ease;
  border: 1px solid rgba(255, 122, 24, 0.2);
  box-shadow: 0 16px 28px rgba(0, 0, 0, 0.35);
}

.panel__card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 0%, rgba(255, 122, 24, 0.15), transparent 65%);
  opacity: 0;
  transition: opacity 180ms ease;
}

.panel__card:focus-visible,
.panel__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 36px rgba(255, 122, 24, 0.25);
  border-color: rgba(255, 153, 0, 0.55);
}

.panel__card:focus-visible::after,
.panel__card:hover::after {
  opacity: 1;
}

.panel__card:active {
  transform: translateY(0);
}

.panel__card[aria-disabled="true"],
.panel__card:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  border-color: rgba(255, 122, 24, 0.1);
  color: rgba(255, 238, 221, 0.35);
  pointer-events: none;
}

.panel__card[aria-disabled="true"] .panel__icon,
.panel__card:disabled .panel__icon {
  filter: grayscale(90%);
  opacity: 0.6;
}

.panel__card[aria-disabled="true"]::after,
.panel__card:disabled::after {
  opacity: 0;
}

.panel__icon {
  font-size: 2.8rem;
  text-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}

.panel__label {
  color: var(--text-muted);
  line-height: 1.4;
}

.panel__card--active {
  border-color: rgba(255, 200, 0, 0.6);
  box-shadow: 0 24px 38px rgba(255, 153, 0, 0.35);
}

.panel__timeline {
  margin-top: 2.75rem;
  display: flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px dashed rgba(255, 122, 24, 0.25);
  font-family: "IBM Plex Mono", "Fira Code", monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.panel__log {
  animation: logReveal 320ms ease;
}

@keyframes logReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(32, 12, 0, 0.65);
  border-top: 1px solid rgba(255, 122, 24, 0.25);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer__led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.footer__led--primary {
  color: #ffb347;
}

.footer__led--secondary {
  color: #ff7a18;
}

.footer__tag {
  letter-spacing: 0.3em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .masthead {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
    gap: 0.75rem;
  }

  .masthead__status {
    letter-spacing: 0.2em;
  }

  .console__gate,
  .console__panel {
    border-radius: 22px;
    padding: 2rem 1.75rem;
    width: min(560px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
  }

  .panel__grid {
    grid-template-columns: 1fr;
  }
}
