/* --- Base & Visuals --- */
        * { box-sizing: border-box; margin: 0; padding: 0; }
        body {
            font-family: 'Inter', Arial, sans-serif;
            background-color: #0a0c10;
            background-image: url('bg.avif');
            background-size: cover; background-position: center; background-repeat: no-repeat;
            background-attachment: fixed; color: #f5f5f5; min-height: 100vh;
        }

        .hidden { display: none !important; }
        .blur { filter: blur(12px); pointer-events: none; opacity: 0.4; }

        /* --- Loading Spinner --- */
        #loading-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: #0f1115; z-index: 10000; display: flex;
            flex-direction: column; align-items: center; justify-content: center;
        }
        .spinner {
            width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.1);
            border-top: 3px solid #3BDE6B; border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        /* --- UI Components --- */
        .container { max-width: 1200px; margin: auto; padding: 24px; }
        .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
        label { font-size: 11px; color: #9da6b5; display: block; margin-bottom: 6px; text-transform: uppercase; }
        input, select, textarea, button { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #303645; background: #0f1115; color: #fff; font-size: 14px; }
        textarea { min-height: 80px; resize: vertical; margin-top: 10px; }
        button { cursor: pointer; background: #fff; color: #000; font-weight: 600; border: none; transition: 0.2s; }
        button.secondary { background: transparent; color: #fff; border: 1px solid #303645; }
        /* Add this to your CSS section */
.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none; /* Prevents clicking it while it's invisible */
}

/* --- Tab Navigation --- */
.tab-nav { 
    display: flex; 
    flex-wrap: wrap; /* Allows tabs to drop to a new line if space is tight */
    gap: 8px; 
    margin-bottom: 24px; 
    border-bottom: 1px solid #262b36; 
    padding-bottom: 12px; 
}

.tab-btn { 
    background: transparent; 
    color: #9da6b5; 
    border: 1px solid transparent; 
    padding: 10px 15px; 
    width: auto; 
    font-size: 15px; 
    cursor: pointer; 
    transition: 0.2s;
    flex: 1 1 auto; /* Allows buttons to grow and fill the row evenly */
    text-align: center;
}
.tab-btn.active { background: #303645; color: #3BDE6B; border-radius: 8px; border: 1px solid #3BDE6B; }
.tab-content { display: none; }

/* Ensure the tab content actually takes up space when active */
.tab-content.active { 
    display: block !important; 
    width: 100%;
    animation: fadeIn 0.4s ease;
}

/* Specific fix for the Pie Chart to prevent it from being 0px wide */
#pieChart {
    display: block;
    max-width: 250px;
    max-height: 250px;
    margin: auto;
    background: transparent !important; /* Removes the dark box if empty */
    border: none !important;
}

/* Ensure the wrapper for the pie chart has a width */
.pie-container {
    position: relative; 
    height: 250px; 
    width: 100%; /* Forces a width so canvas can calculate size */
    display: flex; 
    justify-content: center;
}

/* --- Playbook View Styles --- */


.playbook-grid {
    display: grid;
    /* FIX: Swapped minmax(340px, 1fr) with minmax(0, 1fr) on narrow widths or use a responsive variable */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
    width: 100%;             /* Ensures container respects layout restrictions */
    box-sizing: border-box;
}

#playbook-directory {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .playbook-grid {
        grid-template-columns: 1fr; /* Switch to single fluid column */
        gap: 12px;
    }
    
    /* Prevents the card padding from squeezing text out of view */
    .playbook-card {
        width: 100%;
        max-width: 100%;
    }
    
    /* Adjust empty state card to drop inline margins */
    .playbook-directory > .card {
        padding: 24px 16px !important;
    }
}

.playbook-card {
    background: rgba(23, 26, 33, 0.4);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}

.playbook-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59, 222, 107, 0.3);
}

.playbook-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playbook-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

.playbook-tag-rr {
    background: rgba(59, 222, 107, 0.1);
    border: 1px solid rgba(59, 222, 107, 0.25);
    color: #3BDE6B;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.playbook-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    flex-grow: 1;
}

.playbook-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.playbook-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.playbook-section-title.cond { color: #9da6b5; }
.playbook-section-title.conf { color: #3BDE6B; }
.playbook-section-title.inv { color: #FF4D4D; }

.playbook-text {
    font-size: 13px;
    color: #e2e8f0;
    line-height: 1.5;
    white-space: pre-wrap;
    background: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.playbook-chart-preview {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: #090b0e;
    cursor: pointer;
    transition: filter 0.3s ease;
}

.playbook-chart-preview:hover {
    filter: brightness(1.15);
}

.playbook-footer {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playbook-btn-del {
    background: none;
    border: none;
    color: rgba(255, 77, 77, 0.6);
    font-size: 11px;
    cursor: pointer;
    width: auto;
    padding: 4px 8px;
    font-weight: 500;
    transition: color 0.2s;
}
.playbook-btn-del:hover { color: #FF4D4D; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.visual-fade-in { animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bg-breakeven {
    background-color: #4A4E5A !important; /* A nice slate grey */
    color: white !important;
}



.toast {
    min-width: 280px;
    padding: 16px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    /* The "Cool" Bounce Animation */
    animation: toastBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.toast-win {
    background: rgba(17, 42, 29, 0.9);
    border: 2px solid #3BDE6B;
    color: #3BDE6B;
    box-shadow: 0 0 20px rgba(59, 222, 107, 0.2);
}

.toast-loss {
    background: rgba(42, 17, 17, 0.9);
    border: 2px solid #FF4D4D;
    color: #FF4D4D;
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.2);
}

@keyframes toastBounce {
    0% { transform: translateX(120%); opacity: 0; }
    70% { transform: translateX(-10%); opacity: 1; }
    100% { transform: translateX(0); }
}

.toast.fade-out {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    transition: all 0.4s ease;
}


#auth-success {
    color: #3BDE6B;
    font-size: 12px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 10px;
    
    /* Smoothness settings */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
    height: 0; /* Keeps it from taking space when invisible */
    overflow: hidden;
}

#auth-success.show {
    opacity: 1;
    transform: translateY(0);
    height: auto; /* Snaps to content size smoothly */
    margin-top: 10px;
}
        
        /* --- Stats & EV --- */
        .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
        .stat-box { background: rgba(17, 20, 27, 0.9); border: 1px solid #262b36; border-radius: 12px; padding: 16px; transition: all 0.4s ease; }
        .stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }

        /* --- Chart --- */
        #chart-wrapper { position: relative; width: 100%; height: 300px; margin: 20px 0; }
        canvas { width: 100%; height: 100%; background: rgba(15, 17, 21, 0.8); border-radius: 14px; border: 1px solid #262b36; }

        /* --- Table --- */
        .table-scroll { overflow-x: auto; margin-top: 10px; }
        table { width: 100%; border-collapse: collapse; min-width: 900px; }
        th, td { padding: 14px; text-align: left; border-bottom: 1px solid #262b36; font-size: 13px; }
        .result-win { color: #3BDE6B; font-weight: 600; }
        .result-loss { color: #FF4D4D; font-weight: 600; }
        .result-breakeven { 
    color: #9da6b5; /* Nice muted grey */
    font-weight: 600; 
}
        .calendar-day.faded {
    opacity: 0.25;
    filter: grayscale(1);
}

#calendar-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 4px; /* Tight gap for mobile */
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

.calendar-day {
    aspect-ratio: 1 / 1; /* Keeps them perfectly square */
    min-height: auto; /* Remove the 60px fixed height */
    background: rgba(23, 26, 33, 0.6);
    border: 1px solid #303645;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2px;
}

@media (max-width: 600px) {
    .card { overflow-x: hidden; }
    #dow-grid > div { font-size: 10px; padding: 8px 2px !important; }
    #dow-grid > div > div:first-child { font-size: 9px !important; }
    #dow-grid > div > div:nth-child(2) { font-size: 16px !important; }
    #dow-grid > div > div:last-child { font-size: 9px !important; }
}

/* 3-Column Header Fix */
.calendar-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 0 10px;
}

.header-left, .header-right {
    flex: 1; 
    z-index: 10; /* Ensures interactive elements are on top */
}

.header-center {
    flex: 1.5;
    text-align: center;
    pointer-events: none; /* Clicks pass through this container */
}

#calendar-month-label {
    font-size: 1.5rem;
    font-weight: 900;
    color: #3BDE6B;
    pointer-events: auto; /* Re-enable if you want to click the date itself */
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

/* Group for the buttons and month label */
.calendar-controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid #303645;
}

/* Dropdown Styling */
.type-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #303645;
    color: #9da6b5;
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 13px;
}

/* Navigation Arrow Styling */
.calendar-nav-buttons {
    display: flex;
    gap: 10px;
}

@media (max-width: 480px) {
    .tab-btn { padding: 8px 10px; font-size: 12px; }
    .tab-label { font-size: 9px; display: block; margin-top: 2px; opacity: 0.7; }
}

/* The Switch Container */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 22px;
}

/* Hide default HTML checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The Slider Track */
.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

/* The Moving Knob */
.slider-toggle:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #9da6b5;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

/* Track background when ON */
input:checked + .slider-toggle {
    background-color: rgba(59, 222, 107, 0.15);
    border-color: #3BDE6B;
}

/* Knob position & color when ON */
input:checked + .slider-toggle:before {
    transform: translateX(20px);
    background-color: #3BDE6B;
}

.nav-arrow {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #303645;
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.nav-arrow:hover {
    background: #3BDE6B;
    color: #0d0f14;
    border-color: #3BDE6B;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .calendar-header-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    #calendar-month-label {
        font-size: 1.2rem;
    }
    .header-left, .header-right, .header-center {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

.day-label { 
    font-size: 10px; 
    opacity: 0.6; 
    position: absolute; 
    top: 2px; 
    left: 4px; 
}

.day-pnl { 
    font-weight: 800; 
    font-size: 12px; /* Smaller font to prevent text wrapping */
    text-align: center;
}

/* Mobile specific tweaks */
@media (max-width: 480px) {
    #calendar-grid { gap: 2px; }
    .day-pnl { font-size: 7px; }
    .weekday-header { font-size: 8px; padding-bottom: 4px; }
    .tab-nav {
        gap: 6px;
    }

    .tab-btn {
        flex: 1 1 calc(50% - 6px); /* Creates a 2x2 grid on mobile */
        padding: 12px 5px;
        font-size: 15px;
        border-radius: 8px;
    }
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #303645;
    color: #9da6b5;
    padding: 8px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    width: auto;
    transition: 0.3s;
}

.filter-btn.active {
    background: #3BDE6B;
    color: #0d0f14;
    border-color: #3BDE6B;
    font-weight: 700;
}

/* Vertical dock for icons */
.control-dock {
    position: fixed; /* Fixed ensures it stays put even when scrolling */
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 9999; /* Higher than everything else */
    pointer-events: auto; /* Ensures clicks are captured */
}

/* Base style for the transparent icon buttons */
.dock-icon-btn {
    position: relative;
    z-index: 10000;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5); /* Dimmed white for a premium look */
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: color 0.3s ease, transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

/* Hover effects */
.dock-icon-btn:hover {
    color: #ff4d4d; /* Reddish glow for logout */
}

.dock-icon-btn.settings-trigger:hover {
    color: #3BDE6B; /* Greenish glow for settings */
}

/* The spinning logic for the settings icon */
.dock-icon-btn.settings-trigger svg {
    animation: spin-infinite 6s linear infinite;
}

.weekday-header {
    font-size: 12px;
    color: #9da6b5;
    text-align: center;
    font-weight: 700;
    padding-bottom: 8px;
    text-transform: uppercase;
}

/* --- Performance Map Header --- */
.perf-map-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.perf-map-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.perf-map-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.card {
    /* Transparent base */
    background: rgba(23, 26, 33, 0.4); 
    
    /* The magic: blur and saturation */
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    
    /* Subtle highlight on the edge makes it look like real glass */
    border: 1px solid rgba(255, 255, 255, 0.08); 
    
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

/* Add a subtle glow to the active tab to match the glass vibe */
.tab.active {
    background: rgba(59, 222, 107, 0.15);
    border-bottom: 2px solid #3BDE6B;
    box-shadow: 0 0 15px rgba(59, 222, 107, 0.2);
}

/* Container for the Grade & Error section */
.input-grid {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 12px;
    width: 100%;
}

/* Ensure labels wrap instead of stretching the container */
.input-group label {
    display: block;
    font-size: 11px;
    color: #9da6b5;
    margin-bottom: 5px;
    white-space: normal; /* Allows text to wrap to the next line */
    line-height: 1.2;
}

/* Ensure selects/inputs stay inside their box */
.trade-input {
    width: 100%; /* Forces the dropdown to stay inside the grid cell */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis; /* Adds '...' if text is too long */
    font-size: 13px; /* Slightly smaller to fit more text */
    padding: 8px;
}

.input-row-flex {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Exact 50/50 split */
    gap: 12px;
    width: 100%;
}

.settings-header {
    display: flex;
    justify-content: flex-end;
    padding: 10px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.15); /* Subtle brighten instead of green */
    transform: rotate(360deg); /* Smooth half-turn */
}

/* Container to stack Logout and Settings */
.user-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px; /* Space between Logout and Settings */
    padding: 15px;
}

/* The Settings Button - No background, no oval */
.settings-btn-clean {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6); /* Subtle white */
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    transition: color 0.3s ease;
}

.settings-btn-clean:hover {
    color: #3BDE6B; /* Glows green on hover */
}

/* The Infinite Spin Animation */
.settings-btn-clean svg {
    animation: spin-infinite 4s linear infinite;
}

@keyframes spin-infinite {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Modal Styling */
.modal {
    display: none; /* Hidden until button click */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.glass-modal {
    width: 90%;
    max-width: 400px;
    background: rgba(23, 26, 33, 0.85) !important;
    backdrop-filter: blur(20px);
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Mobile: Stack them so they have full width */
@media (max-width: 480px) {
    .input-grid {
        grid-template-columns: 1fr; /* Stacks Grade on top of Error */
    }
    
    .trade-input {
        font-size: 12px; /* Larger for easier tapping on mobile */
    }
}


        
  /* ── Auth Overlay ── */
#auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(10, 12, 16, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

#auth-error {
    color: #FF4D4D;
    font-size: 12px;
    text-align: center;
    font-weight: 600;
    padding: 10px 14px;
    background: rgba(255, 77, 77, 0.08);
    border: 1px solid rgba(255, 77, 77, 0.2);
    border-radius: 8px;
}

/* Auth card shared */
#auth-selection,
#auth-form {
    width: 100%;
    max-width: 400px;
    background: rgba(17, 20, 27, 0.95);
    border: 1px solid rgba(59, 222, 107, 0.15);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 0 60px rgba(0,0,0,0.6), 0 0 40px rgba(59,222,107,0.05);
    backdrop-filter: blur(24px);
    animation: authSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@media (max-width: 480px) {
    #auth-selection,
    #auth-form {
        padding: 28px 20px;
        border-radius: 16px;
    }
}
        footer { text-align: center; padding: 40px; color: #4b515d; font-size: 11px; }


@keyframes splashPulse {
    0%   { box-shadow: 0 0 0 0 rgba(59,222,107,0.4); }
    60%  { box-shadow: 0 0 0 18px rgba(59,222,107,0); }
    100% { box-shadow: 0 0 0 0 rgba(59,222,107,0); }
}
@keyframes blink {
    0%,100% { opacity:1; } 50% { opacity:0; }
}
@keyframes loadTrack {
    0%   { left:-60%; width:40%; }
    50%  { width:50%; }
    100% { left:110%; width:40%; }
}


@keyframes pulseRadar {
    0% { transform: scale(1); box-shadow: 0 0 20px rgba(59, 222, 107, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 0 35px rgba(59, 222, 107, 0.4); }
    100% { transform: scale(1); box-shadow: 0 0 20px rgba(59, 222, 107, 0.2); }
}

@keyframes sheetUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ══════════════════════════════════════════════════════════════
   Psychology Tab — Layout & Mobile Responsive
   ══════════════════════════════════════════════════════════════ */

/* ── Base tab container ── */
#tab-psychology {
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Stops any child from blowing out the width */
}

#tab-psychology.active {
    display: flex !important;
}

/* ── Every card inside the psychology tab ── */
#tab-psychology .psych-card,
#tab-psychology .card {
    background: #171b26;
    border: 1px solid #262b36;
    border-radius: 12px;
    padding: 18px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* Contain inner content */
}

/* ── Two-column rows → single column on mobile ── */
.psych-row {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first: stacked */
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 640px) {
    .psych-row { grid-template-columns: 1fr 1fr; }
}

/* ── Main check-in + review area (wider breakpoint before splitting) ── */
.psych-row-main {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first: stacked */
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 800px) {
    .psych-row-main { grid-template-columns: 1fr 1fr; }
}

/* ── Stat/metric chips row ── */
.psych-stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 cols on all phones */
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 640px) {
    .psych-stats-row { grid-template-columns: repeat(4, 1fr); }
}

/* ── Emotion picker grid ── */
.emotion-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cols on all screens */
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Individual emotion buttons ── */
.emotion-btn {
    background: transparent;
    border: 1px solid #303645;
    color: #fff;
    padding: 12px 4px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    width: 100%;
    min-height: 48px; /* Comfortable tap target */
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}
.emotion-btn.selected,
.emotion-btn:hover {
    border-color: #3BDE6B;
    background: rgba(59, 222, 107, 0.1);
    color: #3BDE6B;
}

/* ── Review form meta row (date + emotion selector) ── */
.psych-meta-row {
    display: grid;
    grid-template-columns: 1fr; /* Stacked on small phones */
    gap: 12px;
    margin-bottom: 12px;
    width: 100%;
    box-sizing: border-box;
}
@media (min-width: 480px) {
    .psych-meta-row { grid-template-columns: 1fr 1fr; }
}

/* ── Section headings inside psych cards ── */
.psych-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #9da6b5;
    margin-bottom: 8px;
}

/* ── Textarea inside psych tab ── */
#tab-psychology textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Selects / inputs inside psych tab ── */
#tab-psychology select,
#tab-psychology input[type="date"],
#tab-psychology input[type="text"],
#tab-psychology input[type="number"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ── Submit / action buttons inside psych tab ── */
#tab-psychology .psych-submit-btn,
#tab-psychology button[type="submit"],
#tab-psychology .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 14px;
    border-radius: 10px;
    box-sizing: border-box;
}

/* ══════════════════════════════════════════════════════════════
   Psychology Tab — Dedicated Mobile Overrides (≤ 600px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {

    /* Extra bottom padding so content clears the fixed bottom nav */
    #tab-psychology {
        padding-bottom: 88px;
        gap: 12px;
    }

    /* Tighter card padding on small screens */
    #tab-psychology .psych-card,
    #tab-psychology .card {
        padding: 14px 12px;
        border-radius: 10px;
    }

    /* Squeeze emotion buttons a bit tighter on very small phones */
    .emotion-btn {
        padding: 10px 2px;
        font-size: 12px;
        min-height: 44px;
    }

    /* Force full-width textareas */
    #tab-psychology textarea {
        min-height: 90px;
        font-size: 13px;
    }

    /* Section labels stay readable */
    .psych-section-label {
        font-size: 9px;
    }

    /* Stat boxes inside psych tab — always 2-up */
    .psych-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* Ensure no element bleeds past the card edge */
    #tab-psychology * {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ══════════════════════════════════════════════════════════════
   Psychology Tab — Extra-small phones (≤ 380px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {

    #tab-psychology .psych-card,
    #tab-psychology .card {
        padding: 12px 10px;
    }

    /* 2-col emotions if text labels are long */
    .emotion-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .emotion-btn {
        font-size: 11px;
        min-height: 42px;
    }

    /* Stat chips go full width on tiny screens */
    .psych-stats-row {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── SKELETON LOADERS ─────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position:  600px 0; }
}
.skeleton {
    background: linear-gradient(90deg, #1a1e28 25%, #242836 50%, #1a1e28 75%);
    background-size: 600px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: 8px;
}
.skeleton-stat { height: 72px; border-radius: 12px; }
.skeleton-row  { height: 44px; border-radius: 8px; margin-bottom: 8px; }

/* ── MOBILE BOTTOM NAV ────────────────────────────────── */
@media (max-width: 600px) {
    body { padding-bottom: 72px; }

    .tab-nav {
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 9000;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        margin-bottom: 0;
        padding: 0 0 env(safe-area-inset-bottom, 8px);
        background: #0f1115;
        border-top: 1px solid #262b36;
        border-bottom: none;
    }
    .tab-nav::-webkit-scrollbar { display: none; }

    .tab-btn {
        flex: 0 0 auto;
        min-width: 64px;
        padding: 10px 12px 6px;
        font-size: 18px;
        border-radius: 0;
        border: none !important;
        border-top: 2px solid transparent !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        background: transparent !important;
    }
    .tab-btn.active {
        border-top: 2px solid #3BDE6B !important;
        color: #3BDE6B;
        background: transparent !important;
        border-radius: 0;
    }
    .tab-label {
        font-size: 9px;
        display: block;
        opacity: 0.75;
    }
    .tab-btn.active .tab-label { opacity: 1; }
}

@media (max-width: 600px) {
    #tab-playbook {
        padding-bottom: 80px;
    }
    #tab-psychology {
        padding-bottom: 80px;
    }
}

/* ── Charts Tab: full-bleed, edge-to-edge ── */
#tab-charts.active {
    display: flex !important;
    flex-direction: column;
    padding: 0 !important;
    margin: 0 -24px !important; /* bleeds out of .container padding */
    width: calc(100% + 48px) !important;
}

#charts-card {
    flex: 1;
    height: calc(100vh - 130px);
    min-height: 500px;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: #0f1115;
    position: relative;
}

#tv-advanced-chart {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 600px) {
    #tab-charts.active {
        margin: 0 -24px !important;
        width: calc(100% + 48px) !important;
    }
    #charts-card {
        height: calc(100vh - 110px);
    }
}

/* ── LANDING PAGE ── */
#landing-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: #080a0d;
  position: relative;
  overflow: hidden;
}

#landing-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  z-index: 1;
}

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

@keyframes lpPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.85); }
}

@keyframes lpTape {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

#lp-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(59,222,107,0.3);
}

.lp-feat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 28px 26px;
  transition: border-color 0.25s, transform 0.25s;
  position: relative;
  overflow: hidden;
}

.lp-feat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,222,107,0.4), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.lp-feat-card:hover {
  border-color: rgba(59,222,107,0.25);
  transform: translateY(-3px);
}

.lp-feat-card:hover::before {
  opacity: 1;
}

.lp-feat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(59,222,107,0.1);
  border: 1px solid rgba(59,222,107,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.lp-feat-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f0f2f5;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.lp-feat-desc {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #6b7585;
  line-height: 1.6;
  font-weight: 300;
}

@media (max-width: 768px) {
  #landing-page > nav,
  #landing-page > div[style*="max-width:1100px"],
  #landing-page > div[style*="max-width: 1100px"] {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }
  #landing-page > div[style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}

/* ── Upgrade Modal ─────────────────────────────────────────────── */
.um-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,222,107,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,222,107,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.um-sheet {
  background: #13161d;
  border: 1px solid rgba(59,222,107,0.15);
  border-radius: 28px;
  width: 100%;
  max-width: 780px;
  padding: 44px 40px 36px;
  position: relative;
  animation: umIn 0.35s cubic-bezier(0.16,1,0.3,1) both;
  box-shadow: 0 0 0 1px rgba(59,222,107,0.06), 0 40px 80px rgba(0,0,0,0.7);
}
@keyframes umIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.um-close {
  position: absolute;
  top: 18px; right: 20px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #9da6b5;
  font-size: 16px;
  transition: background 0.2s, color 0.2s;
}
.um-close:hover { background: rgba(255,255,255,0.1); color: #fff; }
.um-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59,222,107,0.08);
  border: 1px solid rgba(59,222,107,0.2);
  border-radius: 99px;
  padding: 4px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: #3BDE6B;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.um-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  background: #3BDE6B;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}
.um-title {
  font-family: 'Syne', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 6px;
}
.um-title span { color: #3BDE6B; }
.um-sub {
  font-size: 13px;
  color: #6b7585;
  margin-bottom: 32px;
  line-height: 1.5;
}
.um-plans {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
}
.um-plan {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 20px;
  padding: 24px 20px 20px;
  position: relative;
  transition: border-color 0.2s, transform 0.2s;
  cursor: default;
}
.um-plan:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.14); }
.um-plan.hero {
  background: rgba(59,222,107,0.05);
  border-color: rgba(59,222,107,0.35);
  box-shadow: 0 0 30px rgba(59,222,107,0.06);
}
.um-plan.hero:hover { border-color: rgba(59,222,107,0.55); }
.um-badge {
  position: absolute;
  top: -11px; left: 50%;
  transform: translateX(-50%);
  background: #3BDE6B;
  color: #071009;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 12px;
  border-radius: 99px;
  white-space: nowrap;
}
.um-plan-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7585;
  margin-bottom: 10px;
}
.hero .um-plan-label { color: #3BDE6B; }
.um-price {
  font-family: 'Syne', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  margin-bottom: 2px;
}
.um-price sub {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #6b7585;
  vertical-align: baseline;
}
.um-price-note {
  font-size: 11px;
  color: #3BDE6B;
  font-family: 'DM Mono', monospace;
  margin-bottom: 18px;
  min-height: 16px;
}
.um-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.um-features li {
  font-size: 12px;
  color: #9da6b5;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}
.um-features li .ck {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: rgba(59,222,107,0.1);
  border: 1px solid rgba(59,222,107,0.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 8px;
  color: #3BDE6B;
}
.um-features li .ck.x {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.08);
  color: #3a3f4a;
}
.hero .um-features li { color: #c8d4c0; }
.um-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.um-btn {
  padding: 12px 8px;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  text-align: center;
  border: none;
  outline: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  display: block;
  width: 100%;
  text-decoration: none;
  box-sizing: border-box;
}
.um-btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: #6b7585;
}
.um-btn-ghost:hover { border-color: rgba(255,255,255,0.2); color: #9da6b5; }
.um-btn-outline {
  background: transparent;
  border: 1px solid rgba(59,222,107,0.3);
  color: #3BDE6B;
}
.um-btn-outline:hover { background: rgba(59,222,107,0.07); border-color: rgba(59,222,107,0.5); }
.um-btn-solid {
  background: #3BDE6B;
  color: #071009;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(59,222,107,0.25);
}
.um-btn-solid:hover { background: #4ef07a; transform: translateY(-1px); box-shadow: 0 6px 26px rgba(59,222,107,0.35); }
.um-btn-solid:active { transform: translateY(0); }
.um-compare-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: #6b7585;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin: 0 auto;
  padding: 4px 8px;
  transition: color 0.2s;
}
.um-compare-toggle:hover { color: #9da6b5; }
.um-compare-toggle svg { transition: transform 0.25s; }
.um-compare-toggle.open svg { transform: rotate(180deg); }
.um-table-wrap {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.16,1,0.3,1);
  margin-top: 0;
}
.um-table-wrap.open { max-height: 600px; margin-top: 20px; }
table.um-table { width: 100%; border-collapse: collapse; font-size: 12px; }
table.um-table thead tr th {
  padding: 10px 14px;
  text-align: left;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7585;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
table.um-table thead tr th:not(:first-child) { text-align: center; }
table.um-table tbody tr td {
  padding: 10px 14px;
  color: #9da6b5;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
table.um-table tbody tr:last-child td { border-bottom: none; }
table.um-table tbody tr td:not(:first-child) { text-align: center; }
table.um-table tbody tr td.hi { color: #3BDE6B; font-weight: 600; }
.ck-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
}
.ck-sm.y { background: rgba(59,222,107,0.1); color: #3BDE6B; font-size: 10px; }
.ck-sm.n { background: rgba(255,255,255,0.04); color: #2e333d; font-size: 10px; }
.um-foot {
  text-align: center;
  font-size: 11px;
  color: #3a3f4a;
  margin-top: 18px;
  font-family: 'DM Mono', monospace;
}
@media (max-width: 600px) {
  .um-sheet { padding: 32px 20px 28px; }
  .um-plans { grid-template-columns: 1fr; }
  .um-actions { grid-template-columns: 1fr; }
  .um-title { font-size: 22px; }
}
 
:root {
  --green: #3BDE6B;
  --green-dim: rgba(59,222,107,0.12);
  --green-border: rgba(59,222,107,0.22);
  --red: #FF4D4D;
  --amber: #F5A623;
  --surface: #13161f;
  --surface-2: #1a1e2b;
  --border: rgba(255,255,255,0.06);
  --muted: #5a6070;
  --sub: #8b95a8;
}
 
/* ── CHECKIN HERO ── */
#psych-hero {
  position: relative;
  background: #0e1219;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px 24px;
  margin-bottom: 14px;
  overflow: hidden;
}
#psych-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(59,222,107,0.07) 0%, transparent 65%);
  pointer-events: none;
}
#psych-hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--green-border), transparent);
}
 
/* Emotion ring buttons */
.emo-ring {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0;
}
.emo-btn {
  position: relative;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 16px 6px 12px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--sub);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34,1.56,0.64,1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  overflow: hidden;
}
.emo-btn .emo-icon {
  font-size: 26px;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
.emo-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}
.emo-btn:active { transform: scale(0.93); }
.emo-btn.emo-selected {
  border-color: var(--green);
  color: var(--green);
  background: rgba(59,222,107,0.08);
  box-shadow: 0 0 20px rgba(59,222,107,0.12), inset 0 1px 0 rgba(59,222,107,0.2);
}
.emo-btn.emo-selected .emo-icon { transform: scale(1.15); }
.emo-btn.emo-selected::before {
  background: radial-gradient(circle at 50% 0%, rgba(59,222,107,0.08) 0%, transparent 70%);
  opacity: 1;
}
 
/* Energy slider */
#mental-energy {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #1e2330;
  cursor: pointer;
  outline: none;
}
#mental-energy::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid #0e1219;
  box-shadow: 0 0 10px rgba(59,222,107,0.5);
  cursor: pointer;
  transition: box-shadow 0.2s;
}
#mental-energy::-webkit-slider-thumb:active {
  box-shadow: 0 0 18px rgba(59,222,107,0.7);
}
#mental-energy::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid #0e1219;
  cursor: pointer;
}
 
/* Commit button */
#psych-commit-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--green) 0%, #22c55e 100%);
  color: #061010;
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}
#psych-commit-btn::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s;
}
#psych-commit-btn:hover::after { left: 150%; }
#psych-commit-btn:active { transform: scale(0.975); }
 
/* ── STAT TILES ── */
.psych-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (min-width: 480px) {
  .psych-tiles { grid-template-columns: repeat(4, 1fr); }
}
.psych-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
}
.psych-tile .tile-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.psych-tile .tile-val {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
}
.psych-tile .tile-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  font-family: 'DM Mono', monospace;
}
.psych-tile::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  border-radius: 0 0 14px 14px;
  background: var(--green);
  opacity: 0;
  transition: opacity 0.3s;
}
 
/* discipline bar inside tile */
.disc-bar-track {
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.disc-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.7s cubic-bezier(0.4,0,0.2,1);
  background: var(--green);
}
 
/* ── AI PANEL ── */
#psych-ai-panel {
  background: linear-gradient(160deg, #0b1520 0%, #0e1219 60%, #0a1510 100%);
  border: 1px solid var(--green-border);
  border-radius: 20px;
  padding: 22px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
#psych-ai-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 10%, var(--green) 50%, transparent 90%);
  opacity: 0.5;
}
#psych-ai-panel::after {
  content: '';
  position: absolute;
  bottom: -80px; right: -80px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(59,222,107,0.05) 0%, transparent 70%);
  pointer-events: none;
}
 
#ai-analyze-btn {
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  color: var(--green);
  border-radius: 10px;
  padding: 9px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
#ai-analyze-btn:hover {
  background: rgba(59,222,107,0.2);
  border-color: rgba(59,222,107,0.4);
  box-shadow: 0 0 16px rgba(59,222,107,0.12);
}
#ai-analyze-btn:disabled {
  opacity: 0.5; cursor: not-allowed;
}
 
/* Typewriter cursor */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }
.ai-cursor {
  display: inline-block;
  width: 2px; height: 13px;
  background: var(--green);
  vertical-align: middle;
  margin-left: 1px;
  animation: blink 0.9s infinite;
}
 
/* ── STATE BARS ── */
.state-bar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.state-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.state-bar-name {
  font-size: 12px;
  color: #c8d0de;
  font-weight: 500;
}
.state-bar-val {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 500;
}
.state-bar-track {
  height: 5px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: hidden;
}
.state-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
}
 
/* ── SESSION FEED ── */
.session-card {
  background: rgba(255,255,255,0.018);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}
.session-card:hover { border-color: rgba(255,255,255,0.1); }
.session-card .session-stripe {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 14px 0 0 14px;
}
 
/* ── MANTRAS ── */
.mantra-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(255,255,255,0.018);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.2s;
}
.mantra-item:hover { border-color: var(--green-border); }
 
/* ── RULE BREAK PILL ── */
.rb-pill {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 2px solid rgba(255,77,77,0.5);
  background: rgba(255,77,77,0.04);
}
 
/* ── OPTIONAL EXTRAS COLLAPSE ── */
.extras-wrap {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1);
}
.extras-wrap.open { max-height: 200px; }
 
/* ── SECTION LABELS ── */
.psych-section-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.psych-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
 
/* ── DEBRIEF COLLAPSIBLE ── */
.debrief-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.4,0,0.2,1);
}
.debrief-body.open { grid-template-rows: 1fr; }
.debrief-inner { overflow: hidden; }
 
/* ── INPUTS ── */
.psych-input {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 11px 14px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}
.psych-input:focus { border-color: var(--green-border); }
.psych-select {
  width: 100%;
  background: #1a1e2b;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 11px 14px;
  color: #fff;
  font-size: 13px;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
}
.psych-select:focus { border-color: var(--green-border); }
 
/* ── STREAKS ── */
@keyframes pulse-green {
  0%,100% { box-shadow: 0 0 0 0 rgba(59,222,107,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(59,222,107,0); }
}
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(59,222,107,0.07);
  border: 1px solid var(--green-border);
  border-radius: 20px;
  padding: 5px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--green);
  font-weight: 500;
}
 
/* Staggered reveal */
@keyframes psych-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.psych-reveal {
  animation: psych-rise 0.4s ease both;
}
.psych-reveal:nth-child(1) { animation-delay: 0.05s; }
.psych-reveal:nth-child(2) { animation-delay: 0.1s; }
.psych-reveal:nth-child(3) { animation-delay: 0.15s; }
.psych-reveal:nth-child(4) { animation-delay: 0.2s; }

.pw-rule { font-size: 11px; color: #5c6370; transition: color 0.2s; }
.pw-rule.pass { color: #3BDE6B; }