*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222f;
  --border: #2e2e3e;
  --accent: #6c63ff;
  --accent-hover: #8078ff;
  --text: #e8e8f0;
  --muted: #7a7a98;
  --success: #3dd68c;
  --error: #ff6b6b;
  --warn: #ffa94d;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Hiragino Sans', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.logo { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 1rem; }

.user-info { font-size: 0.85rem; color: var(--muted); }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
}
.badge-free { background: #2e2e3e; color: var(--muted); }
.badge-paid { background: #3d2e1e; color: var(--warn); }

/* Buttons */
.btn {
  padding: 0.5rem 1.2rem; border-radius: 8px; border: none;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); }
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Main */
main { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 3rem 1rem; }

.hero { text-align: center; margin-bottom: 2.5rem; }
.hero h1 { font-size: 2.2rem; font-weight: 800; margin-bottom: 0.5rem; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1rem; }

/* Plan info bar */
.plan-bar {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 1.2rem; margin-bottom: 2rem; font-size: 0.85rem;
}
.plan-bar .limit { color: var(--muted); }
.plan-bar .count { font-weight: 700; }
.plan-bar .upgrade { margin-left: auto; }

/* Upload card */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 2rem; width: 100%; max-width: 600px;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 2.5rem 1rem; text-align: center; cursor: pointer;
  transition: all 0.2s; margin-bottom: 1.5rem;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: rgba(108,99,255,0.06);
}
.drop-zone .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-zone p { color: var(--muted); font-size: 0.9rem; }
.drop-zone .file-name { color: var(--text); font-weight: 600; font-size: 0.95rem; margin-top: 0.4rem; }
.drop-zone input[type=file] { display: none; }

/* Format selector */
.format-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.6rem; display: block; }
.format-grid {
  display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem;
}
.fmt-btn {
  padding: 0.35rem 0.8rem; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--muted); font-size: 0.8rem;
  font-weight: 600; cursor: pointer; transition: all 0.15s; text-transform: uppercase;
}
.fmt-btn:hover { border-color: var(--accent); color: var(--text); }
.fmt-btn.active { border-color: var(--accent); background: rgba(108,99,255,0.15); color: var(--accent); }

/* Progress */
.progress-wrap { margin-top: 1.5rem; display: none; }
.progress-wrap.show { display: block; }
.progress-bar-bg {
  background: var(--surface2); border-radius: 99px; height: 6px; overflow: hidden; margin-bottom: 0.5rem;
}
.progress-bar-fill {
  height: 100%; background: var(--accent); border-radius: 99px;
  width: 0%; transition: width 0.3s; animation: indeterminate 1.4s infinite;
}
@keyframes indeterminate {
  0%   { transform: translateX(-100%); width: 60%; }
  100% { transform: translateX(200%); width: 60%; }
}
.progress-bar-fill.done { animation: none; width: 100%; background: var(--success); }
.progress-bar-fill.error { animation: none; width: 100%; background: var(--error); }
.progress-status { font-size: 0.85rem; color: var(--muted); }

/* Result */
.result-box {
  margin-top: 1.5rem; padding: 1rem; border-radius: 10px;
  background: rgba(61,214,140,0.08); border: 1px solid rgba(61,214,140,0.3);
  display: none;
}
.result-box.show { display: flex; align-items: center; justify-content: space-between; }
.result-box.err { background: rgba(255,107,107,0.08); border-color: rgba(255,107,107,0.3); }
.result-text { font-size: 0.9rem; }
.result-text .success-label { color: var(--success); font-weight: 700; }
.result-text .error-label { color: var(--error); font-weight: 700; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 2rem; width: 100%; max-width: 400px;
  transform: translateY(20px); transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.5rem; }
.modal-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.modal-tab {
  padding: 0.5rem 1rem; background: none; border: none; color: var(--muted);
  font-size: 0.9rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.modal-tab.active { color: var(--text); border-bottom-color: var(--accent); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.4rem; }
.form-group input {
  width: 100%; padding: 0.6rem 0.8rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-size: 0.9rem; outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.form-error { color: var(--error); font-size: 0.8rem; margin-top: 0.5rem; min-height: 1.2em; }
.modal-close {
  position: absolute; top: 1rem; right: 1rem; background: none; border: none;
  color: var(--muted); font-size: 1.3rem; cursor: pointer;
}

/* Low quality notice */
.quality-notice {
  font-size: 0.78rem; color: var(--warn); background: rgba(255,169,77,0.08);
  border: 1px solid rgba(255,169,77,0.2); border-radius: 6px;
  padding: 0.5rem 0.8rem; margin-bottom: 1rem; display: none;
}
.quality-notice.show { display: block; }

/* Footer */
footer { text-align: center; padding: 1.5rem; color: var(--muted); font-size: 0.8rem; border-top: 1px solid var(--border); }

/* Email verification banner */
.verify-banner {
  width: 100%; max-width: 600px; margin-bottom: 1rem;
  padding: 0.75rem 1.2rem; border-radius: 10px; font-size: 0.85rem;
  display: none; align-items: center; justify-content: space-between; gap: 1rem;
}
.verify-banner.show { display: flex; }
.verify-banner.warn { background: rgba(255,169,77,0.1); border: 1px solid rgba(255,169,77,0.3); color: var(--warn); }
.verify-banner.success { background: rgba(61,214,140,0.1); border: 1px solid rgba(61,214,140,0.3); color: var(--success); }
.verify-banner.error-b { background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.3); color: var(--error); }
