/* PAUL-AI — temă „cabină de zbor pe timp de noapte".
   Charcoal profund + un singur accent auriu (Fondatorii). HUD cu reținere. */

:root {
  --bg:        #191a1d;   /* charcoal profund, nu negru */
  --bg-1:      #202024;   /* suprafețe ridicate: header, bară input, carduri */
  --bg-2:      #26272b;   /* bule mesaj, hover */
  --bg-3:      #2e2f34;   /* elevat */
  --line:      rgba(255,255,255,.07);
  --line-2:    rgba(255,255,255,.12);
  --gold:      #fdb913;   /* accentul unic */
  --gold-2:    #ffca4d;
  --gold-tint: rgba(253,185,19,.13);
  --gold-line: rgba(253,185,19,.30);
  --gold-glow: rgba(253,185,19,.22);
  --ink:       #101014;   /* text pe auriu */
  --text:      #e9e9ec;
  --dim:       #9a9aa1;
  --faint:     #66666d;
  --danger:    #d67a6e;   /* roșu stins, o singură nuanță */
  --danger-bg: rgba(214,122,110,.10);
  --danger-line: rgba(214,122,110,.32);
  --radius:    8px;
  --radius-lg: 12px;
  --maxw:      720px;
  --ff-display: "Archivo", -apple-system, system-ui, sans-serif;
  --ff-body:    "Inter", -apple-system, system-ui, sans-serif;
  --ff-mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* altfel .center/.app (display:grid/flex) înving atributul hidden */
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden; /* shell-ul își gestionează scroll-ul intern */
}

/* subtila lumină de sus, ca reflexul unui panou de bord */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(120% 80% at 50% -10%, rgba(253,185,19,.05), transparent 60%);
  pointer-events: none; z-index: 0;
}

/* ── Giroscopul 3D din fundal ─────────────────────────────────────── */
#gyro {
  position: fixed; inset: 0;
  width: 100%; height: 100%; /* canvas = element replaced: fără asta nu se întinde */
  z-index: 0;
  pointer-events: none;
}

/* ── Galeria de cursuri Fondatorii — marquee subtil, în spate de tot ── */
.marquee {
  position: fixed; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  z-index: 0; pointer-events: none; overflow: hidden; opacity: .12;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
.mtrack { display: flex; gap: 18px; width: max-content; will-change: transform; animation: slideR 460s linear infinite; }
.mpanel {
  flex: none; width: 206px; border-radius: 10px; overflow: hidden;
  border: 1px solid rgba(253,185,19,.18);
}
.mpanel img { display: block; width: 100%; height: auto; filter: saturate(.85); }
@keyframes slideR { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .mtrack { animation: none; } }

/* ── Etichete HUD ─────────────────────────────────────────────────── */
.hud {
  font-family: var(--ff-mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
}
.hud-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); margin-right: 7px; vertical-align: middle;
  box-shadow: 0 0 8px var(--gold-glow);
}

/* ── Butoane ──────────────────────────────────────────────────────── */
.btn {
  font-family: var(--ff-body); font-size: 15px; font-weight: 600;
  border: 1px solid var(--line-2); background: transparent; color: var(--text);
  padding: 12px 18px; border-radius: var(--radius); cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--gold-line); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--gold-tint); border-color: var(--gold-line); color: var(--gold);
  font-weight: 700; letter-spacing: .01em;
  box-shadow: 0 6px 26px -14px var(--gold-glow);
}
.btn-primary:hover { background: rgba(253,185,19,.20); border-color: var(--gold); box-shadow: 0 0 22px -6px var(--gold-glow); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Inputuri ─────────────────────────────────────────────────────── */
input, textarea {
  font-family: var(--ff-body); font-size: 16px; /* ≥16 = fără zoom iOS */
  color: var(--text); background: var(--bg-2);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 12px 14px; width: 100%; resize: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input.mono { font-family: var(--ff-mono); letter-spacing: .12em; }

/* focus vizibil, auriu, peste tot */
:where(a, button, input, textarea, .chip):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ── Simbolul (inel-săgeată) ──────────────────────────────────────── */
.mark { display: inline-block; color: var(--gold); flex: none; }
.mark svg { display: block; }

/* ═══════════════════ SHELL CHAT (index) ═══════════════════ */
.app { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(25,26,29,.82); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand .wordmark {
  font-family: var(--ff-display); font-weight: 800; font-size: 18px;
  letter-spacing: .01em; color: var(--text);
}
.brand .wordmark b { color: var(--gold); font-weight: 800; }
.status { display: flex; align-items: center; }

/* fluxul de mesaje */
.stream { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.stream-inner { max-width: var(--maxw); margin: 0 auto; padding: 22px 16px 8px; }

.msg { display: flex; gap: 10px; margin: 18px 0; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .avatar {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--gold-line); background: var(--gold-tint);
  display: grid; place-items: center; color: var(--gold);
}
.msg .bubble {
  border-radius: var(--radius-lg); padding: 11px 14px; max-width: 82%;
  border: 1px solid var(--line);
}
.msg.ai .bubble { background: var(--bg-1); border-top-left-radius: 4px; }
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble {
  background: var(--bg-2); border-top-right-radius: 4px;
  border-color: var(--line-2);
}
.msg.me .avatar { border-color: var(--line-2); background: var(--bg-3); color: var(--dim); }

/* markdown randat */
.bubble p { margin: 0 0 .6em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble strong { color: #fff; font-weight: 600; }
.bubble ul, .bubble ol { margin: .4em 0 .6em; padding-left: 1.25em; }
.bubble li { margin: .2em 0; }
.bubble a { color: var(--gold); text-decoration: none; border-bottom: 1px solid var(--gold-line); }
.bubble a:hover { border-bottom-color: var(--gold); }
.bubble code {
  font-family: var(--ff-mono); font-size: .88em; background: var(--bg-3);
  padding: 1px 5px; border-radius: 4px;
}

/* empty state / bun venit */
.welcome { max-width: var(--maxw); margin: 0 auto; padding: 8px 16px 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.chip {
  font-family: var(--ff-body); font-size: 13.5px; color: var(--text);
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; transition: border-color .15s, background .15s;
}
.chip:hover { border-color: var(--gold-line); background: var(--bg-2); }

/* „se gândește" — trei liniuțe-instrument */
.thinking { display: inline-flex; align-items: center; gap: 5px; height: 20px; }
.thinking i {
  width: 3px; height: 14px; background: var(--gold); border-radius: 2px; opacity: .35;
  animation: blip 1s ease-in-out infinite;
}
.thinking i:nth-child(2) { animation-delay: .16s; }
.thinking i:nth-child(3) { animation-delay: .32s; }
@keyframes blip { 0%,100% { opacity: .25; transform: scaleY(.6); } 50% { opacity: 1; transform: scaleY(1); } }

/* card calm pentru 429 / info */
.notice {
  max-width: var(--maxw); margin: 6px auto; padding: 14px 16px;
  border: 1px solid var(--gold-line); background: var(--gold-tint);
  border-radius: var(--radius-lg); color: var(--text); font-size: 14.5px;
}
.notice.err { border-color: var(--danger-line); background: var(--danger-bg); }
.notice .hud { margin-bottom: 6px; color: var(--gold); }
.notice.err .hud { color: var(--danger); }

/* bara de input jos */
.dock {
  border-top: 1px solid var(--line);
  background: rgba(25,26,29,.9); backdrop-filter: blur(10px);
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom));
}
.composer { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 10px; align-items: flex-end; }
.field { position: relative; flex: 1; }
.field textarea {
  min-height: 46px; max-height: 160px; padding-right: 54px; line-height: 1.4;
}
.counter {
  position: absolute; right: 12px; bottom: 8px;
  font-family: var(--ff-mono); font-size: 10.5px; color: var(--faint);
  letter-spacing: .05em; pointer-events: none;
}
.counter.warn { color: var(--gold); }
.counter.over { color: var(--danger); }
.send {
  flex: none; width: 46px; height: 46px; border-radius: var(--radius);
  border: 1px solid var(--gold-line); background: var(--gold-tint); color: var(--gold);
  display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 0 18px -8px var(--gold-glow);
}
.send:hover { background: rgba(253,185,19,.20); border-color: var(--gold); }
.send:disabled { background: var(--bg-2); border-color: var(--line-2); color: var(--faint); box-shadow: none; cursor: not-allowed; }
/* butonul „Vezi istoric" — auriu, cu text, la stânga barei de chat */
.histbtn {
  flex: none; height: 46px; padding: 0 13px; border-radius: var(--radius);
  border: 1px solid var(--gold-line); background: var(--gold-tint); color: var(--gold);
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font: 600 13px/1 inherit; font-family: inherit; white-space: nowrap;
  box-shadow: 0 0 18px -8px var(--gold-glow);
}
.histbtn:hover { background: rgba(253,185,19,.20); border-color: var(--gold); }
.histbtn:disabled { opacity: .5; cursor: wait; }
/* separatorul de deasupra istoricului încărcat */
.hist-sep { text-align: center; color: var(--faint); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; margin: 14px 0 4px; }

/* contor „câte întrebări azi" + card de upsell la epuizare */
.quota { max-width: var(--maxw); margin: 0 auto 9px; text-align: center; font-size: 13px; color: var(--dim); }
.quota b { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.quota.low b { color: var(--danger); }
.upsell {
  max-width: var(--maxw); margin: 0 auto; text-align: center;
  border: 1px solid var(--gold-line); background: var(--gold-tint);
  border-radius: var(--radius-lg); padding: 16px 18px;
}
.upsell .hud { display: inline-flex; align-items: center; color: var(--gold); margin-bottom: 8px; }
.upsell p { margin: 0 0 14px; color: var(--text); font-size: 14.5px; line-height: 1.5; }
.upsell p b { color: var(--gold); }
.upsell .btn-primary { display: inline-block; text-decoration: none; }

/* ═══════════════════ GATE + acces (centrate) ═══════════════════ */
.center {
  position: relative; z-index: 1; min-height: 100dvh;
  display: flex; flex-direction: column; justify-content: safe center;
  padding: 24px 18px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
}
.center > * { width: min(100%, 420px); margin-inline: auto; }
.center > .foot { width: min(100%, 720px); }
.panel {
  width: min(100%, 420px); background: var(--bg-1);
  border: 1px solid var(--line-2); border-radius: 16px; padding: 30px 26px;
  box-shadow: 0 30px 80px -40px rgba(0,0,0,.8);
}
.panel .cap {
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
}
.panel h1 {
  font-family: var(--ff-display); font-weight: 800; font-size: 26px; margin: 4px 0 0;
  letter-spacing: .01em; text-wrap: balance;
}
.panel h1 b { color: var(--gold); }
.panel .sub { color: var(--dim); font-size: 14.5px; margin: 0; text-wrap: balance; }
.panel form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; }
.panel .hint { color: var(--faint); font-size: 12.5px; text-align: center; margin: 4px 0 0; }
.panel .hint a { color: var(--dim); }
.label { font-family: var(--ff-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 7px; display: block; }
.field-block { text-align: left; }
.field-block .counter { position: static; display: block; text-align: right; margin-top: 5px; }
.check { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 13px; color: var(--dim); line-height: 1.45; }
.check input { width: 18px; height: 18px; flex: none; margin-top: 1px; accent-color: var(--gold); }
.err-line { color: var(--danger); font-size: 13px; min-height: 17px; text-align: center; margin: 0; }

/* ── Boarding pass (momentul de design) ──────────────────────────── */
.pass {
  width: min(100%, 420px); background: linear-gradient(180deg, var(--bg-1), #1c1d21);
  border: 1px solid var(--gold-line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(253,185,19,.06), 0 30px 90px -40px rgba(0,0,0,.85);
  animation: rise .4s ease both;
}
.pass .strip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px dashed var(--gold-line);
  background: var(--gold-tint);
}
.pass .strip .hud { color: var(--gold); }
.pass .body { padding: 22px 24px 24px; }
.pass .row { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.pass .k { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.pass .name { font-family: var(--ff-display); font-weight: 700; font-size: 20px; }
.pass .code-wrap { text-align: center; margin: 6px 0 4px; }
.pass .code {
  font-family: var(--ff-mono); font-weight: 600; font-size: 34px; letter-spacing: .34em;
  color: var(--gold); text-shadow: 0 0 24px var(--gold-glow); padding-left: .34em;
}
.pass .barcode {
  height: 34px; margin: 18px 0 6px; border-radius: 4px;
  background-image: repeating-linear-gradient(90deg, var(--faint) 0 2px, transparent 2px 5px, var(--dim) 5px 6px, transparent 6px 10px);
  opacity: .5;
}
.pass .warn { color: var(--dim); font-size: 12.5px; text-align: center; margin: 12px 0 0; }
.copybar { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.copybar .btn { width: 100%; }

/* ── Footer ───────────────────────────────────────────────────────── */
.foot {
  max-width: var(--maxw); margin: 8px auto 0; padding: 14px 16px 22px;
  text-align: center; color: var(--faint); font-size: 12px; line-height: 1.5;
}
.foot img { height: 15px; opacity: .5; margin-bottom: 8px; display: inline-block; }
.center .foot { margin-top: 20px; }

/* ── Toast copiere ────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  background: var(--bg-3); border: 1px solid var(--gold-line); color: var(--text);
  font-size: 13.5px; padding: 10px 16px; border-radius: 999px; z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Desktop ──────────────────────────────────────────────────────── */
@media (min-width: 760px) {
  .brand .wordmark { font-size: 20px; }
  .stream-inner { padding-top: 30px; }
  .msg .bubble { max-width: 76%; }
}

/* ── Mișcare redusă: giroscopul static, fără animații ─────────────── */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}


/* ── POZE ATAȘATE LA MESAJ ────────────────────────────────────────────── */
.atasbtn {
  flex: none; height: 46px; width: 46px; border-radius: var(--radius);
  border: 1px solid var(--gold-line); background: var(--gold-tint); color: var(--gold);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 0 18px -8px var(--gold-glow);
}
.atasbtn:hover { background: rgba(253,185,19,.20); border-color: var(--gold); }
.atasbtn:disabled { opacity: .5; cursor: not-allowed; }
.poze { max-width: var(--maxw); margin: 0 auto 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.poza { position: relative; width: 62px; height: 62px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line-2); background: var(--bg-2); }
.poza img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poza button { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font: 700 12px/1 inherit; padding: 0; }
.msg .poza-trimisa { max-width: 220px; border-radius: 10px; margin-top: 8px; display: block;
  border: 1px solid var(--line-2); }
.dock.peste-poza { outline: 2px dashed var(--gold); outline-offset: -6px; border-radius: var(--radius); }

/* bara de scris: câmpul nu se mai strivește după ce am adăugat agrafa.
   Sub 560px, „Vezi istoric" rămâne doar cu pictograma, ca să încapă tot. */
.composer .field { min-width: 0; flex: 1 1 auto; }
.composer .histbtn, .composer .atasbtn, .composer .send { flex: 0 0 auto; }
@media (max-width: 560px) {
  .composer .histbtn span { display: none; }
  .composer .histbtn { width: 46px; padding: 0; justify-content: center; }
}


/* ── „Reia de unde ai rămas" + fișa omului ───────────────────────────── */
.reluare {
  max-width: var(--maxw); margin: 10px auto 2px; padding: 14px 16px;
  border: 1px solid var(--gold-line); background: var(--gold-tint);
  border-radius: var(--radius); animation: rise .3s ease both;
}
.reluare-cap { color: var(--gold); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; font-weight: 700; margin-bottom: 6px; }
.reluare-text { margin: 0 0 10px; color: var(--ink); font-size: 15px; line-height: 1.5; }
.reluare .chips { margin: 0; }
.fisabtn {
  height: 30px; padding: 0 10px; margin-right: 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--dim);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 600 12px/1 inherit; font-family: inherit;
}
.fisabtn:hover { color: var(--gold); border-color: var(--gold-line); background: var(--gold-tint); }
.fisa-panou { position: fixed; inset: 0; z-index: 40; display: flex;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.fisa-cutie { width: min(560px, 100%); max-height: 80vh; overflow: auto;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 24px 60px -20px #000; }
.fisa-sus { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fisa-sus b { font-size: 16px; }
.fisa-inchide { border: 0; background: transparent; color: var(--dim); font-size: 22px;
  line-height: 1; cursor: pointer; padding: 0 4px; }
.fisa-inchide:hover { color: var(--gold); }
.fisa-sub { color: var(--faint); font-size: 12.5px; margin: 6px 0 14px; }
.fisa-rand { display: grid; grid-template-columns: 150px 1fr; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line-2); align-items: start; }
.fisa-eticheta { color: var(--faint); font-size: 12.5px; padding-top: 2px; }
.fisa-valoare { font-size: 14px; line-height: 1.45; border-radius: 8px; padding: 2px 6px;
  border: 1px solid transparent; outline: none; }
.fisa-valoare:hover { border-color: var(--line-2); }
.fisa-valoare:focus { border-color: var(--gold); background: var(--bg-2); }
.fisa-gol { color: var(--faint); font-size: 13.5px; line-height: 1.5; }
@media (max-width: 560px) {
  .fisabtn span { display: none; }
  .fisabtn { width: 30px; padding: 0; justify-content: center; }
  .fisa-rand { grid-template-columns: 1fr; gap: 2px; }
}

.fisa-valoare.fisa-goala:empty:before { content: attr(data-gol); color: var(--faint); }
.fisa-valoare.fisa-goala { border-color: var(--line-2); border-style: dashed; }
.fisa-valoare.fisa-goala:focus { border-style: solid; }

/* Bara de scris pe ecran îngust: câmpul pe rândul lui, butoanele dedesubt.
   Cu agrafa adăugată, cele patru elemente pe un rând lăsau textului 159px și
   „Întreabă-l pe Paul-AI..." se rupea pe patru rânduri (văzut pe live). */
@media (max-width: 620px) {
  .composer { flex-wrap: wrap; row-gap: 8px; }
  .composer .field { order: -1; flex: 1 0 100%; }
  .composer .histbtn, .composer .atasbtn { flex: 0 0 auto; }
  .composer .send { margin-left: auto; }
}
