/* ============================================
   Music Theory for AI Songwriting - Styles
   ============================================ */

:root {
    --bg: #0a0a0f;
    --bg-soft: #12121a;
    --bg-card: #15151f;
    --bg-card-hover: #1a1a25;
    --text: #f0f0f5;
    --text-secondary: #8888a0;
    --text-muted: #55556a;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --accent: #c890ff;        /* violet — music */
    --accent-2: #ffc890;      /* gold — instruments */
    --accent-3: #90ffd0;      /* mint — melody */
    --accent-4: #ff90c0;      /* pink */
    --bar-major: #ff90c0;
    --bg-elevated: #1a1a26;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --code-bg: #0e0e16;
    --selection-bg: rgba(200, 144, 255, 0.3);
    --axis: #55556a;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --mono: 'JetBrains Mono', ui-monospace, monospace;
    --sans: 'Outfit', -apple-system, sans-serif;
    --serif: 'Noto Serif SC', serif;
}

[data-theme="light"] {
    --bg: #faf8f5;
    --bg-soft: #f0ede5;
    --bg-card: #ffffff;
    --bg-card-hover: #fafaf5;
    --text: #1a1a24;
    --text-secondary: #5d5d72;
    --text-muted: #9999a8;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --accent: #7a3ec8;
    --accent-2: #b8862a;
    --accent-3: #1a9b6e;
    --accent-4: #c83a7a;
    --bar-major: #c83a7a;
    --bg-elevated: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --code-bg: #f0ede5;
    --selection-bg: rgba(122, 62, 200, 0.2);
    --axis: #c5c5d0;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

::selection { background: var(--selection-bg); color: var(--text); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

.bg-noise {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1000;
    opacity: 0.5;
}

[data-theme="light"] .bg-noise { opacity: 0.4; }

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 80px 80px;
    pointer-events: none;
    z-index: -1;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    opacity: 0.3;
}

/* ===== Header ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 24px;
    background: linear-gradient(to bottom, var(--bg) 60%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

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

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

.brand-mark {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--bg);
}

.brand-name {
    font-family: var(--mono);
    font-size: 16px;
    font-weight: 500;
}

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

.theme-toggle {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle:hover { color: var(--text); border-color: var(--border-hover); }

.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
[data-theme="light"] .theme-toggle .sun { display: block; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* ===== Deck Container ===== */
.deck-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ===== Navigation ===== */
.deck-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-dots {
    flex: 1;
    display: flex;
    gap: 6px;
    justify-content: center;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.nav-dot:hover { background: var(--text-muted); }
.nav-dot.active {
    background: var(--accent);
    width: 28px;
    border-radius: 5px;
}

.nav-counter {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

.fullscreen-btn { margin-left: auto; }

/* ===== Slide Base ===== */
.deck {
    position: relative;
    min-height: 70vh;
}

.slide {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 56px;
    box-shadow: var(--shadow);
    min-height: 70vh;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.4s ease;
}

.slide.active { display: block; }

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

.slide-num {
    position: absolute;
    top: 24px;
    right: 32px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.slide-title {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.slide-title-en {
    font-family: var(--mono);
    font-size: 0.5em;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
    -webkit-text-fill-color: var(--text-muted);
    background: none;
    margin-left: 8px;
}

.slide-lead {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

/* ===== Slide 1: Cover ===== */
.slide-cover {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    display: none;
    text-align: center;
    padding: 80px 56px;
    position: relative;
    overflow: hidden;
}

.slide-cover.active { display: flex; align-items: center; justify-content: center; }

.cover-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
}

.cover-tag {
    display: inline-block;
    padding: 6px 16px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--accent-2);
    background: rgba(255, 200, 144, 0.1);
    border: 1px solid rgba(255, 200, 144, 0.25);
    border-radius: 999px;
    margin-bottom: 32px;
}

.cover-title {
    font-family: var(--serif);
    font-size: clamp(3rem, 7vw, 5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cover-subtitle {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.cover-en {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 32px;
}

.cover-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 40px;
}

.cover-foot {
    display: inline-flex;
    gap: 12px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 20px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.cover-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
    opacity: 0.4;
}

.music-staff {
    position: absolute;
    width: 120%;
    height: 100%;
    left: -10%;
    transform: rotate(-8deg);
}

.staff-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background: var(--border);
}

.staff-line:nth-child(1) { top: 30%; }
.staff-line:nth-child(2) { top: 40%; }
.staff-line:nth-child(3) { top: 50%; }
.staff-line:nth-child(4) { top: 60%; }
.staff-line:nth-child(5) { top: 70%; }

.note {
    position: absolute;
    font-size: 36px;
    color: var(--accent);
    opacity: 0.5;
}

.note-1 { top: 35%; left: 10%; }
.note-2 { top: 50%; left: 35%; }
.note-3 { top: 30%; left: 60%; }
.note-4 { top: 55%; left: 80%; }

/* ===== Slide 2: TOC ===== */
.toc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 32px;
}

@media (max-width: 700px) {
    .toc-grid { grid-template-columns: 1fr; }
}

.toc-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
}

.toc-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.toc-num {
    font-family: var(--mono);
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    min-width: 40px;
}

.toc-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    display: block;
}

.toc-en {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ===== Slide 3: Flow Diagram ===== */
.flow-diagram {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 24px;
    background: var(--bg-soft);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 78px;
    text-align: center;
    transition: all 0.2s;
}

.flow-step:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.flow-step.chorus {
    background: linear-gradient(135deg, rgba(255, 144, 192, 0.15), rgba(255, 144, 192, 0.05));
    border-color: var(--bar-major);
}

.flow-step.bridge {
    background: rgba(144, 255, 208, 0.08);
    border-color: var(--accent-3);
}

.flow-step.peak {
    background: linear-gradient(135deg, rgba(200, 144, 255, 0.2), rgba(255, 200, 144, 0.15));
    border-color: var(--accent-2);
    box-shadow: 0 0 16px rgba(200, 144, 255, 0.3);
}

.flow-tag {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.flow-cn {
    font-size: 11px;
    color: var(--text-secondary);
}

.flow-arrow {
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

.info-box {
    padding: 16px 20px;
    background: rgba(200, 144, 255, 0.08);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    margin-bottom: 24px;
}

.energy-curve {
    margin-top: 16px;
    padding: 16px 20px;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
}

.energy-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.energy-curve svg {
    width: 100%;
    height: auto;
    max-height: 120px;
}

/* ===== Slide 4, 5: Terms Grid ===== */
.terms-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 800px) {
    .terms-grid { grid-template-columns: 1fr; }
}

.term-card {
    padding: 20px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.2s;
}

.term-card:hover { border-color: var(--border-hover); }

.term-card.highlight {
    background: linear-gradient(135deg, rgba(255, 144, 192, 0.06), var(--bg-soft));
    border-left: 3px solid var(--bar-major);
}

.term-head {
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.term-cn {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.term-en {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    padding: 2px 8px;
    background: rgba(200, 144, 255, 0.1);
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.term-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

.term-ai {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 10px;
    background: var(--bg);
    border-left: 2px solid var(--accent-3);
    border-radius: 4px;
    line-height: 1.5;
}

.term-ai strong { color: var(--accent-3); }

/* ===== Slide 6: Attributes ===== */
.attr-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.attr-row {
    padding: 16px 20px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.attr-name {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
}

.attr-cn {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.attr-en {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
}

.attr-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.attr-example {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent-2);
    padding: 4px 8px;
    background: rgba(255, 200, 144, 0.1);
    border-radius: 4px;
    display: inline-block;
}

/* ===== Slide 7: Prompt Block ===== */
.prompt-block {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    font-family: var(--mono);
    font-size: 13px;
}

.prompt-section {
    margin-bottom: 16px;
}

.prompt-section:last-child { margin-bottom: 0; }

.prompt-label {
    color: var(--accent-3);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
}

.prompt-line {
    color: var(--text-secondary);
    line-height: 1.7;
    padding-left: 0;
}

.pk { color: var(--accent); }
.pv { color: var(--text); }

.principles {
    padding: 20px;
    background: var(--bg-soft);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-2);
}

.principles h3 {
    font-size: 14px;
    color: var(--accent-2);
    margin-bottom: 12px;
}

.principles ol {
    padding-left: 24px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.8;
}

.principles li { margin-bottom: 4px; }
.principles strong { color: var(--text); }

/* ===== Slide 8: Compare ===== */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 800px) {
    .compare-grid { grid-template-columns: 1fr; }
}

.compare-col {
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.compare-col.bad {
    background: linear-gradient(135deg, rgba(255, 108, 142, 0.05), var(--bg-soft));
    border-left: 4px solid var(--accent-4);
}

.compare-col.good {
    background: linear-gradient(135deg, rgba(144, 255, 208, 0.05), var(--bg-soft));
    border-left: 4px solid var(--accent-3);
}

.compare-label {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.compare-col.bad .compare-label { color: var(--accent-4); }
.compare-col.good .compare-label { color: var(--accent-3); }

.compare-quote {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-style: italic;
}

.compare-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-family: var(--mono);
}

.compare-block {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 12px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.compare-block .indent {
    padding-left: 16px;
    color: var(--text-muted);
}

.compare-issues p {
    font-size: 13px;
    color: var(--accent-4);
    line-height: 1.6;
}

.compare-issues strong { color: var(--accent-4); }

.conclusion {
    text-align: center;
    padding: 16px;
    background: rgba(200, 144, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: 14px;
}

/* ===== Slide 9: Cheat Sheet ===== */
.cheat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

@media (max-width: 800px) {
    .cheat-grid { grid-template-columns: repeat(2, 1fr); }
}

.cheat-row {
    padding: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}

.cheat-row.highlight {
    background: linear-gradient(135deg, rgba(255, 144, 192, 0.1), var(--bg-soft));
    border-color: var(--bar-major);
}

.cheat-name {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.cheat-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.formula-banner {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(200, 144, 255, 0.15), rgba(255, 200, 144, 0.1));
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    font-family: var(--mono);
    font-size: 16px;
    color: var(--text);
}

.formula-banner strong { color: var(--accent-2); }

/* ===== Slide 10: Outro ===== */
.slide-outro {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    display: none;
    text-align: center;
    padding: 80px 56px;
}

.slide-outro.active { display: flex; align-items: center; justify-content: center; }

.outro-content {
    max-width: 700px;
    margin: 0 auto;
}

.outro-icon {
    font-size: 64px;
    color: var(--accent);
    margin-bottom: 32px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.outro-title {
    font-family: var(--serif);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.outro-subtitle {
    font-family: var(--mono);
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 40px;
}

.outro-message {
    font-size: 17px;
    color: var(--text);
    line-height: 1.8;
    margin-bottom: 48px;
}

.outro-credits {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* ===== Footer ===== */
.site-footer {
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.site-footer p {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .slide { padding: 32px 24px; }
    .flow-diagram { padding: 16px; }
    .flow-step { min-width: 64px; padding: 8px 10px; }
    .flow-arrow { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}