:root {
  --bg: #06080c;
  --fg: #e8f1ef;
  --muted: #7d8f8c;
  --accent: #5eead4;
  --accent-dim: rgba(94, 234, 212, 0.18);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

body {
  height: 100vh;
  height: 100dvh;
  position: relative;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Code rain fades out towards the centre so it never fights the quote. */
#rain {
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 25%, #000 85%);
          mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 25%, #000 85%);
}

#face { cursor: crosshair; }

/* ---------- top bar ---------- */

.bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(20px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 0;
  pointer-events: none;
  z-index: 2;
}

.brand {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 4px;
  vertical-align: -0.18em;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

.term-toggle {
  pointer-events: auto;
  font: 500 13px var(--mono);
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(125, 143, 140, 0.3);
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.term-toggle:hover, .term-toggle:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  outline: none;
}

/* ---------- quote ---------- */

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 16px;
  pointer-events: none;
  z-index: 1;
}

.quote {
  pointer-events: auto;
  margin: 0;
  max-width: min(760px, 100%);
  text-align: center;
  cursor: pointer;
  outline: none;
  padding: 24px clamp(8px, 3vw, 32px);
  border-radius: 16px;
  /* soft halo so text reads cleanly over the particles */
  background: radial-gradient(ellipse at center, rgba(6, 8, 12, 0.78) 0%, rgba(6, 8, 12, 0.55) 55%, rgba(6, 8, 12, 0) 75%);
}
.quote:focus-visible { box-shadow: 0 0 0 1px var(--accent-dim); }

.quote-tag {
  display: block;
  font-size: 12px;
  color: var(--accent);
  opacity: 0.8;
  margin-bottom: 18px;
  letter-spacing: 0.04em;
  min-height: 1em;
}

.quote-text {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(26px, 4.2vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.005em;
  text-wrap: balance;
  text-shadow: 0 0 24px var(--bg), 0 0 8px var(--bg);
  min-height: 1.2em;
}
.quote-text.long { font-size: clamp(22px, 3.2vw, 36px); }

.type-cursor {
  display: inline-block;
  width: 2px;
  height: 0.9em;
  margin-left: 3px;
  vertical-align: -0.08em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
.quote.done .type-cursor { opacity: 0; animation: none; transition: opacity .6s; }

.quote-author {
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .6s ease, transform .6s ease;
}
.quote-author::before { content: '— '; }
.quote.done .quote-author { opacity: 1; transform: none; }

/* ---------- socials ---------- */

.socials {
  position: fixed;
  left: 50%;
  bottom: max(9vh, calc(env(safe-area-inset-bottom) + 56px));
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  z-index: 2;
}

.socials a {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--fg);
  background: rgba(6, 8, 12, 0.6);
  border: 1px solid rgba(232, 241, 239, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color .25s, border-color .25s, transform .25s, box-shadow .25s;
}
.socials a:hover, .socials a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 0 22px var(--accent-dim);
  outline: none;
}
.socials svg { width: 20px; height: 20px; fill: currentColor; }

/* ---------- hint + progress ---------- */

.hint {
  position: fixed;
  left: 0; right: 0;
  bottom: max(22px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
  z-index: 2;
}
.hint kbd {
  font: inherit;
  color: var(--fg);
  border: 1px solid rgba(125, 143, 140, 0.35);
  border-radius: 4px;
  padding: 1px 5px;
}
.hint .sep { margin: 0 8px; }

.progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  z-index: 2;
}
.progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--accent));
  opacity: 0.55;
  transform-origin: left;
  transform: scaleX(0);
}

@media (hover: none) {
  .hint { display: none; }
}

/* ---------- terminal ---------- */

.terminal {
  position: fixed;
  z-index: 10;
  left: 50%;
  top: 72px;
  width: min(680px, calc(100vw - 32px));
  height: min(380px, calc(100dvh - 140px));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  background: rgba(8, 11, 15, 0.94);
  border: 1px solid rgba(94, 234, 212, 0.25);
  border-radius: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
  animation: term-in .18s ease-out;
}
.terminal[hidden] { display: none; }

.term-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid rgba(125, 143, 140, 0.15);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: #2a3335; }

.term-out {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 4px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.term-out .cmd { color: var(--fg); }
.term-out .cmd b { color: var(--accent); font-weight: 400; }
.term-out .res { color: #a9bbb8; }
.term-out .err { color: #f7a1a1; }
.term-out a { color: var(--accent); }

.term-line {
  display: flex;
  gap: 8px;
  padding: 6px 14px 12px;
}
.prompt { color: var(--accent); white-space: nowrap; }
#term-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--fg);
  font: inherit;
  caret-color: var(--accent);
}

@media (max-width: 520px) {
  .prompt { display: none; }
  .term-line::before { content: '$'; color: var(--accent); }
}

/* ---------- misc ---------- */

.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;
}

@keyframes blink { 50% { opacity: 0; } }
@keyframes term-in { from { opacity: 0; transform: translate(-50%, -8px); } }

@media (prefers-reduced-motion: reduce) {
  .caret, .type-cursor { animation: none; }
  .terminal { animation: none; }
}
