:root {
  --bg: #17191c;
  --fg-bright: #e8e8e8;
  --fg-mid: #888888;
  --fg-faint: #444444;
  --accent: #e7d61b;
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg-mid);
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
}

#screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
  overflow: hidden;
}

#hero-meta {
  margin-top: 28px;
}

/* fine grid texture — applied to body so it covers everything */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 999;
}

#canvas {
  font-family: "JetBrains Mono", "Cascadia Mono", "IBM Plex Mono", ui-monospace, Menlo, monospace;
  /* font-size set by responsive clamp() rule below */
  line-height: 1.0;
  letter-spacing: 0;
  color: #e6e6e6;
  white-space: pre;
  margin: 0;
  display: block;

  /* Crispness stack — ANSI Shadow glyphs already carry their own shadow,
     so we kill every browser feature that would smear or antialias them
     against a clean grid. */
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "calt" 0, "dlig" 0;
  font-kerning: none;
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  transform: translateZ(0);
  text-shadow: none;

  /* Soft outer bloom via filter — no per-glyph smearing */
  filter: drop-shadow(0 0 10px rgba(230, 230, 230, 0.15));
  transition: filter 300ms ease, opacity 300ms ease, transform 500ms ease;
}

/* ── EXIT ANIMATION ─────────────────────────────────────────────── */
/* Triggered when body gets .exiting (on ENTER BARKROOMS click). */
body.exiting #canvas {
  animation: canvas-exit 620ms steps(6, end) forwards;
}
body.exiting #hero-meta {
  animation: meta-exit 420ms ease forwards;
}

@keyframes canvas-exit {
  0%   { transform: translateZ(0) scale(1);       opacity: 1; filter: drop-shadow(0 0 10px rgba(230,230,230,0.15)); }
  20%  { transform: translateZ(0) scale(1.015);   opacity: 1; filter: drop-shadow(0 0 14px rgba(230,230,230,0.35)) brightness(1.25); }
  50%  { transform: translateZ(0) scale(0.995);   opacity: 0.85; filter: drop-shadow(0 0 10px rgba(230,230,230,0.25)) contrast(1.2); }
  80%  { transform: translateZ(0) scale(1.01);    opacity: 0.35; filter: blur(2px) brightness(0.6); }
  100% { transform: translateZ(0) scale(1.05);    opacity: 0;    filter: blur(6px) brightness(0.2); }
}

@keyframes meta-exit {
  0%   { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(4px); }
}

/* prominent subtitle that fades in after the canvas reveal */
#title-sub {
  margin-top: 22px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(13px, 1.6vw, 20px);
  font-weight: 600;
  letter-spacing: clamp(2px, 0.45vw, 5px);
  color: var(--fg-bright);
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 6px rgba(232,232,232,0.18);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 700ms ease, transform 700ms ease;
  padding-left: 0.4em;
}
#title-sub.visible {
  opacity: 1;
  transform: translateY(0);
}

.hidden { display: none !important; }

#hero-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 900ms ease, visibility 0s;
  min-height: 90px;
}

#hero-meta.visible {
  opacity: 1;
  visibility: visible;
}

/* Override .hidden for hero-meta — keep it in layout flow */
#hero-meta.hidden {
  display: flex !important;
  visibility: hidden;
  opacity: 0;
}

#title {
  font-family: inherit;
  font-size: 20px;
  font-weight: normal;
  color: var(--fg-bright);
  letter-spacing: 6px;
  text-shadow: 0 0 2px rgba(232,232,232,0.35);
}

#eyebrow {
  font-family: inherit;
  font-size: 11px;
  color: var(--fg-mid);
  letter-spacing: 8px;
  text-transform: uppercase;
  text-align: center;
  padding: 0 0 0 8px; /* compensate for the trailing letter-spacing so it optically centers */
  margin-bottom: 14px;
  opacity: 0.55;
  font-feature-settings: "tnum";
  text-shadow: 0 0 6px rgba(232, 232, 232, 0.08);
}

#tagline {
  color: var(--fg-mid);
  font-size: 13px;
  letter-spacing: 2px;
}

#button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

#enter-btn {
  font-family: inherit;
  font-size: 15px;
  color: var(--fg-bright);
  text-decoration: none;
  padding: 10px 22px;
  border: 1px solid var(--fg-bright);
  letter-spacing: 2px;
  transition: all 120ms ease;
  background: transparent;
  text-shadow: 0 0 2px rgba(232,232,232,0.4);
}

#enter-btn:hover,
#enter-btn:focus {
  background: var(--fg-bright);
  color: var(--bg);
  text-shadow: none;
  outline: none;
}

/* ── Top-right social link ─────────────────────────────────── */
#social {
  position: fixed;
  top: 22px;
  right: 26px;
  z-index: 20;
  color: var(--fg-mid);
  text-decoration: none;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 6px 4px;
  transition: color 160ms ease, text-shadow 160ms ease;
}

#social .bracket { color: var(--fg-faint); }
#social .label   { color: var(--fg-mid); }
#social .x       {
  color: var(--fg-bright);
  font-weight: 600;
  font-size: 14px;
  text-shadow: 0 0 2px rgba(232,232,232,0.4);
}

#social:hover,
#social:focus {
  outline: none;
}
#social:hover .bracket,
#social:focus .bracket { color: var(--fg-bright); }
#social:hover .label,
#social:focus .label   { color: var(--fg-bright); }
#social:hover .x,
#social:focus .x       {
  text-shadow: 0 0 4px rgba(232,232,232,0.8), 0 0 10px rgba(232,232,232,0.35);
}

#cursor {
  color: var(--fg-bright);
  font-size: 16px;
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ── LORE SECTION (scroll down from hero) ──────────────────── */
#lore {
  max-width: 560px;
  margin: 0 auto;
  padding: 60px 24px 100px;
  width: 100%;
}

.terminal-block {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-mid);
  white-space: pre;
  margin: 0;
  overflow-x: auto;
}

.terminal-block s {
  color: var(--fg-faint);
  text-decoration: line-through;
}

.lore-link {
  color: var(--fg-bright);
  text-decoration: none;
  transition: color 120ms ease;
}

.lore-link:hover {
  color: var(--accent);
}

/* ── LORE WINDOWS ─────────────────────────────────────────── */
.window {
  background: #0e1014;
  border: 1px solid #2a2d33;
  border-radius: 10px;
  margin: 24px 0;
  overflow: hidden;
  transition: border-color 200ms ease;
}
.window:hover { border-color: #3a3e46; }

.window-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(255,255,255,0.035);
  border-bottom: 1px solid #2a2d33;
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--fg-mid);
  text-transform: uppercase;
}
.window-dots {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.window-dots span {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.window-dots span:nth-child(1) { background: #ff5f57; }
.window-dots span:nth-child(2) { background: #febc2e; }
.window-dots span:nth-child(3) { background: #28c840; }
.window-title {
  color: var(--fg-bright);
  margin-left: 4px;
  flex: 1;
}
.window-tag {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1.5px;
}

.window-body {
  padding: 20px 22px;
  font-family: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg-mid);
}
.window-body p { margin: 0 0 14px 0; }
.window-body p:last-child { margin: 0; }
.window-body strong { color: var(--fg-bright); font-weight: 600; }
.window-body em { color: var(--accent); font-style: normal; }
.window-body a { color: var(--fg-bright); text-decoration: underline; text-underline-offset: 3px; }
.window-body a:hover { color: var(--accent); }

.window-body ol,
.window-body ul {
  list-style: none;
  padding: 0;
  margin: 0 0 12px 0;
  counter-reset: stp;
}
.window-body ol li {
  counter-increment: stp;
  padding: 4px 0 4px 28px;
  position: relative;
}
.window-body ol li::before {
  content: counter(stp, decimal-leading-zero);
  position: absolute;
  left: 0; top: 4px;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 1px;
}
.window-body ul li {
  padding: 3px 0 3px 18px;
  position: relative;
}
.window-body ul li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ── X / TWEET MOCKUP ─────────────────────────────────────── */
.tweet-mock {
  display: block;
  max-width: 100%;
  margin: 0;
  background: #000;
  color: #e7e9ea;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  text-decoration: none;
  border-radius: 0;
  padding: 18px 20px;
  transition: background 180ms ease;
}
.tweet-mock:hover { background: #0a0a0a; }

.tweet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.tweet-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, #4a3a2a 0%, #5b4630 100%);
  border: 1px solid #2f3336;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  line-height: 1;
}
.tweet-author { display: flex; flex-direction: column; line-height: 1.2; }
.tweet-name {
  display: flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 15px;
  color: #e7e9ea;
}
.tweet-verified {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  color: #1d9bf0;
}
.tweet-verified svg { width: 18px; height: 18px; }
.tweet-handle {
  font-size: 14px; color: #71767b; font-weight: 400;
  margin-top: 1px;
}

.tweet-body {
  font-size: 17px; line-height: 1.45;
  color: #e7e9ea;
  margin-bottom: 14px;
}
.tweet-body p { margin: 0 0 6px 0; }
.tweet-body p:last-child { margin: 0; }

.tweet-meta {
  font-size: 13px; color: #71767b;
  padding-bottom: 12px;
  border-bottom: 1px solid #2f3336;
  margin-bottom: 12px;
}
.tweet-meta strong { color: #e7e9ea; font-weight: 600; }

.tweet-actions {
  display: flex; justify-content: space-between;
  font-size: 13px; color: #71767b;
  flex-wrap: wrap; gap: 8px;
}
.tweet-actions span {
  display: inline-flex; align-items: center; gap: 4px;
}

@media (max-width: 640px) {
  .window-body { padding: 16px 16px; font-size: 12px; }
  .window-head { padding: 8px 12px; font-size: 9px; }
  .tweet-mock { padding: 14px 16px; }
  .tweet-body { font-size: 15px; }
  .tweet-meta, .tweet-actions { font-size: 12px; }
}

/* ── RESPONSIVE CANVAS SCALING ──────────────────────────────── */
/*
  Canvas is 30 chars wide. Smaller AGI — max 36px desktop, ~12px mobile.
*/
#canvas {
  font-size: clamp(12px, calc((100vw - 64px) / 26), 36px);
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  #tagline { font-size: 12px; }
}

@media (max-width: 640px) {
  #screen { padding: 20px 12px; }
  #tagline { font-size: 12px; letter-spacing: 1px; }
  #enter-btn { font-size: 14px; padding: 12px 20px; letter-spacing: 2px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  #social { font-size: 10px; top: 10px; right: 10px; letter-spacing: 1px; padding: 10px 8px; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; }
  #social .x { font-size: 12px; }
  #hero-meta { gap: 16px; margin-top: 20px; min-height: 80px; }
  #lore { padding: 32px 20px 80px; max-width: 100%; }
  .terminal-block {
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.7;
  }
}

@media (max-width: 400px) {
  #screen { padding: 16px 8px; }
  #tagline { font-size: 11px; letter-spacing: 0.5px; }
  #enter-btn { font-size: 13px; padding: 10px 16px; min-height: 44px; }
  .terminal-block { font-size: 12px; }
  #hero-meta { margin-top: 16px; gap: 12px; }
}
