:root {
  --primary: #0f0e0c;
  --secondary: #6366f1;
  --accent: #c8382a;
  --bg: #fdfcfa;
  --card-bg: #ffffff;
  --text-main: #1a1917;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --gold: #c9933a;
  --paper: #f8f9fa;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-main);
  font-family: 'DM Sans', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* NAVIGATION */
nav {
  padding: 24px 0;
  position: sticky;
  top: 0;
  background: rgba(253, 252, 250, 0.8);
  backdrop-filter: blur(12px);
  z-index: 50;
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.logo span {
  color: var(--accent);
  font-style: italic;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--primary);
}

.settings-nav-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.settings-nav-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

/* HERO */
.hero {
  padding: 100px 0 80px;
  text-align: center;
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
}

.hero-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 24px;
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 24px;
  letter-spacing: -0.03em;
}

.hero h1 span {
  color: var(--accent);
  font-style: italic;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.cta-btn {
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.2s;
}

.cta-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(200, 56, 42, 0.2);
}

.secondary-btn {
  background: transparent;
  color: var(--primary);
  text-decoration: none;
  padding: 16px 32px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.secondary-btn:hover {
  background: var(--paper);
  border-color: var(--primary);
}

/* MAIN DECODER AREA */
main {
  padding-bottom: 100px;
}

.how-it-works {
  background: white;
  padding: 40px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 60px;
}

.hiw-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
}

.hiw-step {
  text-align: center;
  flex: 1;
}

.hiw-num {
  display: inline-flex;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 14px;
}

.hiw-step p {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 500;
}

.hiw-arrow {
  font-size: 24px;
  color: var(--border);
  user-select: none;
}

.main-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.input-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  gap: 12px;
}

.action-link {
  background: none;
  border: none;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.action-link:hover {
  text-decoration: underline;
}

textarea {
  width: 100%;
  min-height: 220px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  color: var(--text-main);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--secondary);
}

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.file-chip {
  background: var(--paper);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  animation: fadeIn 0.3s ease;
}

.file-chip .remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  padding: 0;
  transition: color 0.2s;
}

.file-chip .remove-btn:hover {
  color: var(--accent);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.decode-btn {
  width: 100%;
  padding: 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-top: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.decode-btn:hover:not(:disabled) {
  background: var(--accent);
  transform: translateY(-1px);
}

.decode-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* RESULTS */
.results-card {
  display: none;
  animation: fadeInScale 0.4s ease-out;
}

.results-card.active {
  display: block;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.section-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

.risk-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  background: var(--success);
  color: white;
}

.risk-high { background: var(--error); }
.risk-med { background: var(--warning); }

.summary-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
}

.summary-list {
  list-style: none;
  margin-bottom: 32px;
}

.summary-list li {
  position: relative;
  padding-left: 36px;
  margin-bottom: 16px;
  font-size: 16px;
}

.bullet-num {
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.redflag-card {
  background: #fff5f5;
  border-left: 4px solid var(--accent);
  padding: 20px;
  border-radius: 0 16px 16px 0;
  margin-top: 12px;
}

.redflag-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.redflag-label {
  font-weight: 700;
  font-size: 13px;
  color: var(--accent);
}

.footer-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

.copy-btn, .export-btn {
  flex: 1;
  padding: 14px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.copy-btn:hover, .export-btn:hover {
  background: var(--paper);
  border-color: var(--primary);
}

/* HISTORY */
.history-card {
  margin-top: 40px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.history-item {
  padding: 16px;
  background: var(--paper);
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item:hover {
  border-color: var(--secondary);
  background: white;
}

.history-info h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.history-info p {
  font-size: 12px;
  color: var(--text-muted);
}

/* FEATURES SECTION */
.features {
  padding: 100px 0;
  background: var(--paper);
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  font-weight: 900;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 32px;
}

.feature-item {
  background: white;
  padding: 40px;
  border-radius: 24px;
  border: 1px solid var(--border);
  transition: transform 0.3s;
}

.feature-item:hover {
  transform: translateY(-8px);
}

.feature-icon {
  font-size: 32px;
  margin-bottom: 24px;
}

.feature-item h3 {
  font-size: 20px;
  margin-bottom: 16px;
}

.feature-item p {
  color: var(--text-muted);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 12, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.input-group {
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.modal input {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.input-hint {
  font-size: 12px;
  margin-top: 8px;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-save {
  flex: 2;
  padding: 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

.modal-cancel {
  flex: 1;
  padding: 14px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* LOADER */
.loader {
  display: none;
  text-align: center;
  padding: 40px;
}

.loader.active { display: block; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* FOOTER */
footer {
  padding: 80px 0 40px;
  background: white;
  border-top: 1px solid var(--border);
}

.footer-logo {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 12px;
}

.footer-logo span { color: var(--accent); font-style: italic; }

.footer-tagline {
  color: var(--text-muted);
  margin-bottom: 40px;
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.bmc-btn img {
  height: 40px;
  display: block;
}

.footer-links {
  align-items: center;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 200;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
  .hero h1 { font-size: 42px; }
  .nav-links a { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 24px; text-align: center; }
  .footer-links { justify-content: center; }
}
