/* ============================================================
   IAESTUDA — Universo do Conhecimento
   Design system: espaço profundo, ciano da marca, laranja de energia.
   ============================================================ */

:root {
  /* Cor */
  --bg: oklch(0.14 0.035 268);            /* espaço profundo, azul-violeta */
  --bg-deep: oklch(0.10 0.03 268);
  --surface: oklch(0.19 0.04 268 / 0.72);
  --surface-solid: oklch(0.19 0.04 268);
  --surface-2: oklch(0.24 0.045 268);
  --line: oklch(0.75 0.08 250 / 0.14);
  --line-strong: oklch(0.75 0.1 250 / 0.3);

  --ink: oklch(0.95 0.01 250);
  --ink-dim: oklch(0.78 0.03 255);
  --ink-faint: oklch(0.62 0.04 260);

  --cyan: oklch(0.83 0.13 215);           /* marca */
  --cyan-deep: oklch(0.6 0.12 220);
  --orange: oklch(0.78 0.15 60);          /* exame / energia */
  --gold: oklch(0.86 0.14 92);            /* XP / recompensa */
  --violet: oklch(0.7 0.14 295);          /* nébula */
  --green: oklch(0.8 0.16 150);
  --red: oklch(0.68 0.19 20);

  /* Tipografia */
  --font-ui: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  /* Ritmo */
  --r-s: 8px; --r-m: 14px; --r-l: 22px;
  --shell-h: 64px;

  /* Movimento */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 160ms; --t-med: 320ms; --t-slow: 700ms;

  /* Z */
  --z-rail: 10; --z-topbar: 20; --z-overlay: 40; --z-toast: 50;
}

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

[hidden] { display: none !important; }

html {
  color-scheme: dark;
  max-width: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-deep);
  color: var(--ink);
  min-height: 100dvh;
  max-width: 100%;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

h1, h2, h3 { text-wrap: balance; font-weight: 600; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ Fundo: universo ============ */
#universe {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  display: block;
}
.nebula-tint {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 78% 12%, oklch(0.4 0.12 295 / 0.14), transparent 70%),
    radial-gradient(50% 45% at 12% 85%, oklch(0.45 0.1 220 / 0.12), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 40%, oklch(0.08 0.03 268 / 0.75) 100%);
}

/* ============ Topbar ============ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--shell-h);
  z-index: var(--z-topbar);
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px;
  background: linear-gradient(to bottom, oklch(0.1 0.03 268 / 0.9), oklch(0.1 0.03 268 / 0.55) 70%, transparent);
}

.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--cyan); text-decoration: none;
}
.brand-glyph { display: grid; place-items: center; }
.brand-glyph svg { filter: drop-shadow(0 0 8px oklch(0.83 0.13 215 / 0.5)); }
.brand-name {
  font-weight: 700; letter-spacing: 0.18em; font-size: 0.95rem;
  color: var(--ink);
}

/* Navegação central */
.mainnav {
  position: relative;
  display: flex; gap: 4px;
  margin-inline: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: oklch(0.16 0.035 268 / 0.6);
  backdrop-filter: blur(12px);
}
.mainnav-link {
  position: relative; z-index: 1;
  padding: 7px 18px;
  border-radius: 99px;
  color: var(--ink-dim); text-decoration: none;
  font-size: 0.92rem; font-weight: 500;
  transition: color var(--t-fast) var(--ease-out);
}
.mainnav-link:hover { color: var(--ink); }
.mainnav-link.is-active { color: oklch(0.13 0.03 268); }
.mainnav-ind {
  position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
  border-radius: 99px;
  background: var(--cyan);
  box-shadow: 0 0 18px oklch(0.83 0.13 215 / 0.45);
  transition: left var(--t-med) var(--ease-out), width var(--t-med) var(--ease-out);
}

/* HUD do jogador */
.hud { position: relative; display: flex; align-items: center; gap: 14px; }

.hud-streak {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
  transition: color var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.hud-streak.is-lit { color: var(--orange); border-color: oklch(0.78 0.15 60 / 0.4); }
.hud-streak.is-lit .flame { filter: drop-shadow(0 0 6px oklch(0.78 0.15 60 / 0.7)); }
.hud-streak:hover { transform: translateY(-1px); }
.hud-streak-n { font-weight: 700; font-size: 0.95rem; }
.hud-streak.bump { animation: bump 0.5s var(--ease-out); }
@keyframes bump { 30% { transform: scale(1.25); } }

.hud-xp { width: 150px; }
.hud-xp-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.hud-level { font-size: 0.72rem; font-weight: 600; color: var(--ink-dim); letter-spacing: 0.04em; }
.hud-xp-n { font-size: 0.68rem; color: var(--gold); }
.hud-xp-bar {
  height: 5px; border-radius: 99px;
  background: oklch(0.3 0.04 268 / 0.8);
  overflow: hidden;
}
.hud-xp-fill {
  height: 100%; width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  box-shadow: 0 0 8px oklch(0.86 0.14 92 / 0.6);
  transition: width var(--t-slow) var(--ease-out);
}

.hud-avatar {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
}
.hud-ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.hud-ring circle { fill: none; stroke-width: 2.5; }
.hud-ring-bg { stroke: oklch(0.3 0.04 268); }
.hud-ring-fg {
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-dasharray: 119.4;   /* 2πr, r=19 */
  stroke-dashoffset: 119.4;
  transition: stroke-dashoffset var(--t-slow) var(--ease-out);
}
.hud-avatar-letter {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-deep), oklch(0.45 0.12 280));
  font-weight: 700; font-size: 0.85rem;
}
.hud-avatar-lvl {
  position: absolute; right: -3px; bottom: -3px;
  min-width: 17px; height: 17px;
  display: grid; place-items: center;
  border-radius: 99px;
  background: var(--gold);
  color: oklch(0.2 0.05 92);
  font-size: 0.6rem; font-weight: 700;
  padding-inline: 3px;
}

/* ============ Vistas ============ */
#app { position: relative; z-index: 2; }

.view {
  min-height: 100dvh;
  padding-top: var(--shell-h);
  animation: view-in var(--t-slow) var(--ease-out);
}
@keyframes view-in {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
}

/* ============ CHAT ============ */
.view-chat {
  display: flex;
  min-width: 0;
  height: 100dvh;
  overflow-x: clip;
}

.chat-rail {
  position: sticky; top: var(--shell-h);
  z-index: var(--z-rail);
  width: 250px; flex: 0 0 auto;
  height: calc(100dvh - var(--shell-h));
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: oklch(0.12 0.03 268 / 0.55);
  backdrop-filter: blur(10px);
  display: flex; flex-direction: column;
  transition: margin-left var(--t-med) var(--ease-out), opacity var(--t-med);
}
.chat-rail.is-hidden { margin-left: -250px; opacity: 0; pointer-events: none; }

.chat-new { width: 100%; margin-bottom: 20px; }

.rail-label {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 8px; padding-inline: 6px;
}
.rail-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.rail-group {
  margin: 12px 6px 4px;
  color: var(--ink-faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rail-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--r-s);
  color: var(--ink-dim); font-size: 0.85rem;
  text-align: left; width: 100%;
  white-space: nowrap; overflow: hidden;
  transition: background var(--t-fast), color var(--t-fast);
}
.rail-item.is-active { background: oklch(0.83 0.13 215 / 0.12); color: var(--ink); }
.rail-title { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.rail-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-meta { display: none; }
.rail-item:hover { background: oklch(0.3 0.05 268 / 0.4); color: var(--ink); }
.rail-item .x { opacity: 0; color: var(--ink-faint); flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; }
.rail-item:hover .x { opacity: 1; }
.rail-empty { padding: 8px 10px; color: var(--ink-faint); font-size: 0.82rem; }

.rail-toggle {
  position: absolute; top: 18px; left: 12px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-s);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  background: oklch(0.16 0.035 268 / 0.7);
  transition: transform var(--t-med) var(--ease-out);
}
.rail-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }

.chat-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--shell-h));
  min-height: 0;
  padding: 0 clamp(16px, 5vw, 64px);
}

/* Núcleo (estado vazio) */
.chat-hero {
  margin: auto;
  max-width: 720px;
  text-align: center;
  padding-bottom: 40px;
}

.core {
  position: relative;
  width: 130px; height: 130px;
  margin: 0 auto 30px;
}
.core-heart {
  position: absolute; inset: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, oklch(0.95 0.05 210), var(--cyan) 45%, var(--cyan-deep) 80%);
  box-shadow:
    0 0 30px oklch(0.83 0.13 215 / 0.65),
    0 0 90px oklch(0.83 0.13 215 / 0.3);
  animation: core-breathe 4.5s ease-in-out infinite;
}
@keyframes core-breathe {
  50% { transform: scale(1.08); box-shadow: 0 0 44px oklch(0.83 0.13 215 / 0.8), 0 0 120px oklch(0.83 0.13 215 / 0.4); }
}
.core-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid oklch(0.83 0.13 215 / 0.35);
}
.core-ring-a { animation: spin 14s linear infinite; border-style: dashed; }
.core-ring-b { inset: 12px; border-color: oklch(0.7 0.14 295 / 0.4); animation: spin 9s linear infinite reverse; }
.core-ring-c { inset: 24px; border-color: oklch(0.78 0.15 60 / 0.3); animation: spin 20s linear infinite; }
.core-ring-a::after, .core-ring-b::after {
  content: ""; position: absolute; top: -3px; left: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.core-ring-b::after { background: var(--violet); box-shadow: 0 0 8px var(--violet); }
@keyframes spin { to { transform: rotate(360deg); } }

.chat-greet {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 600; letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.chat-sub { color: var(--ink-dim); font-size: 1.05rem; margin-bottom: 34px; }

.starters {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
}
.starter {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: oklch(0.19 0.04 268 / 0.55);
  color: var(--ink-dim);
  font-size: 0.88rem;
  transition: border-color var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease-out), background var(--t-fast);
}
.starter:hover {
  border-color: oklch(0.83 0.13 215 / 0.5);
  color: var(--ink);
  transform: translateY(-2px);
  background: oklch(0.22 0.045 268 / 0.7);
}
.starter-k {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}
.starter-daily { border-color: oklch(0.86 0.14 92 / 0.4); }
.starter-daily:hover { border-color: oklch(0.86 0.14 92 / 0.8); }
.starter-k-daily { color: var(--gold); }
.starter-daily.is-done { opacity: 0.55; }

/* Conversa */
.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 0 calc(var(--composer-height, 96px) + 24px);
}
.chat-thread {
  max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 18px;
}
.chat-active-turn-spacer {
  flex: 0 0 auto;
  pointer-events: none;
}
.msg { display: flex; gap: 12px; max-width: 100%; animation: msg-in var(--t-med) var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(8px); } }
.msg-user { justify-content: flex-end; }
.msg-user .msg-body {
  background: linear-gradient(135deg, oklch(0.45 0.1 220 / 0.5), oklch(0.4 0.1 280 / 0.5));
  border: 1px solid oklch(0.83 0.13 215 / 0.25);
  border-radius: var(--r-l) var(--r-s) var(--r-l) var(--r-l);
  max-width: 78%;
}
.msg-ai .msg-body {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-s) var(--r-l) var(--r-l) var(--r-l);
  max-width: 88%;
}
.msg-body { padding: 13px 17px; font-size: 0.96rem; line-height: 1.6; overflow-wrap: break-word; }
.msg-body p + p { margin-top: 0.7em; }
.thinking-label { display: block; color: var(--muted); font-size: 0.9rem; margin-bottom: 9px; }
.image-progress { display: block; width: min(260px, 54vw); height: 4px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.1); margin-bottom: 10px; }
.image-progress i { display: block; width: 42%; height: 100%; border-radius: inherit; background: var(--cyan); animation: image-progress 1.15s ease-in-out infinite; }
.image-skeleton { display: none; width: min(260px, 54vw); aspect-ratio: 4/3; border-radius: 8px; background: linear-gradient(100deg, rgba(255,255,255,0.08), rgba(255,255,255,0.18), rgba(255,255,255,0.08)); background-size: 220% 100%; animation: image-skeleton 1.4s linear infinite; }
.is-thinking .thinking-label ~ .image-skeleton { display: block; }
@keyframes image-progress { 0% { transform: translateX(-120%); } 100% { transform: translateX(260%); } }
@keyframes image-skeleton { to { background-position-x: -220%; } }
.adaptive-blocks { margin-top: 14px; display: grid; gap: 10px; }
.adaptive-block { border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; padding: 11px 12px; background: rgba(255,255,255,0.04); }
.adaptive-block h4 { margin: 0 0 7px; font-size: 0.82rem; color: var(--cyan); }
.adaptive-block ol { margin: 0; padding-left: 1.1rem; }
.adaptive-block table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.adaptive-block th,.adaptive-block td { border-bottom: 1px solid rgba(255,255,255,0.1); padding: 6px; text-align: left; }
.adaptive-block pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.adaptive-visual svg { width: 100%; max-width: 360px; height: auto; display: block; }
.adaptive-visual line { stroke: var(--cyan); stroke-width: 1.4; opacity: 0.75; }
.adaptive-visual circle { fill: rgba(0,207,255,0.12); stroke: var(--cyan); stroke-width: 1.2; }
.adaptive-visual text { fill: var(--ink); font-size: 4px; text-anchor: middle; dominant-baseline: middle; }
.adaptive-visual circle,
.adaptive-visual text { cursor: pointer; transition: filter 0.18s ease, opacity 0.18s ease; }
.adaptive-visual circle:hover,
.adaptive-visual text:hover { filter: drop-shadow(0 0 5px rgba(0,207,255,0.65)); }
.adaptive-visual circle.is-active { filter: drop-shadow(0 0 7px rgba(0,207,255,0.8)); stroke-width: 2; }
.adaptive-visual text.is-active { font-weight: 700; }
.adaptive-visual-detail { margin-top: 7px; color: var(--muted); font-size: 0.86rem; }
.adaptive-generated-image img { width: 100%; max-width: 520px; border-radius: 8px; display: block; }
.adaptive-generated-image figcaption { margin-top: 7px; color: var(--muted); font-size: 0.86rem; }
.generated-image-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.generated-image-actions a,
.generated-image-actions button { border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.06); color: var(--ink); padding: 7px 10px; font: inherit; font-size: 0.86rem; text-decoration: none; cursor: pointer; }
.generated-image-actions a:hover,
.generated-image-actions button:hover { border-color: var(--cyan); }
.traffic-scene {
  display: grid;
  gap: 10px;
}
.traffic-scene svg {
  width: 100%;
  max-width: 520px;
  aspect-ratio: 1;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #49624f;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.traffic-vehicle {
  cursor: pointer;
  transition: opacity 0.18s ease, filter 0.18s ease;
}
.traffic-scene svg:has(.traffic-vehicle.is-active) .traffic-vehicle:not(.is-active) { opacity: 0.42; }
.traffic-vehicle:hover,
.traffic-vehicle:focus,
.traffic-vehicle.is-active { filter: drop-shadow(0 0 4px rgba(255,255,255,0.75)); outline: none; }
.traffic-vehicle-label {
  fill: #fff;
  font-size: 4px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  paint-order: stroke;
  stroke: rgba(0,0,0,0.45);
  stroke-width: 0.7px;
}
.traffic-priority-number {
  fill: #111827;
  font-size: 5px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #fef3c7;
  stroke-width: 2px;
}
.traffic-legend {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) 1.2fr;
  gap: 12px;
  font-size: 0.84rem;
}
.traffic-legend div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: start;
}
.traffic-legend strong { flex-basis: 100%; color: var(--ink); }
.traffic-legend span {
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--ink);
}
.traffic-legend ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
}
.adaptive-chart { height: 130px; display: flex; align-items: end; gap: 9px; padding-top: 10px; }
.adaptive-chart span { flex: 1; min-width: 18px; border-radius: 5px 5px 0 0; background: linear-gradient(180deg, var(--cyan), var(--gold)); }
.adaptive-generated-image { margin: 0; display: grid; gap: 7px; }
.adaptive-generated-image img { width: 100%; max-width: 520px; border-radius: 8px; display: block; }
.adaptive-generated-image figcaption { color: var(--muted); font-size: 0.84rem; }
.adaptive-journey { display: flex; flex-wrap: wrap; gap: 7px; }
.adaptive-journey span { border: 1px solid rgba(0,207,255,0.22); border-radius: 999px; padding: 5px 9px; color: var(--muted); font-size: 0.78rem; }
.adaptive-journey button {
  border: 1px solid rgba(0,207,255,0.28);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(0,207,255,0.08);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.adaptive-journey button:hover,
.adaptive-journey button:focus-visible { border-color: var(--cyan); outline: none; }
.msg-orb {
  flex: 0 0 auto;
  width: 30px; height: 30px; margin-top: 3px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, oklch(0.95 0.05 210), var(--cyan) 50%, var(--cyan-deep));
  box-shadow: 0 0 12px oklch(0.83 0.13 215 / 0.5);
}
.msg-ai.is-thinking .msg-orb { animation: core-breathe 1.1s ease-in-out infinite; }
.dots { display: inline-flex; gap: 5px; padding-block: 4px; }
.dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-faint);
  animation: dot 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 40% { transform: translateY(-4px); background: var(--cyan); } }

/* Compositor */
.composer {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 8px;
  max-width: 760px; width: 100%;
  margin: 10px auto;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  background: oklch(0.16 0.035 268 / 0.85);
  backdrop-filter: blur(14px);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.composer:focus-within {
  border-color: oklch(0.83 0.13 215 / 0.6);
  box-shadow: 0 0 24px oklch(0.83 0.13 215 / 0.15);
}
.composer.is-dragging-files {
  border-color: oklch(0.86 0.14 92 / 0.75);
  box-shadow: 0 0 24px oklch(0.86 0.14 92 / 0.18);
}
.composer-input {
  flex: 1; background: none; border: 0; outline: none;
  font-size: 0.98rem; padding-block: 8px;
}
.composer-input::placeholder { color: var(--ink-faint); }
.composer-icon {
  display: grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  color: var(--ink-faint);
  transition: color var(--t-fast), background var(--t-fast);
}
.composer-icon:hover { color: var(--ink); background: oklch(0.3 0.05 268 / 0.5); }
.composer-send {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cyan);
  color: oklch(0.15 0.03 220);
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast);
}
.composer-send:hover { transform: scale(1.06); box-shadow: 0 0 18px oklch(0.83 0.13 215 / 0.5); }
.attachment-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 760px;
  width: 100%;
  margin: 8px auto 0;
}
.attachment-queue[hidden] { display: none; }
.attachment-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  width: min(100%, 250px);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: oklch(0.18 0.035 268 / 0.86);
}
.attachment-thumb,
.attachment-icon {
  width: 42px;
  height: 42px;
  border-radius: 7px;
}
.attachment-thumb { object-fit: cover; }
.attachment-icon {
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: oklch(0.24 0.05 268 / 0.7);
  font-size: 0.72rem;
  font-weight: 700;
}
.attachment-meta { min-width: 0; }
.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--ink);
}
.attachment-state {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.attachment-card.is-error .attachment-state { color: var(--danger); }
.attachment-remove {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--ink-faint);
}
.attachment-remove:hover { color: var(--ink); background: oklch(0.3 0.05 268 / 0.5); }
.attachment-remove:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============ Botões ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px;
  border-radius: var(--r-m);
  font-weight: 600; font-size: 0.92rem;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: oklch(0.83 0.13 215 / 0.14);
  border: 1px solid oklch(0.83 0.13 215 / 0.4);
  color: var(--cyan);
}
.btn-primary:hover { background: oklch(0.83 0.13 215 / 0.22); box-shadow: 0 0 16px oklch(0.83 0.13 215 / 0.2); }
.btn-launch {
  background: linear-gradient(135deg, var(--orange), oklch(0.7 0.17 40));
  color: oklch(0.16 0.05 60);
  box-shadow: 0 4px 24px oklch(0.78 0.15 60 / 0.3);
}
.btn-launch:hover { transform: translateY(-2px); box-shadow: 0 8px 32px oklch(0.78 0.15 60 / 0.45); }
.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink-dim);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-faint); }

/* ============ EXAME: setup ============ */
.exam-setup, .exam-run, .exam-reveal, .exam-end {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(24px, 6vh, 60px) 20px 60px;
}
.exam-head { text-align: center; margin-bottom: 36px; }
.exam-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -0.02em; margin-bottom: 10px; }
.exam-head p { color: var(--ink-dim); font-size: 1.02rem; }

.exam-form {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 26px;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 150px; }
.field-grow { flex: 2 1 280px; }
.field-s { flex: 0 1 130px; }
.field-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.field input, .field select {
  padding: 12px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: oklch(0.17 0.035 268 / 0.7);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus, .field select:focus {
  border-color: oklch(0.78 0.15 60 / 0.55);
  box-shadow: 0 0 16px oklch(0.78 0.15 60 / 0.12);
}

/* Modos de jogo */
.modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 30px;
}
.mode {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: oklch(0.17 0.035 268 / 0.6);
  text-align: left;
  transition: border-color var(--t-fast), transform var(--t-fast) var(--ease-out), background var(--t-fast), box-shadow var(--t-fast);
}
.mode:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.mode.is-active {
  border-color: oklch(0.78 0.15 60 / 0.65);
  background: oklch(0.22 0.05 60 / 0.25);
  box-shadow: 0 0 24px oklch(0.78 0.15 60 / 0.18);
}
.mode-badge {
  font-size: 1.15rem; line-height: 1;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 12px;
  margin-bottom: 2px;
}
.mode-badge-c { background: oklch(0.83 0.13 215 / 0.15); color: var(--cyan); }
.mode-badge-s { background: oklch(0.86 0.14 92 / 0.15); color: var(--gold); }
.mode-badge-m { background: oklch(0.68 0.19 20 / 0.18); color: var(--red); }
.mode-badge-b { background: oklch(0.7 0.14 295 / 0.18); color: var(--violet); }
.mode-name { font-weight: 700; font-size: 1rem; }
.mode-desc { color: var(--ink-dim); font-size: 0.8rem; line-height: 1.4; }
.mode-xp { margin-top: 4px; font-size: 0.7rem; color: var(--gold); }

.exam-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ EXAME: a decorrer ============ */
.run-hud { margin-bottom: 26px; }
.run-track { display: flex; gap: 7px; margin-bottom: 12px; }
.run-dot {
  flex: 1; height: 6px; border-radius: 99px;
  background: oklch(0.3 0.04 268);
  transition: background var(--t-med), box-shadow var(--t-med);
}
.run-dot.is-now { background: var(--orange); box-shadow: 0 0 10px oklch(0.78 0.15 60 / 0.6); }
.run-dot.is-good { background: var(--green); }
.run-dot.is-mid { background: var(--gold); }
.run-dot.is-bad { background: var(--red); }

.run-meta {
  display: flex; align-items: center; gap: 16px;
  font-size: 0.78rem; color: var(--ink-dim);
}
.run-mode { letter-spacing: 0.14em; color: var(--orange); }
.run-lives { color: var(--red); font-size: 0.95rem; letter-spacing: 3px; }
.run-combo { color: var(--gold); }
.run-combo.bump { animation: bump 0.5s var(--ease-out); }
.run-timer { margin-left: auto; font-size: 0.95rem; color: var(--ink); }
.run-timer.is-low { color: var(--red); animation: pulse-red 1s ease-in-out infinite; }
@keyframes pulse-red { 50% { opacity: 0.5; } }

.run-card {
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: oklch(0.16 0.035 268 / 0.8);
  backdrop-filter: blur(10px);
  padding: clamp(20px, 4vw, 36px);
}
.run-qn { font-size: 0.72rem; color: var(--ink-faint); letter-spacing: 0.16em; margin-bottom: 14px; }
.run-q { font-size: clamp(1.15rem, 2.4vw, 1.5rem); line-height: 1.45; font-weight: 600; margin-bottom: 24px; }
.run-answer {
  width: 100%;
  padding: 16px;
  border-radius: var(--r-m);
  border: 1px solid var(--line);
  background: oklch(0.13 0.03 268 / 0.8);
  resize: vertical; min-height: 130px;
  line-height: 1.6; font-size: 0.98rem;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.run-answer:focus { border-color: oklch(0.78 0.15 60 / 0.5); box-shadow: 0 0 20px oklch(0.78 0.15 60 / 0.1); }
.run-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 18px; flex-wrap: wrap;
}
.run-hint { font-size: 0.78rem; color: var(--ink-faint); }

/* ============ EXAME: revelação ============ */
.exam-reveal { text-align: center; }
.reveal-eyebrow {
  font-size: 0.72rem; letter-spacing: 0.22em; color: var(--ink-faint);
  margin-bottom: 30px;
}
.reveal-eyebrow.is-scanning { animation: scanning 1.2s ease-in-out infinite; color: var(--cyan); }
@keyframes scanning { 50% { opacity: 0.35; } }

.gauge { position: relative; width: 220px; margin: 0 auto 22px; }
.gauge svg { width: 100%; transform: rotate(-90deg); }
.gauge circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.gauge-bg { stroke: oklch(0.28 0.04 268); }
.gauge-fg {
  stroke: var(--grade-c, var(--cyan));
  stroke-dasharray: 603.2;      /* 2πr, r=96 */
  stroke-dashoffset: 603.2;
  filter: drop-shadow(0 0 10px var(--grade-c, var(--cyan)));
  transition: stroke-dashoffset 2.2s var(--ease-out), stroke 0.6s;
}
.gauge-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.gauge-n { font-size: 3.6rem; font-weight: 700; line-height: 1; color: var(--grade-c, var(--ink)); }
.gauge-sub { color: var(--ink-faint); font-size: 0.9rem; margin-top: 4px; }

.reveal-verdict {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em;
  min-height: 1.5em;
  color: var(--grade-c, var(--ink));
  opacity: 0; transform: translateY(8px);
  transition: opacity var(--t-slow) var(--ease-out), transform var(--t-slow) var(--ease-out);
}
.reveal-verdict.is-in { opacity: 1; transform: none; }
.reveal-xp {
  color: var(--gold); font-size: 0.95rem; min-height: 1.4em; margin-top: 8px;
  opacity: 0; transition: opacity var(--t-slow) var(--ease-out);
}
.reveal-xp.is-in { opacity: 1; }

.skills {
  max-width: 480px; margin: 26px auto 0;
  display: flex; flex-direction: column; gap: 13px;
  text-align: left;
}
.skill { opacity: 0; transform: translateX(-10px); transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out); }
.skill.is-in { opacity: 1; transform: none; }
.skill-top { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 5px; }
.skill-name { color: var(--ink-dim); }
.skill-val { color: var(--ink); }
.skill-bar { height: 6px; border-radius: 99px; background: oklch(0.28 0.04 268); overflow: hidden; }
.skill-fill {
  height: 100%; width: 0; border-radius: 99px;
  transition: width 1.1s var(--ease-out);
}

.reveal-model {
  max-width: 480px; margin: 26px auto 0;
  padding: 20px 22px;
  border: 1px solid oklch(0.86 0.14 92 / 0.3);
  border-radius: var(--r-l);
  background: oklch(0.2 0.045 92 / 0.14);
  text-align: left;
  animation: view-in var(--t-slow) var(--ease-out);
}
.reveal-model h3 { font-size: 0.95rem; color: var(--gold); margin-bottom: 10px; }
.reveal-model p { font-size: 0.9rem; color: var(--ink-dim); line-height: 1.6; }

.reveal-plan {
  max-width: 480px; margin: 30px auto 0;
  padding: 20px 22px;
  border: 1px solid oklch(0.83 0.13 215 / 0.25);
  border-radius: var(--r-l);
  background: oklch(0.18 0.04 240 / 0.5);
  text-align: left;
  animation: view-in var(--t-slow) var(--ease-out);
}
.reveal-plan h3 { font-size: 0.95rem; color: var(--cyan); margin-bottom: 12px; }
.reveal-plan ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.reveal-plan li {
  display: flex; gap: 10px;
  font-size: 0.9rem; color: var(--ink-dim); line-height: 1.5;
}
.reveal-plan li::before { content: "→"; color: var(--cyan); flex: 0 0 auto; }

.reveal-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: 30px;
  animation: view-in var(--t-slow) var(--ease-out);
}

/* ============ EXAME: fim ============ */
.exam-end { text-align: center; }
.end-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: 24px; }
.end-stats {
  display: flex; justify-content: center; gap: clamp(18px, 5vw, 48px);
  margin-bottom: 30px; flex-wrap: wrap;
}
.end-stat { text-align: center; }
.end-stat-n { display: block; font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; }
.end-stat-l { font-size: 0.75rem; color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase; }
.end-const { max-width: 100%; }
.end-const-cap { color: var(--ink-dim); font-size: 0.9rem; margin: 10px 0 26px; }

/* Revisão pergunta a pergunta */
.end-review {
  max-width: 660px; margin: 6px auto 30px;
  text-align: left;
}
.end-review > h3 {
  font-size: 1rem; color: var(--ink);
  margin-bottom: 12px; text-align: center;
}
.review-item {
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  background: oklch(0.16 0.035 268 / 0.75);
  margin-bottom: 8px;
  overflow: hidden;
}
.review-item summary {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  transition: background var(--t-fast);
}
.review-item summary::-webkit-details-marker { display: none; }
.review-item summary:hover { background: oklch(0.2 0.04 268 / 0.6); }
.review-item summary::after {
  content: "▾"; margin-left: auto; color: var(--ink-faint);
  transition: transform var(--t-fast);
}
.review-item[open] summary::after { transform: rotate(180deg); }
.review-score {
  flex: 0 0 auto;
  min-width: 34px; text-align: center;
  font-weight: 700; font-size: 0.95rem;
}
.review-q {
  color: var(--ink-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.review-item[open] .review-q { white-space: normal; }
.review-body { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.review-block {
  padding: 12px 14px;
  border-radius: var(--r-s);
  font-size: 0.86rem; line-height: 1.55;
}
.review-block h4 {
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 6px; font-weight: 600;
}
.review-block p { color: var(--ink-dim); }
.review-mine { background: oklch(0.2 0.04 268 / 0.55); border: 1px solid var(--line); }
.review-mine h4 { color: var(--ink-faint); }
.review-model { background: oklch(0.2 0.045 92 / 0.12); border: 1px solid oklch(0.86 0.14 92 / 0.25); }
.review-model h4 { color: var(--gold); }

/* Painel de perfil */
.profile-pop {
  position: absolute; top: calc(100% + 12px); right: 0;
  width: 300px;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: oklch(0.15 0.035 268 / 0.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 60px oklch(0.05 0.02 268 / 0.7);
  z-index: var(--z-overlay);
  animation: view-in var(--t-med) var(--ease-out);
}
.profile-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.profile-avatar {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan-deep), oklch(0.45 0.12 280));
  font-weight: 700;
}
.profile-name { font-weight: 700; }
.profile-level { font-size: 0.78rem; color: var(--gold); }
.profile-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  margin-bottom: 14px;
  padding: 10px 6px;
  border-radius: var(--r-m);
  background: oklch(0.19 0.04 268 / 0.7);
}
.profile-stat { text-align: center; }
.profile-stat span { display: block; font-size: 0.95rem; font-weight: 700; }
.profile-stat small { font-size: 0.62rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.profile-plan { margin-bottom: 12px; }
.profile-plan-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.82rem; color: var(--ink-dim);
  margin-bottom: 10px;
}
.profile-plan-badge {
  font-size: 0.72rem; font-weight: 600;
  padding: 3px 10px; border-radius: 99px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.profile-upgrade { width: 100%; text-decoration: none; font-size: 0.88rem; }
.profile-links {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
}
.profile-links a, .profile-links button { color: var(--ink-dim); text-decoration: none; font-size: 0.8rem; }
.profile-links a:hover, .profile-links button:hover { color: var(--ink); }
.profile-danger { color: oklch(0.68 0.19 20 / 0.8); font-size: 0.8rem; }
.profile-danger:hover { color: var(--red); }

/* ============ OBSERVATÓRIO ============ */
.view-prog { padding-inline: clamp(16px, 4vw, 48px); padding-bottom: 60px; }
.prog-head { text-align: center; padding: clamp(20px, 5vh, 46px) 0 30px; }
.prog-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -0.02em; margin-bottom: 10px; }
.prog-head p { color: var(--ink-dim); }

.prog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  max-width: 1240px;
  margin: 0 auto;
}

.prog-sky-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: oklch(0.11 0.03 268 / 0.7);
  overflow: hidden;
  min-height: 520px;
}
#skyMap { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sky-tip {
  position: absolute;
  padding: 10px 14px;
  border-radius: var(--r-m);
  border: 1px solid var(--line-strong);
  background: oklch(0.15 0.035 268 / 0.95);
  font-size: 0.82rem;
  pointer-events: none;
  z-index: 2;
  max-width: 230px;
}
.sky-tip b { display: block; margin-bottom: 2px; }
.sky-tip .t-meta { color: var(--ink-dim); }
.sky-empty {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center; color: var(--ink-dim);
  font-size: 1.02rem; line-height: 1.7;
  padding: 20px;
}

.prog-side { display: flex; flex-direction: column; gap: 16px; }
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  background: oklch(0.16 0.035 268 / 0.75);
  backdrop-filter: blur(8px);
  padding: 18px 20px;
}

.level-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.level-title { font-weight: 700; font-size: 1.1rem; }
.level-xp { color: var(--gold); font-size: 0.8rem; }
.level-bar { height: 7px; border-radius: 99px; background: oklch(0.28 0.04 268); overflow: hidden; margin-bottom: 8px; }
.level-fill {
  height: 100%; width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold), var(--orange));
  transition: width var(--t-slow) var(--ease-out);
}
.level-next { font-size: 0.8rem; color: var(--ink-dim); margin-bottom: 14px; }
.ladder { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.ladder li {
  font-size: 0.72rem; padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--ink-faint);
}
.ladder li.is-done { color: var(--ink-dim); border-color: var(--line-strong); }
.ladder li.is-now { color: var(--gold); border-color: oklch(0.86 0.14 92 / 0.5); }

.streak-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.streak-big {
  font-family: var(--font-mono); font-size: 2.4rem; font-weight: 700;
  color: var(--orange); line-height: 1;
}
.streak-lab { font-weight: 600; font-size: 0.9rem; }
.streak-sub { font-size: 0.78rem; color: var(--ink-dim); }
.streak-cal { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.cal-day {
  aspect-ratio: 1; border-radius: 3px;
  background: oklch(0.26 0.04 268);
}
.cal-day.l1 { background: oklch(0.45 0.09 60); }
.cal-day.l2 { background: oklch(0.62 0.13 60); }
.cal-day.l3 { background: oklch(0.78 0.15 60); box-shadow: 0 0 5px oklch(0.78 0.15 60 / 0.5); }
.cal-day.is-today { outline: 1px solid var(--ink-dim); outline-offset: 1px; }

.league-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.league-head h3 { font-size: 1rem; }
.league-timer { font-size: 0.72rem; color: var(--violet); }
.league-list { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.league-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-s);
  font-size: 0.86rem;
}
.league-row .pos { font-family: var(--font-mono); width: 20px; color: var(--ink-faint); font-size: 0.78rem; }
.league-row .nm { flex: 1; color: var(--ink-dim); }
.league-row .pts { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-dim); }
.league-row.is-me {
  background: oklch(0.83 0.13 215 / 0.1);
  border: 1px solid oklch(0.83 0.13 215 / 0.3);
}
.league-row.is-me .nm { color: var(--ink); font-weight: 600; }
.league-row.is-promo .pos { color: var(--green); }
.league-note { font-size: 0.74rem; color: var(--ink-faint); }

/* ============ Toasts ============ */
.toasts {
  position: fixed; top: calc(var(--shell-h) + 10px); right: 18px;
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  border-radius: var(--r-m);
  border: 1px solid oklch(0.86 0.14 92 / 0.4);
  background: oklch(0.17 0.04 268 / 0.95);
  font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 8px 30px oklch(0.05 0.02 268 / 0.6);
  animation: toast-in 0.45s var(--ease-out);
}
.toast.out { animation: toast-out 0.4s var(--ease-out) forwards; }
.toast-xp { color: var(--gold); }
.toast-streak { color: var(--orange); border-color: oklch(0.78 0.15 60 / 0.4); }
.toast-star { color: var(--cyan); border-color: oklch(0.83 0.13 215 / 0.4); }
@keyframes toast-in { from { opacity: 0; transform: translateX(30px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* ============ Level-up ============ */
.levelup {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  display: grid; place-items: center;
  background: oklch(0.07 0.02 268 / 0.8);
  backdrop-filter: blur(6px);
  animation: fade-in 0.4s var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } }
.levelup-card {
  text-align: center;
  padding: 46px 60px;
  border-radius: var(--r-l);
  border: 1px solid oklch(0.86 0.14 92 / 0.4);
  background: oklch(0.15 0.035 268 / 0.95);
  box-shadow: 0 0 80px oklch(0.86 0.14 92 / 0.2);
  animation: levelup-in 0.6s var(--ease-out);
}
@keyframes levelup-in { from { opacity: 0; transform: scale(0.85); } }
.levelup-title {
  font-size: 2.4rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--gold);
  margin: 4px 0 8px;
}
.levelup-sub { color: var(--ink-dim); margin-bottom: 26px; }

/* ============ Responsivo ============ */
@media (max-width: 1020px) {
  .prog-grid { grid-template-columns: 1fr; }
  .prog-sky-wrap { min-height: 380px; }
}
@media (max-width: 860px) {
  .hud-xp { display: none; }
  .chat-rail {
    position: fixed; left: 0; top: var(--shell-h); bottom: 0;
    background: oklch(0.12 0.03 268 / 0.96);
  }
  .chat-rail.is-hidden {
    margin-left: 0;
    visibility: hidden;
    transform: translateX(-100%);
  }
  .chat-rail:not(.is-hidden) { box-shadow: 30px 0 60px oklch(0.05 0.02 268 / 0.5); }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding-inline: 14px; }
  .hud { margin-left: auto; }
  .hud-streak { padding: 6px 9px; }
  /* navegação passa para uma barra inferior, estilo app */
  .mainnav {
    position: fixed; bottom: 12px; left: 14px; right: 14px;
    margin: 0;
    justify-content: space-around;
    background: oklch(0.14 0.035 268 / 0.92);
    box-shadow: 0 10px 40px oklch(0.05 0.02 268 / 0.7);
  }
  .mainnav-link { flex: 1; text-align: center; padding: 9px 6px; font-size: 0.86rem; }
  .view { padding-bottom: 76px; }
  .composer { margin-bottom: 0; }
  .chat-stage { height: calc(100dvh - var(--shell-h) - 76px); }
  .levelup-card { padding: 34px 26px; margin: 16px; }
  .toasts { right: 12px; left: 12px; align-items: flex-end; }
}

/* ============ Movimento reduzido ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .core-ring-a, .core-ring-b, .core-ring-c, .core-heart { animation: none; }
}
