/* CRT Terminal overlay */

.crt-panel {
  width: min(680px, 95vw);
  max-height: 95vh;
}

.crt-screen {
  position: relative;
  background: #000;
  border: 3px solid #1a401a;
  padding: 24px;
  color: var(--phosphor);
  text-shadow: 0 0 6px #33ff66, 0 0 14px rgba(51, 255, 102, 0.35);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 95vh;
  -webkit-overflow-scrolling: touch;
  box-shadow:
    inset 0 0 40px rgba(51, 255, 102, 0.06),
    0 0 20px rgba(51, 255, 102, 0.12);
  animation: crt-flicker 3s infinite, crt-jitter 0.15s infinite;
}

.crt-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 4px
  );
}

.crt-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 58%,
    rgba(0, 0, 0, 0.32) 88%,
    rgba(0, 0, 0, 0.58) 100%
  );
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 0.96; }
  94% { opacity: 0.82; }
  96% { opacity: 0.98; }
}

@keyframes crt-jitter {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(0.4px, 0); }
  40% { transform: translate(-0.4px, 0.25px); }
  60% { transform: translate(0.25px, -0.25px); }
  80% { transform: translate(-0.25px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .crt-screen {
    animation: none;
  }
}

.crt-title {
  position: relative;
  z-index: 2;
  margin: 0 0 24px;
  font-size: 1.25rem;
  letter-spacing: 0.1em;
}

.crt-status {
  position: relative;
  z-index: 2;
  margin: 0 0 32px;
}

.crt-line {
  margin: 0 0 12px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}

.crt-line-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.crt-label {
  letter-spacing: 0.04em;
}

.crt-value {
  padding-left: 0;
}

.crt-text {
  margin: 0 0 24px;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.crt-subtitle {
  margin: -12px 0 20px;
  letter-spacing: 0.08em;
}

.crt-section {
  margin-top: 16px;
}

.crt-index {
  padding-left: 8px;
}

.crt-note {
  padding-left: 0;
}

.crt-page[hidden] {
  display: none;
}

.crt-menu {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
}

.crt-menu-btn,
.crt-back-btn {
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--phosphor);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-align: left;
  text-shadow: inherit;
  cursor: pointer;
}

.crt-menu-btn:hover,
.crt-menu-btn:focus,
.crt-back-btn:hover,
.crt-back-btn:focus {
  outline: none;
  color: #b8ffca;
  text-shadow: 0 0 8px #33ff66, 0 0 18px rgba(51, 255, 102, 0.45);
}

.crt-file-list {
  display: grid;
  gap: 20px;
  margin: 20px 0 24px;
}

.crt-file-list p,
.crt-location p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.crt-file-list span {
  display: block;
  margin-bottom: 2px;
  letter-spacing: 0.08em;
}

.crt-catalog-entry {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(51, 255, 102, 0.18);
}

.crt-catalog-entry:last-child {
  border-bottom: 0;
}

.crt-catalog-entry p {
  margin-bottom: 6px;
}

.crt-catalog-entry p:nth-child(3),
.crt-catalog-entry p:nth-child(5) {
  margin-top: 12px;
  letter-spacing: 0.08em;
}

.crt-file-number {
  letter-spacing: 0.1em;
}

.crt-location {
  margin-top: 18px;
}

.crt-back-btn {
  margin-top: 24px;
}

.crt-buttons {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid #1a401a;
}

.crt-btn {
  padding: 8px 16px;
  border: 1px solid #aa2222;
  background: transparent;
  color: #ff3333;
  text-shadow: 0 0 6px rgba(180, 0, 0, 0.6);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.crt-btn:hover:not(:disabled) {
  background: #8b0000;
  border-color: #ff4444;
  color: #fff;
  text-shadow: none;
}

.crt-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: #993333;
  border-color: #662222;
}
