@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #09090b;
  --surface: rgba(255,255,255,.04);
  --surface-h: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.08);
  --border-h: rgba(255,255,255,.15);
  --text: #fafafa;
  --text2: #71717a;
  --text3: #52525b;
  --accent: #a78bfa;
  --accent2: #7c3aed;
  --accent-g: rgba(167,139,250,.15);
  --ok: #4ade80;
  --ok-g: rgba(74,222,128,.12);
  --err: #fb7185;
  --err-g: rgba(251,113,133,.12);
  --r: 8px;
  --rm: 12px;
  --rl: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-g), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app { position: relative; z-index: 1; }

/* header */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(9,9,11,.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  box-shadow: 0 0 24px var(--accent-g);
  flex-shrink: 0;
}

.logo-text { font-size: 18px; font-weight: 700; letter-spacing: -.03em; }
.logo-div { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.logo-sub { font-size: 13px; color: var(--text2); }

.header-right { margin-left: auto; display: flex; gap: 12px; }

.status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text2);
  padding: 6px 12px;
  border-radius: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* hero */
.hero {
  text-align: center;
  padding: 64px 32px 48px;
  max-width: 640px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-g);
  border: 1px solid rgba(167,139,250,.2);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.1;
  margin-bottom: 12px;
  background: linear-gradient(to bottom, var(--text) 40%, var(--text2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 15px;
  color: var(--text2);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.6;
}

/* layout */
.container { max-width: 1120px; margin: 0 auto; padding: 0 32px 80px; }
.main-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  transition: border-color .3s;
}
.card:hover { border-color: var(--border-h); }

.card-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}
.card-icon.p { background: var(--accent-g); }
.card-icon.g { background: var(--ok-g); }

.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 24px; }

/* form */
.fg { margin-bottom: 14px; }

.fl {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fl .req { color: var(--err); }

.fi, .ft {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: all .2s;
  outline: none;
}
.fi::placeholder, .ft::placeholder { color: var(--text3); }
.fi:focus, .ft:focus {
  border-color: var(--accent);
  background: rgba(167,139,250,.03);
  box-shadow: 0 0 0 3px var(--accent-g);
}
.ft { resize: vertical; min-height: 56px; }
.fr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* upload */
.us-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

.ug { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }

.uz {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: var(--rm);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .25s;
  background: rgba(255,255,255,.01);
  overflow: hidden;
}
.uz:hover { border-color: var(--accent); background: rgba(167,139,250,.03); }
.uz.ok { border-color: var(--ok); border-style: solid; background: var(--ok-g); }
.uz input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 2; }
.uz-c { position: relative; z-index: 1; pointer-events: none; }
.uz-e { font-size: 20px; margin-bottom: 4px; display: block; }
.uz-h { font-size: 11px; color: var(--text3); font-weight: 500; }
.uz-p {
  width: 100%;
  max-height: 80px;
  object-fit: contain;
  border-radius: 6px;
  margin-top: 8px;
  display: none;
}
.uz.ok .uz-p { display: block; }
.uz.ok .uz-e, .uz.ok .uz-h { display: none; }

/* button */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--rm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 32px var(--accent-g), inset 0 1px 0 rgba(255,255,255,.1);
  transition: all .25s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.1), transparent);
  opacity: 0;
  transition: opacity .25s;
}
.btn:hover::before { opacity: 1; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 0 48px var(--accent-g); }
.btn:active { transform: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: 0; }

/* results */
.results { margin-top: 40px; display: none; animation: fadeUp .5s ease; }
.results.vis { display: block; }
@keyframes fadeUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

.res-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.res-title::before {
  content: '';
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: var(--accent);
}

.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.res-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  transition: border-color .3s;
}
.res-card:hover { border-color: var(--border-h); }

.res-top {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.res-label { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.res-dot { width: 8px; height: 8px; border-radius: 50%; }

.badge {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.badge-o { background: var(--accent-g); color: var(--accent); border: 1px solid rgba(167,139,250,.2); }
.badge-a { background: var(--ok-g); color: var(--ok); border: 1px solid rgba(74,222,128,.2); }

.res-img {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: rgba(0,0,0,.2);
}
.res-img img {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--rm);
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
  border: 1px solid var(--border);
}

.res-bot { padding: 12px 16px 16px; display: flex; gap: 8px; }

.btn-dl {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-dl:hover { border-color: var(--border-h); background: var(--surface-h); }

/* overlay */
.ov {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(9,9,11,.9);
  backdrop-filter: blur(8px);
  place-items: center;
  flex-direction: column;
  gap: 20px;
}
.ov.vis { display: grid; }

.spin {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to{transform:rotate(360deg)} }

.ov-t { font-size: 14px; color: var(--text2); font-weight: 500; }
.ov-s { font-size: 12px; color: var(--text3); margin-top: -12px; }

/* toast */
.tc {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--rm);
  font-size: 13px;
  font-weight: 500;
  background: #18181b;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  animation: tIn .3s ease;
  max-width: 360px;
}
.toast.error { border-color: var(--err); background: var(--err-g); color: var(--err); }
.toast.success { border-color: var(--ok); background: var(--ok-g); color: var(--ok); }
@keyframes tIn { from{opacity:0;transform:translateY(10px) scale(.95)} to{opacity:1;transform:translateY(0) scale(1)} }

/* responsive */
@media (max-width: 768px) {
  .main-grid, .res-grid, .ug, .fr { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .hero { padding: 40px 20px 32px; }
  .container { padding: 0 16px 60px; }
  .header { padding: 0 16px; }
  .logo-sub, .logo-div { display: none; }
}