:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a2e;
    --accent-purple: #9b59b6;
    --accent-pink: #e91e63;
    --accent-blue: #2196f3;
    --accent-green: #4caf50;
    --accent-orange: #ff9800;
    --accent-red: #f44336;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-dim: #555;
    --border: #1e1e2e;
    --gradient: linear-gradient(135deg, #9b59b6, #e91e63);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    -webkit-font-smoothing: antialiased;
}

#app { max-width: 600px; margin: 0 auto; }

/* Header */
.header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo h1 { font-size: 20px; font-weight: 700; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-stats { font-size: 13px; color: var(--text-secondary); }

/* Tabs */
.tabs {
    display: flex; gap: 0; border-bottom: 1px solid var(--border);
    padding: 0 8px; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 10px 4px; border: none; background: none; color: var(--text-dim);
    font-size: 11px; cursor: pointer; position: relative; white-space: nowrap;
    transition: color 0.2s;
}
.tab span:first-child { font-size: 18px; }
.tab.active { color: var(--accent-purple); }
.tab.active::after {
    content: ''; position: absolute; bottom: 0; left: 20%; right: 20%;
    height: 2px; background: var(--gradient); border-radius: 1px;
}

/* Tab Content */
.tab-content { display: none; padding: 16px; padding-bottom: 80px; }
.tab-content.active { display: block; }

/* Section Headers */
.section-header { margin-bottom: 16px; }
.section-header h2 { font-size: 18px; font-weight: 600; }
.section-header .badge {
    display: inline-block; background: var(--gradient); color: white;
    font-size: 11px; padding: 2px 8px; border-radius: 10px; margin-left: 8px;
}

/* Filter Row */
.filter-row { display: flex; gap: 8px; margin-top: 8px; }
.filter-row select {
    flex: 1; background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
    font-size: 12px;
}

/* === IDEA CARDS === */
.ideas-list { display: flex; flex-direction: column; gap: 12px; }

.idea-card {
    background: var(--bg-card); border-radius: 14px; padding: 16px;
    border: 1px solid var(--border); cursor: pointer;
    transition: transform 0.15s, border-color 0.2s;
    animation: fadeIn 0.3s ease;
}
.idea-card:active { transform: scale(0.98); }
.idea-card.liked { border-color: var(--accent-pink); }
.idea-card.passed { opacity: 0.4; }

.idea-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.idea-title { font-size: 16px; font-weight: 600; flex: 1; }
.idea-viral { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.idea-viral.high { background: rgba(233,30,99,0.2); color: var(--accent-pink); }
.idea-viral.medium { background: rgba(255,152,0,0.2); color: var(--accent-orange); }
.idea-viral.low { background: rgba(76,175,80,0.2); color: var(--accent-green); }

.idea-description { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }

.idea-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.idea-tag {
    font-size: 11px; padding: 3px 8px; border-radius: 6px;
    background: rgba(155,89,182,0.15); color: var(--accent-purple);
}
.idea-tag.mood { background: rgba(33,150,243,0.15); color: var(--accent-blue); }
.idea-tag.genre { background: rgba(233,30,99,0.15); color: var(--accent-pink); }

.idea-actions { display: flex; gap: 8px; }
.idea-btn {
    flex: 1; padding: 8px; border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.idea-btn.like { background: rgba(233,30,99,0.15); color: var(--accent-pink); }
.idea-btn.like:hover { background: rgba(233,30,99,0.3); }
.idea-btn.like.active { background: var(--accent-pink); color: white; }
.idea-btn.pass { background: rgba(255,255,255,0.05); color: var(--text-dim); }
.idea-btn.pass:hover { background: rgba(255,255,255,0.1); }

/* Lyrics Badge */
.lyrics-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; color: var(--accent-green); margin-top: 8px;
}

/* === SONG CARDS === */
.songs-list { display: flex; flex-direction: column; gap: 10px; }
.song-card {
    background: var(--bg-card); border-radius: 12px; padding: 14px;
    border: 1px solid var(--border); cursor: pointer;
    transition: transform 0.15s;
}
.song-card:active { transform: scale(0.98); }
.song-card-top { display: flex; justify-content: space-between; align-items: center; }
.song-title { font-size: 15px; font-weight: 600; }
.song-status {
    font-size: 10px; padding: 2px 8px; border-radius: 8px; font-weight: 600;
}
.song-status.draft { background: rgba(255,152,0,0.2); color: var(--accent-orange); }
.song-status.finished { background: rgba(76,175,80,0.2); color: var(--accent-green); }
.song-status.released { background: rgba(33,150,243,0.2); color: var(--accent-blue); }
.song-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.song-rating { margin-top: 6px; color: var(--accent-orange); font-size: 13px; }

/* === KNOWLEDGE CARDS === */
.knowledge-list { display: flex; flex-direction: column; gap: 10px; }
.knowledge-card {
    background: var(--bg-card); border-radius: 12px; padding: 14px;
    border: 1px solid var(--border);
}
.knowledge-category {
    font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
    color: var(--accent-purple); margin-bottom: 6px;
}
.knowledge-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.knowledge-content { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.knowledge-source { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.knowledge-date { font-size: 10px; color: var(--text-dim); margin-top: 4px; }

/* === TREND CARDS === */
.trends-list { display: flex; flex-direction: column; gap: 10px; }
.trend-card {
    background: var(--bg-card); border-radius: 12px; padding: 14px;
    border: 1px solid var(--border);
}
.trend-genre { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.trend-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.trend-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-dim); }
.trend-hotness { color: var(--accent-pink); font-weight: 600; }
.trend-examples { margin-top: 8px; font-size: 12px; color: var(--accent-blue); }

/* === MODALS === */
.modal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100; display: flex; align-items: flex-end; justify-content: center;
}
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-content {
    position: relative; width: 100%; max-width: 600px; max-height: 85vh;
    background: var(--bg-card); border-radius: 20px 20px 0 0;
    padding: 20px; overflow-y: auto;
    animation: slideUp 0.25s ease;
}
.close-modal {
    position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,0.1);
    border: none; color: var(--text-secondary); width: 30px; height: 30px;
    border-radius: 50%; cursor: pointer; font-size: 16px;
}
.modal h3 { font-size: 20px; margin-bottom: 12px; padding-right: 30px; }
.modal .label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent-purple); margin-top: 14px; margin-bottom: 4px; }
.modal .value { font-size: 13px; color: var(--text-secondary); line-height: 1.5; white-space: pre-wrap; }

/* Lyrics in modal */
.lyrics-box {
    background: var(--bg-dark); border-radius: 10px; padding: 14px;
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 12px;
    line-height: 1.6; white-space: pre-wrap; margin-top: 8px;
    border: 1px solid var(--border);
}
.copy-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--gradient); color: white; border: none;
    padding: 10px 20px; border-radius: 10px; font-size: 13px;
    font-weight: 600; cursor: pointer; margin-top: 12px;
}

/* Loading & Empty */
.loading, .empty { text-align: center; color: var(--text-dim); padding: 40px 20px; font-size: 14px; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Search */
.search-bar {
    width: 100%; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; padding: 10px 14px; color: var(--text-primary);
    font-size: 14px; margin-bottom: 12px; outline: none;
}
.search-bar:focus { border-color: var(--accent-purple); }
.search-bar::placeholder { color: var(--text-dim); }