/* ============================================================
   AION — Age Intelligence Engine
   Cinematic "dark coffee" parody UI
   ============================================================ */

:root {
  /* Core palette (fixed) */
  --espresso: #14100D;
  --espresso-deep: #0D0A07;
  --surface: #1E1813;
  --surface-2: #261F18;
  --latte: #C9A876;
  --amber: #B5733A;
  --text: #EDE3D3;
  --muted: #8A7B6B;
  --line: rgba(201, 168, 118, 0.14);

  /* Accent — recolored per active model */
  --accent: #C9A876;
  --accent-soft: rgba(201, 168, 118, 0.16);
  --accent-glow: rgba(201, 168, 118, 0.28);

  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-hero: "Fraunces", Georgia, serif;
  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--espresso-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ---------- App frame (mobile column) ---------- */
.stage {
  min-height: 100dvh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background:
    radial-gradient(120% 70% at 50% -10%, #1a140f 0%, var(--espresso-deep) 70%);
}

.app-frame {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  background: var(--espresso);
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 0 90px rgba(0,0,0,0.6);
}

/* ---------- Cinematic overlays ---------- */
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  background:
    radial-gradient(130% 100% at 50% 42%, transparent 50%, rgba(0,0,0,0.5) 100%);
}

.grain {
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  pointer-events: none;
  z-index: 51;
  opacity: 0.07;
  background-image: var(--grain-url);
  background-size: 220px 220px;
  will-change: transform;
  animation: grain 0.6s steps(4) infinite;
  mix-blend-mode: soft-light;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-3%, 2%); }
  50%  { transform: translate(2%, -3%); }
  75%  { transform: translate(-2%, -2%); }
  100% { transform: translate(3%, 1%); }
}

/* faint accent bloom at top, recolors per model */
.bloom {
  position: absolute;
  top: -160px;
  left: 50%;
  transform: translateX(-50%);
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%);
  filter: blur(8px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
  transition: background 0.7s var(--ease);
}

/* ---------- Instagram bar (persistent, all screens) ---------- */
.ig-bar {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px 8px 12px;
  border-radius: 100px;
  background: rgba(30, 24, 19, 0.74);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 32px -14px rgba(0,0,0,0.8);
  transition: transform 0.25s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.ig-bar:hover {
  transform: translateX(-50%) translateY(-1px);
  border-color: color-mix(in oklab, var(--latte) 50%, transparent);
  background: rgba(38, 31, 24, 0.85);
}
.ig-bar:active { transform: translateX(-50%) scale(0.97); }
.ig-bar .ig-ico { display: inline-flex; color: var(--latte); }
.ig-bar .ig-sub { color: var(--muted); font-weight: 500; }

/* ---------- Screen system ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 60px 22px calc(26px + env(safe-area-inset-bottom));
  z-index: 1;
}
.screen-scroll { overflow-y: auto; }

.screen-enter { animation: screenIn 0.55s var(--ease-out) both; }
.screen-exit  { animation: screenOut 0.32s var(--ease) both; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(14px) scale(0.992); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes screenOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-10px) scale(0.992); }
}

/* ---------- Type ---------- */
.kicker {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  transition: color 0.5s var(--ease);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--r-md);
  padding: 17px 22px;
  cursor: pointer;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.25s var(--ease), filter 0.25s var(--ease), background 0.4s var(--ease);
}
.btn:active { transform: scale(0.975); }

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, color-mix(in oklab, var(--accent) 82%, #000) 100%);
  color: #1a130c;
  box-shadow: 0 10px 30px -12px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--surface-2); }

/* Instagram follow button (result / confession) */
.btn-ig {
  background: var(--surface);
  color: var(--text);
  border: 1px solid color-mix(in oklab, var(--latte) 32%, var(--line));
  text-decoration: none;
}
.btn-ig:hover { background: var(--surface-2); border-color: color-mix(in oklab, var(--latte) 55%, transparent); }
.btn-ig svg { color: var(--latte); }

.btn-row { display: flex; flex-direction: column; gap: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.spacer { flex: 1 1 auto; }

/* ============================================================
   HOME
   ============================================================ */
.home { justify-content: center; text-align: center; }

.logo {
  font-family: var(--font-hero);
  font-weight: 600;
  font-size: 72px;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text);
  text-shadow: 0 2px 40px rgba(201,168,118,0.18);
}
.logo-mark {
  width: 54px; height: 54px;
  margin: 0 auto 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  position: relative;
  background: radial-gradient(circle at 50% 40%, rgba(201,168,118,0.14), transparent 70%);
}
.logo-mark::before {
  content: "";
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--latte);
  box-shadow: 0 0 22px 3px var(--accent-glow);
}
.logo-mark::after {
  content: "";
  position: absolute; inset: 7px;
  border-radius: 50%;
  border: 1px solid rgba(201,168,118,0.22);
  animation: ring 6s linear infinite;
}
@keyframes ring { to { transform: rotate(360deg); } }

.home-sub {
  font-family: var(--font-ui);
  font-size: 12.5px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--latte);
  margin-top: 16px;
}
.home-promise {
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 300px;
  margin: 22px auto 0;
  text-wrap: pretty;
}
.home-cta { margin-top: 38px; }

.byline {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 0; right: 0;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  opacity: 0.85;
  text-decoration: none;
  transition: opacity 0.25s var(--ease), color 0.25s var(--ease);
}
.byline:hover { opacity: 1; color: var(--text); }
.byline b { color: var(--latte); font-weight: 600; }

/* ============================================================
   BIRTHDATE
   ============================================================ */
.head { margin-bottom: 30px; }
.head h1 {
  font-family: var(--font-hero);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.1;
  margin-top: 12px;
  letter-spacing: -0.01em;
}
.head p {
  color: var(--muted);
  font-size: 14.5px;
  margin-top: 10px;
  line-height: 1.5;
}

.field { margin-top: 8px; }
.field label {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}
.date-grid { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; }
.inp {
  font-family: var(--font-ui);
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 15px 14px;
  width: 100%;
  text-align: center;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
  appearance: none;
}
.inp:focus { outline: none; border-color: var(--accent); background: var(--surface-2); }
.inp::placeholder { color: rgba(138,123,107,0.7); }
select.inp { text-align: left; }

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 14px;
  min-height: 18px;
}
.hint.err { color: #E0795C; }
.preview-age {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--latte);
  margin-top: 14px;
  min-height: 18px;
  letter-spacing: 0.02em;
}

/* ============================================================
   MODEL SELECT
   ============================================================ */
.models-head { margin-bottom: 18px; }
.models-head h1 {
  font-family: var(--font-hero);
  font-weight: 500;
  font-size: 28px;
  margin-top: 10px;
}
.models-head p { color: var(--muted); font-size: 13.5px; margin-top: 6px; }

.model-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: 20px;
}
.mcard {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px 14px 14px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
  --c: var(--latte);
}
.mcard:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--c) 55%, transparent); }
.mcard:active { transform: translateY(0) scale(0.98); }
.mcard::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--c);
  opacity: 0.9;
}
.mcard.locked { opacity: 0.82; }

.mcard-dot {
  width: 26px; height: 26px; border-radius: 8px;
  background: color-mix(in oklab, var(--c) 22%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--c) 45%, transparent);
  display: grid; place-items: center;
  margin-bottom: 12px;
}
.mcard-dot i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 12px 1px color-mix(in oklab, var(--c) 70%, transparent);
}
.mcard-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: 0.005em;
  color: var(--text);
  line-height: 1.15;
}
.mcard-maker {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.mcard-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.badge {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 100px;
  background: color-mix(in oklab, var(--c) 16%, transparent);
  color: color-mix(in oklab, var(--c) 78%, var(--text));
  white-space: nowrap;
}
.lock-ico { margin-left: auto; color: var(--muted); display: flex; }

/* ============================================================
   LOADING
   ============================================================ */
.loading { justify-content: flex-start; }
.load-top { text-align: center; margin-top: 26px; }
.load-model {
  font-family: var(--font-hero);
  font-weight: 500;
  font-size: 26px;
  margin-top: 14px;
}
.load-orb {
  width: 88px; height: 88px;
  margin: 0 auto 4px;
  border-radius: 50%;
  position: relative;
  display: grid; place-items: center;
}
.load-orb::before, .load-orb::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1.1s linear infinite;
}
.load-orb::after { inset: 12px; border-top-color: color-mix(in oklab, var(--accent) 50%, transparent); animation-duration: 1.7s; animation-direction: reverse; }
.load-orb i {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 22px 4px var(--accent-glow);
  animation: pulse 1.4s var(--ease) infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{ transform: scale(1); opacity:1 } 50%{ transform: scale(1.5); opacity:0.6 } }

.trace {
  margin-top: 30px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  font-family: "Space Grotesk", monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  overflow: hidden;
}
.trace-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: start;
  animation: traceIn 0.4s var(--ease-out) both;
  opacity: 0.55;
}
.trace-line.active { opacity: 1; color: var(--text); }
.trace-line .tick { color: var(--accent); font-size: 11px; line-height: 1.6; }
.trace-line.zh { font-family: var(--font-body); }
@keyframes traceIn { from { opacity: 0; transform: translateX(-6px); } }

.progress-wrap { margin-top: 18px; }
.progress-meta {
  display: flex; justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
.progress-meta .t { color: var(--accent); font-variant-numeric: tabular-nums; }
.bar { height: 4px; border-radius: 100px; background: rgba(255,255,255,0.06); overflow: hidden; }
.bar > i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 60%, #fff));
  border-radius: 100px;
  box-shadow: 0 0 14px var(--accent-glow);
  transition: width 0.3s linear;
}

/* ============================================================
   RESULT
   ============================================================ */
.result { justify-content: center; }
.result-top { text-align: center; }
.result-label {
  font-family: var(--font-ui);
  font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--muted);
}
.age-num {
  font-family: var(--font-hero);
  font-weight: 600;
  font-size: 148px;
  line-height: 0.9;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 8px 0 2px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 6px 60px var(--accent-glow);
}
.age-unit {
  font-family: var(--font-ui);
  font-size: 14px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--accent);
}

/* joke / error result (no number) */
.result-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 18px;
  background: color-mix(in oklab, var(--accent) 16%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
  display: grid; place-items: center;
  color: var(--accent);
}
.result-title {
  font-family: var(--font-hero);
  font-weight: 500;
  font-size: 30px;
  text-align: center;
  line-height: 1.12;
  margin-bottom: 4px;
  text-wrap: balance;
}

/* chat bubble */
.bubble-wrap {
  margin-top: 30px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  animation: bubbleIn 0.5s var(--ease-out) 0.15s both;
}
.bubble-av {
  flex: 0 0 auto;
  width: 32px; height: 32px; border-radius: 9px;
  background: color-mix(in oklab, var(--accent) 22%, var(--surface));
  border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent);
  display: grid; place-items: center;
  margin-top: 2px;
}
.bubble-av i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  text-wrap: pretty;
}
.bubble .who {
  font-family: var(--font-ui);
  font-size: 11px; letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
}
.bubble b { color: var(--latte); font-weight: 600; }
.bubble .cost {
  display: block; margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 11px; color: var(--muted);
}
.bubble .zh { font-size: 15.5px; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(10px); } }

.result-actions { margin-top: 30px; }

/* paywall card */
.paywall { text-align: center; }
.paywall .price {
  font-family: var(--font-hero);
  font-weight: 600;
  font-size: 54px;
  color: var(--accent);
  margin: 6px 0;
}
.paywall .price small { font-family: var(--font-ui); font-size: 15px; color: var(--muted); letter-spacing: 0.05em; }
.feature-list {
  list-style: none;
  margin: 22px 0 28px;
  display: flex; flex-direction: column; gap: 12px;
  text-align: left;
}
.feature-list li {
  display: flex; gap: 11px; align-items: center;
  font-size: 14.5px; color: var(--text);
}
.feature-list li svg { color: var(--accent); flex: 0 0 auto; }
.fineprint { font-size: 11px; color: var(--muted); margin-top: 14px; line-height: 1.5; opacity: 0.8; }

/* ============================================================
   DIRECTOR PANEL
   ============================================================ */
.director-dot {
  position: fixed;
  bottom: 14px; right: 14px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: rgba(201,168,118,0.18);
  border: 1px solid rgba(201,168,118,0.25);
  z-index: 80;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}
.director-dot:hover { transform: scale(1.5); background: var(--latte); }

.director {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8,6,4,0.55);
  backdrop-filter: blur(4px);
}
.director.open { display: flex; animation: fadeIn 0.25s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } }

.director-panel {
  width: 100%;
  max-width: 430px;
  background: #17120E;
  border-top: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 86dvh;
  overflow-y: auto;
  animation: sheetUp 0.4s var(--ease-out) both;
}
@keyframes sheetUp { from { transform: translateY(100%); } }

.director-panel h3 {
  font-family: var(--font-ui);
  font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--latte);
  display: flex; align-items: center; gap: 8px;
}
.director-panel .sub { font-size: 12px; color: var(--muted); margin-top: 6px; margin-bottom: 18px; }
.dir-close {
  position: absolute; top: 18px; right: 18px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  display: grid; place-items: center;
}
.dir-group { margin-bottom: 18px; }
.dir-group > label {
  font-family: var(--font-ui);
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); display: block; margin-bottom: 9px;
}
.dir-sel {
  width: 100%;
  font-family: var(--font-ui); font-size: 14px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 13px; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%238A7B6B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.dir-sel:focus { outline: none; border-color: var(--accent); }

.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1;
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 500;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 8px; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.seg button.on { color: #1a130c; background: var(--latte); border-color: var(--latte); font-weight: 600; }

.dir-time { display: flex; align-items: center; gap: 12px; }
.dir-time input[type=range] { flex: 1; accent-color: var(--latte); }
.dir-time .val {
  font-family: var(--font-ui); font-size: 13px; color: var(--latte);
  font-variant-numeric: tabular-nums; min-width: 56px; text-align: right;
}
.dir-time input[type=range].auto { opacity: 0.4; }

.dir-note {
  font-size: 11px; color: var(--muted); line-height: 1.5;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; margin-top: 4px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
  .logo-mark::after, .load-orb::before, .load-orb::after, .load-orb i { animation: none; }
  .screen-enter, .screen-exit, .trace-line, .bubble-wrap, .director.open, .director-panel { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* very small phones */
@media (max-height: 680px) {
  .logo { font-size: 60px; }
  .age-num { font-size: 120px; }
}

/* ============================================================
   DESKTOP / PC — full-bleed cinematic scene, centred content
   ============================================================ */
@media (min-width: 700px) {
  .stage { background: var(--espresso); }

  /* frame fills the whole window; background grain/vignette go edge-to-edge */
  .app-frame {
    max-width: none;
    width: 100vw;
    box-shadow: none;
  }
  .bloom { width: 620px; height: 620px; top: -240px; }

  /* every screen centres a comfortable content column */
  .screen {
    align-items: center;
    padding: 84px 40px calc(48px + env(safe-area-inset-bottom));
  }
  .screen > *:not(.spacer) {
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  /* birthdate: centre the whole group vertically */
  .screen.birth { justify-content: center; }
  .screen.birth .spacer { flex: 0 0 40px; }

  /* model select: wider, three columns, spread across the screen */
  .screen.screen-scroll { padding-top: 92px; }
  .screen > .models-head { max-width: 880px; text-align: center; }
  .screen > .models-head h1 { font-size: 40px; }
  .screen > .models-head p { font-size: 16px; }
  .screen > .model-grid {
    max-width: 880px;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .mcard { min-height: 150px; padding: 20px 18px 18px; }
  .mcard-name { font-size: 16px; }

  /* loading: keep full-height column, just widen */
  .screen.loading > *:not(.spacer) { max-width: 560px; }
  .screen.loading .load-top { margin-top: 6vh; }
  .load-model { font-size: 34px; }
  .load-orb { width: 104px; height: 104px; }

  /* hero scale-up for big screens */
  .logo { font-size: 104px; }
  .logo-mark { width: 64px; height: 64px; margin-bottom: 26px; }
  .home-sub { font-size: 14px; }
  .home-promise { font-size: 18px; max-width: 360px; }
  .head h1 { font-size: 38px; }
  .age-num { font-size: 184px; }
  .result-title { font-size: 36px; }
  .bubble { font-size: 16.5px; }

  /* keep the byline pinned and centred across the full width */
  .byline { max-width: none; }
}

@media (min-width: 700px) and (max-height: 760px) {
  .age-num { font-size: 132px; }
  .logo { font-size: 80px; }
  .screen.loading .load-top { margin-top: 2vh; }
}

/* ============================================================
   EASTER EGGS
   ============================================================ */
#matrixCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  pointer-events: none; /* Чтобы текст не перекрывал кнопки */
  opacity: 0;
  transition: opacity 1.5s ease-in;
  mix-blend-mode: screen; /* Красиво ложится поверх шума и градиентов */
}

/* ============================================================
   EASTER EGGS (DATES, MODELS, CHEATS)
   ============================================================ */
.vampire-overlay, .terminator-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
  z-index: 10000; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.95); color: #fff; /* Строгий белый цвет вместо красного */
  font-family: 'Space Grotesk', sans-serif; 
  text-align: center; font-size: 1.5rem; padding: 20px; font-weight: bold;
  animation: flashWarning 1.2s infinite; pointer-events: none;
}
.terminator-overlay {
  border: 10px solid #fff; 
  background: rgba(10,10,10,0.95);
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.05) 2px, rgba(255,255,255,0.05) 4px);
}
@keyframes flashWarning { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

.jobs-mode {
  font-family: 'Courier New', Courier, monospace !important;
  filter: grayscale(100%) contrast(150%);
}

.shake-body { animation: uiShake 0.15s infinite; }
@keyframes uiShake {
  0% { transform: translate(1px, 1px) rotate(0deg); }
  25% { transform: translate(-2px, -1px) rotate(-1deg); }
  50% { transform: translate(1px, -2px) rotate(1deg); }
  75% { transform: translate(-1px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -1px) rotate(0deg); }
}

/* Экран темнеет от нехватки питания вместо красного свечения */
.overheat-vignette {
  box-shadow: inset 0 0 150px rgba(0,0,0,0.95); 
  pointer-events: none; 
  position: fixed; inset: 0; z-index: 9999;
}

.social-credit-toast {
  position: fixed; top: 20px; right: 20px; background: #2FB457; color: white;
  padding: 15px 25px; border-radius: 8px; font-weight: bold; z-index: 10000;
  box-shadow: 0 4px 20px rgba(47,180,87,0.4);
  animation: slideInToast 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes slideInToast { from { transform: translateX(150%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.censored-blur .screen { filter: blur(14px) grayscale(100%); pointer-events: none; transition: 0.3s; }
.censored-stamp {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-15deg);
  color: #d32f2f; border: 8px solid #d32f2f; font-size: clamp(3rem, 10vw, 6rem); 
  font-weight: 900; padding: 10px 40px; letter-spacing: 5px; z-index: 10000; 
  font-family: 'Inter', sans-serif; text-shadow: 0 0 20px rgba(211,47,47,0.6); 
  border-radius: 10px; pointer-events: none; opacity: 0;
  animation: stampDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.5s forwards;
}
@keyframes stampDown { from { transform: translate(-50%, -50%) rotate(-15deg) scale(3); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-15deg) scale(1); opacity: 1; } }

.skynet-mode {
  --accent: #ff0000 !important; --accent-soft: rgba(255,0,0,0.15) !important;
  background-color: #050000 !important; color: #ff3333 !important;
}
.skynet-mode .grain { opacity: 0.6; }
.skynet-mode * { font-family: 'Courier New', Courier, monospace !important; }