/* =========================================
   July Life Coach -- Practice Tools
   Meditation, Mantra Quiz, 108 Prostrations
   ========================================= */

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

:root {
    --bg-deep: #07090d;
    --bg-surface: #0d1117;
    --bg-card: #131820;
    --bg-card-hover: #1a2230;
    --text-primary: #e6e8ec;
    --text-secondary: #8b919a;
    --text-muted: #565d68;
    --accent: #C27C5A;
    --accent-glow: rgba(194, 124, 90, 0.15);
    --accent-hover: #d4906e;
    --accent-soft: rgba(194, 124, 90, 0.08);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --font-serif: 'Libre Baskerville', Georgia, serif;
    --font-sans: 'Inter', -apple-system, sans-serif;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* -- Page Layout -- */

.practice-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 80px 1.5rem 4rem;
    min-height: 100vh;
}

.practice-header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeUp 0.5s ease-out;
}

.practice-header h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 0.4rem;
    letter-spacing: -0.01em;
}

.practice-header p {
    color: var(--text-muted);
    font-size: 0.88rem;
    max-width: 420px;
    margin: 0 auto;
}

/* -- Guide Toggle -- */

.guide-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.guide-toggle-btn {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    padding: 0.35rem 0.8rem;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.guide-toggle-btn:hover {
    color: var(--text-secondary);
    border-color: var(--border-hover);
}

.guide-toggle-btn.active {
    color: var(--accent);
    border-color: rgba(194, 124, 90, 0.25);
    background: var(--accent-soft);
}

.guide-toggle-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.2s;
}

.guide-toggle-btn.active .guide-toggle-dot {
    background: var(--accent);
}

/* -- Guide Instruction Panel -- */

.guide-panel {
    background: var(--accent-soft);
    border: 1px solid rgba(194, 124, 90, 0.12);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    margin: 0 auto 1.5rem;
    max-width: 440px;
    animation: fadeUp 0.3s ease-out;
}

.guide-panel p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
}

.guide-panel strong {
    color: var(--text-primary);
}

/* -- Prostration Video Background -- */

.prostration-video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.prostration-video-bg video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prostration-video-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 9, 13, 0.6);
}

/* -- Tool Tabs -- */

.tool-tabs {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin-bottom: 2.5rem;
    animation: fadeUp 0.5s ease-out 0.05s both;
}

.tool-tab {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.55rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.tool-tab:hover {
    color: var(--text-secondary);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.03);
}

.tool-tab.active {
    color: var(--text-primary);
    background: var(--accent-soft);
    border-color: rgba(194, 124, 90, 0.25);
}

/* -- Tool Panels -- */

.tool-panel {
    display: none;
    animation: fadeUp 0.4s ease-out;
}

.tool-panel.active {
    display: block;
}

/* ===================================
   MEDITATION TIMER
   =================================== */

.meditation-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* Duration pills */
.duration-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2.5rem;
}

.duration-pill {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.5rem 1.1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.duration-pill:hover {
    color: var(--text-secondary);
    border-color: var(--border-hover);
}

.duration-pill.active {
    color: var(--text-primary);
    background: var(--accent-glow);
    border-color: rgba(194, 124, 90, 0.3);
}

/* Breathing circle */
.breath-orb-wrapper {
    position: relative;
    width: 240px;
    height: 240px;
    margin-bottom: 2rem;
}

.breath-orb-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 124, 90, 0.06) 0%, transparent 70%);
    border: 1px solid rgba(194, 124, 90, 0.12);
    transition: transform 4s cubic-bezier(0.4, 0, 0.2, 1);
}

.breath-orb-bg.inhale { transform: scale(1.35); }
.breath-orb-bg.hold { transform: scale(1.35); }
.breath-orb-bg.exhale { transform: scale(1); }
.breath-orb-bg.ready { transform: scale(1); }

.breath-orb-glow {
    position: absolute;
    inset: -30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 124, 90, 0.08) 0%, transparent 60%);
    transition: opacity 4s ease;
    opacity: 0.3;
}

.breath-orb-bg.inhale ~ .breath-orb-glow,
.breath-orb-bg.hold ~ .breath-orb-glow { opacity: 1; }
.breath-orb-bg.exhale ~ .breath-orb-glow { opacity: 0.3; }

.breath-timer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 3px;
    color: var(--text-secondary);
    z-index: 2;
    font-variant-numeric: tabular-nums;
}

.breath-timer.running {
    color: var(--text-primary);
}

/* Breathing phase text */
.breath-phase {
    font-size: 0.9rem;
    color: var(--accent);
    font-weight: 500;
    margin-bottom: 0.5rem;
    min-height: 1.4em;
    transition: opacity 0.3s ease;
    letter-spacing: 0.5px;
}

.breath-message {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    min-height: 1.4em;
    font-style: italic;
}

/* Mantra display (shown during meditation if set) */
.active-mantra {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-style: italic;
    color: var(--accent);
    margin-bottom: 2rem;
    padding: 0.8rem 1.2rem;
    background: var(--accent-soft);
    border-radius: 10px;
    border: 1px solid rgba(194, 124, 90, 0.1);
    max-width: 400px;
    line-height: 1.6;
    opacity: 0.9;
}

/* Timer controls */
.timer-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-begin {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    padding: 0.9rem 2.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-begin:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(194, 124, 90, 0.3);
}

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

.btn-skip {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.6rem 1rem;
    transition: color 0.2s;
}

.btn-skip:hover { color: var(--text-primary); }

/* ===================================
   MANTRA QUIZ
   =================================== */

.mantra-container {
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

/* Quiz intro */
.mantra-intro {
    animation: fadeUp 0.5s ease-out;
}

.mantra-intro h2 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 400;
    margin-bottom: 0.8rem;
}

.mantra-intro p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

/* Quiz question */
.mantra-question {
    animation: fadeUp 0.35s ease-out;
}

.mantra-step-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 1.5rem;
    display: block;
}

.mantra-question h3 {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 400;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.mantra-options {
    display: grid;
    gap: 0.7rem;
}

.mantra-option {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.1rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.mantra-option:hover {
    border-color: rgba(194, 124, 90, 0.3);
    background: var(--bg-card-hover);
    transform: translateX(4px);
}

.mantra-option:active {
    transform: translateX(2px);
}

/* Quiz result */
.mantra-result {
    animation: fadeUp 0.8s ease-out;
    padding: 2rem 0;
    position: relative;
}

.mantra-result-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 124, 90, 0.1) 0%, transparent 70%);
    animation: pulseGlow 6s ease-in-out infinite;
    pointer-events: none;
}

.mantra-result-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1.8rem;
}

.mantra-result-text {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--accent);
    margin-bottom: 2.5rem;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.mantra-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.btn-secondary {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    padding: 0.65rem 1.3rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

/* ===================================
   108 PROSTRATIONS
   =================================== */

.prostration-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.prostration-counter {
    position: relative;
    width: 240px;
    height: 240px;
    margin-bottom: 2rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.prostration-counter:active .prostration-ring-progress {
    filter: brightness(1.3);
}

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

.prostration-ring-bg {
    fill: none;
    stroke: rgba(194, 124, 90, 0.1);
    stroke-width: 3;
}

.prostration-ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.3s ease;
}

.prostration-count-display {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.prostration-count-number {
    font-size: 3.2rem;
    font-weight: 300;
    letter-spacing: 2px;
    color: var(--text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: transform 0.15s ease;
}

.prostration-count-number.bump {
    transform: scale(1.08);
}

.prostration-count-target {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.prostration-instruction {
    font-size: 0.95rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-weight: 400;
    min-height: 1.5em;
}

.prostration-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 2rem;
    max-width: 320px;
    line-height: 1.6;
}

.btn-reset {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
}

.btn-reset:hover { color: var(--text-primary); }

/* Tap ripple effect */
.prostration-counter::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(194, 124, 90, 0.15) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.prostration-counter.tapped::after {
    opacity: 1;
    transform: scale(1);
}

/* ===================================
   POST-SESSION JOURNAL
   =================================== */

.journal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 9, 13, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.5s ease-out;
}

.journal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 480px;
    animation: fadeUp 0.5s ease-out 0.1s both;
}

.journal-card h2 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.3rem;
}

.journal-card .journal-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.journal-mantra {
    text-align: center;
    padding: 0.8rem 1rem;
    background: var(--accent-soft);
    border-radius: 8px;
    border: 1px solid rgba(194, 124, 90, 0.1);
    margin-bottom: 1.2rem;
}

.journal-mantra-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.journal-mantra-text {
    font-family: var(--font-serif);
    font-size: 0.92rem;
    font-style: italic;
    color: var(--accent);
    line-height: 1.5;
}

.journal-textarea {
    width: 100%;
    min-height: 120px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 1.2rem;
}

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

.journal-textarea:focus {
    border-color: rgba(194, 124, 90, 0.3);
}

.journal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.btn-save {
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    padding: 0.7rem 1.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save:hover {
    background: var(--accent-hover);
}

.btn-save:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-skip-journal {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 1rem;
    transition: color 0.2s;
}

.btn-skip-journal:hover {
    color: var(--text-primary);
}

/* ===================================
   COMPLETION CELEBRATION
   =================================== */

.completion-message {
    text-align: center;
    padding: 1rem 0 2rem;
    animation: fadeUp 0.5s ease-out;
}

.completion-message h2 {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.completion-message p {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

/* ===================================
   ANIMATIONS
   =================================== */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 600px) {
    .practice-page {
        padding-top: 64px;
    }

    .practice-header h1 {
        font-size: 1.6rem;
    }

    .tool-tabs {
        gap: 0.3rem;
    }

    .tool-tab {
        font-size: 0.78rem;
        padding: 0.5rem 0.9rem;
    }

    .breath-orb-wrapper {
        width: 200px;
        height: 200px;
    }

    .breath-timer {
        font-size: 2.5rem;
    }

    .prostration-counter {
        width: 200px;
        height: 200px;
    }

    .prostration-count-number {
        font-size: 2.8rem;
    }

    .mantra-question h3 {
        font-size: 1.15rem;
    }

    .mantra-result-text {
        font-size: 1.25rem;
    }

    .journal-card {
        padding: 2rem 1.5rem;
    }

    .duration-selector {
        gap: 0.4rem;
    }

    .duration-pill {
        font-size: 0.8rem;
        padding: 0.45rem 0.9rem;
    }
}
