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

:root {
  --color-bg: #0f0f13;
  --color-surface: #1a1a24;
  --color-surface-alt: #222230;
  --color-border: #2e2e40;
  --color-text: #e8e6f0;
  --color-text-muted: #9896a8;
  --color-accent: #c4a1ff;
  --color-accent-hover: #d4b8ff;
  --color-accent-dim: rgba(196, 161, 255, 0.15);
  --color-success: #7ee787;
  --color-warning: #ffd166;
  --color-danger: #ff6b6b;
  --color-danger-hover: #ff8585;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --max-width: 1200px;
  --transition: 0.2s ease;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg: #f5f3fa;
    --color-surface: #ffffff;
    --color-surface-alt: #eeeaf5;
    --color-border: #d8d0e8;
    --color-text: #1e1a2e;
    --color-text-muted: #6b6480;
    --color-accent-dim: rgba(106, 52, 200, 0.1);
    --shadow: 0 2px 12px rgba(80, 50, 130, 0.1);
  }
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover, a:focus-visible { color: var(--color-accent-hover); text-decoration: underline; }

.skip-link {
  position: absolute; top: -100%;
  background: var(--color-accent); color: #000;
  padding: 8px 16px; border-radius: var(--radius-sm);
  z-index: 100; font-weight: 600;
}
.skip-link:focus { top: 8px; left: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container {
  width: 100%; max-width: var(--max-width);
  margin: 0 auto; padding: 0 20px;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center;
  justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  color: var(--color-text); font-weight: 700; font-size: 1.2rem;
  text-decoration: none;
}
.logo:hover, .logo:focus-visible { color: var(--color-text); text-decoration: none; }
.logo-icon { color: var(--color-accent); }
.logo-accent { color: var(--color-accent); }

.nav-list {
  display: flex; list-style: none; gap: 24px;
}
.nav-list a {
  color: var(--color-text-muted);
  font-weight: 500; font-size: 0.95rem;
  padding: 4px 0;
}
.nav-list a:hover, .nav-list a[aria-current="page"] {
  color: var(--color-accent); text-decoration: none;
}

/* ===== HERO ===== */
.hero-section {
  padding: 60px 0 40px;
  text-align: center;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--color-text) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.15rem; color: var(--color-text-muted);
  max-width: 600px; margin: 0 auto;
}

/* ===== WORKSPACE ===== */
.workspace-section {
  padding: 20px 0 60px;
  flex: 1;
}
.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
}

.project-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.project-picker {
  flex: 1; min-width: 180px;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.9rem;
}

.song-form {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.form-block {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
  background: var(--color-surface-alt);
}
.form-legend {
  font-weight: 700; font-size: 1.05rem;
  padding: 0 8px; margin-left: -8px;
  color: var(--color-accent);
}
.form-label {
  display: block; font-size: 0.85rem;
  font-weight: 600; margin: 12px 0 4px;
  color: var(--color-text-muted);
}
.form-label:first-child { margin-top: 0; }
.form-input, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-dim);
}
.form-input::placeholder { color: var(--color-text-muted); opacity: 0.6; }

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

.form-actions {
  display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 600;
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-sans);
}
.btn:hover, .btn:focus-visible {
  background: var(--color-border);
  text-decoration: none;
}
.btn-primary {
  background: var(--color-accent);
  color: #000;
  border-color: var(--color-accent);
  font-size: 1rem;
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #000;
}
.btn-secondary {
  background: transparent;
  border-color: var(--color-border);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.btn-danger {
  color: var(--color-danger);
  border-color: rgba(255,107,107,0.3);
}
.btn-danger:hover, .btn-danger:focus-visible {
  color: var(--color-danger-hover);
  border-color: var(--color-danger);
}
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

/* ===== RESULTS ===== */
.results-area {
  margin-top: 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.results-heading {
  font-size: 1.4rem; font-weight: 700;
  margin-bottom: 20px;
}
.results-content { margin-bottom: 20px; }

.result-dimension {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.result-dimension:last-child { border-bottom: none; margin-bottom: 0; }

.result-dim-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.result-dim-label {
  font-weight: 700; font-size: 1rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-accent);
}
.result-badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-high { background: rgba(126,231,135,0.15); color: var(--color-success); }
.badge-medium { background: rgba(255,209,102,0.15); color: var(--color-warning); }
.badge-low { background: rgba(255,107,107,0.12); color: var(--color-danger); }
.badge-none { background: var(--color-surface-alt); color: var(--color-text-muted); }

.result-detail {
  font-size: 0.95rem; color: var(--color-text-muted);
  margin-bottom: 6px;
}
.result-suggestion {
  background: var(--color-accent-dim);
  border-left: 3px solid var(--color-accent);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 8px;
  font-size: 0.95rem;
}

.results-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
}

.toast {
  margin-top: 12px; padding: 10px 16px;
  background: rgba(126,231,135,0.12);
  border: 1px solid rgba(126,231,135,0.3);
  border-radius: var(--radius-sm);
  color: var(--color-success);
  font-size: 0.9rem;
}

/* ===== SIDEBAR ===== */
.sidebar {
  display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 80px;
}
.sidebar-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.sidebar-title {
  font-size: 1rem; font-weight: 700;
  margin-bottom: 14px;
  color: var(--color-accent);
}

.scenario-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px; flex-wrap: wrap;
}
.scenario-tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 600;
  border: none; background: transparent;
  color: var(--color-text-muted);
  cursor: pointer; transition: all var(--transition);
  font-family: var(--font-sans);
}
.scenario-tab:hover { color: var(--color-text); background: var(--color-surface-alt); }
.scenario-tab.active {
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

.scenario-panel { font-size: 0.9rem; line-height: 1.65; }
.scenario-panel p { margin-bottom: 10px; }
.scenario-panel p:last-child { margin-bottom: 0; }
.scenario-panel strong { color: var(--color-text); }

.mistake-list {
  list-style: none; font-size: 0.9rem;
}
.mistake-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  line-height: 1.55;
}
.mistake-list li:last-child { border-bottom: none; }
.mistake-list strong { color: var(--color-text); }

.example-list { font-size: 0.9rem; }
.example-list dt {
  font-weight: 700; color: var(--color-accent);
  margin-top: 12px;
}
.example-list dt:first-child { margin-top: 0; }
.example-list dd {
  color: var(--color-text-muted);
  line-height: 1.55; margin-top: 4px;
}

.checklist {
  list-style: none; padding: 0;
}
.checklist li {
  padding: 6px 0 6px 24px;
  position: relative;
}
.checklist li::before {
  content: '→'; position: absolute; left: 0;
  color: var(--color-accent); font-weight: 700;
}

/* ===== GUIDE ===== */
.guide-section {
  padding: 60px 0;
  background: var(--color-surface-alt);
  border-top: 1px solid var(--color-border);
}
.section-heading {
  font-size: 1.6rem; font-weight: 700;
  margin-bottom: 32px;
  text-align: center;
}
.guide-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
.guide-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}
.guide-card h3 {
  font-size: 1.05rem; font-weight: 700;
  margin-bottom: 10px;
  color: var(--color-accent);
}
.guide-card p {
  font-size: 0.95rem; color: var(--color-text-muted);
  line-height: 1.65;
}

/* ===== FAQ ===== */
.faq-section {
  padding: 60px 0;
}
.faq-list {
  max-width: 720px; margin: 0 auto;
}
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-question {
  padding: 16px 20px;
  font-weight: 600; font-size: 1rem;
  cursor: pointer;
  list-style: none;
  display: flex; align-items: center;
  justify-content: space-between;
  transition: background var(--transition);
}
.faq-question:hover { background: var(--color-surface-alt); }
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
  content: '+'; font-size: 1.3rem;
  color: var(--color-accent); font-weight: 400;
}
.faq-item[open] .faq-question::after { content: '−'; }
.faq-answer {
  padding: 0 20px 16px;
  font-size: 0.95rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ===== FOOTER ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 32px 0;
  margin-top: auto;
}
.footer-inner {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
}
.footer-brand {
  font-weight: 700; font-size: 1.1rem;
}
.footer-links {
  display: flex; list-style: none; gap: 20px;
}
.footer-links a {
  color: var(--color-text-muted); font-size: 0.9rem;
}
.footer-links a:hover { color: var(--color-accent); }
.footer-meta {
  font-size: 0.8rem; color: var(--color-text-muted);
}
.footer-meta a { color: var(--color-text-muted); text-decoration: underline; }
.footer-meta a:hover { color: var(--color-accent); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
  .sidebar { position: static; }
}

@media (max-width: 640px) {
  .form-columns { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
  .hero-section { padding: 40px 0 28px; }
  .hero-title { font-size: 1.8rem; }
  .song-form { padding: 18px; }
  .results-area { padding: 18px; }
  .nav-list { gap: 14px; }
  .form-actions { flex-direction: column; }
  .btn { width: 100%; }
}

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .sidebar, .hero-section,
  .project-bar, .form-actions, .results-actions,
  .faq-section, .guide-section, .site-nav, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  .results-area { border: none; padding: 0; }
  .workspace-section { padding: 0; }
  .song-form { border: 1px solid #ccc; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
