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

/* ========= LIGHT MODE (Default) ========= */
:root {
    --bg: #e8ecf0;
    --bg-main: #e8ecf0;
    --bg-elevated: rgba(255, 255, 255, 0.25);
    --bg-mirror: rgba(255, 255, 255, 0.15);
    --fg: #1f2937;
    --muted: #6b7280;
    --panel: rgba(255, 255, 255, 0.25);
    --border: rgba(148, 163, 184, 0.3);
    --border-subtle: rgba(148, 163, 184, 0.2);
    --border-strong: rgba(148, 163, 184, 0.4);
    --brand: #6b7c6e;
    --brand-hover: #5a6b5d;
    --glass-tint: rgba(255, 255, 255, 0.2);
    --steel: #60758a;
    --chrome: #d1d5db;
    --mirror-border: rgba(255, 255, 255, 0.4);
    --mirror-glow: rgba(255, 255, 255, 0.3);
    --accent-main: #6b7c6e;
    --accent-soft: rgba(107, 124, 110, 0.12);
    --text-accent: #5a6b5d;
    --danger: #dc2626;
    --danger-soft: rgba(220, 38, 38, 0.1);
    --success: #059669;
    --success-soft: rgba(5, 150, 105, 0.1);
    
    /* Light mode reflection colors */
    --sweep-color: rgba(255, 255, 255, 0.6);
    --shimmer-color: rgba(255, 255, 255, 0.1);
    --glow-primary: rgba(255, 255, 255, 0.5);
    --glow-secondary: rgba(107, 124, 110, 0.08);
    --highlight-line: rgba(255, 255, 255, 0.3);
    --card-highlight-top: rgba(255, 255, 255, 0.8);
    --card-shadow-bottom: rgba(148, 163, 184, 0.2);
}

/* ========= DARK MODE (Mirror Room) ========= */
[data-theme="dark"] {
    --bg: #050608;
    --bg-main: #050608;
    --bg-elevated: #0C0E11;
    --bg-mirror: #101319;
    --fg: #E4E7F1;
    --muted: #6F7380;
    --panel: rgba(12, 14, 17, 0.9);
    --border: #2A303A;
    --border-subtle: #1C2027;
    --border-strong: #2C323E;
    --brand: #9D8CFF;
    --brand-hover: #B5A7FF;
    --glass-tint: rgba(16, 19, 25, 0.85);
    --steel: #A3A8B7;
    --chrome: #2C323E;
    --mirror-border: #2A303A;
    --mirror-glow: rgba(123, 148, 255, 0.12);
    --accent-main: #9D8CFF;
    --accent-soft: rgba(157, 140, 255, 0.16);
    --text-accent: #C5D0FF;
    --danger: #F47474;
    --danger-soft: rgba(244, 116, 116, 0.12);
    --success: #6FD3B6;
    --success-soft: rgba(111, 211, 182, 0.12);
    
    /* Dark mode reflection colors - softer, more ethereal */
    --sweep-color: rgba(157, 140, 255, 0.15);
    --shimmer-color: rgba(123, 148, 255, 0.08);
    --glow-primary: rgba(123, 148, 255, 0.15);
    --glow-secondary: rgba(157, 140, 255, 0.06);
    --highlight-line: rgba(123, 148, 255, 0.12);
    --card-highlight-top: rgba(123, 148, 255, 0.15);
    --card-shadow-bottom: rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    background: linear-gradient(180deg, #f5f7fb 0%, #cfd3da 50%, #e8ecf0 100%);
    background-attachment: fixed;
    color: var(--fg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.3s ease;
}

[data-theme="dark"] body,
body[data-theme="dark"] {
    background: linear-gradient(180deg, #080A0D 0%, #050608 50%, #0C0E11 100%);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 50% 20%, var(--glow-primary) 0%, transparent 40%),
        radial-gradient(circle at 80% 60%, var(--glow-secondary) 0%, transparent 50%),
        linear-gradient(0deg, transparent 48%, var(--highlight-line) 50%, transparent 52%);
    pointer-events: none;
    z-index: 0;
    transition: background 0.4s ease;
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -100%;
    width: 50px;
    height: 200%;
    background: linear-gradient(90deg, transparent, var(--sweep-color), transparent);
    animation: lightSweep 12s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
    transform: skewX(-20deg);
}

@keyframes lightSweep {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}

.wrap {
    max-width: 680px;
    margin: 32px auto;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 2;
}

h1 {
    font-size: 24px;
    font-weight: 300;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #374151 0%, #6b7280 50%, #374151 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

h1::before {
    content: '🪞';
    font-size: 20px;
    filter: grayscale(0.3) brightness(1.1);
}

h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--fg);
}

h3 {
    margin: 16px 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sub {
    color: var(--muted);
    margin-bottom: 8px;
    font-size: 14px;
}

.disclaimer {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 16px;
    opacity: 0.7;
    font-style: italic;
}

.card {
    background: var(--glass-tint);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 2px solid var(--mirror-border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 1px 0 var(--card-highlight-top) inset,
        0 -1px 0 var(--card-shadow-bottom) inset,
        0 0 40px var(--mirror-glow);
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        var(--card-highlight-top) 20%, 
        var(--highlight-line) 50%,
        var(--card-highlight-top) 80%,
        transparent);
    border-radius: 12px 12px 0 0;
}

.card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--shimmer-color) 0%, transparent 70%);
    animation: shimmer 10s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); opacity: 0.5; }
    50% { transform: translate(10%, 10%); opacity: 0.8; }
}

.chat {
    height: 55vh;
    overflow-y: auto;
    margin: 16px 0;
    padding: 16px 12px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, var(--bg-mirror) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-radius: 8px;
    border: 1px solid var(--mirror-border);
    position: relative;
    transition: background 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .chat {
    background: linear-gradient(180deg, var(--bg-mirror) 0%, rgba(16, 19, 25, 0.8) 100%);
    box-shadow: 0 0 40px var(--mirror-glow);
}

.chat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, var(--highlight-line) 0%, transparent 100%);
    pointer-events: none;
    border-radius: 8px 8px 0 0;
}

.chat::-webkit-scrollbar {
    width: 6px;
}

.chat::-webkit-scrollbar-track {
    background: var(--border-subtle);
}

.chat::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.chat::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

.msg {
    display: flex;
    width: 100%;
    margin: 0;
    animation: slideIn 0.3s ease-out;
}

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

.bubble {
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 70%;
    word-wrap: break-word;
    line-height: 1.6;
    font-size: 15px;
    display: inline-block;
}

.me {
    justify-content: flex-end;
    text-align: right;
}

.me .bubble {
    background: linear-gradient(135deg, var(--brand) 0%, #5a6b5d 100%);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(107, 124, 110, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.bot {
    justify-content: flex-start;
    text-align: left;
}

.bot .bubble {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: #1f2937;
    border-radius: 18px 18px 18px 4px;
    margin-right: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .bot .bubble {
    background: rgba(16, 19, 25, 0.85);
    border: 1px solid var(--border-subtle);
    color: var(--fg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(123, 148, 255, 0.1);
}

[data-theme="dark"] .me .bubble {
    background: linear-gradient(135deg, var(--accent-main) 0%, #7B68EE 100%);
    box-shadow: 0 2px 8px rgba(157, 140, 255, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.summary-bubble {
    background: rgba(107, 124, 110, 0.12) !important;
    border: 1px solid rgba(107, 124, 110, 0.3) !important;
}

/* Dark mode summary: very muted, mostly neutral with subtle violet outline */
[data-theme="dark"] .summary-bubble {
    background: rgba(28, 32, 39, 0.7) !important;
    border: 1px solid var(--border-subtle) !important;
    padding: 20px !important;
    max-width: 85% !important;
    line-height: 1.65 !important;
}

.summary-bubble strong {
    color: var(--brand);
    font-weight: 600;
}

.copy-summary-btn {
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--steel);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.copy-summary-btn:hover {
    border-color: var(--brand);
    background: rgba(107, 124, 110, 0.15);
    color: var(--fg);
}

.copy-summary-btn.copied {
    border-color: #059669;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
}

.copy-summary-btn svg {
    flex-shrink: 0;
}

.energy-selector {
    margin-bottom: 20px;
    text-align: center;
}

.energy-prompt {
    font-size: 13px;
    color: var(--steel);
    margin-bottom: 14px;
    letter-spacing: 0.01em;
}

.energy-options {
    display: flex;
    gap: 14px;
    justify-content: center;
    align-items: center;
}

.energy-btn {
    font-size: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.2) 100%);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    width: 27px;
    height: 27px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 3.5px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.energy-btn:hover {
    border-color: rgba(0, 0, 0, 0.12);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.3) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.energy-btn.selected {
    border-color: rgba(107, 124, 110, 0.3);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.3) 100%);
    box-shadow: inset 0 1px 3px rgba(107, 124, 110, 0.2),
                0 0 0 1px rgba(107, 124, 110, 0.1),
                0 2px 8px rgba(107, 124, 110, 0.15);
}

.energy-btn.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

/* Dark mode energy buttons */
[data-theme="dark"] .energy-btn {
    background: linear-gradient(180deg, rgba(28, 32, 39, 0.8) 0%, rgba(16, 19, 25, 0.9) 100%);
    border-color: var(--border-subtle);
}

[data-theme="dark"] .energy-btn:hover {
    border-color: var(--border-strong);
    background: linear-gradient(180deg, rgba(44, 50, 62, 0.9) 0%, rgba(28, 32, 39, 0.8) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .energy-btn.selected {
    border-color: var(--accent-main);
    background: linear-gradient(180deg, rgba(44, 50, 62, 0.9) 0%, rgba(28, 32, 39, 0.8) 100%);
    box-shadow: inset 0 1px 3px rgba(157, 140, 255, 0.2),
                0 0 0 1px var(--accent-soft),
                0 2px 8px rgba(157, 140, 255, 0.15);
}

.energy-btn[data-energy="1"] {
    filter: brightness(1) contrast(1.05);
}

.energy-btn[data-energy="2"] {
    filter: brightness(1.02) contrast(0.98);
    text-shadow: 0 0 0.3px rgba(255, 255, 255, 0.4);
}

.energy-btn[data-energy="3"] {
    filter: brightness(0.95) contrast(1.15) saturate(0);
    background: linear-gradient(180deg, rgba(245, 245, 245, 0.5) 0%, rgba(240, 240, 240, 0.4) 100%);
}

.recheck-link {
    margin-top: 12px;
    background: none;
    border: none;
    color: var(--brand);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px 8px;
}

.recheck-link:hover {
    opacity: 0.8;
}

.witness-indicator {
    background: rgba(107, 124, 110, 0.12);
    border: 1px solid rgba(107, 124, 110, 0.25);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--brand);
}

.witness-icon {
    font-size: 16px;
}

.witness-text {
    font-weight: 500;
}

.purpose-banner {
    background: rgba(107, 124, 110, 0.08);
    border: 1px solid rgba(107, 124, 110, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 12px;
    color: rgba(107, 124, 110, 0.7);
    text-align: center;
    opacity: 0.6;
    transition: opacity 240ms ease;
}

.purpose-banner.highlight {
    opacity: 1;
    color: var(--brand);
    font-weight: 500;
}

.past-reflections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reflection-item {
    background: rgba(255, 255, 255, 0.4);
    border-left: 3px solid rgba(107, 124, 110, 0.4);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
}

.reflection-date {
    font-size: 11px;
    color: var(--steel);
    margin-top: 6px;
    opacity: 0.7;
}

.input-container {
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.done-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--steel);
    border-radius: 12px;
    padding: 14px 20px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 56px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .done-btn {
    background: var(--bg-elevated);
    border-color: var(--border-subtle);
    color: var(--steel);
    box-shadow: inset 0 1px 0 rgba(123, 148, 255, 0.1);
}

[data-theme="dark"] .done-btn:hover {
    border-color: var(--accent-main);
    background: rgba(157, 140, 255, 0.1);
    color: var(--fg);
    box-shadow: inset 0 1px 0 rgba(123, 148, 255, 0.2), 
                0 0 12px var(--mirror-glow);
}

/* Mirror shimmer effect */
.done-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(107, 124, 110, 0.3) 50%, 
        transparent 100%
    );
    animation: mirror-shimmer 3s ease-in-out infinite;
}

@keyframes mirror-shimmer {
    0% {
        left: -100%;
    }
    50%, 100% {
        left: 100%;
    }
}

.done-btn:hover {
    border-color: var(--accent-main);
    color: var(--fg);
    background: rgba(107, 124, 110, 0.2);
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 
                0 0 12px rgba(107, 124, 110, 0.3);
}

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

.done-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.form-buttons button[type="submit"] {
    flex: 1;
}

textarea {
    flex: 1;
    min-height: 56px;
    max-height: 120px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    color: var(--fg);
    padding: 14px;
    resize: vertical;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] textarea {
    background: rgba(5, 6, 8, 0.9);
    border-color: var(--border-subtle);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-main);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05),
                0 0 0 3px var(--accent-soft);
}

[data-theme="dark"] textarea:focus {
    background: rgba(12, 14, 17, 0.95);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3),
                0 0 0 3px var(--accent-soft);
}

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

textarea.ripple {
    animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
    0% {
        box-shadow: 
            inset 0 1px 3px rgba(0, 0, 0, 0.05),
            0 0 0 0 rgba(107, 124, 110, 0.4);
    }
    50% {
        box-shadow: 
            inset 0 1px 3px rgba(0, 0, 0, 0.05),
            0 0 0 8px rgba(107, 124, 110, 0.2),
            0 0 20px rgba(107, 124, 110, 0.1);
    }
    100% {
        box-shadow: 
            inset 0 1px 3px rgba(0, 0, 0, 0.05),
            0 0 0 12px rgba(107, 124, 110, 0);
    }
}

button {
    background: linear-gradient(135deg, var(--brand) 0%, #5a6b5d 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 14px 24px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 56px;
    box-shadow: 0 2px 8px rgba(107, 124, 110, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 124, 110, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:active {
    transform: translateY(0);
}

/* Dark mode: Send button - solid violet */
[data-theme="dark"] button[type="submit"] {
    background: linear-gradient(135deg, var(--accent-main) 0%, #7B68EE 100%);
    border: 1px solid rgba(157, 140, 255, 0.3);
    box-shadow: 0 2px 8px rgba(157, 140, 255, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] button[type="submit"]:hover {
    box-shadow: 0 4px 12px rgba(157, 140, 255, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Dark mode: neutral gray controls, not violet */
[data-theme="dark"] .controls {
    background: rgba(28, 32, 39, 0.6);
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.meta {
    color: var(--muted);
    font-size: 12px;
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.switch {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fg);
    font-size: 13px;
}

.switch input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand);
}

.switch label {
    cursor: pointer;
    user-select: none;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.profile-header h2 {
    margin: 0;
}

.status-badge {
    font-size: 11px;
    padding: 4px 10px;
    background: rgba(96, 117, 138, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: var(--steel);
    font-weight: 500;
}

/* Dark mode: neutral gray badge */
[data-theme="dark"] .status-badge {
    background: rgba(44, 50, 62, 0.6);
    border: 1px solid var(--border-subtle);
    color: var(--muted);
}

.insights-section {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Dark mode: muted neutral background, violet outline only */
[data-theme="dark"] .insights-section {
    background: rgba(28, 32, 39, 0.5);
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.insights-section h3 {
    margin: 0 0 12px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Dark mode: use muted violet for just the header text */
[data-theme="dark"] .insights-section h3 {
    color: var(--accent-main);
    opacity: 0.8;
}

.notes {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
    margin: 0;
}

/* Dark mode notes */
[data-theme="dark"] .notes {
    color: var(--fg);
}

.notes:empty::before {
    content: 'The mirror is learning your style...';
    color: var(--muted);
    font-style: italic;
}

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

.profile-toggle-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--steel);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.profile-toggle-btn:hover {
    border-color: var(--brand);
    color: var(--fg);
}

.profile-toggle-btn::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.2s ease;
}

.profile-toggle-btn.open::after {
    transform: rotate(-180deg);
}

.export-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--steel);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    height: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.export-btn:hover {
    border-color: var(--brand);
    color: var(--fg);
    background: rgba(107, 124, 110, 0.2);
}

.export-btn svg {
    flex-shrink: 0;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.3);
    color: var(--steel);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    width: auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.icon-btn:hover {
    border-color: var(--brand);
    color: var(--fg);
    background: rgba(107, 124, 110, 0.2);
}

.pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, 'Courier New', monospace;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    padding: 12px;
    color: #475569;
    overflow: auto;
    max-height: 300px;
    white-space: pre-wrap;
    margin-top: 8px;
    display: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.pill.open {
    display: block;
}

.pill::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.pill::-webkit-scrollbar-track {
    background: transparent;
}

.pill::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Crisis Modal */
.crisis-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.crisis-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    position: relative;
}

.crisis-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.2s;
    z-index: 10;
}

.crisis-close-btn:hover {
    color: white;
}

.crisis-header {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    padding: 24px;
    border-radius: 12px 12px 0 0;
}

.crisis-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.crisis-body {
    padding: 24px;
}

.crisis-notice {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--fg);
}

.crisis-resources {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.crisis-resource-link {
    text-decoration: none;
    display: block;
    transition: transform 0.15s ease;
}

.crisis-resource-link:hover {
    transform: translateY(-2px);
}

.crisis-resource-link:active {
    transform: translateY(0);
}

.crisis-resource-card {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0%, rgba(220, 38, 38, 0.04) 100%);
    border: 2px solid rgba(220, 38, 38, 0.2);
    border-radius: 10px;
    padding: 14px 16px;
    transition: all 0.2s ease;
}

.crisis-resource-link:hover .crisis-resource-card {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.12) 0%, rgba(220, 38, 38, 0.06) 100%);
    border-color: rgba(220, 38, 38, 0.35);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.15);
}

.crisis-resource-card h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: #dc2626;
}

.crisis-desc {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
}

.crisis-footer {
    background: rgba(107, 124, 110, 0.08);
    padding: 16px;
    border-radius: 8px;
}

.crisis-note {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--muted);
    opacity: 0.85;
}

.crisis-copy-btn {
    background: var(--brand);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.crisis-copy-btn:hover {
    background: var(--brand-hover);
}

/* Reflection Patterns at bottom of conversation */
.reflection-patterns-bottom {
    margin-top: 16px;
    padding-top: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* Dark mode: neutral border */
[data-theme="dark"] .reflection-patterns-bottom {
    border-top: 1px solid var(--border-subtle);
}

@media (max-width: 900px) {
    .wrap {
        max-width: 100%;
        margin: 16px auto;
        padding: 0 12px;
    }
    
    .chat {
        height: 68vh;
    }
    
    .reflection-patterns-bottom {
        margin-top: 12px;
        padding-top: 16px;
    }
    
    /* Reduce bubble text size and padding for mobile */
    .bubble {
        font-size: 14px;
        padding: 12px 14px;
        line-height: 1.5;
        max-width: 80%;
    }
    
    /* Adjust message spacing */
    .chat {
        gap: 12px;
    }
    
    /* Make header more compact */
    h1 {
        font-size: 20px;
    }
    
    .sub {
        font-size: 13px;
    }
    
    /* Prevent input zoom on iOS - keep at 16px minimum */
    textarea {
        font-size: 16px;
        min-height: 52px;
    }
    
    /* Improve touch targets for all buttons - minimum 44px height */
    button {
        padding: 16px 24px;
        min-height: 48px;
        font-size: 15px;
    }
    
    .done-btn {
        padding: 16px 20px;
        min-height: 48px;
        font-size: 15px;
    }
    
    /* Energy selector - ensure buttons are easy to tap */
    .energy-btn {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    
    .energy-options {
        gap: 12px;
    }
    
    /* Form buttons spacing */
    .form-buttons {
        gap: 8px;
    }
    
    /* Smooth keyboard behavior */
    body {
        position: relative;
    }
    
    .crisis-content {
        max-height: 95vh;
    }
    
    .crisis-header h2 {
        font-size: 20px;
    }
    
    /* Resonance options - larger touch targets */
    .resonance-option {
        padding: 18px 20px;
        min-height: 72px;
    }
    
    .resonance-emoji {
        font-size: 2.2rem;
    }
    
    /* Crisis modal buttons */
    .crisis-copy-btn {
        min-height: 48px;
        padding: 14px 20px;
    }
    
    /* Text-style buttons and links */
    .recheck-link {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Profile action buttons */
    .export-btn, .profile-toggle-btn, .icon-btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Crisis modal links - critical for emergency access */
    .crisis-action a {
        display: inline-block;
        min-height: 48px;
        padding: 14px 16px;
        line-height: 1.4;
        text-align: center;
    }
    
    /* Checkbox/toggle switches - enlarge touch target with absolute positioning */
    .switch {
        min-height: 52px;
        position: relative;
        align-items: stretch;
        gap: 0;
    }
    
    /* Invisible checkbox covering entire switch area for maximum touch target */
    .switch input[type="checkbox"] {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
        z-index: 2;
        margin: 0;
    }
    
    /* Label provides visual styling */
    .switch label {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        min-height: 52px;
        border-radius: 8px;
        position: relative;
        flex: 1;
        background: rgba(255, 255, 255, 0.35);
        pointer-events: none;
    }
    
    /* Visual toggle indicator */
    .switch label::before {
        content: '✓';
        font-size: 12px;
        color: var(--brand);
        font-weight: bold;
        opacity: 0;
        transition: opacity 0.2s;
    }
    
    /* Show checkmark when checked */
    .switch input[type="checkbox"]:checked + label::before {
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Emotional Resonance Selector */
#resonance-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

#resonance-overlay.show {
    display: flex;
}

.resonance-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.resonance-card {
    position: relative;
    width: min(480px, 92vw);
    border-radius: 18px;
    padding: 28px 24px 24px;
    background: radial-gradient(80% 120% at 50% 0%, rgba(107, 124, 110, 0.15), rgba(107, 124, 110, 0.05)), rgba(22,22,28,0.95);
    border: 1px solid rgba(107, 124, 110, 0.2);
    color: #EDEDF0;
    box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}

#resonance-title {
    margin: 0 0 8px 0;
    font-weight: 600;
    font-size: 1.2rem;
    color: #F5F5F7;
    text-align: center;
}

.resonance-subtitle {
    margin: 0 0 24px 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
    text-align: center;
    line-height: 1.4;
}

.resonance-options {
    display: grid;
    gap: 12px;
}

.resonance-option {
    appearance: none;
    border: 1.5px solid rgba(107, 124, 110, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    background: rgba(107, 124, 110, 0.08);
    color: #E8E8EA;
    cursor: pointer;
    transition: all 150ms ease;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 1rem;
    text-align: left;
}

.resonance-option:hover {
    background: rgba(107, 124, 110, 0.15);
    border-color: rgba(107, 124, 110, 0.5);
    transform: translateY(-1px);
}

.resonance-option:active {
    transform: translateY(0);
}

.resonance-emoji {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.resonance-label {
    flex: 1;
    font-weight: 500;
}

/* Artifact Overlay */
#artifact-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

#artifact-overlay.show {
    display: flex;
}

.artifact-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.artifact-card {
    position: relative;
    width: min(580px, 92vw);
    max-height: 85vh;
    border-radius: 18px;
    padding: 24px 20px 20px;
    background: radial-gradient(80% 120% at 50% 0%, rgba(107, 124, 110, 0.15), rgba(107, 124, 110, 0.05)), rgba(22,22,28,0.95);
    border: 1px solid rgba(107, 124, 110, 0.2);
    color: #EDEDF0;
    box-shadow: 0 12px 48px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.artifact-glow {
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    pointer-events: none;
    background: radial-gradient(100% 60% at 50% 0%, rgba(107, 124, 110, 0.25), rgba(107, 124, 110, 0) 60%);
    filter: blur(14px);
}

.artifact-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.artifact-content::-webkit-scrollbar {
    width: 6px;
}

.artifact-content::-webkit-scrollbar-track {
    background: transparent;
}

.artifact-content::-webkit-scrollbar-thumb {
    background: rgba(107, 124, 110, 0.4);
    border-radius: 3px;
}

.artifact-content::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 124, 110, 0.6);
}

#artifact-title {
    margin: 0 0 12px 0;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: #F5F5F7;
    font-size: 1.15rem;
}

#artifact-text {
    margin: 0;
    line-height: 1.6;
    font-size: 0.95rem;
    white-space: pre-wrap;
    color: #E8E8EA;
}

.artifact-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.artifact-actions .btn {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 100ms ease, opacity 120ms ease, border-color 120ms ease;
    flex: 1;
}

.artifact-actions .btn:active {
    transform: translateY(1px);
}

.artifact-actions .btn.primary {
    background: #AFADEB;
    color: #111;
    border-color: rgba(0,0,0,0.15);
}

.artifact-actions .btn.primary:hover {
    opacity: 0.95;
}

.artifact-actions .btn.ghost {
    background: transparent;
    color: #EDEDF0;
    border-color: rgba(255,255,255,0.25);
}

.artifact-actions .btn.ghost:hover {
    border-color: rgba(255,255,255,0.45);
}

.artifact-caption {
    display: block;
    opacity: 0.75;
    letter-spacing: 0.2px;
    font-size: 13px;
}

@keyframes artifactFade {
    to {
        opacity: 0;
        filter: blur(6px);
        transform: scale(0.98);
    }
}

@media (max-width: 600px) {
    /* Compact layout for small phones */
    .wrap {
        margin: 8px auto;
        padding: 0 10px;
        gap: 10px;
    }
    
    h1 {
        font-size: 18px;
        margin: 0 0 2px;
    }
    
    .sub {
        font-size: 12px;
        margin-bottom: 4px;
    }
    
    .disclaimer {
        margin-bottom: 8px;
        font-size: 11px;
    }
    
    .energy-selector {
        margin: 8px 0;
        padding: 12px;
    }
    
    .chat {
        height: 38vh;
        margin: 8px 0;
    }
    
    /* Smaller bubbles on very small screens */
    .bubble {
        font-size: 13px;
        padding: 10px 12px;
        max-width: 85%;
    }
    
    /* Energy buttons - slightly smaller but still tappable */
    .energy-btn {
        width: 54px;
        height: 54px;
        font-size: 26px;
    }
    
    .energy-options {
        gap: 10px;
    }
    
    /* Compact textarea on small screens */
    textarea {
        min-height: 48px;
        padding: 12px 14px;
        font-size: 16px;
    }
    
    /* Buttons remain accessible */
    button {
        padding: 14px 20px;
        min-height: 46px;
        font-size: 14px;
    }
    
    .done-btn {
        padding: 14px 18px;
        min-height: 46px;
    }
    
    /* Resonance selector adjustments */
    .resonance-card {
        width: min(420px, 94vw);
        padding: 24px 20px 20px;
    }
    
    .resonance-option {
        padding: 16px 18px;
        min-height: 68px;
    }
    
    .resonance-emoji {
        font-size: 2rem;
    }
    
    .resonance-label {
        font-size: 0.95rem;
    }
    
    /* Session summary/artifact */
    .artifact-card {
        max-height: 90vh;
        padding: 20px 18px 18px;
    }
    
    #artifact-title {
        font-size: 1.05rem;
        margin-bottom: 10px;
    }
    
    #artifact-text {
        font-size: 0.9rem;
        line-height: 1.55;
    }
    
    .artifact-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .artifact-actions .btn {
        padding: 14px 16px;
        min-height: 46px;
        font-size: 0.9rem;
        width: 100%;
    }
    
    .artifact-caption {
        font-size: 12px;
        margin-top: 4px;
    }
    
    /* Crisis modal on small screens */
    .crisis-content {
        max-width: 95vw;
        padding: 20px 16px;
    }
    
    .crisis-copy-btn {
        width: 100%;
        min-height: 46px;
        padding: 14px 20px;
    }
}

/* Landscape mode optimizations for phones */
@media (max-width: 900px) and (max-height: 500px) {
    .chat {
        height: 50vh;
    }
    
    .wrap {
        margin: 8px auto;
    }
    
    h1 {
        font-size: 16px;
    }
    
    .energy-selector {
        padding: 12px;
    }
    
    textarea {
        min-height: 44px;
    }
}

/* ===== GUIDE OVERLAY + PANEL ===== */
.mirror-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 1.25rem;
    z-index: 9999;
    overflow-y: auto;
}

.mirror-overlay.open {
    display: flex;
}

.mirror-panel {
    background: radial-gradient(circle at top, #1a202c, #0f172a);
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    max-width: 640px;
    width: 100%;
    padding: 1.25rem 1.25rem 1.5rem;
    box-shadow:
        0 22px 45px rgba(0, 0, 0, 0.65),
        0 0 40px rgba(107, 124, 110, 0.15);
    position: relative;
    color: #e5e7eb;
    animation: panelFadeIn 0.18s ease-out;
    margin-top: 2rem;
    margin-bottom: 4rem;
}

@keyframes panelFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mirror-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mirror-panel-title {
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.mirror-panel-title-glow {
    width: 9px;
    height: 20px;
    border-radius: 999px;
    background: linear-gradient(to bottom, #6b7c6e, #5a6b5d);
    box-shadow: 0 0 12px rgba(107, 124, 110, 0.6);
}

.mirror-panel-subtitle {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
}

.mirror-close-button {
    border: none;
    background: transparent;
    color: #9ca3af;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.08s ease;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.mirror-close-button:hover {
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    transform: translateY(-1px);
}

.mirror-close-button:active {
    transform: translateY(0);
}

/* ===== Accordion ===== */
.mirror-accordion {
    margin-top: 0.25rem;
}

.mirror-item {
    border-radius: 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.75);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.mirror-item-header {
    width: 100%;
    border: none;
    background: transparent;
    color: inherit;
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
}

.mirror-item-header span.label {
    flex: 1;
    padding-right: 0.75rem;
}

.mirror-item-header span.chevron {
    font-size: 0.85rem;
    transition: transform 0.16s ease;
    opacity: 0.8;
    flex-shrink: 0;
}

.mirror-item.open .mirror-item-header span.chevron {
    transform: rotate(90deg);
}

.mirror-item-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.18s ease-out;
    padding: 0;
}

.mirror-item-body-inner {
    padding-bottom: 0.75rem;
    padding-top: 0.1rem;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.mirror-item.open .mirror-item-body {
    max-height: 300px;
}

/* Nested accordion for category questions */
.mirror-nested {
    padding: 0;
    margin: 0;
}

.mirror-nested-item {
    border: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    background: transparent;
    overflow: hidden;
}

.mirror-nested-item:last-child {
    border-bottom: none;
}

.mirror-nested-header {
    width: 100%;
    border: none;
    background: transparent;
    color: inherit;
    padding: 0.7rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 0.8rem;
    text-align: left;
    transition: opacity 0.12s ease;
}

.mirror-nested-header:hover {
    opacity: 0.8;
}

.mirror-nested-header span.nested-label {
    flex: 1;
    padding-right: 0.75rem;
    color: #cbd5e1;
}

.mirror-nested-header span.nested-chevron {
    font-size: 0.7rem;
    transition: transform 0.16s ease;
    opacity: 0.5;
    flex-shrink: 0;
}

.mirror-nested-item.open .mirror-nested-header span.nested-chevron {
    transform: rotate(90deg);
}

.mirror-nested-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.18s ease-out;
    padding: 0;
}

.mirror-nested-body-inner {
    padding-bottom: 0.7rem;
    padding-top: 0.1rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    font-size: 0.78rem;
    color: #94a3b8;
    line-height: 1.55;
}

.mirror-nested-item.open .mirror-nested-body {
    max-height: 250px;
}

.mirror-category .mirror-item-body {
    padding: 0;
}

.mirror-category .mirror-item-body-inner {
    padding: 0.6rem 0.85rem 0.75rem;
}

.mirror-category.open .mirror-item-body {
    max-height: 1000px;
}

/* ===== HEADER WITH INFO ICON ===== */
.aime-header {
    position: relative;
    text-align: center;
    margin-bottom: 1rem;
    padding-top: 8px;
}

.aime-heading-group {
    text-align: center;
}

.aime-header-controls {
    position: absolute;
    top: 8px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Theme Toggle Button */
.theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent-main);
    box-shadow: 0 0 12px var(--mirror-glow);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    font-size: 14px;
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-icon-light {
    opacity: 1;
    transform: translateY(0);
}

.theme-icon-dark {
    opacity: 0;
    transform: translateY(10px);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: translateY(-10px);
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: translateY(0);
}

.aime-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.aime-title::before {
    display: none;
}

.mirror-info-icon {
    position: relative;
    right: auto;
    top: auto;
    transform: none;
    border: none;
    background: rgba(107, 124, 110, 0.08);
    border-radius: 999px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    color: #64748b;
    box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.35);
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.mirror-info-icon:hover {
    background: var(--accent-soft);
    box-shadow:
        0 0 0 1px var(--accent-main),
        0 0 9px var(--mirror-glow);
    transform: translateY(-1px);
}

.mirror-info-icon:active {
    transform: translateY(0);
}

.aime-subtitle {
    margin: 0.35rem 0 0.1rem;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.9;
}

.aime-disclaimer {
    margin: 0;
    font-size: 0.72rem;
    text-align: center;
    opacity: 0.7;
}

.aime-footer {
    margin: 16px 0 0;
    padding: 12px 0;
    font-size: 0.7rem;
    text-align: center;
    color: #64748b;
    opacity: 0.65;
    font-weight: 400;
}

/* Small screens */
@media (max-width: 640px) {
    .mirror-panel {
        padding: 1rem 0.9rem 1.25rem;
        border-radius: 0.9rem;
        margin-top: 1rem;
    }

    .mirror-panel-title {
        font-size: 0.98rem;
    }

    .mirror-panel-subtitle {
        font-size: 0.78rem;
    }

    .mirror-item-header {
        padding: 0.6rem 0.7rem;
    }

    .mirror-item-body-inner {
        font-size: 0.78rem;
    }
    
    .mirror-info-icon {
        width: 26px;
        height: 26px;
        font-size: 0.82rem;
    }
}

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 2.5rem 1rem;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--muted);
    opacity: 0.7;
    letter-spacing: 0.02em;
}

@media (max-width: 640px) {
    .app-footer {
        padding: 2rem 1rem;
        font-size: 0.75rem;
    }
}

/* ===== FOOTER CONTACT ===== */
.footer-company {
    margin-bottom: 0.5rem;
}

.footer-contact {
    margin-top: 0.5rem;
}

.footer-email {
    color: var(--brand);
    text-decoration: none;
    transition: color 0.15s ease, opacity 0.15s ease;
    font-size: 0.78rem;
}

.footer-email:hover {
    color: var(--brand-hover);
    opacity: 1;
    text-decoration: underline;
}

@media (max-width: 640px) {
    .footer-email {
        font-size: 0.74rem;
    }
}

/* ===== MIRROR PANEL LINKS ===== */
.mirror-link {
    color: #6b7c6e;
    text-decoration: underline;
    transition: color 0.15s ease;
}

.mirror-link:hover {
    color: #8b9d8e;
}

/* ===== DESKTOP LAYOUT OPTIMIZATION ===== */
/* Optimize for larger screens to fit everything without scrolling */
@media (min-width: 900px) {
    .wrap {
        margin: 8px auto 16px;
        gap: 8px;
    }
    
    .chat {
        height: 42vh;
        margin: 8px 0;
        padding: 10px 10px 10px 8px;
        gap: 10px;
    }
    
    .bubble {
        padding: 10px 14px;
        font-size: 13.5px;
        line-height: 1.5;
    }
    
    .card {
        padding: 12px 16px;
    }
    
    h1 {
        font-size: 20px;
        margin: 0 0 2px;
    }
    
    h1::before {
        font-size: 18px;
    }
    
    .sub {
        margin-bottom: 4px;
        font-size: 12.5px;
    }
    
    .disclaimer {
        margin-bottom: 8px;
        font-size: 11.5px;
    }
    
    .energy-selector {
        margin: 8px 0;
    }
    
    .energy-btn {
        width: 25px;
        height: 25px;
        font-size: 18px;
        padding: 3px;
    }
    
    .input-wrap textarea {
        min-height: 48px;
        max-height: 100px;
        font-size: 14px;
        padding: 12px 14px;
    }
    
    .btn-send {
        height: 40px;
        padding: 0 20px;
        font-size: 13px;
    }
    
    .btn-done {
        height: 38px;
        font-size: 13px;
    }
    
    .reflection-style {
        padding: 10px 14px;
        margin-top: 8px;
    }
    
    .reflection-style summary {
        font-size: 12px;
        padding: 6px 0;
    }
    
    .style-grid {
        gap: 6px;
        margin-top: 8px;
    }
    
    .style-card {
        padding: 8px 10px;
    }
    
    .style-icon {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .style-label {
        font-size: 11px;
    }
    
    .style-desc {
        font-size: 10px;
    }
}

/* Extra optimization for very tall screens */
@media (min-width: 900px) and (min-height: 900px) {
    .chat {
        height: 48vh;
    }
}
