:root {
  --bg: #020408;
  --phosphor: #4af2ff;
  --phosphor-dim: #2a8ea8;
  --phosphor-bright: #b8fbff;
  --amber: #ffb000;
  --glow: 0 0 6px rgba(74, 242, 255, 0.75), 0 0 18px rgba(74, 242, 255, 0.35);
  --glow-strong: 0 0 10px rgba(74, 242, 255, 0.95), 0 0 26px rgba(74, 242, 255, 0.55);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--phosphor);
  font-family: 'VT323', 'IBM Plex Mono', monospace;
  font-size: 22px;
  line-height: 1.35;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* CRT outer frame — slight vignette + curvature */
.crt {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #05101a 0%, #010308 70%, #000 100%);
  padding: clamp(16px, 3vw, 48px);
  overflow: hidden;
}

.crt::before {
  /* Scanlines */
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.25) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  pointer-events: none;
  z-index: 3;
}

.crt::after {
  /* Vignette */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.65) 100%);
  pointer-events: none;
  z-index: 2;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(20px, 4vw, 56px);
  animation: flicker 4s infinite steps(1);
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  96%      { opacity: 0.96; }
  97%      { opacity: 1; }
  98%      { opacity: 0.93; }
  99%      { opacity: 1; }
}

.terminal {
  text-shadow: var(--glow);
  letter-spacing: 0.02em;
}

/* Boot sequence */
.boot {
  font-family: inherit;
  font-size: inherit;
  white-space: pre-wrap;
  min-height: 1.35em;
}

.boot .err { color: var(--amber); text-shadow: 0 0 6px rgba(255,176,0,0.75); }

/* Menu */
.menu[hidden] { display: none; }

.brand {
  text-align: center;
  margin-bottom: 2rem;
}

.whale {
  position: absolute;
  top: clamp(16px, 3vw, 40px);
  right: clamp(16px, 3vw, 40px);
  width: clamp(110px, 14vw, 180px);
  aspect-ratio: 1 / 1;
  background-color: var(--phosphor);
  -webkit-mask: url('assets/kujido-logo.png') center / contain no-repeat;
          mask: url('assets/kujido-logo.png') center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(74, 242, 255, 0.85))
          drop-shadow(0 0 22px rgba(74, 242, 255, 0.5))
          drop-shadow(0 0 40px rgba(74, 242, 255, 0.25));
  z-index: 4;
  pointer-events: none;
}

.title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 400;
  letter-spacing: 0.15em;
  text-shadow: var(--glow-strong);
}

.subtitle {
  color: var(--phosphor-dim);
  font-size: 0.85em;
  letter-spacing: 0.2em;
  margin-top: 0.25rem;
}

.prompt {
  margin: 1.5rem 0 0.75rem;
  letter-spacing: 0.1em;
  color: var(--phosphor-bright);
}

.apps {
  list-style: none;
  border-top: 1px solid rgba(74, 242, 255, 0.25);
  border-bottom: 1px solid rgba(74, 242, 255, 0.25);
  padding: 0.75rem 0;
}

.app {
  display: grid;
  grid-template-columns: 1.2em auto 1fr auto auto;
  align-items: baseline;
  gap: 0.5em;
  padding: 0.35em 0.5em;
  text-decoration: none;
  color: var(--phosphor);
  letter-spacing: 0.06em;
  transition: background 80ms linear;
}

.app .marker { opacity: 0; }
.app:hover .marker,
.app:focus-visible .marker { opacity: 1; animation: blink 1s steps(1) infinite; }

.app:hover,
.app:focus-visible {
  background: rgba(74, 242, 255, 0.08);
  color: var(--phosphor-bright);
  text-shadow: var(--glow-strong);
  outline: none;
}

.app .name { font-weight: 500; }

.app .dots {
  overflow: hidden;
  white-space: nowrap;
  color: var(--phosphor-dim);
}
.app .dots::before {
  content: '....................................................................';
}

.app .desc {
  color: var(--phosphor-dim);
  font-size: 0.85em;
  padding: 0 0.75em;
  letter-spacing: 0.08em;
}

.app .status {
  font-size: 0.85em;
  color: var(--phosphor);
}

.app[data-status="offline"] {
  color: var(--phosphor-dim);
  pointer-events: none;
  cursor: not-allowed;
}
.app[data-status="offline"] .status { color: var(--amber); text-shadow: 0 0 6px rgba(255,176,0,0.6); }

.app.disabled { display: grid; }

/* Footer */
.footer {
  margin-top: 2rem;
  text-align: center;
  color: var(--phosphor-dim);
  font-size: 0.85em;
  letter-spacing: 0.1em;
}

.tagline {
  min-height: 1.2em;
  margin-bottom: 0.5rem;
  color: var(--phosphor);
  opacity: 0.85;
}

.cursor {
  display: inline-block;
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Responsive */
@media (max-width: 640px) {
  html, body { font-size: 18px; }
  .whale { width: 90px; top: 12px; right: 12px; }
  .app {
    grid-template-columns: 1.2em auto 1fr auto;
  }
  .app .desc { display: none; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .cursor, .app:hover .marker { animation: none; opacity: 1; }
}
