:root {
  --main-blue:#3a7bd5;
  --nav-bg:#b3b1ac;
  --active-bg:#f7fafc;
  --active-color:#222;
  --ink:#222;
  --bg:#f7fafc;
  --card:#ffffff;
  --ok:#19b36b;
  --ok-hover:#13794d;
  --shadow:0 0 16px rgba(60,80,140,.08);
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{font-family:'Segoe UI', Arial, sans-serif;background:var(--bg);color:var(--ink)}


/* ============================================================
   Sticky Top Notice Bar (Lightweight-AI uses .notice)
   ============================================================ */
.notice{
  position:sticky;top:0;z-index:1000;
  width:100%;background:#0e1523;color:#fff;
  padding:.7rem .9rem;text-align:center;font-size:1rem;
  line-height:1.4;
}
.notice a{color:#bfe0ff;text-decoration:underline}


/* ============================================================
   HEADER
   ============================================================ */
header{
  background:var(--main-blue);
  color:#fff;
  text-align:center;
  padding:0.8em 0 0.7em;
}
h1{margin:0 0 .2em 0;font-size:2.5em;font-weight:700}


/* ============================================================
   NAVBAR (Unified AIGS + Lightweight-AI)
   ============================================================ */
nav{background:var(--nav-bg);border-bottom:2px solid #222}

.navbar-wrap{
  max-width:1200px;
  margin:0 auto;
  padding:0 .5rem;
}

.navbar{
  display:flex;
  align-items:center;
  gap:.4rem;
  overflow-x:auto;
  white-space:nowrap;
  scrollbar-width:none;
  padding:.35rem .25rem 0;
}
.navbar::-webkit-scrollbar{display:none}

.nav-link{
  display:inline-block;
  font-family:Georgia,serif;
  font-weight:700;
  opacity:.95;
  color:#fff;
  text-decoration:none;
  padding:.95rem 1.25rem .85rem;
  scroll-snap-align:center;
  border-radius:1rem 1rem 0 0;
  transition:background .14s,color .14s,border-bottom .14s;
}

.nav-link:hover,
.nav-link:focus-visible{
  outline:none;
  background:var(--active-bg);
  color:var(--active-color);
}

.nav-link.active{
  background:var(--active-bg);
  color:var(--active-color);
  border-bottom:3px solid var(--main-blue);
}


/* Center navbar on wider screens */
@media (min-width: 801px){
  .navbar{
    justify-content:center;
    overflow-x:visible;
    white-space:normal;
  }
}


/* ============================================================
   MAIN CONTAINER
   ============================================================ */
.container{
  max-width:1000px;
  margin:2em auto;
  padding:1.5em;
  background:#fff;
  border-radius:18px;
  box-shadow:var(--shadow)
}


/* ============================================================
   BUTTONS
   ============================================================ */
button,.btn-link{
  padding:.75em 1.5em;font-size:1em;border-radius:7px;border:none;
  background:var(--main-blue);color:#fff;font-weight:600;cursor:pointer;
  margin-left:.6em;transition:background .18s
}
button:hover,.btn-link:hover{background:#215b99;color:#fff}



/* ============================================================
   RESULT AREA — TEXT ABOVE, IMAGE BELOW
   ============================================================ */
.result-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5em;
}

.result-text {
  background:#f8fafc;border-radius:10px;padding:1rem;
  font-size:1.05rem;color:#0a2333;
  overflow-x:auto;font-family:'JetBrains Mono','Consolas','Menlo',monospace;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.result-right {
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:1em;
}

.result-img{
  width:100%;
  max-width:100%;
  height:auto;
  border-radius:10px;
  border:1px solid #ccc;
  box-shadow:0 2px 6px #eee;
  display:block;
}

.download-btn{
  margin:1em 0 0 0;
  padding:.7em 1.4em;
  background:var(--ok);
  color:#fff;
  border:none;
  border-radius:7px;
  font-size:1em;
  font-weight:bold;
  cursor:pointer;
  display:none;
  text-align:center;
  text-decoration:none;
}
.download-btn:hover{background:var(--ok-hover)}


/* ============================================================
   FOOTER
   ============================================================ */
footer{padding:1rem 1.25rem;text-align:center;color:#444}
footer a{color:var(--main-blue)}


/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop{
  position:fixed;inset:0;background:rgba(0,0,0,.55);
  display:none;align-items:center;justify-content:center;
  z-index:2000;
}
.modal{
  background:#fff;max-width:860px;width:92vw;
  max-height:86vh;overflow:auto;
  border-radius:14px;
  box-shadow:0 20px 60px rgba(0,0,0,.35)
}
.modal header{background:#0e1523;color:#fff;padding:1rem 1.25rem}
.modal h2{margin:.2rem 0 0 0;font-size:1.35rem}
.modal .body{padding:1rem 1.25rem;color:#222}
.modal .actions{
  padding:1rem 1.25rem;text-align:right;
  background:#f2f5f8;border-top:1px solid #e6ecf2;
  border-radius:0 0 14px 14px;
}
.close-btn{
  background:#334155;color:#fff;border:none;
  border-radius:8px;padding:.55rem 1rem;cursor:pointer
}
.close-btn:hover{background:#1f2937}


/* ============================================================
   MOBILE FIXES
   ============================================================ */
@media (max-width:700px){
  header{padding:1em 0 0.7em;}
  h1{font-size:2em}
  .nav-link{font-size:1.05em;padding:.8em 1.1em .7em 1.1em}
}

@media (max-width:768px){
  .result-right { width:100% !important; position:static !important; }
  .result-img { max-height:none !important; }
}


/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-wrap{margin-top:.75rem}
.progress-head{display:flex;justify-content:space-between;align-items:center;margin:.25rem 0 .5rem}
.progress-head #progressLabel{font-weight:600;color:#0a2333}
.progress{
  position:relative;height:10px;background:#e8edf3;
  border-radius:999px;overflow:hidden;
  box-shadow:inset 0 1px 2px rgba(0,0,0,.06)
}
.progress .bar{
  position:absolute;left:0;top:0;height:100%;width:0%;
  background:linear-gradient(90deg,#3a7bd5,#67b2f3);
  border-radius:999px;
  transition:width .25s ease-in-out
}
.bar.indeterminate{
  width:40%;left:-40%;
  animation:indet 1.2s infinite linear
}
@keyframes indet{
  0%{left:-40%}
  50%{left:20%}
  100%{left:100%}
}
