:root {
  /* Foundation — true black, like the cube */
  --color-bg: #000000;
  --color-surface: #111111;
  --color-surface-hover: #1a1a1a;
  --color-border: #222222;
  --color-text: #e8e8e8;
  --color-text-muted: #777777;

  /* The palette — NeXT-inspired, GIF-friendly */
  --color-pink: #d94090;
  --color-delight: #f5a623;
  --color-yellow: #e8b820;
  --color-green: #36a852;
  --color-orange: #d9712e;
  --color-glow: hsla(54, 100%, 92%, 1);

  /* Typography */
  --font-display: system-ui, -apple-system, sans-serif;
  --font-subtitle: system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, sans-serif;

  /* Font sizes */
  --qg-fs-xs: 0.7rem;
  --qg-fs-sm: 0.8125rem;
  --qg-fs-md: 0.875rem;
  --qg-fs-base: 1rem;
  --qg-fs-lg: 1.125rem;
  --qg-fs-xl: 1.5rem;
  --qg-fs-2xl: 2rem;
  --qg-fs-3xl: 3rem;

  /* Spacing — multiples of 8 */
  --qg-space-xs: 0.25rem;
  --qg-space-sm: 0.5rem;
  --qg-space-md: 1rem;
  --qg-space-lg: 2rem;
  --qg-space-xl: 3rem;
  --qg-space-2xl: 4rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--qg-fs-base);
  line-height: 1.5;
  color: var(--color-text);
  background: radial-gradient(ellipse at 50% 0%, hsl(0, 0%, 14%) 0%, hsl(0, 0%, 0%) 60%)
    no-repeat fixed;
  background-color: #000;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(255, 255, 255, 0.03) 2px,
    rgba(255, 255, 255, 0.03) 4px
  );
  background-size: 100% 4px;
  animation: scanline-scroll 8s linear infinite;
}

@keyframes scanline-scroll {
  from { background-position: 0 0; }
  to   { background-position: 0 100vh; }
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--qg-space-lg);
}

.header {
  padding-top: var(--qg-space-lg);
  margin-bottom: 2.5rem;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hidden {
  display: none !important;
}

a {
  color: var(--color-text);
  text-decoration: none;
  border-bottom: 2px solid var(--color-pink);
  transition: color 0.1s;
}

a:hover {
  color: var(--color-pink);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.1;
  margin: 0;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--qg-fs-2xl);
  font-weight: 700;
}

h2 {
  font-size: var(--qg-fs-xl);
  font-weight: 700;
}

h3 {
  font-size: var(--qg-fs-lg);
  font-weight: 700;
}

p {
  margin: 0;
}

/* Wordmark */

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--qg-fs-3xl);
  color: var(--color-text);
  text-decoration: none;
  border-bottom: none;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.wordmark:hover {
  color: var(--color-text);
}

/* Separator */

.qg-icon-separator {
  width: 0.4em;
  height: 0.4em;
  fill: currentColor;
  vertical-align: middle;
}

/* Footer */

.footer {
  padding: var(--qg-space-2xl) 0 var(--qg-space-lg);
  color: rgba(255, 255, 255, 0.1);
  font-size: var(--qg-fs-sm);
  text-align: center;
}

/* Form Fields */

.qg-form {
  text-align: left;
}

.qg-field {
  margin-bottom: 1.25rem;
}

.qg-label {
  display: block;
  font-size: var(--qg-fs-sm);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: var(--qg-space-sm);
}

.qg-input {
  width: 100%;
  font-family: inherit;
  font-size: var(--qg-fs-base);
  padding: 0.75rem var(--qg-space-md);
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.qg-input:focus {
  border-color: rgba(255, 255, 255, 0.4);
}

.qg-input-error {
  border-color: var(--color-pink);
}

.qg-field-error {
  color: var(--color-pink);
  font-size: var(--qg-fs-md);
  margin-top: 0.4rem;
}

.qg-btn {
  width: 100%;
  font-family: inherit;
  font-size: var(--qg-fs-md);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.9em 2em;
  cursor: pointer;
  background: linear-gradient(
    180deg,
    #fff 0%,
    #e0e0e0 100%
  );
  color: #000;
  border: none;
  border-radius: 999px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 -1px 0 rgba(0, 0, 0, 0.1) inset,
    0 2px 6px rgba(0, 0, 0, 0.4);
  transition: background 0.2s;
}

.qg-btn:hover {
  background: linear-gradient(
    180deg,
    #fff 0%,
    #eee 100%
  );
}

/* Screen */

.screen {
  background: #000;
  border: 1px solid #000;
  border-radius: 8px;
  aspect-ratio: 3/2;
  animation: tv-flicker-screen 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

.screen video,
.screen img {
  border-radius: 8px;
}

@keyframes tv-flicker-screen {
  0% { box-shadow: 0 0 15px 1px hsla(54, 100%, 92%, 0.09); }
  15% { box-shadow: 0 0 18px 3px hsla(54, 100%, 92%, 0.12); }
  30% { box-shadow: 0 0 13px 0px hsla(54, 100%, 92%, 0.08); }
  45% { box-shadow: 0 0 16px 2px hsla(54, 100%, 92%, 0.11); }
  60% { box-shadow: 0 0 12px 1px hsla(54, 100%, 92%, 0.08); }
  75% { box-shadow: 0 0 17px 2px hsla(54, 100%, 92%, 0.1); }
  100% { box-shadow: 0 0 15px 1px hsla(54, 100%, 92%, 0.09); }
}

.screen video,
.screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Source Credit */

.gif-source {
  color: rgba(255, 255, 255, 0.2);
  font-size: var(--qg-fs-sm);
  text-align: center;
  margin-top: var(--qg-space-lg);
}

/* Flash Messages */

.flash {
  font-size: var(--qg-fs-md);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-green);
  background: rgba(54, 168, 82, 0.08);
  border: 1px solid rgba(54, 168, 82, 0.15);
  border-radius: 6px;
  padding: 0.65rem 1rem;
  margin-bottom: var(--qg-space-lg);
  animation: flash-in 0.3s ease-out;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
