:root{
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --primary: #0a66ff;
  --orange: #ff8b2a;
  --red: #e11d48;
  --radius: 16px;
  --shadow: 0 10px 24px rgba(0,0,0,.08);
  --gap: clamp(12px, 2vw, 24px);
  --container: min(1100px, 94vw);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: light dark; }
body {
  margin: 0;
  font-family: Inter, Roboto, "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #eef2f7, #f8fafc 30%, #eef2f7);
}

/* Header/Footer */
.app-header, .app-footer {
  width: 100%;
  background: transparent;
}
.app-header .container, .app-footer .container {
  width: var(--container);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) var(--gap) 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.site-title { margin: 0; font-size: clamp(1.25rem, 1.6rem, 2rem); }
.nav-actions .btn { margin-left: 8px; }

.app-footer {
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--gap);
  align-items: center;
}
.footer-logo { max-height: 56px; width: auto; border-radius: 12px; box-shadow: var(--shadow); background:#fff; }
.footer-links .btn { margin-left: 8px; }

/* Layout */
.container { width: var(--container); margin: 0 auto; padding: 0 var(--gap) var(--gap); }
.main { min-height: 100dvh; display: block; }
.panel{
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 3vw, 28px);
  margin: var(--gap) 0;
}
.panel-title{ margin: 0 0 8px; }
.muted{ color: var(--muted); }

/* Grid */
.grid { display: grid; gap: var(--gap); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 10px 16px; border-radius: 999px; border: 0;
  cursor: pointer; text-decoration: none; font-weight: 600; min-height: 44px;
  transition: transform .06s ease, box-shadow .2s ease, opacity .2s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.06);
}
.btn:hover{ transform: translateY(-1px); }
.btn:focus-visible{ outline: 3px solid #b3d1ff; outline-offset: 2px; }
.btn:active{ transform: translateY(0); }
.btn-primary{ background: var(--primary); color: #fff; }
.btn-orange{ background: var(--orange); color: #fff; }
.btn-red{ background: var(--red); color: #fff; }
.btn-ghost{ background: #f1f5f9; color: var(--text); }

/* Forms */
.form{ display: grid; gap: var(--gap); }
.form-field{ display: grid; gap: 6px; }
.form-field input[type="text"], .form-field input[type="file"]{
  width: 100%; border: 1px solid #e2e8f0; background: #fff; color: var(--text);
  padding: 12px 14px; border-radius: 12px; min-height: 44px;
}
.controls{ display:flex; gap: 10px; flex-wrap: wrap; }

/* Dropzone */
.dropzone{
  border: 2px dashed #cbd5e1; border-radius: 16px; background: #f8fafc;
  padding: clamp(20px, 5vw, 40px); text-align: center;
}
.dropzone:focus{ outline: none; box-shadow: 0 0 0 4px #b3d1ff; }
.dropzone input[type="file"]{ display:none; }
.dropzone p{ margin: 6px 0; }

/* Result */
.result.hidden, .progress.hidden { display: none; }
.result-inner{ display:flex; gap:10px; align-items:center; }
.success{ margin: 0; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* Header layout with circular logo */
.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  width: 80px;
  height: 80px;
  border-radius: 9999px;
  object-fit: cover;
  box-shadow: var(--shadow);
  background: #fff;
}

/* Dropzone preview */
.dz-preview {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 100%;
  /* let it shrink back naturally when cleared */
}

.dz-thumb {
  display: block;
  width: auto;
  height: auto;
  max-width: 256px;
  max-height: 265px;
  border-radius: 12px;
  object-fit: contain; /* keep aspect ratio, fit inside 512 box */
  background: #fff;
  box-shadow: var(--shadow);
}

.dz-meta {
  display: grid;
  gap: 6px;
  max-width: min(420px, 60vw);
  overflow-wrap: anywhere;
}

.dropzone.drag-over { background: #eef6ff; }
.hidden { display: none !important; }

