*, *::before, *::after{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-med) var(--ease), color var(--dur-med) var(--ease);
}
img{ max-width: 100%; display: block; }
button{ font: inherit; color: inherit; }
input, select, textarea{ font: inherit; }
a{ color: inherit; }

:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden{
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

#app{ min-height: 100vh; display: flex; flex-direction: column; }

/* ---------------- Header ---------------- */
.app-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand{ display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark{
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), hsl(var(--accent-h) 92% 64%));
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.brand-mark svg{ width: 17px; height: 17px; }
.brand-name{ font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand-name small{ display: block; font-weight: 500; font-size: 10px; color: var(--text-tertiary); letter-spacing: .04em; text-transform: uppercase; }

.header-actions{ display: flex; align-items: center; gap: 4px; }

.icon-btn{
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  position: relative;
}
.icon-btn:hover{ background: var(--bg-secondary); border-color: var(--border); }
.icon-btn svg{ width: 18px; height: 18px; }
.icon-btn.active{ background: var(--accent-soft); color: var(--accent-strong); }

.lang-toggle{
  width: auto; padding: 0 10px;
  font-weight: 700; font-size: 12px; letter-spacing: .02em;
}

/* Tooltip */
[data-tip]{ position: relative; }
[data-tip]::after{
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
  z-index: 60;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (hover: none){
  [data-tip]::after{ display: none; }
}

/* ---------------- Buttons ---------------- */
.btn{
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.btn:hover{ border-color: var(--border-strong); background: var(--bg-secondary); }
.btn:active{ transform: translateY(1px); }
.btn-primary{
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0e00;
}
.btn-primary:hover{ background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-sm{ padding: 7px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-block{ width: 100%; }
.btn-danger{ color: var(--danger); }
.btn-danger:hover{ background: var(--danger-soft); border-color: var(--danger); }
.btn[disabled]{ opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ---------------- Landing / Empty state ---------------- */
.landing{
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 48px 20px 64px;
  position: relative;
  overflow: hidden;
}
.landing-noise{
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, var(--accent-soft) 0, transparent 40%),
    radial-gradient(circle at 85% 75%, var(--accent-soft) 0, transparent 38%);
  pointer-events: none;
}
.landing-eyebrow{
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 6px 14px; border-radius: 999px;
  margin-bottom: 22px;
  position: relative;
}
.landing h1{
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 60px);
  line-height: 1.04;
  letter-spacing: -.03em;
  margin: 0 0 16px;
  font-weight: 800;
  position: relative;
  max-width: 16ch;
}
.landing h1 em{
  font-style: normal;
  color: var(--accent-strong);
  position: relative;
}
.landing-sub{
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 0 36px;
  line-height: 1.55;
  position: relative;
}

.dropzone{
  position: relative;
  width: min(560px, 92vw);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-xl);
  background: var(--surface);
  padding: 40px 28px;
  cursor: pointer;
  transition: border-color var(--dur-med) var(--ease), background var(--dur-med) var(--ease), transform var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-sm);
}
.dropzone:hover{ border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dropzone.drag-over{
  border-color: var(--accent);
  background: var(--accent-soft);
  border-style: solid;
  transform: scale(1.015);
}
.dropzone-icon{
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--accent-strong);
  display: grid; place-items: center;
}
.dropzone-icon svg{ width: 26px; height: 26px; }
.dropzone-title{ font-weight: 700; font-size: 16.5px; margin-bottom: 6px; }
.dropzone-hint{ font-size: 13px; color: var(--text-tertiary); }
.dropzone input[type="file"]{ display: none; }

.landing-points{
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  margin: 30px 0 0; padding: 0;
  max-width: 620px;
  position: relative;
}
.landing-points li{
  font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
}
.landing-points li svg{ width: 13px; height: 13px; color: var(--success); flex-shrink: 0; }

.landing-privacy{
  margin-top: 26px;
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex; align-items: center; gap: 6px;
  position: relative;
}
.landing-privacy svg{ width: 14px; height: 14px; }

/* ---------------- Footer ---------------- */
.app-footer{
  border-top: 1px solid var(--border);
  padding: 22px 20px;
  display: flex; flex-wrap: wrap; gap: 14px;
  align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text-tertiary);
  background: var(--surface);
}
.footer-links{ display: flex; gap: 18px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.footer-links a{ text-decoration: none; color: var(--text-secondary); }
.footer-links a:hover{ color: var(--accent-strong); }

/* ---------------- Toast ---------------- */
.toast-stack{
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200; width: min(420px, 92vw);
}
.toast{
  background: var(--text-primary); color: var(--bg-primary);
  padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in var(--dur-med) var(--ease);
}
.toast.success{ background: var(--success); color: white; }
.toast.error{ background: var(--danger); color: white; }
@keyframes toast-in{ from{ opacity:0; transform: translateY(10px); } to{ opacity:1; transform: translateY(0); } }

/* checkerboard for transparency */
.checker{
  background-image:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  background-color: var(--checker-b);
}

.processing-overlay{
  position: fixed; inset: 0; background: var(--scrim);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  z-index: 300; backdrop-filter: blur(3px);
}
.spinner{
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: rotate(360deg); } }
.processing-text{ font-weight: 600; font-size: 13.5px; color: var(--text-secondary); }
.processing-bar{ width: 200px; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.processing-bar-fill{ height: 100%; background: var(--accent); width: 0%; transition: width .15s var(--ease); }

[hidden]{ display: none !important; }
