/* ==========================================================================
   Design System & Tokens - Divination Synthesis Platform
   Palette: Deep Celestial Slate, Warm Sand Paper, Noble Amber & Bronze Accents
   ========================================================================== */

:root {
  /* Color Tokens */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-dark: #0f172a;
  --bg-dark-card: #1e293b;
  --bg-warm-tint: #fefaf6;

  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-on-dark: #f8fafc;

  --primary: #1e3a8a;       /* Deep Imperial Blue */
  --primary-hover: #172554;
  --primary-light: #eff6ff;

  --accent: #b45309;        /* Warm Gold Bronze */
  --accent-hover: #92400e;
  --accent-light: #fffbeb;

  --secondary: #0f766e;      /* Deep Jade / Sage */
  --border: #e2e8f0;
  --border-dark: #334155;
  --border-focus: #3b82f6;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Cinzel', 'Georgia', serif;
}

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

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

/* Layout */
.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation & Header */
.site-header {
  background: var(--bg-dark);
  color: var(--text-on-dark);
  padding: 24px 0;
  border-bottom: 1px solid var(--border-dark);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-symbol {
  font-size: 24px;
  color: #f59e0b;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-light);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-badge {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: #fbbf24;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 48px 0 32px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  color: var(--bg-dark);
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 0.02em;
}

.hero-lead {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto 24px;
}

.systems-badge-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sys-pill {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Main Form Card */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 48px;
}

.form-section-title {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.form-label .required {
  color: #dc2626;
}

.form-input, .form-select, .form-textarea {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

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

/* Autocomplete Dropdown */
.autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-xl);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.autocomplete-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Checkbox Toggle */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  margin-top: 4px;
}

/* Submit Action Button */
.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.btn-submit:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-submit:active {
  transform: translateY(0);
}

/* Results / Summary Section */
.results-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

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

.summary-header-card {
  background: var(--bg-warm-tint);
  border: 1px solid #fed7aa;
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.summary-headline {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 14px;
}

.summary-body {
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.7;
}

/* System Cards Grid */
.system-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 36px;
}

.system-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.system-card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 8px;
}

.system-card-highlight {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
  margin-bottom: 12px;
}

.system-card-badge {
  font-size: 0.8rem;
  padding: 4px 8px;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* I Ching Visualizer Card */
.iching-card {
  background: var(--bg-dark);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-xl);
}

.iching-card-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: #fbbf24;
  margin-bottom: 12px;
}

.iching-diagram-row {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.iching-lines-box {
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-dark);
}

.iching-line {
  font-family: monospace;
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  color: #f8fafc;
}

.iching-line.changing {
  color: #f59e0b;
  font-weight: bold;
}

.iching-text {
  font-size: 1rem;
  color: #cbd5e1;
  line-height: 1.6;
  max-width: 600px;
}

/* Upgrade Card (Paid Tier 2) */
.upgrade-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 40px;
  color: #ffffff;
  box-shadow: var(--shadow-xl);
  text-align: center;
  margin-bottom: 60px;
}

.upgrade-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  color: #f59e0b;
  margin-bottom: 12px;
}

.upgrade-desc {
  font-size: 1.05rem;
  color: #cbd5e1;
  max-width: 700px;
  margin: 0 auto 24px;
  line-height: 1.6;
}

.upgrade-features-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  text-align: left;
  max-width: 750px;
  margin: 0 auto 32px;
}

.upgrade-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  color: #f1f5f9;
}

.upgrade-feature-item::before {
  content: '✓';
  color: #f59e0b;
  font-weight: bold;
}

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

.btn-purchase {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #ffffff;
  padding: 16px 36px;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px 0 rgba(180, 83, 9, 0.4);
  transition: all 0.2s ease;
}

.btn-purchase:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

.btn-sandbox {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 16px 24px;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-sandbox:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #ffffff;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

/* Footer */
.site-footer {
  background: #ffffff;
  border-top: 1px solid var(--border);
  padding: 32px 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
