/* ================================================
   MEMORY ENCODER PWA — Design System
   Mobile-first, dark cinematic, gold/blue accents
   ================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg: #07070c;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-input: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-gold: rgba(212, 168, 83, 0.3);
    --gold: #d4a853;
    --gold-bright: #f0c96e;
    --gold-glow: rgba(212, 168, 83, 0.12);
    --blue: #4a9eff;
    --blue-glow: rgba(74, 158, 255, 0.12);
    --green: #4ade80;
    --green-glow: rgba(74, 222, 128, 0.12);
    --text: #f0eee6;
    --text-dim: rgba(240, 238, 230, 0.75);
    --text-muted: rgba(240, 238, 230, 0.5);
    --header-bg: rgba(7, 7, 12, 0.9);
    --tab-bg: rgba(7, 7, 12, 0.95);
    --option-bg: #1a1a24;
    --ring-bg: rgba(255, 255, 255, 0.05);
    --font: 'Inter', -apple-system, sans-serif;
    --display: 'Outfit', sans-serif;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-full: 100px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"] {
    --bg: #f5f3ee;
    --bg-card: rgba(0, 0, 0, 0.04);
    --bg-card-hover: rgba(0, 0, 0, 0.07);
    --bg-input: rgba(0, 0, 0, 0.05);
    --border: rgba(0, 0, 0, 0.1);
    --border-gold: rgba(180, 130, 40, 0.35);
    --gold: #a07820;
    --gold-bright: #c49530;
    --gold-glow: rgba(160, 120, 32, 0.1);
    --blue: #2a7ae0;
    --blue-glow: rgba(42, 122, 224, 0.1);
    --green: #22a855;
    --green-glow: rgba(34, 168, 85, 0.1);
    --text: #1a1814;
    --text-dim: rgba(26, 24, 20, 0.65);
    --text-muted: rgba(26, 24, 20, 0.4);
    --header-bg: rgba(245, 243, 238, 0.92);
    --tab-bg: rgba(245, 243, 238, 0.95);
    --option-bg: #eae8e2;
    --ring-bg: rgba(0, 0, 0, 0.06);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: calc(70px + var(--safe-bottom));
}

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

input,
select,
textarea,
button {
    font-family: var(--font);
}

/* ---- App Header ---- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 1rem 1.25rem 0.75rem;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header h1 {
    font-family: var(--display);
    font-size: 1.35rem;
    font-weight: 800;
}

.app-header h1 span {
    color: var(--gold);
}

.app-header-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 0.15rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.font-size-controls {
    display: flex;
    gap: 2px;
}

.font-size-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
}

.font-size-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

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

/* ---- Tab Bar ---- */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    background: var(--tab-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding-bottom: var(--safe-bottom);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 0 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
    color: var(--gold);
}

.tab-btn:hover {
    color: var(--text-dim);
}

.tab-btn .tab-icon {
    font-size: 1.25rem;
}

.tab-btn .tab-label {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ---- Screens ---- */
.screen {
    display: none;
    padding: 1.25rem;
    min-height: calc(100vh - 130px);
}

.screen.active {
    display: block;
    animation: screenIn 0.3s ease;
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Dashboard ---- */
.score-ring-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.score-ring {
    position: relative;
    width: 180px;
    height: 180px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--ring-bg);
    stroke-width: 8;
}

.score-ring-fill {
    fill: none;
    stroke: var(--gold);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 8px rgba(212, 168, 83, 0.3));
}

.score-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-ring-value {
    font-family: var(--display);
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
}

.score-ring-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 4px;
}

.week-streak {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 1rem 0 1.5rem;
}

.week-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.week-day-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.week-day-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: all 0.3s;
}

.week-day-dot.active {
    background: var(--gold-glow);
    border-color: var(--border-gold);
    color: var(--gold);
    font-weight: 700;
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-tile {
    padding: 1rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
}

.stat-tile-value {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold);
}

.stat-tile-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.daily-voice {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 1rem;
}

.daily-voice-quote {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.daily-voice-quote::before {
    content: '"';
    color: var(--gold);
    font-weight: 700;
}

.daily-voice-quote::after {
    content: '"';
    color: var(--gold);
    font-weight: 700;
}

.daily-voice-athlete {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold);
}

/* ---- Pipeline ---- */
.pipeline-section {
    margin-top: 1.5rem;
}

.pipeline-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.5rem 0;
}

.pipe-stage {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius);
    transition: all 0.2s;
    min-width: 70px;
}

.pipe-stage:hover {
    background: var(--bg-card-hover);
}

.pipe-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border);
    font-size: 1.2rem;
    transition: all 0.2s;
}

.pipe-stage:hover .pipe-icon {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(212, 168, 83, 0.3);
}

.pipe-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.pipe-sub {
    font-size: 0.5rem;
    color: var(--text-dim);
    white-space: nowrap;
}

.pipe-arrow {
    color: var(--text-dim);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ---- Concept Card Modal ---- */
.concept-card-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s;
}

.concept-card {
    background: var(--bg-card);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    max-width: 400px;
    width: 100%;
    padding: 1.5rem;
    position: relative;
}

.concept-card-icon {
    font-size: 2rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.concept-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

.concept-card-body {
    font-size: 0.82rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.concept-card-stats {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-size: 0.78rem;
}

.concept-card-stats dt {
    color: var(--text-dim);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.4rem;
}

.concept-card-stats dt:first-child {
    margin-top: 0;
}

.concept-card-stats dd {
    color: var(--text);
    font-weight: 600;
    margin: 0;
    padding: 0;
}

.concept-card-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
}

/* ---- PDR Logger ---- */
.pdr-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.form-input,
.form-select {
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--gold);
}

.skill-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.skill-suggestions:empty {
    display: none;
}

.skill-chip {
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.skill-chip:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--bg-card-hover);
}

.skill-chip.active {
    border-color: var(--gold);
    background: var(--gold);
    color: var(--bg);
    font-weight: 700;
}

.form-select {
    cursor: pointer;
}

.form-select option {
    background: var(--option-bg);
    color: var(--text);
}

.ndp-reminder {
    padding: 0.75rem 1rem;
    background: var(--gold-glow);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
    text-align: center;
    letter-spacing: 0.03em;
}

.rep-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.rep-count {
    font-family: var(--display);
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--gold);
    min-width: 100px;
    text-align: center;
}

.rep-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rep-btn:active {
    background: var(--gold);
    color: var(--bg);
    border-color: var(--gold);
    transform: scale(0.92);
}

.rep-btn-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rep-btn-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.rep-btn-small:active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
}

.session-timer {
    text-align: center;
    padding: 0.75rem;
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dim);
}

.btn-full {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-full);
    border: none;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-gold {
    background: var(--gold);
    color: var(--bg);
}

.btn-gold:hover {
    background: var(--gold-bright);
}

.btn-gold:active {
    transform: scale(0.97);
}

.btn-outline {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* Session History */
.section-heading {
    font-family: var(--display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 2rem 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.session-type-badge {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-weight: 900;
    font-size: 1rem;
    background: var(--gold-glow);
    color: var(--gold);
    border: 1px solid var(--border-gold);
    flex-shrink: 0;
}

.session-info {
    flex: 1;
}

.session-skill {
    font-size: 0.85rem;
    font-weight: 600;
}

.session-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.session-reps {
    font-family: var(--display);
    font-size: 1rem;
    font-weight: 800;
    color: var(--gold);
}

/* ---- Game Mode ---- */
.game-mode-setup {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    text-align: center;
    gap: 2rem;
    padding: 2rem;
}

.game-mode-icon {
    font-size: 4rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.game-mode-title {
    font-family: var(--display);
    font-size: 1.75rem;
    font-weight: 800;
}

.game-mode-encoding {
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius);
    max-width: 320px;
    width: 100%;
}

.game-mode-encoding p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.game-mode-encoding strong {
    color: var(--gold);
    font-size: 1.25rem;
}

.game-mode-cypher {
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 600;
    font-style: italic;
    color: var(--gold);
    max-width: 280px;
    line-height: 1.4;
}

/* Active game mode - full dark */
.game-active {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.breathing-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    animation: breathe 4s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(212, 168, 83, 0.3);
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.3;
    }

    50% {
        transform: scale(1.8);
        opacity: 0.6;
    }
}

.game-exit-btn {
    padding: 0.5rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    background: none;
    color: rgba(255, 255, 255, 0.2);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
}

.game-exit-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ---- Journal ---- */
.journal-slider-container {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.journal-slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.journal-slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--blue), var(--gold));
    outline: none;
}

.journal-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--gold);
    border: 3px solid var(--bg);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(212, 168, 83, 0.4);
}

.slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 0.55rem;
    color: var(--text-muted);
    padding: 0.25rem 2px 0;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.slider-feedback {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg-card-hover);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--gold);
}

.slider-value {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold);
    min-width: 2.2rem;
    text-align: center;
}

.slider-desc {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.journal-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    line-height: 1.6;
}

.journal-textarea:focus {
    border-color: var(--gold);
}

.journal-textarea::placeholder {
    color: var(--text-muted);
}

.journal-entry {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.journal-entry-date {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.journal-entry-score {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.score-zone {
    background: var(--gold-glow);
    color: var(--gold);
}

.score-flow {
    background: var(--blue-glow);
    color: var(--blue);
}

.score-mixed {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
}

.journal-entry-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.6;
}

/* ---- Learn ---- */
.learn-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.learn-tab {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.learn-tab.active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
}

.flashcard {
    padding: 3rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s;
    perspective: 600px;
}

.flashcard.flipped {
    border-color: var(--border-gold);
    background: var(--gold-glow);
}

.flashcard-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}

.flashcard-term {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gold);
}

.flashcard-def {
    font-size: 0.9rem;
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 300px;
}

.flashcard-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.flashcard-nav-btn {
    padding: 0.6rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-dim);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.flashcard-nav-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.flashcard-counter {
    text-align: center;
    margin-top: 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.voice-mini-card {
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.voice-mini-card:hover {
    border-color: var(--border-gold);
}

.voice-mini-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.voice-mini-quote {
    font-size: 0.8rem;
    font-style: italic;
    color: var(--text-dim);
    margin-top: 0.25rem;
}

.voice-mini-meta {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-family: var(--display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dim);
}

.empty-state-desc {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.75rem 1.5rem;
    background: var(--gold);
    color: var(--bg);
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    opacity: 0;
    transition: all 0.3s;
    z-index: 150;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Insights Tab ---- */

.insights-chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    overflow: hidden;
}

.correlation-svg {
    width: 100%;
    height: auto;
}

.chart-axis {
    stroke: var(--border);
    stroke-width: 0.5;
}

.chart-line-reps {
    stroke: var(--gold);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.chart-line-zone {
    stroke: var(--blue, #60a5fa);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    stroke-dasharray: 4 2;
}

.chart-dot-zone {
    fill: var(--blue, #60a5fa);
}

.chart-label {
    fill: var(--text-muted);
    font-size: 5px;
    font-family: inherit;
}

.chart-legend {
    fill: var(--text-dim);
    font-size: 4px;
    font-family: inherit;
}

.legend-reps {
    fill: var(--gold);
}

.legend-zone {
    fill: var(--blue, #60a5fa);
}

.insights-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
}

.insights-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.insights-empty-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Choking Predictor */

.choking-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--text-muted);
}

.choking-safe {
    border-left-color: var(--green, #4ade80);
}

.choking-warning {
    border-left-color: var(--gold);
}

.choking-danger {
    border-left-color: var(--red, #f87171);
}

.choking-unknown {
    border-left-color: var(--text-muted);
}

.choking-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.choking-icon {
    font-size: 1.25rem;
}

.choking-level {
    font-weight: 800;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.choking-days {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.choking-message {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-dim);
    margin: 0;
}

/* Milestone Badges */

.milestones-grid {
    display: grid;
    gap: 0.75rem;
}

.milestone-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    transition: all 0.2s;
}

.milestone-card.earned {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--card-bg), rgba(212, 168, 83, 0.08));
}

.milestone-card.locked {
    opacity: 0.6;
}

.milestone-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.milestone-info {
    flex: 1;
    min-width: 0;
}

.milestone-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 2px;
}

.milestone-desc {
    font-size: 0.7rem;
    color: var(--text-dim);
    line-height: 1.4;
}

.milestone-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.milestone-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.milestone-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.milestone-pct {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 2rem;
    text-align: right;
}

/* 6-tab adjustment */
.tab-btn .tab-icon {
    font-size: 1.1rem;
}

.tab-btn .tab-label {
    font-size: 0.55rem;
}

/* ---- Share Modal ---- */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    padding: 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: slideUp 0.3s ease;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    margin: 0 0 0.5rem;
}

.modal-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0 0 0.75rem;
}

.modal-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 0 0 1rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ---- Community Voice Cards ---- */

.community-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-dim);
}

.community-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.community-empty-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.community-voice-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-left: 3px solid var(--gold);
}

.community-voice-quote {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
    font-style: italic;
    margin-bottom: 0.5rem;
}

.community-voice-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.community-sport-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gold);
    color: var(--bg);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.community-zone-score {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ---- Testimonial Action Buttons ---- */

.testimonial-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.testimonial-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.03em;
}

.testimonial-btn:hover {
    background: rgba(212, 168, 83, 0.12);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

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

.testimonial-share-btn:hover {
    background: rgba(212, 168, 83, 0.15);
    border-color: var(--gold);
    color: var(--gold);
}

.testimonial-copy-btn:hover {
    background: rgba(96, 165, 250, 0.12);
    border-color: var(--blue, #60a5fa);
    color: var(--blue, #60a5fa);
}

.testimonial-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-left: auto;
}

.testimonial-site-link {
    display: block;
    text-align: center;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.08), rgba(212, 168, 83, 0.03));
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: var(--radius);
    color: var(--gold);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    letter-spacing: 0.02em;
}

.testimonial-site-link:hover {
    background: linear-gradient(135deg, rgba(212, 168, 83, 0.15), rgba(212, 168, 83, 0.06));
    border-color: var(--gold);
    transform: translateY(-1px);
}

.testimonial-book-link {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0.03));
    border-color: rgba(96, 165, 250, 0.2);
    color: var(--blue, #60a5fa);
}

.testimonial-book-link:hover {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(96, 165, 250, 0.06));
    border-color: var(--blue, #60a5fa);
    color: var(--blue, #60a5fa);
}

.testimonial-app-link {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.08), rgba(74, 222, 128, 0.03));
    border-color: rgba(74, 222, 128, 0.2);
    color: var(--green, #4ade80);
}

.testimonial-app-link:hover {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(74, 222, 128, 0.06));
    border-color: var(--green, #4ade80);
    color: var(--green, #4ade80);
}

/* ---- Protocol Steps ---- */

.protocol-steps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.protocol-step {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.protocol-step.active {
    color: var(--gold);
    opacity: 1;
    font-size: 0.85rem;
}

.protocol-step.completed {
    color: var(--green, #4ade80);
    opacity: 0.8;
}

.protocol-divider {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 0.7rem;
}

.protocol-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 320px;
    min-height: 200px;
}

.protocol-controls {
    width: 100%;
    max-width: 280px;
    margin-top: 1.5rem;
}

.protocol-next-btn {
    max-width: 280px;
}

/* Breathe Step */
.protocol-breathe {
    text-align: center;
}

.breathe-instruction {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 1.5rem;
}

.breathe-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Recall Step */
.protocol-recall {
    text-align: center;
    width: 100%;
}

.recall-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.recall-skill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.recall-skill-name {
    font-weight: 700;
    color: var(--text);
}

.recall-skill-reps {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 600;
}

.recall-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 1rem;
}

.recall-summary {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 1rem;
}

.recall-cypher {
    font-size: 0.85rem;
    color: var(--gold);
    font-style: italic;
    margin-top: 1rem;
    line-height: 1.6;
}

/* Release Step */
.protocol-release {
    text-align: center;
}

.release-cypher {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gold);
    font-style: italic;
    margin-top: 1.5rem;
    line-height: 1.6;
}

.release-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.75rem;
}

/* ---- Encoding Decay Timer ---- */

.decay-timer {
    margin: 0.75rem 0;
}

.decay-timer-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    border-left: 3px solid var(--text-muted);
}

.decay-timer-card.decay-safe {
    border-left-color: var(--green, #4ade80);
}

.decay-timer-card.decay-warning {
    border-left-color: var(--gold);
}

.decay-timer-card.decay-danger {
    border-left-color: #ef4444;
}

.decay-timer-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
}

.decay-icon {
    font-size: 0.8rem;
}

.decay-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.decay-timer-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin: 0.25rem 0;
}

.decay-timer-msg {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ---- Screen Guide Popup ---- */

.guide-card {
    max-width: 360px;
    background: #0e0d0b;
    border-color: var(--gold);
    color: rgba(240, 238, 230, 0.9);
    font-size: 16px;
}

.guide-card .modal-title {
    color: rgba(240, 238, 230, 0.9);
    font-size: 1.1em;
}

.guide-icon {
    font-size: 2em;
    margin-bottom: 0.5em;
}

.guide-body {
    text-align: left;
    font-size: 0.85em;
    color: rgba(240, 238, 230, 0.85);
    line-height: 1.6;
    margin: 0.75em 0 1.25em;
}

.guide-body ul {
    list-style: none;
    padding: 0;
    margin: 0.5em 0;
}

.guide-body li {
    padding: 0.3rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.guide-body li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--gold);
    font-weight: 700;
}

.guide-body p:last-child {
    font-style: italic;
    color: var(--gold);
    margin-top: 0.75em;
}

.guide-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    width: 100%;
}

.guide-card .btn-full {
    padding: 1em;
    font-size: 0.85em;
}

.guide-dismiss-btn {
    background: none;
    border: none;
    color: rgba(240, 238, 230, 0.5);
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.guide-dismiss-btn:hover {
    opacity: 1;
}

/* ================================================
   MOBILE RESPONSIVE — iPhone / Android
   ================================================ */
@media (max-width: 600px) {

    /* Screen safe area + tab clearance */
    .screen {
        padding: 1rem 0.75rem;
        padding-bottom: calc(80px + var(--safe-bottom));
    }

    /* Header tighter */
    .header {
        padding: 0.5rem 0.75rem;
    }

    /* Score ring – slightly smaller */
    .score-ring {
        width: 150px;
        height: 150px;
    }

    .score-ring-value {
        font-size: 2rem;
    }

    /* Week streak – smaller dots */
    .week-day-dot {
        width: 28px;
        height: 28px;
        font-size: 0.6rem;
    }

    .week-streak {
        gap: 6px;
    }

    /* Stats cards */
    .stat-tile {
        padding: 0.75rem 0.5rem;
    }

    .stat-tile-value {
        font-size: 1.25rem;
    }

    /* Pipeline – compact for mobile */
    .pipeline-row {
        gap: 0;
        justify-content: space-around;
        overflow-x: hidden;
        flex-wrap: nowrap;
        padding: 0.5rem 0;
    }

    .pipe-stage {
        min-width: unset;
        padding: 0.2rem;
        flex: 1;
    }

    .pipe-icon {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .pipe-label {
        font-size: 0.45rem;
    }

    .pipe-sub {
        display: none;
    }

    .pipe-arrow {
        display: none;
    }

    /* Concept card modal – full width */
    .concept-card-overlay {
        padding: 0.5rem;
    }

    .concept-card {
        max-width: 100%;
        padding: 1.25rem;
    }

    .concept-card-icon {
        font-size: 2rem;
    }

    .concept-card-title {
        font-size: 0.85rem;
    }

    .concept-card-body {
        font-size: 0.8rem;
    }

    .concept-card-stats dt,
    .concept-card-stats dd {
        font-size: 0.75rem;
        padding: 0.4rem 0;
    }

    /* Tab bar */
    .tab-btn {
        padding: 8px 0 6px;
    }

    .tab-btn .tab-icon {
        font-size: 1.1rem;
    }

    .tab-btn .tab-label {
        font-size: 0.5rem;
    }

    /* Train form – tighter  */
    .pdr-selector {
        gap: 0.5rem;
    }

    .reps-control {
        gap: 0.5rem;
    }

    /* Guide popup – mobile friendly */
    .guide-card {
        max-width: 100%;
        margin: 0.5rem;
        padding: 1.25rem;
        max-height: 80vh;
    }

    /* Insights correlations */
    .correlation-grid {
        grid-template-columns: 1fr;
    }

    /* Learn sub-tabs */
    .learn-tabs {
        gap: 0.25rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .learn-tab {
        font-size: 0.65rem;
        padding: 0.4rem 0.6rem;
        white-space: nowrap;
    }
}

/* Extra small phones (iPhone SE, 375px) */
@media (max-width: 380px) {
    .pipe-stage {
        padding: 0.15rem;
    }

    .pipe-label {
        font-size: 0.4rem;
        max-width: 50px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pipe-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .pipe-arrow {
        display: none;
    }

    .stat-tile-value {
        font-size: 1.1rem;
    }

    .score-ring {
        width: 130px;
        height: 130px;
    }

    .week-day-dot {
        width: 24px;
        height: 24px;
    }

    .tab-btn .tab-label {
        font-size: 0.45rem;
    }
}

/* ================================================
   SONG JOURNAL — Sub-tabs, Cards, Detail Overlay
   ================================================ */

/* ---- 1. Journal Sub-Tabs ---- */
.journal-sub-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.journal-sub-tab {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.journal-sub-tab:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.journal-sub-tab.active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
}

/* ---- 1b. Why Music Immersion Panel ---- */
.song-why-toggle {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--gold);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 0.75rem;
    position: relative;
    padding-right: 2.5rem;
}

.song-why-toggle::after {
    content: '▸';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    transition: transform 0.25s ease;
}

.song-why-toggle.open::after {
    transform: translateY(-50%) rotate(90deg);
}

.song-why-toggle:hover {
    background: var(--gold-glow);
    border-color: var(--border-gold);
}

.song-why-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 0.75rem;
    margin-bottom: 1rem;
    animation: slideUp 0.25s ease;
    max-height: 60vh;
    overflow-y: auto;
}

.song-why-panel p {
    font-size: 0.85rem;
    color: var(--text-dim);
    line-height: 1.7;
    margin: 0 0 0.85rem;
}

.song-why-panel p:last-child {
    margin-bottom: 0.5rem;
}

.song-why-panel strong {
    color: var(--gold);
    font-weight: 700;
}

.song-why-panel em {
    color: var(--text);
    font-style: italic;
}

/* ---- 2. Song Journal Section ---- */
.song-journal-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    animation: screenIn 0.3s ease;
}

/* ---- 3. Song Progress Header ---- */
.song-progress-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.song-progress-ring {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
}

.song-progress-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.song-progress-ring .ring-bg {
    fill: none;
    stroke: var(--ring-bg);
    stroke-width: 6;
}

.song-progress-ring .ring-fill {
    fill: none;
    stroke: var(--gold);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px rgba(212, 168, 83, 0.25));
}

.song-progress-ring .ring-fill-blue {
    stroke: var(--blue);
    filter: drop-shadow(0 0 6px rgba(74, 158, 255, 0.25));
}

.song-progress-info {
    flex: 1;
    min-width: 0;
}

.song-progress-info .progress-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.song-progress-info .progress-value {
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.song-phase-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-radius: var(--radius-full);
    background: var(--gold-glow);
    color: var(--gold);
    border: 1px solid var(--border-gold);
    white-space: nowrap;
}

/* ---- 4. Immersion Banner ---- */
.immersion-banner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: rgba(212, 168, 83, 0.08);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.2s ease;
}

.immersion-days {
    font-family: var(--display);
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
    min-width: 2.5rem;
    text-align: center;
    filter: drop-shadow(0 0 8px rgba(212, 168, 83, 0.2));
}

.immersion-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.45;
}

.immersion-label strong {
    color: var(--gold);
    font-weight: 700;
}

[data-theme="light"] .immersion-banner {
    background: rgba(160, 120, 32, 0.07);
}

/* ---- 5. Song Grid ---- */
.song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

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

/* ---- 6. Song Card ---- */
.song-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.song-card:hover {
    transform: scale(1.03);
    border-color: var(--border-gold);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.25),
        0 0 15px rgba(212, 168, 83, 0.08);
}

.song-card:active {
    transform: scale(0.98);
}

.song-card.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(212, 168, 83, 0.12);
}

.song-card-art {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg-card-hover);
    display: block;
}

.song-card-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.5rem 0.6rem 0.15rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-card-meta {
    font-size: 0.6rem;
    color: var(--text-muted);
    padding: 0 0.6rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.song-card-badge {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.2s ease;
}

.song-card:hover .song-card-badge {
    transform: scale(1.1);
}

.badge-pass1 {
    background: rgba(74, 222, 128, 0.2);
    color: var(--green);
    border-color: rgba(74, 222, 128, 0.3);
}

.badge-pass2 {
    background: rgba(212, 168, 83, 0.25);
    color: var(--gold-bright);
    border-color: var(--border-gold);
}

[data-theme="light"] .song-card:hover {
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.08),
        0 0 15px rgba(160, 120, 32, 0.06);
}

[data-theme="light"] .song-card-badge {
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .badge-pass1 {
    background: rgba(34, 168, 85, 0.15);
}

[data-theme="light"] .badge-pass2 {
    background: rgba(160, 120, 32, 0.15);
}

/* ---- 7. Song Detail Overlay ---- */
.song-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.song-detail-card {
    background: var(--bg);
    border: 1px solid var(--border-gold);
    border-radius: var(--radius);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.song-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.song-detail-art {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.song-detail-title {
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 0.35rem;
}

.song-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.4rem;
}

.song-detail-tags span {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
}

.song-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    background: var(--gold);
    color: var(--bg);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.6rem;
}

.song-play-btn:hover {
    background: var(--gold-bright);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.3);
}

.song-play-btn:active {
    transform: scale(0.97);
}

.song-pass-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-dim);
    margin: 0.75rem 0;
}

.song-pass-indicator.pass-active {
    background: var(--gold-glow);
    border-color: var(--border-gold);
    color: var(--gold);
}

.song-journal-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    line-height: 1.6;
    transition: border-color 0.2s ease;
}

.song-journal-textarea:focus {
    border-color: var(--gold);
}

.song-journal-textarea::placeholder {
    color: var(--text-muted);
}

.song-word-count {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: right;
    padding: 0.25rem 0.25rem 0;
    font-weight: 600;
    transition: color 0.2s ease;
}

.song-word-count.over-limit {
    color: #ef4444;
}

.song-save-btn {
    width: 100%;
    padding: 0.85rem;
    border-radius: var(--radius-full);
    border: none;
    background: var(--gold);
    color: var(--bg);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.75rem;
}

.song-save-btn:hover {
    background: var(--gold-bright);
}

.song-save-btn:active {
    transform: scale(0.97);
}

.song-detail-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s ease;
    z-index: 2;
}

.song-detail-close:hover {
    color: var(--text);
}

[data-theme="light"] .song-detail-overlay {
    background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .song-detail-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

/* ---- 8. Song History ---- */
.song-history {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.song-history-entry {
    padding: 0.85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease;
}

.song-history-entry:hover {
    border-color: var(--border-gold);
}

.song-history-pass {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--gold-glow);
    color: var(--gold);
    border: 1px solid var(--border-gold);
    margin-bottom: 0.35rem;
}

.song-history-date {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.song-history-text {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.6;
}

/* ---- 9. Song Search Bar (input element) ---- */
.song-search-bar {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: var(--radius-full, 100px);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}

.song-search-bar:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.08);
}

.song-search-bar::placeholder {
    color: var(--text-muted, var(--text-dim));
}

/* ---- 10. Song Count Label ---- */
.song-count-label {
    font-size: 0.7rem;
    color: var(--text-muted, var(--text-dim));
    text-align: center;
    padding: 0.25rem 0 0.75rem;
    letter-spacing: 0.03em;
}

/* ---- 10b. Song Filter Bar ---- */
.song-filter-bar {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.song-filter-bar::-webkit-scrollbar {
    display: none;
}

.song-filter-btn {
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full, 100px);
    background: transparent;
    color: var(--text-dim);
    font-family: var(--font);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.song-filter-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.song-filter-btn.active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
}

/* ---- 11. Song Progress Rings (generated by JS) ---- */
.song-progress-rings {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.song-progress-ring-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.song-progress-ring-wrap svg {
    width: 56px;
    height: 56px;
}

.song-ring-label {
    font-family: var(--display, inherit);
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    margin-top: 0.25rem;
    line-height: 1;
}

.song-ring-label span {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
}

.song-ring-sub {
    font-size: 0.6rem;
    color: var(--text-muted, var(--text-dim));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-top: 0.15rem;
}

/* ---- 12. Song History Header ---- */
.song-history-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.song-history-pass.pass2 {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.3);
}

/* ---- 13. Song Detail Info + Duration ---- */
.song-detail-info {
    flex: 1;
    min-width: 0;
}

.song-detail-dur {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}


@media (max-width: 600px) {
    .song-progress-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .song-detail-card {
        max-width: 100%;
        padding: 1.25rem;
        max-height: 85vh;
    }

    .song-detail-art {
        width: 90px;
        height: 90px;
    }

    .song-detail-title {
        font-size: 1rem;
    }

    .immersion-days {
        font-size: 1.75rem;
    }

    .journal-sub-tabs {
        gap: 0.25rem;
    }

    .journal-sub-tab {
        font-size: 0.65rem;
        padding: 0.45rem 0.5rem;
    }
}

@media (max-width: 380px) {
    .song-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .song-detail-art {
        width: 100px;
        height: 100px;
    }

    .song-detail-tags {
        justify-content: center;
    }
}