:root{
  --bg:#0b0f17;
  --panel:#111827;
  --card:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#243046;
  --accent:#60a5fa;
  --danger:#f87171;
}

:root{
  --footer-height: 56px;
}

*{ box-sizing:border-box; }

html, body {
  height: 100%;
}

/*html, body{
  height: auto;
  min-height: 100%;
}*/

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow: auto;
  min-height: 100vh;
  flex-direction: column;
}

body.siteBody{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.siteBody main{
  flex: 1 0 auto;
}

main{
  flex: 1;
  min-height: 0;
}

html{
  scrollbar-gutter: stable;
}

/* Tool page only: keep the app-style internal scrolling */
body.toolBody{
  height: 100vh;
  overflow: hidden;         /* <-- tool keeps internal scroll panes */
  display: flex;
  flex-direction: column;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 16px;
  border-bottom:1px solid var(--line);
  background:rgba(17,24,39,0.65);
  backdrop-filter: blur(8px);
  position:sticky;
  top:0;
  z-index:10;
}
.brand{ font-weight:700; letter-spacing:.2px; }
.hint{ color:var(--muted); font-size:12px; }

.layout{
  display:grid;
  grid-template-columns: 360px 1fr;
  /*height: calc(100vh - 90px);*/
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel{
  border-right:1px solid var(--line);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  overflow: auto;
  min-height: 0;
}

.card{
  background:linear-gradient(180deg, rgba(15,23,42,.85), rgba(15,23,42,.65));
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px;
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
  max-width: 100%;
  box-sizing: border-box;
}

.card h2{
  margin:0 0 10px 0;
  font-size:14px;
  color:#f3f4f6;
}

.row{
  display:flex;
  gap:8px;
  align-items:center;
  margin:8px 0;
}

button{
  background:rgba(96,165,250,.15);
  color:var(--text);
  border:1px solid rgba(96,165,250,.25);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  font-weight:600;
}
button:disabled{
  opacity:.45;
  cursor:not-allowed;
}

input[type="file"]{
  width:100%;
  padding:8px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.25);
  color:var(--text);
}

input[type="range"]{
  width:100%;
}

.meta{
  color:var(--muted);
  font-size:12px;
  line-height:1.35;
  margin-top:6px;
}
.warn{ color:#fbbf24; }

textarea{
  width:100%;
  min-height:140px;
  resize:vertical;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(0,0,0,.35);
  color:var(--text);
  padding:10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:12px;
}

.viewer{
  padding:14px;
  gap:10px;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.viewerTop{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  color:var(--muted);
  font-size:13px;
}

.canvasWrap{
  position:relative;
  overflow:auto;
  display:flex;
  justify-content:center;   /* horizontal center */
  align-items:flex-start;   /* keep top aligned */
  padding:24px;             /* breathing room */
  /*max-height: calc(100vh - 160px);*/
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
}

/*.canvasWrap:not(:has(canvas[height])) {
  align-items:center;
}*/

.canvasWrap.empty { align-items: center; }

/* This wrapper defines the coordinate system */
.canvasCenter{
  position:relative;
}

#pdfCanvas{
  display:block;
  width:auto;     
  height:auto;
  /*box-shadow: 0 20px 40px rgba(0,0,0,.35);*/
  border-radius:1px;
}

.overlay{
  position:absolute;
  inset:0;
  pointer-events:auto;
}

.box{
  position:absolute;
  border:2px solid var(--accent);
  background:rgba(96,165,250,.12);
  border-radius:0px;
  cursor:move;
  user-select:none;
}

.box.selected{
  border-color:#34d399;
  background:rgba(52,211,153,.12);
}

.box .handle{
  position:absolute;
  width:12px;
  height:12px;
  right:-6px;
  bottom:-6px;
  border-radius:4px;
  background:#34d399;
  border:2px solid rgba(0,0,0,.35);
  cursor:nwse-resize;
}

.kv{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap:6px 10px;
  font-size:12px;
  color:var(--muted);
}
.kv > div:nth-child(2n){
  color:var(--text);
}

/*.footer{
  padding:10px 16px;
  border-top:1px solid var(--line);
  color:var(--muted);
  font-size:12px;
}*/

/* Footer base */
.footer{
  height: var(--footer-height);
  min-height: var(--footer-height);
  border-top: 1px solid var(--line);
  background: rgba(17,24,39,0.55);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 12px;

  /* Subtle entrance animation */
  opacity: 0;
  transform: translateY(6px);
  animation: footerIn 420ms ease-out forwards;
}

/* Inner grid: left / center / right */
.footerInner{
  max-width: 1120px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.footerLeft{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.footerBrand{
  text-decoration: none;
  color: var(--text);
  font-weight: 900;
  letter-spacing: -0.2px;
}

.footerTag{
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center nav links */
.footerLinks{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footerLinks a{
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.footerLinks a:hover{
  color: var(--text);
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

/* Right side */
.footerRight{
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.footerSep{
  opacity: .7;
}

/* Animation */
@keyframes footerIn{
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .footer{
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Responsive: stack nicely on small screens */
@media (max-width: 780px){
  :root{ --footer-height: 92px; } /* fixed height still, but taller */

  .footerInner{
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 10px 16px;
    height: auto; /* allow the taller footer to breathe */
  }

  .footerLeft,
  .footerRight{
    justify-content: center;
    white-space: normal;
  }

  .footerTag{
    white-space: normal;
  }

  .footerLinks{
    flex-wrap: wrap;
    gap: 6px;
  }
}


.cursorHud{
  position:absolute;
  padding:6px 8px;
  border-radius:10px;
  font-size:12px;
  background: rgba(0,0,0,.75);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  pointer-events:none;
  transform: translate(10px, 10px);
  white-space:nowrap;
}

.viewerBody{
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  overflow: hidden;
}

.thumbRail{
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  padding: 10px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  /*max-height: calc(100vh - 160px);*/
}

.thumb{
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0,0,0,.25);
  padding: 8px;
  margin-bottom: 10px;
  cursor: pointer;
}

.thumb.active{
  outline: 2px solid #34d399;
}

.thumb canvas{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.thumb .label{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.thumbSlot{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:120px; /* placeholder height */
  color: var(--muted);
  font-size: 12px;
}

.viewerActions{
  display:flex;
  align-items:center;
  gap:10px;
}

.viewerActions .small{
  color: var(--muted);
  font-size: 12px;
}

.guides{
  position:absolute;
  inset:0;
  pointer-events:none;
}

.guideLine{
  position:absolute;
  opacity:0.85;
}

.guideV{
  top:0; bottom:0;
  width:2px;
  background: #34d399;
}

.guideH{
  left:0; right:0;
  height:2px;
  background: #34d399;
}

@media (max-width: 1100px){
  .layout{
    grid-template-columns: 1fr;
  }

  .panel{
    border-right: none;
    border-bottom: 1px solid var(--line);
    max-height: 42vh;
  }

  .viewer{
    height: auto;
  }
}

@media (max-width: 720px){
  .viewerBody{
    grid-template-columns: 1fr; /* thumbnails on top */
    grid-template-rows: 160px 1fr;
  }

  .thumbRail{
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
  }

  .thumb{
    min-width: 140px;
    margin-bottom: 0;
  }
}

/* Mobile: allow page scrolling + stack layout */
@media (max-width: 900px){
  body{
    overflow: auto;     /* allow page scroll */
    height: auto;       /* don't lock to 100vh */
  }

  .layout{
    grid-template-columns: 1fr; /* stack panel فوق viewer */
    overflow: visible;          /* let the document scroll */
    min-height: auto;
  }

  .panel{
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  /* Let viewer expand naturally (page scroll will handle overflow) */
  .viewer{
    height: auto;
    overflow: visible;
  }

  /* Stack thumbs above canvas on mobile */
  .viewerBody{
    grid-template-columns: 1fr;
    grid-template-rows: 160px 1fr;
    overflow: visible;
  }

  /* Thumbnails become horizontal scroller (better UX on mobile) */
  .thumbRail{
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 10px;
    white-space: nowrap;
  }

  .thumb{
    min-width: 140px;
    margin-bottom: 0;
  }

  /* PDF area: avoid nested scroll fights on mobile */
  .canvasWrap{
    overflow: visible;
  }
}

/* --- Site header/nav additions --- */
.siteHeader .brand{
  text-decoration:none;
  color: var(--text);
}

.nav{
  display:flex;
  gap:14px;
  align-items:center;
}

.nav a{
  color: var(--muted);
  text-decoration:none;
  font-weight:600;
  font-size:13px;
  padding:8px 10px;
  border-radius:10px;
  border: 1px solid transparent;
}

.nav a:hover{
  color: var(--text);
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.nav a.active{
  color: var(--text);
  border-color: rgba(96,165,250,.25);
  background: rgba(96,165,250,.12);
}

.navRight{
  display:flex;
  align-items:center;
  gap:10px;
}

.cta{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(96,165,250,.25);
  background: rgba(96,165,250,.15);
  color: var(--text);
  text-decoration:none;
  font-weight:700;
  font-size:13px;
}

.navToggle{
  display:none;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: var(--text);
  cursor:pointer;
}

.hideOnMobile{ display:inline; }

/* Mobile nav */
@media (max-width: 900px){
  .hideOnMobile{ display:none; }
  .navToggle{ display:inline-flex; }

  .nav{
    position:absolute;
    top: 56px;
    right: 12px;
    left: 12px;
    display:none;
    flex-direction:column;
    align-items:stretch;
    gap:6px;
    padding:10px;
    border:1px solid var(--line);
    border-radius:14px;
    background: rgba(17,24,39,.92);
    backdrop-filter: blur(10px);
    z-index: 20;
  }
  .nav.open{ display:flex; }
  .nav a{ width:100%; }
}

/* --- Landing page layout --- */
.landing{
  padding: 26px 16px 40px;
  max-width: 1120px;
  margin: 0 auto;
}

/* Allow scrolling on content pages (landing/docs/faq/contact) */
.landing{
  flex: 1;
  min-height: 0;
}

.hero{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  align-items: stretch;
  margin-top: 10px;
}

.heroCopy h1{
  margin: 0 0 10px 0;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -.3px;
}

.lead{
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 14px 0;
}

.heroCtas{
  display:flex;
  gap:10px;
  align-items:center;
  margin: 12px 0 14px;
}

.btnGhost{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color: var(--text);
  text-decoration:none;
  font-weight:700;
  font-size:13px;
}

.trust{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top: 10px;
}

.pill{
  font-size:12px;
  color: var(--muted);
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  padding:6px 10px;
  border-radius:999px;
}

.grid3{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.bullets{
  margin: 8px 0 0 18px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 13px;
}

.codeBox{
  margin: 10px 0 6px 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.35);
  color: var(--text);
  overflow:auto;
  font-size: 12px;
}

.ctaBand{
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(96,165,250,.25);
  background: linear-gradient(180deg, rgba(96,165,250,.12), rgba(96,165,250,.06));
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.ctaBand h2{
  margin:0 0 6px 0;
  font-size: 16px;
}

/* Fake preview card */
.heroCard{ height: 100%; }
.miniShot{
  border:1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
  overflow:hidden;
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
  height: 100%;
  display:flex;
  flex-direction:column;
}
.miniTop{
  display:flex;
  align-items:center;
  gap:6px;
  padding:10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.dot{
  width:10px;height:10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}
.miniTitle{ margin-left: 6px; color: var(--muted); font-size: 12px; }
.miniBody{
  flex:1;
  display:grid;
  grid-template-columns: 30% 1fr;
  min-height: 220px;
}
.miniSidebar{ border-right:1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.18); }
.miniCanvas{ position:relative; background: rgba(0,0,0,.10); }
.miniBox{
  position:absolute;
  left: 18%;
  top: 22%;
  width: 48%;
  height: 20%;
  border:2px solid rgba(96,165,250,.85);
  background: rgba(96,165,250,.10);
}
.miniBox.b2{
  left: 30%;
  top: 55%;
  width: 40%;
  height: 18%;
}
.miniGuide.v{
  position:absolute;
  top:0; bottom:0;
  left: 50%;
  width:2px;
  background: rgba(52,211,153,.75);
}
.miniGuide.h{
  position:absolute;
  left:0; right:0;
  top: 50%;
  height:2px;
  background: rgba(52,211,153,.75);
}
.miniFoot{
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  border-top:1px solid rgba(255,255,255,.08);
}

@media (max-width: 980px){
  .hero{ grid-template-columns: 1fr; }
  .grid3{ grid-template-columns: 1fr; }
  .split{ grid-template-columns: 1fr; }
  .heroCopy h1{ font-size: 32px; }
}

/* --- Docs/FAQ/Contact extras --- */
.docPage .card a { color: var(--text); }
.docHero{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  margin-top: 8px;
  margin-bottom: 12px;
}
.docQuick{ display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end; }

.docLayout{
  display:grid;
  grid-template-columns: 300px 1fr;
  gap: 12px;
}
.docNavTitle{
  font-weight:800;
  margin-bottom: 10px;
  font-size: 13px;
}
.docNav a{
  display:block;
  text-decoration:none;
  color: var(--muted);
  font-weight:700;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.docNav a:hover{
  color: var(--text);
  border-color: rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.docSection h2{ margin-top: 0; }
.docSection { margin-bottom: 5px;}
.docList{ color: var(--muted); line-height: 1.8; font-size: 13px; }
.docGrid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.note{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* Accordion */
.faqList, .faqMini{ display:flex; flex-direction:column; gap:8px; }

.faqList{
  width: 100%;
}

.faqQ{
  width:100%;
  text-align:left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.25);
  color: var(--text);
  cursor:pointer;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
}
.faqA{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.03);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow-x: hidden;
}

.faqQ,
.faqA{
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.chev{ color: var(--muted); font-weight:900; }

/* Contact form */
.contactForm{ display:flex; flex-direction:column; gap:10px; margin-top: 10px; }
.field{ display:flex; flex-direction:column; gap:6px; }
.field span{ color: var(--muted); font-size: 12px; font-weight: 800; }
.field input, .field textarea{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  color: var(--text);
  outline: none;
}
.field input:focus, .field textarea:focus{
  border-color: rgba(96,165,250,.35);
  box-shadow: 0 0 0 3px rgba(96,165,250,.12);
}
.formRow{ display:flex; gap:10px; align-items:center; margin-top: 2px; }

@media (max-width: 980px){
  .docHero{ align-items:flex-start; flex-direction:column; }
  .docLayout{ grid-template-columns: 1fr; }
  .docGrid2{ grid-template-columns: 1fr; }
}

.brandWord {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.brandWord .accent {
  color: var(--accent);
  font-weight: 800;
}

.bmcBtn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border-radius:10px;
  text-decoration:none;
  font-weight:800;
  font-size:12px;

  background: #FFDD00;
  color:#111;
  border: 1px solid rgba(0,0,0,.15);
}

.bmcBtn:hover{
  filter: brightness(0.95);
}

