/* Base typography */
/* @font-face {
    font-family: 'Futura Nova';
    src: url('../assets/fonts/futuranova.woff2') format('woff2');
} */

@font-face {
  font-family: "Workbench";
  src: url("../fonts/strikefighter.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --chapter-max-width: 800px;
  --chapter-font-size: 16px;
}

.skip-link {
  position: absolute;
  top: -1000px;
  left: -1000px;
  padding: 0.75rem 1rem;
  background: #4cd1a9;
  color: #03121a;
  font-weight: 600;
  border-radius: 4px;
  z-index: 300;
  text-decoration: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
  left: 1rem;
  transform: translateY(0);
  opacity: 1;
}

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

body {
  font-family: "Futura Nova", sans-serif;
  background-color: #0a0e17;
  color: #e0e0e0;
  line-height: 1.6;
}

.chapter-nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 2rem 0;
}

.chapter-select {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 0.35rem;
  color: inherit;
}

.chapter-select span {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.chapter-dropdown-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  /* margin-top: 0.75rem; */
}

.chapter-toggle {
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.chapter-toggle:hover,
.chapter-toggle:focus-visible {
  background: rgba(76, 209, 169, 0.12);
  border-color: rgba(76, 209, 169, 0.6);
  outline: none;
}

.chapter-audio-player {
  margin-top: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  display: none;
}

.chapter-audio-header {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.chapter-audio-controls {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

.chapter-audio-button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chapter-audio-button:hover,
.chapter-audio-button:focus-visible {
  background: rgba(76, 209, 169, 0.12);
  border-color: rgba(76, 209, 169, 0.6);
  outline: none;
}

.chapter-audio-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.chapter-audio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  pointer-events: none;
}

.chapter-audio-timeline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chapter-audio-scrubber {
  flex: 1;
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  accent-color: #4cd1a9;
}

.chapter-audio-scrubber::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4cd1a9;
  cursor: pointer;
}

.chapter-audio-scrubber::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4cd1a9;
  border: none;
  cursor: pointer;
}

.chapter-audio-scrubber:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chapter-audio-time {
  font-size: 0.75rem;
  min-width: 3.25rem;
  text-align: center;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.7);
}

.home-link {
  margin-top: 0.5rem;
  align-self: flex-start;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0rem;
  border-radius: 4px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.home-link:hover,
.home-link:focus-visible {
  background: rgba(76, 209, 169, 0.12);
  border-color: rgba(76, 209, 169, 0.6);
  outline: none;
}

.search-toggle {
  margin-top: 0.5rem;
  align-self: flex-start;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.search-toggle:hover,
.search-toggle:focus-visible {
  background: rgba(76, 209, 169, 0.12);
  border-color: rgba(76, 209, 169, 0.6);
  outline: none;
}

.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 15, 0.7);
  backdrop-filter: blur(4px);
  z-index: 800;
}

.search-backdrop[hidden],
.search-panel[hidden] {
  display: none;
}

.search-panel {
  position: fixed;
  inset: 0;
  padding: 3rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 900;
}

.search-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.search-panel__inner {
  width: min(680px, 100%);
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.search-panel__header h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
}

.search-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  padding: 0.4rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.search-close:hover,
.search-close:focus-visible {
  background: rgba(76, 209, 169, 0.18);
  border-color: rgba(76, 209, 169, 0.6);
  outline: none;
}

.search-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
}

.search-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(13, 18, 28, 0.85);
  color: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: rgba(76, 209, 169, 0.7);
  box-shadow: 0 0 0 2px rgba(76, 209, 169, 0.25);
  outline: none;
}

.search-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.search-status {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.search-sort-wrap[hidden] {
  display: none;
}

.search-sort-toggle {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: inherit;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.search-sort-toggle:hover,
.search-sort-toggle:focus-visible {
  background: rgba(76, 209, 169, 0.12);
  border-color: rgba(76, 209, 169, 0.6);
  outline: none;
}

.search-sort-toggle[aria-pressed="true"] {
  background: rgba(76, 209, 169, 0.15);
  border-color: rgba(76, 209, 169, 0.5);
}

.search-result__meta {
  display: block;
  font-size: 0.78rem;
  color: rgba(76, 209, 169, 0.8);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.search-results {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-result a {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.search-result a:hover,
.search-result a:focus-visible {
  border-color: rgba(76, 209, 169, 0.5);
  background: rgba(76, 209, 169, 0.12);
  outline: none;
}

.search-result__title {
  display: block;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.search-result__snippet {
  display: block;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
}

mark {
  background: rgba(76, 209, 169, 0.4);
  color: inherit;
  padding: 0 0.15rem;
  border-radius: 3px;
}

.chapter-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  list-style: none;
  margin: 0;
  min-width: 220px;
  padding: 0.75rem;
  border-radius: 6px;
  background: rgba(7, 11, 19, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  z-index: 200;
}

.chapter-dropdown[hidden] {
  display: none;
}

.chapter-dropdown li {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
}

.chapter-link {
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.chapter-link:hover {
  color: #4cd1a9;
}

.chapter-link[aria-current="page"] {
  color: #4cd1a9;
  cursor: default;
}

.chapter-voice-control {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chapter-voice-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chapter-voice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chapter-voice-mode {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.56);
}

.chapter-voice-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapter-voice-option {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

.chapter-voice-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.chapter-voice-switch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chapter-voice-slider {
  position: relative;
  width: 48px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.chapter-voice-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #0a0e17;
  box-shadow: 0 0 0 1px rgba(76, 209, 169, 0.25);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.chapter-voice-switch input:checked + .chapter-voice-slider {
  background: rgba(76, 209, 169, 0.35);
  border-color: rgba(76, 209, 169, 0.6);
}

.chapter-voice-switch input:checked + .chapter-voice-slider::after {
  transform: translateX(24px);
  background: #4cd1a9;
  box-shadow: 0 0 0 1px rgba(76, 209, 169, 0.5);
}

.chapter-voice-switch input:focus-visible + .chapter-voice-slider {
  outline: 2px solid #4cd1a9;
  outline-offset: 2px;
}

.chapter-voice-description {
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.45);
}

.chapter-width-control {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chapter-width-item {
  margin-top: 0.5rem;
}

.chapter-font-item {
  margin-top: 0.5rem;
}

.chapter-width-label {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.chapter-width-slider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapter-font-slider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chapter-width-slider input[type="range"] {
  -webkit-appearance: none;
  /* width: 140px; */
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chapter-width-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4cd1a9;
  border: none;
  box-shadow: 0 0 0 2px rgba(76, 209, 169, 0.35);
  transition: transform 0.2s ease;
}

.chapter-width-slider input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4cd1a9;
  border: none;
  box-shadow: 0 0 0 2px rgba(76, 209, 169, 0.35);
  transition: transform 0.2s ease;
}

.chapter-font-slider input[type="range"] {
  -webkit-appearance: none;
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chapter-font-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4cd1a9;
  border: none;
  box-shadow: 0 0 0 2px rgba(76, 209, 169, 0.35);
  transition: transform 0.2s ease;
}

.chapter-font-slider input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #4cd1a9;
  border: none;
  box-shadow: 0 0 0 2px rgba(76, 209, 169, 0.35);
  transition: transform 0.2s ease;
}

.chapter-width-slider input[type="range"]:hover::-webkit-slider-thumb,
.chapter-width-slider input[type="range"]:focus-visible::-webkit-slider-thumb,
.chapter-width-slider input[type="range"]:hover::-moz-range-thumb,
.chapter-width-slider input[type="range"]:focus-visible::-moz-range-thumb {
  transform: scale(1.1);
}

.chapter-font-slider input[type="range"]:hover::-webkit-slider-thumb,
.chapter-font-slider input[type="range"]:focus-visible::-webkit-slider-thumb,
.chapter-font-slider input[type="range"]:hover::-moz-range-thumb,
.chapter-font-slider input[type="range"]:focus-visible::-moz-range-thumb {
  transform: scale(1.1);
}

.chapter-width-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.02);
}

.chapter-width-slider input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chapter-font-slider input[type="range"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chapter-font-icon-small {
  font-size: 0.55rem !important;
  line-height: 1;
}

.chapter-font-icon-large {
  font-size: 1.1rem;
  line-height: 1;
}

.home-link {
  color: white;
}

.previous-chapter {
  color: white;
}
.next-chapter {
  color: white;
}

/* Emotional text styling */
.text-mysterious {
  color: #8a7cce;
  font-style: italic;
}

.text-tense {
  color: #d1594c;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.text-romantic {
  color: #c27ba0;
  font-style: italic;
  letter-spacing: 0.02em;
}

.text-terminal {
  font-family: "Courier New", monospace;
  color: #4cd1a9;
  background-color: rgba(10, 30, 40, 0.3);
  padding: 0.5em;
  border-radius: 4px;
  font-size: 0.9em;
}

.chapter-body {
  font-size: var(--chapter-font-size, 16px);
  line-height: 1.7;
  text-align: justify;
  text-justify: inter-word;
}

.chapter-body p,
.chapter-body blockquote,
.chapter-body li {
  font-size: inherit;
}

/* Responsive layout */
.chapter-content {
  max-width: min(100%, var(--chapter-max-width, 800px));
  margin: 0 auto;
  padding: 2rem;
}

@media (max-width: 768px) {
  .chapter-content {
    padding: 0.5rem;
  }

  .chapter-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem 0.5rem 0;
  }

  .chapter-select {
    width: 100%;
    gap: 0.5rem;
  }

  .chapter-dropdown {
    width: 95%;
    position: static;
    box-shadow: none;
    backdrop-filter: none;
  }

  .chapter-width-control {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: none;
  }

  .chapter-width-item {
    display: none;
  }

  .search-panel {
    align-items: flex-start;
    padding-top: 4rem;
  }

  .search-panel__inner {
    padding: 1.25rem;
    gap: 1rem;
  }
  .chapter-font-slider input[type="range"] {
  
  width: 90%;

}
}

.reading-progress-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 12px;
  background-color: rgba(15, 20, 30, 0.7);
  z-index: 1000;
}

.reading-progress-bar {
  height: 100%;
  width: 0;
  background-color: #4cd1a9; /* Using the same terminal green color */
  transition: width 0.2s ease;
}
.scramble {
  font-size: clamp(28px, 6vw, 64px);
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: default;
  user-select: none;
  font-family: "Workbench", sans-serif;
}
.scramble span {
  display: inline-block; /* allows per-char transforms */
  will-change: transform, filter;
  font-family: "Workbench", sans-serif;
}


/* Optional: Make it more subtle on smaller screens */
@media (max-width: 768px) {
  .reading-progress-container {
    height: 6px;
  }
  .scramble {
  font-size: clamp(32px, 10vw, 128px);
  letter-spacing: 0.02em;
  line-height: 1.2;
  cursor: default;
  user-select: none;
  font-family: "Workbench", sans-serif;
}
.scramble span {
  display: inline-block; /* allows per-char transforms */
  will-change: transform, filter;
  font-family: "Workbench", sans-serif;
}

}

/* Adjust footer padding to prevent overlap with progress bar */
.chapter-footer {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-bottom: 20px;
  align-items: center;
}

body.terminal-locked {
  overflow: hidden;
}

.terminal-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: radial-gradient(ellipse at 20% 20%, rgba(76, 209, 169, 0.06), transparent 32%),
    radial-gradient(ellipse at 80% 80%, rgba(73, 155, 255, 0.05), transparent 28%),
    #05070f;
  color: #e0e0e0;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.terminal-gate--scramble .terminal-gate__frame {
  animation: gateGlitch 0.12s steps(2) infinite;
}

.terminal-gate--blackout .terminal-gate__frame {
  opacity: 0;
  transform: scale(1.01);
  filter: blur(1px);
  transition: opacity 0.5s ease, transform 0.5s ease, filter 0.5s ease;
}

.terminal-gate--unlocked {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
}

.terminal-gate__frame {
  width: min(1100px, 92vw);
  background: linear-gradient(145deg, rgba(15, 20, 30, 0.92), rgba(8, 11, 18, 0.95));
  border: 1px solid rgba(76, 209, 169, 0.25);
  border-radius: 14px;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow:
    0 20px 80px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 1rem;
  animation: gateIn 0.6s ease;
  max-height: 90vh;
  overflow: auto;
}

.terminal-gate__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.terminal-gate__row--meta {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(76, 209, 169, 0.8);
}

.terminal-gate__led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #4cd1a9;
  box-shadow: 0 0 14px rgba(76, 209, 169, 0.8);
}

.terminal-gate__hero {
  display: grid;
  gap: 0.4rem;
}

.terminal-gate__title {
  font-size: clamp(1.2rem, 3.4vw, 1.55rem);
  letter-spacing: 0.06em;
  color: #dbe9e7;
}

.terminal-gate__subtitle {
  color: rgba(255, 255, 255, 0.78);
}

.terminal-gate__clue {
  background: rgba(76, 209, 169, 0.08);
  border: 1px solid rgba(76, 209, 169, 0.32);
  border-radius: 10px;
  padding: 0.9rem 1rem;
}

.terminal-gate__label {
  display: block;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0.35rem;
}

.terminal-gate__code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.terminal-gate__code code {
  color: #4cd1a9;
}

.terminal-gate__hint {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.terminal-gate__input {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
}

.terminal-gate__input input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-size: 1rem;
  padding: 0.4rem 0.2rem;
}

.terminal-gate__input input:focus {
  outline: none;
}

.terminal-gate__input button {
  background: #4cd1a9;
  color: #03121a;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.terminal-gate__input button:hover,
.terminal-gate__input button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(76, 209, 169, 0.28);
  outline: none;
}

.terminal-gate__status {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.75);
  min-height: 1.2em;
}

.terminal-gate__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.terminal-gate__aux-btn {
  background: linear-gradient(135deg, rgba(76, 209, 169, 0.2), rgba(126, 199, 255, 0.18));
  color: #dff6ff;
  border: 1px solid rgba(126, 199, 255, 0.4);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 0.15rem;
  min-width: 240px;
  box-shadow:
    0 12px 38px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.terminal-gate__aux-btn:hover,
.terminal-gate__aux-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow:
    0 16px 38px rgba(76, 209, 169, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  outline: none;
  border-color: rgba(76, 209, 169, 0.6);
}

.terminal-gate__aux-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.95rem;
}

.terminal-gate__aux-sub {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.9rem;
}

.terminal-gate--error .terminal-gate__frame {
  animation: gateError 0.25s linear;
}

.terminal-gate__lockout {
  position: fixed;
  inset: 0;
  z-index: 2200;
  pointer-events: none;
  opacity: 0;
  background: #020304;
  overflow: hidden;
  display: grid;
  place-items: center;
  transition: opacity 0.4s ease;
}

.terminal-gate__lockout.is-active {
  pointer-events: auto;
}

.terminal-gate--lockout .terminal-gate__lockout {
  opacity: 1;
}

.terminal-gate--blackout .terminal-gate__lockout {
  opacity: 1;
}

.terminal-gate__hash-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  z-index: 0;
  transition: opacity 0.4s ease;
}

.terminal-gate__lockout.show-hash .terminal-gate__hash-img {
  opacity: 1;
}

.terminal-gate__noise,
.terminal-gate__scanlines {
  position: absolute;
  inset: -20%;
}

.terminal-gate__noise {
  background-image:
    radial-gradient(rgba(76, 209, 169, 0.9) 1.1px, transparent 0),
    radial-gradient(rgba(126, 199, 255, 0.9) 1px, transparent 0);
  background-size: 4px 4px, 3px 3px;
  mix-blend-mode: screen;
  opacity: 0;
  animation: staticShift 0.22s steps(2) infinite;
}

.terminal-gate--scramble .terminal-gate__noise {
  opacity: 0.45;
}

.terminal-gate--blackout .terminal-gate__noise {
  opacity: 0.3;
  animation-duration: 0.14s;
}

.terminal-gate__scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.06) 2px,
    rgba(0, 0, 0, 0.3) 4px,
    rgba(0, 0, 0, 0.35) 6px
  );
  mix-blend-mode: multiply;
  opacity: 0;
  animation: scanSweep 1.6s linear infinite;
}

.terminal-gate--scramble .terminal-gate__scanlines {
  opacity: 0.7;
}

.terminal-gate--blackout .terminal-gate__scanlines {
  opacity: 0.4;
  animation-duration: 1s;
}

.terminal-gate__reboot {
  position: relative;
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: 0.32em;
  color: #9afbd9;
  opacity: 0;
  text-align: center;
}

.terminal-gate--rebooting .terminal-gate__reboot {
  opacity: 1;
  animation: rebootPulse 0.9s ease-in-out infinite;
}

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

@keyframes gateError {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@keyframes gateGlitch {
  0% {
    transform: translateX(0) scale(1);
    filter: hue-rotate(0deg);
  }
  50% {
    transform: translateX(-6px) scale(1.01);
    filter: hue-rotate(-4deg);
  }
  100% {
    transform: translateX(4px) scale(0.99);
    filter: hue-rotate(6deg);
  }
}

@keyframes staticShift {
  from {
    transform: translate3d(-4%, -6%, 0);
  }
  to {
    transform: translate3d(6%, 8%, 0);
  }
}

@keyframes scanSweep {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(12px);
  }
}

@keyframes rebootPulse {
  0%,
  100% {
    text-shadow:
      0 0 18px rgba(76, 209, 169, 0.7),
      0 0 28px rgba(126, 199, 255, 0.65);
    opacity: 0.98;
  }
  50% {
    text-shadow:
      0 0 32px rgba(126, 199, 255, 0.8),
      0 0 44px rgba(154, 251, 217, 0.75);
    opacity: 0.55;
  }
}

@media (max-width: 720px) {
  .terminal-gate {
    align-items: flex-start;
    padding: 1rem;
  }

  .terminal-gate__frame {
    width: 100%;
    padding: 1rem;
    gap: 0.75rem;
    border-radius: 12px;
  }

  .terminal-gate__row {
    align-items: flex-start;
    gap: 0.5rem;
  }

  .terminal-gate__hero {
    gap: 0.25rem;
  }

  .terminal-gate__clue {
    padding: 0.75rem 0.85rem;
  }

  .terminal-gate__input {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }

  .terminal-gate__input button {
    width: 100%;
  }

  .terminal-gate__actions {
    justify-content: stretch;
  }

  .terminal-gate__aux-btn {
    width: 100%;
  }
}

.gate-dashboard {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
  z-index: 2100;
}

.gate-dashboard--open {
  pointer-events: auto;
  opacity: 1;
}

.gate-dashboard__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(76, 209, 169, 0.08), rgba(3, 10, 18, 0.9)),
    radial-gradient(circle at 80% 80%, rgba(126, 199, 255, 0.08), rgba(3, 10, 18, 0.92));
  backdrop-filter: blur(4px);
}

.gate-dashboard__panel {
  position: relative;
  background: linear-gradient(145deg, rgba(8, 13, 22, 0.92), rgba(5, 10, 17, 0.97));
  border: 1px solid rgba(126, 199, 255, 0.3);
  border-radius: 16px;
  width: min(1100px, 92vw);
  max-height: 88vh;
  overflow: hidden;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  animation: gateIn 0.4s ease;
}

.gate-dashboard__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.25rem 0.5rem;
  gap: 1rem;
}

.gate-dashboard__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(76, 209, 169, 0.85);
  font-size: 0.85rem;
}

.gate-dashboard__title {
  margin: 0.15rem 0;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  color: #e8fbff;
}

.gate-dashboard__subtitle {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
}

.gate-dashboard__close {
  background: rgba(255, 255, 255, 0.06);
  color: #dff6ff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gate-dashboard__close:hover,
.gate-dashboard__close:focus-visible {
  transform: rotate(8deg) scale(1.02);
  box-shadow: 0 10px 30px rgba(126, 199, 255, 0.25);
  border-color: rgba(126, 199, 255, 0.5);
  outline: none;
}

.gate-dashboard__grid {
  display: grid;
  gap: 1rem;
  padding: 0.75rem 1.25rem 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.gate-dashboard__card {
  position: relative;
  background: radial-gradient(circle at 20% 10%, rgba(76, 209, 169, 0.06), transparent 35%),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 0.9rem;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 18px 48px rgba(0, 0, 0, 0.35);
}

.gate-dashboard__card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.gate-dashboard__card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}

.gate-dashboard__tag {
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.gate-dashboard__meta {
  color: rgba(255, 255, 255, 0.6);
}

.gate-dashboard__card-title {
  margin: 0.45rem 0 0.35rem;
  font-weight: 700;
  color: #f2fbff;
}

.gate-dashboard__chart {
  position: relative;
  height: 180px;
  border-radius: 10px;
  background: rgba(5, 15, 24, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.gate-dashboard__chart canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.gate-dashboard__readout {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent, #4cd1a9);
  text-shadow: 0 0 14px var(--glow, rgba(76, 209, 169, 0.25));
  letter-spacing: 0.06em;
}

@media (max-width: 720px) {
  .gate-dashboard {
    align-items: flex-start;
    padding: 1rem;
  }

  .gate-dashboard__panel {
    width: 100%;
    max-height: calc(100vh - 1.5rem);
    overflow: auto;
    border-radius: 12px;
  }

  .gate-dashboard__header {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1rem 0.35rem;
  }

  .gate-dashboard__close {
    align-self: flex-end;
  }

  .gate-dashboard__title {
    font-size: clamp(1.25rem, 5vw, 1.6rem);
  }

  .gate-dashboard__subtitle {
    font-size: 0.95rem;
  }

  .gate-dashboard__grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    padding: 0.5rem 1rem 1rem;
    gap: 0.8rem;
  }

  .gate-dashboard__chart {
    height: 160px;
  }
}

pre,
code {
  color: #d3b633;
}

body.search-open {
  overflow: hidden;
}
