/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --accent: #a78bfa;
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1f1f35;
  --bg-input: #16162a;
  --surface: #252542;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --text-bright: #f8fafc;
  --border: #2d2d4a;
  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.4);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

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

a {
  text-decoration: none;
  color: inherit;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  background: rgba(15, 15, 26, 0.92);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-bright);
}

.logo i {
  font-size: 1.5rem;
  color: var(--primary-light);
}

.logo strong {
  font-weight: 800;
  color: var(--primary-light);
}

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

.nav-links a {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

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

.btn-nav {
  background: var(--primary) !important;
  color: white !important;
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 600 !important;
  transition: all var(--transition) !important;
}

.btn-nav:hover {
  background: var(--primary-dark) !important;
  transform: translateY(-1px);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 50%, rgba(167, 139, 250, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 60%);
  animation: heroPulse 8s ease-in-out infinite alternate;
}

@keyframes heroPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 8px 20px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 32px;
  letter-spacing: 0.5px;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 24px;
  color: var(--text-bright);
}

.gradient-text {
  background: linear-gradient(135deg, #818cf8, #a78bfa, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-desc {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin-bottom: 40px;
  line-height: 1.8;
}

.btn-hero {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 16px 40px;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all var(--transition);
  box-shadow: 0 4px 24px rgba(99, 102, 241, 0.4);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-hero:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5);
}

/* ===== Section Common ===== */
.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-bright);
  margin-bottom: 12px;
}

.section-desc {
  text-align: center;
  color: var(--text-dim);
  font-size: 1.05rem;
  margin-bottom: 48px;
}

/* ===== Features ===== */
.features {
  padding: 100px 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}

.feature-card:nth-child(9) {
  grid-column: 2 / 4;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: white;
  margin-bottom: 20px;
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* ===== How It Works ===== */
.how-it-works {
  padding: 100px 0;
  background: var(--bg-card);
}

.steps-vertical {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.step-v {
  display: flex;
  gap: 20px;
}

.step-v-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.step-v-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  flex-shrink: 0;
}

.step-v-line {
  width: 2px;
  flex: 1;
  background: linear-gradient(to bottom, var(--primary), var(--border));
  margin: 6px 0 0;
  min-height: 20px;
}

.step-v-content {
  flex: 1;
  padding-bottom: 32px;
}

.step-v-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-v-content h3 i {
  color: var(--primary-light);
  font-size: 0.95rem;
}

.step-v-content p {
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 10px;
}

.step-v-content a.step-link {
  color: var(--primary-light);
  font-weight: 600;
  text-decoration: underline;
}

.step-tip {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.step-tip i {
  color: var(--warning);
  font-size: 0.85rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.step-tip a {
  color: var(--primary-light);
  text-decoration: underline;
}

.step-formats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.format-tag {
  padding: 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ===== Analyzer Section ===== */
.analyzer {
  padding: 100px 0 120px;
}

.analyzer-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

/* Left Panel */
.analyzer-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}

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

.form-group > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.form-group > label i {
  color: var(--primary-light);
}

.api-link {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--primary-light) !important;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 48px 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.btn-toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--primary);
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.upload-zone.has-file {
  border-style: solid;
  border-color: var(--success);
  background: rgba(52, 211, 153, 0.05);
  padding: 20px;
}

.upload-content i {
  font-size: 2.5rem;
  color: var(--primary-light);
  margin-bottom: 12px;
}

.upload-content p {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
}

.upload-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(52, 211, 153, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  font-size: 1.2rem;
}

.file-details {
  flex: 1;
  text-align: left;
}

.file-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.file-size {
  display: block;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.btn-remove-file {
  background: rgba(248, 113, 113, 0.15);
  border: none;
  color: var(--error);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.btn-remove-file:hover {
  background: rgba(248, 113, 113, 0.3);
}

/* Analysis Types */
.analysis-types {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  flex: 0 0 calc(25% - 6px);
  min-width: 0;
}

.type-btn i {
  font-size: 1.1rem;
}

.type-btn span {
  font-size: 0.78rem;
  font-weight: 500;
}

.type-btn:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(99, 102, 241, 0.05);
}

.type-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
}

/* Custom Prompt */
#customPrompt {
  width: 100%;
  padding: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  transition: border-color var(--transition);
}

#customPrompt:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

#customPrompt::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

/* Analyze Button */
.btn-analyze {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.btn-analyze:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== Result Panel ===== */
.result-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 80px;
}

/* Empty State */
.result-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--primary-light);
  margin-bottom: 20px;
}

.result-empty h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.result-empty p {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* Loading State */
.result-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.loading-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}

.loading-spinner i {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: var(--primary-light);
  animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.result-loading h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.loading-msg {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.loading-bar {
  width: 200px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  animation: loadingMove 2s ease-in-out infinite;
}

@keyframes loadingMove {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 60%; }
  100% { transform: translateX(400%); width: 30%; }
}

/* Result Content */
.result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.result-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.result-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.result-actions {
  display: flex;
  gap: 8px;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-action:hover {
  border-color: var(--primary);
  color: var(--text);
}

.result-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-height: 70vh;
}

/* Markdown Styles inside result */
.result-body h1, .result-body h2, .result-body h3,
.result-body h4, .result-body h5, .result-body h6 {
  color: var(--text-bright);
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.4;
}

.result-body h1 { font-size: 1.5rem; }
.result-body h2 {
  font-size: 1.25rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.result-body h3 { font-size: 1.1rem; }
.result-body h4 { font-size: 1rem; }

.result-body p {
  margin-bottom: 12px;
  color: var(--text);
}

.result-body ul, .result-body ol {
  margin-bottom: 12px;
  padding-left: 24px;
}

.result-body li {
  margin-bottom: 6px;
  color: var(--text);
}

.result-body strong {
  color: var(--text-bright);
  font-weight: 700;
}

.result-body code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--primary-light);
}

.result-body pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.result-body pre code {
  background: none;
  padding: 0;
}

.result-body blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-dim);
  font-style: italic;
}

.result-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.result-body th, .result-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  text-align: left;
}

.result-body th {
  background: var(--surface);
  font-weight: 600;
  color: var(--text-bright);
}

.result-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* Error State */
.result-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.result-error > i {
  font-size: 2.5rem;
  color: var(--error);
  margin-bottom: 16px;
}

.result-error h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.result-error p {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 20px;
  max-width: 400px;
}

.btn-retry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-retry:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

/* ===== Footer ===== */
.footer {
  padding: 48px 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.footer-content {
  text-align: center;
}

.footer-logo {
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--text-bright);
  margin-bottom: 8px;
}

.footer-logo i {
  color: var(--primary-light);
}

.footer-logo strong {
  font-weight: 800;
  color: var(--primary-light);
}

.footer-content > p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.footer-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--success);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: rgba(52, 211, 153, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

.toast.error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
}

/* ===== Responsive ===== */

/* Tablet */
@media (max-width: 900px) {
  .container {
    padding: 0 16px;
  }

  .analyzer-wrapper {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
    min-height: 400px;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .feature-card:nth-child(9) {
    grid-column: 1 / -1;
  }

  .features {
    padding: 60px 0;
  }

  .how-it-works {
    padding: 60px 0;
  }

  .analyzer {
    padding: 60px 0 80px;
  }

  .hero {
    padding: 100px 20px 60px;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .section-desc {
    font-size: 0.95rem;
    margin-bottom: 32px;
  }

  .type-btn {
    flex: 0 0 calc(25% - 6px);
  }
}

/* Mobile */
@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  .container {
    padding: 0 12px;
  }

  /* Header */
  .header-inner {
    padding: 0 12px;
    height: 56px;
  }

  .logo {
    font-size: 1.1rem;
    gap: 8px;
  }

  .logo i {
    font-size: 1.3rem;
  }

  .nav-links a:not(.btn-nav) {
    display: none;
  }

  .btn-nav {
    padding: 6px 14px;
    font-size: 0.82rem !important;
  }

  /* Hero */
  .hero {
    min-height: 80vh;
    min-height: 80dvh;
    padding: 80px 16px 48px;
  }

  .hero-badge {
    font-size: 0.75rem;
    padding: 6px 14px;
    margin-bottom: 20px;
  }

  .hero h1 {
    font-size: 1.75rem;
    margin-bottom: 16px;
  }

  .hero-desc {
    font-size: 0.92rem;
    margin-bottom: 28px;
    line-height: 1.7;
  }

  .hero-desc br {
    display: none;
  }

  .btn-hero {
    padding: 14px 28px;
    font-size: 0.95rem;
    border-radius: 10px;
    width: 100%;
    justify-content: center;
    max-width: 280px;
  }

  /* Features */
  .features {
    padding: 48px 0;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .feature-card {
    padding: 20px;
  }

  .feature-card:nth-child(9) {
    grid-column: auto;
  }

  .feature-icon {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    margin-bottom: 14px;
  }

  .feature-card h3 {
    font-size: 1.05rem;
    margin-bottom: 6px;
  }

  .feature-card p {
    font-size: 0.85rem;
  }

  .section-title {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }

  .section-desc {
    font-size: 0.9rem;
    margin-bottom: 28px;
  }

  /* How It Works */
  .how-it-works {
    padding: 48px 0;
  }

  .steps-vertical {
    max-width: 100%;
  }

  .step-v {
    gap: 12px;
  }

  .step-v-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .step-v-content {
    padding-bottom: 20px;
  }

  .step-v-content h3 {
    font-size: 0.95rem;
    flex-wrap: wrap;
  }

  .step-v-content p {
    font-size: 0.85rem;
  }

  .step-tip {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .format-tag {
    font-size: 0.65rem;
    padding: 2px 8px;
  }

  /* Analyzer */
  .analyzer {
    padding: 48px 0 60px;
  }

  .analyzer-panel {
    padding: 20px 16px;
    border-radius: var(--radius);
  }

  .form-group {
    margin-bottom: 18px;
  }

  .form-group > label {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }

  /* API Key */
  .input-wrapper input {
    padding: 10px 44px 10px 12px;
    font-size: 0.85rem;
  }

  .api-link {
    font-size: 0.72rem;
  }

  /* Model Selector */
  .model-select {
    font-size: 0.84rem;
    padding: 10px 12px;
  }

  .model-badge span {
    font-size: 0.68rem;
    padding: 2px 8px;
  }

  .fallback-title {
    font-size: 0.76rem;
  }

  .fallback-model {
    font-size: 0.76rem;
  }

  .fallback-select {
    font-size: 0.78rem;
  }

  .model-info-item {
    padding: 8px 10px;
  }

  .model-info-name {
    font-size: 0.78rem;
  }

  .model-info-tags span {
    font-size: 0.6rem;
  }

  .model-info-item p {
    font-size: 0.72rem;
  }

  /* Upload Zone */
  .upload-zone {
    padding: 28px 16px;
  }

  .upload-content i {
    font-size: 2rem;
    margin-bottom: 8px;
  }

  .upload-content p {
    font-size: 0.88rem;
  }

  .upload-hint {
    font-size: 0.72rem;
  }

  .upload-zone.has-file {
    padding: 14px;
  }

  .file-name {
    max-width: 180px;
    font-size: 0.85rem;
  }

  .file-size {
    font-size: 0.72rem;
  }

  .file-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  /* Analysis Types - 2 columns on mobile */
  .analysis-types {
    gap: 6px;
  }

  .analysis-types .type-btn {
    flex: 0 0 calc(50% - 3px);
    padding: 10px 6px;
  }

  .type-btn i {
    font-size: 1rem;
  }

  .type-btn span {
    font-size: 0.72rem;
  }

  /* Custom Prompt */
  .custom-sub-label {
    font-size: 0.78rem;
    margin-top: 12px;
  }

  .preset-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .preset-btn {
    font-size: 0.75rem;
    padding: 8px 10px;
  }

  .depth-selector {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .depth-btn {
    padding: 8px 6px;
    font-size: 0.74rem;
  }

  .format-options {
    gap: 6px;
  }

  .format-check {
    font-size: 0.76rem;
    padding: 4px 8px;
  }

  .audience-selector select {
    font-size: 0.84rem;
    padding: 8px 10px;
  }

  #customPrompt {
    font-size: 0.85rem;
    padding: 12px;
    rows: 4;
  }

  /* Submit Button */
  .btn-analyze {
    padding: 14px;
    font-size: 0.95rem;
    border-radius: 10px;
  }

  /* Result Panel */
  .result-panel {
    min-height: 300px;
    border-radius: var(--radius);
  }

  .result-empty {
    padding: 32px 20px;
  }

  .empty-icon {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }

  .result-empty h3 {
    font-size: 1rem;
  }

  .result-empty p {
    font-size: 0.85rem;
  }

  .result-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 16px;
    gap: 8px;
  }

  .result-meta {
    font-size: 0.75rem;
    gap: 8px;
  }

  .result-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-action {
    padding: 6px 10px;
    font-size: 0.75rem;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .result-body {
    padding: 16px;
    max-height: 60vh;
  }

  .result-body h1 { font-size: 1.25rem; }
  .result-body h2 { font-size: 1.1rem; }
  .result-body h3 { font-size: 1rem; }
  .result-body p { font-size: 0.88rem; }
  .result-body li { font-size: 0.88rem; }

  .result-body table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .result-body th, .result-body td {
    padding: 6px 8px;
  }

  .result-loading {
    padding: 32px 20px;
  }

  .loading-spinner {
    width: 64px;
    height: 64px;
  }

  .loading-spinner i {
    font-size: 1.2rem;
  }

  .result-error {
    padding: 32px 20px;
  }

  .result-error > i {
    font-size: 2rem;
  }

  /* Modal */
  .modal-overlay {
    padding: 8px;
    align-items: flex-end;
  }

  .modal {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h3 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-body label {
    font-size: 0.82rem;
  }

  .modal-input {
    font-size: 0.84rem;
    padding: 8px 12px;
  }

  .modal-textarea {
    font-size: 0.84rem;
    padding: 8px 12px;
  }

  .smtp-presets {
    grid-template-columns: repeat(2, 1fr);
  }

  .smtp-row {
    flex-direction: column;
    gap: 8px;
  }

  .smtp-field-small {
    max-width: 100%;
  }

  .modal-footer {
    padding: 12px 16px;
  }

  .btn-modal-cancel {
    padding: 8px 18px;
    font-size: 0.85rem;
  }

  .btn-modal-send {
    padding: 8px 20px;
    font-size: 0.85rem;
  }

  .recipient-input {
    min-width: 140px;
    font-size: 0.84rem;
  }

  .recipients-area {
    min-height: 42px;
  }

  /* Footer */
  .footer {
    padding: 32px 0;
  }

  .footer-logo {
    font-size: 1.05rem;
  }

  .footer-content > p {
    font-size: 0.8rem;
  }

  .footer-note {
    font-size: 0.72rem;
    padding: 6px 12px;
    text-align: left;
  }

  /* Toast */
  .toast {
    bottom: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
    font-size: 0.84rem;
    padding: 12px 16px;
  }
}

/* Extra small devices */
@media (max-width: 380px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-desc {
    font-size: 0.85rem;
  }

  .feature-card {
    padding: 16px;
  }

  .analysis-types .type-btn {
    padding: 8px 4px;
  }

  .type-btn span {
    font-size: 0.68rem;
  }

  .btn-hero {
    padding: 12px 24px;
    font-size: 0.9rem;
  }

  .step-v-content h3 {
    font-size: 0.88rem;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .type-btn,
  .preset-btn,
  .depth-btn,
  .smtp-preset-btn,
  .btn-action,
  .btn-analyze,
  .btn-hero,
  .btn-nav,
  .format-check,
  .fallback-header,
  .email-preview-toggle {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* Bigger touch targets on mobile */
  .type-btn {
    min-height: 44px;
  }

  .btn-action {
    min-height: 40px;
  }

  .checkbox-row {
    min-height: 36px;
  }

  .checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  /* Disable hover effects on touch */
  .feature-card:hover {
    transform: none;
  }

  .btn-hero:hover {
    transform: none;
  }

  .btn-analyze:hover {
    transform: none;
  }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  .footer {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }

  .modal-overlay {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .toast {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .header-inner {
    padding-left: calc(24px + env(safe-area-inset-left));
    padding-right: calc(24px + env(safe-area-inset-right));
  }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 80px 24px 40px;
  }

  .hero h1 {
    font-size: 1.5rem;
  }
}

/* ===== Model Selector ===== */
.model-info-toggle {
  margin-left: auto;
  cursor: pointer;
  color: var(--primary-light);
  font-size: 0.85rem;
  transition: color var(--transition);
}

.model-info-toggle:hover {
  color: var(--accent);
}

.model-selector-wrapper {
  margin-bottom: 12px;
}

.model-selector-label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.model-select {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: auto;
}

.model-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.model-select optgroup {
  font-weight: 600;
  color: var(--text-dim);
}

.model-select option {
  padding: 6px;
  background: var(--bg-input);
  color: var(--text);
}

.model-badge {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.model-badge span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-speed {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: var(--success);
}

.badge-speed-fastest {
  background: rgba(52, 211, 153, 0.18) !important;
  border-color: rgba(52, 211, 153, 0.4) !important;
}

.badge-speed-slow {
  background: rgba(251, 191, 36, 0.12) !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
  color: var(--warning) !important;
}

.badge-quality {
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-light);
}

.badge-quality-highest {
  background: rgba(167, 139, 250, 0.15) !important;
  border-color: rgba(167, 139, 250, 0.35) !important;
  color: var(--accent) !important;
}

.badge-quality-medium {
  background: rgba(148, 163, 184, 0.12) !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
  color: var(--text-dim) !important;
}

.badge-preview {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: var(--warning);
}

/* Fallback Settings */
.fallback-settings {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-input);
}

.fallback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  cursor: pointer;
  transition: background var(--transition);
}

.fallback-header:hover {
  background: rgba(99, 102, 241, 0.04);
}

.fallback-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.fallback-title i {
  color: var(--primary-light);
  font-size: 0.85rem;
}

.fallback-arrow {
  color: var(--text-dim);
  font-size: 0.75rem;
  transition: transform 0.2s;
}

.fallback-arrow.open {
  transform: rotate(180deg);
}

.fallback-body {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.fallback-desc {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-bottom: 14px;
  line-height: 1.6;
}

.fallback-chain {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.fallback-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.fallback-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.fallback-model {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  font-family: 'Courier New', monospace;
}

.fallback-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary-light);
  padding: 2px 8px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 4px;
}

.fallback-select {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: auto;
}

.fallback-select:focus {
  outline: none;
  border-color: var(--primary);
}

.fallback-arrow-icon {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.7rem;
  opacity: 0.5;
  padding: 0 0 0 17px;
}

.fallback-summary {
  font-size: 0.76rem;
  color: var(--text-dim);
  padding: 8px 12px;
  background: rgba(99, 102, 241, 0.06);
  border-radius: 6px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.fallback-summary strong {
  color: var(--primary-light);
  font-family: 'Courier New', monospace;
  font-size: 0.74rem;
}

.btn-reset-fallback {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-reset-fallback:hover {
  border-color: var(--primary);
  color: var(--text);
}

/* Model Info Panel */
.model-info-panel {
  margin-top: 10px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.model-info-close {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  font-size: 0.85rem;
  transition: color var(--transition);
}

.model-info-close:hover {
  color: var(--text-bright);
}

.model-info-panel h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 12px;
}

.model-info-panel h4 i {
  color: var(--primary-light);
}

.model-info-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-info-item {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color var(--transition);
}

.model-info-item:hover {
  border-color: var(--primary);
}

.model-info-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-bright);
  margin-bottom: 5px;
}

.recommend-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.model-info-tags {
  display: flex;
  gap: 5px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.model-info-tags span {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 4px;
}

.tag-preview { background: rgba(251, 191, 36, 0.12); color: var(--warning); border: 1px solid rgba(251, 191, 36, 0.3); }
.tag-stable { background: rgba(52, 211, 153, 0.12); color: var(--success); border: 1px solid rgba(52, 211, 153, 0.3); }
.tag-fast { background: rgba(52, 211, 153, 0.08); color: #6ee7b7; border: 1px solid rgba(110, 231, 183, 0.3); }
.tag-fastest { background: rgba(52, 211, 153, 0.15); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.4); }
.tag-slow { background: rgba(251, 191, 36, 0.08); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.25); }
.tag-quality-high { background: rgba(99, 102, 241, 0.1); color: var(--primary-light); border: 1px solid rgba(99, 102, 241, 0.25); }
.tag-quality-good { background: rgba(99, 102, 241, 0.08); color: #818cf8; border: 1px solid rgba(129, 140, 248, 0.25); }
.tag-quality-mid { background: rgba(148, 163, 184, 0.1); color: var(--text-dim); border: 1px solid rgba(148, 163, 184, 0.25); }

.model-info-item p {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* Meta fallback indicator */
.meta-fallback {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  padding: 1px 8px;
  border-radius: 4px;
  color: var(--warning) !important;
  font-size: 0.75rem;
  cursor: help;
}

/* ===== Enhanced Custom Prompt ===== */
.custom-sub-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-sub-label .hint {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.7;
}

/* Preset Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.preset-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}

.preset-btn i {
  font-size: 0.85rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.preset-btn:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(99, 102, 241, 0.06);
}

.preset-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
}

/* Depth Selector */
.depth-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.depth-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.depth-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.depth-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
}

/* Format Options */
.format-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.format-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all var(--transition);
}

.format-check:hover {
  border-color: var(--primary);
}

.format-check input[type="checkbox"] {
  accent-color: var(--primary);
}

/* Audience Selector */
.audience-selector select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: auto;
}

.audience-selector select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===== Email Button in Actions ===== */
.btn-action-email {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(167, 139, 250, 0.15)) !important;
  border-color: var(--primary) !important;
  color: var(--primary-light) !important;
}

.btn-action-email:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(167, 139, 250, 0.25)) !important;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

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

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

.modal-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-bright);
}

.modal-header h3 i {
  color: var(--primary-light);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text-bright);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.modal-body .form-group {
  margin-bottom: 18px;
}

.modal-body label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.modal-body label i {
  color: var(--primary-light);
  font-size: 0.9rem;
}

.required {
  color: var(--error);
  font-weight: 400;
}

.modal-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color var(--transition);
}

.modal-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.modal-input::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.modal-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  resize: vertical;
  transition: border-color var(--transition);
}

.modal-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.modal-textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

/* SMTP Presets */
.smtp-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.smtp-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.smtp-preset-btn i {
  font-size: 1.1rem;
}

.smtp-preset-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.smtp-preset-btn.active {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-light);
}

/* SMTP Settings */
.smtp-settings {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.smtp-row {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.smtp-row:last-child {
  margin-bottom: 0;
}

.smtp-field {
  flex: 1;
}

.smtp-field-small {
  max-width: 100px;
}

.smtp-field label {
  font-size: 0.76rem !important;
  margin-bottom: 4px !important;
  font-weight: 500 !important;
  color: var(--text-dim) !important;
}

.smtp-field input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  transition: border-color var(--transition);
}

.smtp-field input:focus {
  outline: none;
  border-color: var(--primary);
}

.smtp-field input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.smtp-help {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--text-dim);
  display: none;
}

.smtp-help a {
  color: var(--primary-light);
  text-decoration: underline;
}

.smtp-help.visible {
  display: block;
}

/* Recipients */
.recipients-area {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  transition: border-color var(--transition);
  cursor: text;
}

.recipients-area:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.recipients-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.recipient-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 8px 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--primary-light);
}

.recipient-tag .tag-remove {
  background: none;
  border: none;
  color: var(--primary-light);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 2px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.recipient-tag .tag-remove:hover {
  opacity: 1;
}

.recipient-input {
  flex: 1;
  min-width: 200px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 4px 6px;
  outline: none;
}

.recipient-input::placeholder {
  color: var(--text-dim);
  opacity: 0.5;
}

.recipients-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 6px;
}

/* Email Preview */
.email-preview-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 4px;
}

.email-preview-toggle:hover {
  border-color: var(--primary);
  color: var(--text);
}

.email-preview-toggle #previewArrow {
  margin-left: auto;
  transition: transform 0.2s;
}

.email-preview-toggle.open #previewArrow {
  transform: rotate(180deg);
}

.email-preview {
  margin-top: 8px;
  padding: 16px;
  background: #1e1e2f;
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text);
}

.email-preview h1, .email-preview h2, .email-preview h3 {
  color: var(--text-bright);
}

/* Modal Footer */
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.btn-modal-cancel {
  padding: 10px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-modal-cancel:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.btn-modal-send {
  padding: 10px 28px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  border-radius: 8px;
  color: white;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.btn-modal-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-modal-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ===== Scrollbar ===== */
.result-body::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.email-preview::-webkit-scrollbar {
  width: 6px;
}

.result-body::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.email-preview::-webkit-scrollbar-track {
  background: transparent;
}

.result-body::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.email-preview::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.result-body::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.email-preview::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* (Responsive additions moved to main responsive block above) */
