:root{
  --bg:#0f172a; --card:#0b1224; --line:#1f2937; --text:#e5e7eb; --muted:#94a3b8; --accent:#38bdf8;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.4 system-ui,-apple-system,Segoe UI,Roboto,Ubuntu}
header{padding:10px 16px;border-bottom:1px solid var(--line);background:#0b1224}
main{max-width:1200px;margin:16px auto;padding:0 16px;display:grid;grid-template-columns:1fr 1fr;gap:16px}
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px}
h2{margin:6px 0 10px}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:6px 0}
.muted{color:var(--muted);font-size:12px}
.small{font-size:12px;color:#a5b4fc}
button{background:#0b1224;border:1px solid #243147;color:var(--text);padding:7px 10px;border-radius:8px;cursor:pointer}
button:hover{border-color:#33507a}
label>input[type="range"]{vertical-align:middle}
textarea{width:100%;min-height:130px;background:#0b1224;border:1px solid var(--line);border-radius:8px;color:var(--text);padding:8px}

#wrap{position:relative;height:520px;border:2px dashed #334155;border-radius:10px;background:#0b1224;overflow:hidden}
#cv{position:absolute;inset:0;width:100%;height:100%;cursor:grab}
#cv.drag{cursor:grabbing}

/* About/How-to badge spacing e deja în stânga; să nu se suprapună pe mobile */
@media (max-width: 640px){
  #saBranding{ right:10px; top:10px; font-size:12px; }
  #saBranding .saSmall{ font-size:11px; opacity:.8; }
}

/* adaugă în style.css (sau într-un <style> existent) */
.sa-branding{
  pointer-events:none;
  /* opțional: discretă lizibilitate asupra oricărui fundal */
  background: linear-gradient(90deg, rgba(11,18,32,.9), rgba(11,18,32,0));
  padding: 6px 10px 6px 10px;
  border-bottom-left-radius: 10px;
  border-left: 1px solid #334155;
}
@media (max-width: 640px){
  #saBranding{ right:10px; top:10px; font-size:12px; }
  #saBranding .saSmall{ font-size:11px; opacity:.85; }
}
/* ===== Silver Angel badge spacer (ADD-ONLY) ===== */
(function(){
  const badge = document.getElementById('saBranding');
  if (!badge) return;

  // țin IDs standard la butoanele tale; dacă diferă, schimbă aici selecția
  const btnAbout = document.getElementById('btnAbout');
  const btnHowTo = document.getElementById('btnHowTo');

  function applySpacer(){
    // măsoară înălțimea reală a badge-ului
    const h = badge.offsetHeight || 0;

    // rezervă spațiu sus pentru întregul document, ca să nu se suprapună cu textarea etc.
    // folosesc margin pe containerul principal dacă îl ai; altfel pe body
    const main = document.querySelector('main, .container, .app, body');
    if (main) {
      // păstrăm doar un mic offset (6–8px) sub badge
      const extra = 8;
      if (main === document.body) {
        document.body.style.paddingTop = (h + extra) + 'px';
      } else {
        main.style.marginTop = (h + extra) + 'px';
      }
    }

    // repoziționează About / How to imediat sub badge, păstrând distanța inițială dintre ele
    const gap = 8;           // distanța între badge și primul buton
    const btnGap = 10;       // distanța între About și How to
    const baseTop = (badge.getBoundingClientRect().top + window.scrollY + h + gap) + 'px';

    if (btnAbout) btnAbout.style.top = baseTop;
    if (btnHowTo) {
      // dacă About există, pune How to sub el; altfel sub badge
      const above = (btnAbout ? (btnAbout.offsetHeight + btnGap) : 0);
      btnHowTo.style.top =
        (badge.getBoundingClientRect().top + window.scrollY + h + gap + above) + 'px';
    }
  }

  // rulează la load și la resize (în caz de wrap pe două linii)
  window.addEventListener('load', applySpacer);
  window.addEventListener('resize', applySpacer);
  // dacă schimbi limba și se schimbă lungimea textului
  document.addEventListener('change', (e)=>{
    if (e.target && e.target.tagName === 'SELECT') {
      // mic delay pentru reflow
      setTimeout(applySpacer, 0);
    }
  });
})();

/* Force badge to top-right, never bottom/left */
#saBranding {
  position: fixed;
  right: 14px;
  top: 8px;
  left: auto !important;
  bottom: auto !important;
  z-index: 9997;
  color: #e5e7eb;
  font: 13px/1.3 system-ui;
  pointer-events: none; /* don't block clicks */
}

.sa-branding{
  background: linear-gradient(90deg, rgba(11,18,32,.9), rgba(11,18,32,0));
  padding: 6px 10px;
  border-bottom-left-radius: 10px;
  border-left: 1px solid #334155;
}

.saSmall{ font-size: 12px; opacity: .85; }

@media (max-width: 640px){
  #saBranding { right: 10px; top: 10px; font-size: 12px; }
  .saSmall { font-size: 11px; }
}
#saBranding{ position:fixed; right:14px; top:8px; left:auto!important; bottom:auto!important; z-index:9997; }
/* Header fix: title stânga, brand dreapta */
.app-header{
  position: sticky;       /* rămâne sus la scroll, ca dropdown-ul tău */
  top: 0;
  z-index: 999;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #0b1220;           /* pe tema ta actuală */
  border-bottom: 1px solid #334155;
}

.app-header .hdr-right{
  display: flex;
  align-items: flex-start;
  gap: 12px;               /* loc pentru dropdown-ul de limbă, dacă îl pui aici */
}

.app-header .brand{
  text-align: right;
  color: #e5e7eb;
  font: 13px/1.3 system-ui;
}

.app-header .brand .small{
  font-size: 12px;
  opacity: .85;
}

/* Responsive: când spațiul e mic, header-ul face wrap frumos */
@media (max-width: 900px){
  .app-header{ flex-wrap: wrap; }
  .app-header .hdr-right{ width: 100%; justify-content: space-between; }
  .app-header .brand{ font-size: 12px; }
  .app-header .brand .small{ font-size: 11px; }
}

/* Header minimal: brand aliniat la dreapta, fără titlu ca să nu dublăm */
.app-header{
  position: sticky;      /* rămâne sus, ca topbar-ul tău */
  top: 0;
  z-index: 999;
  display: flex;
  justify-content: flex-end;  /* brandul în dreapta */
  padding: 6px 14px;
  background: #0b1220;        /* se potrivește cu tema actuală */
  border-bottom: 1px solid #334155;
}

.app-header .brand{
  text-align: right;
  color: #e5e7eb;
  font: 13px/1.3 system-ui;
}

.app-header .brand .small{
  font-size: 12px;
  opacity: .85;
}

/* Responsive mic */
@media (max-width: 900px){
  .app-header .brand{ font-size: 12px; }
  .app-header .brand .small{ font-size: 11px; }
}
