/**
 * Memory v3 — ask your Life Graph
 */
body.zl-memory-v3 {
    --zl-mem-canvas: #f4f4f8;
    --zl-mem-card: #ffffff;
    --zl-mem-accent: #7da82a;
    --zl-mem-lime: #c9ff57;
}

body.zl-memory-v3 .zl-atmosphere {
    display: none;
}

body.zl-memory-v3 .dashboard {
    min-height: 100vh;
    background: var(--zl-mem-canvas);
}

body.zl-memory-v3 .main-content {
    padding: 1.35rem 1.75rem 2rem !important;
    max-width: none !important;
    background: var(--zl-mem-canvas);
}

/* ——— Header ——— */
.zl-memory-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.zl-memory-v3 .zl-memory-top .zl-display {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.55rem);
    color: #1a1a1f;
}

.zl-memory-v3 .zl-memory-top .zl-display em {
    font-style: italic;
    color: var(--zl-mem-accent);
}

.zl-memory-tagline {
    margin: 0.5rem 0 0;
    font-size: 1rem;
    color: #6b7280;
    max-width: 40rem;
}

.zl-memory-kbd-hint {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 500;
    color: #6b7280;
    padding: 0.5rem 0.85rem;
    background: var(--zl-mem-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.zl-memory-kbd-hint kbd {
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    margin: 0 0.15rem;
}

/* ——— Ask bar ——— */
.zl-memory-ask {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.55rem 0.55rem 0.65rem;
    margin-bottom: 1.25rem;
    background: var(--zl-mem-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 999px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
}

.zl-memory-ask:focus-within {
    border-color: rgba(125, 168, 42, 0.45);
    box-shadow: 0 8px 32px rgba(125, 168, 42, 0.12);
}

.zl-memory-ask-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(201, 255, 87, 0.5), rgba(125, 168, 42, 0.25));
    color: var(--zl-mem-accent);
    flex-shrink: 0;
}

.zl-memory-ask-icon [data-lucide] {
    width: 20px;
    height: 20px;
}

.zl-memory-ask input {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    font-family: var(--font-ui, 'DM Sans', sans-serif);
    font-size: 1.02rem;
    color: #1a1a1f;
    outline: none;
    padding: 0.5rem 0;
}

.zl-memory-ask input::placeholder {
    color: #9ca3af;
}

.zl-memory-ask-go {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--zl-mem-lime), var(--zl-mem-accent));
    color: #0a0a0c;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
}

.zl-memory-ask-go:hover {
    transform: scale(1.04);
}

.zl-memory-ask-go [data-lucide] {
    width: 18px;
    height: 18px;
}

/* ——— Layout ——— */
.zl-memory-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 1.25rem;
    align-items: start;
}

.zl-memory-card {
    background: var(--zl-mem-card);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    padding: 1.1rem 1.25rem;
}

.zl-memory-card h2,
.zl-memory-card h3 {
    margin: 0 0 0.65rem;
    font-family: var(--font-ui, 'DM Sans', sans-serif);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}

/* Suggestions */
.zl-memory-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.zl-memory-suggestion {
    padding: 0.45rem 0.9rem;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
    background: var(--zl-mem-card);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.zl-memory-suggestion:hover {
    border-color: var(--zl-mem-accent);
    background: rgba(201, 255, 87, 0.12);
    color: #1a1a1f;
}

/* Answer */
.zl-memory-answer-card {
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
}

.zl-memory-answer-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, rgba(201, 255, 87, 0.12) 0%, transparent 50%);
    pointer-events: none;
}

.zl-memory-answer-inner {
    position: relative;
    z-index: 1;
}

.zl-memory-query-label {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
}

.zl-memory-query-text {
    margin: 0 0 1rem;
    font-family: var(--font-serif, 'Instrument Serif', Georgia, serif);
    font-size: 1.15rem;
    font-style: italic;
    color: #4b5563;
}

.zl-memory-answer-text {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.65;
    color: #1a1a1f;
}

.zl-memory-answer-card.loading .zl-memory-answer-text {
    color: #9ca3af;
    font-style: italic;
}

.zl-memory-mood-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    border-radius: 999px;
    background: rgba(201, 255, 87, 0.2);
    color: #4a6b15;
}

/* Sources */
.zl-memory-sources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.65rem;
}

.zl-memory-source {
    display: block;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-left: 3px solid var(--src-color, #6eb5ff);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.zl-memory-source:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.zl-memory-source strong {
    display: block;
    font-size: 0.88rem;
    color: #1a1a1f;
    margin-bottom: 0.2rem;
}

.zl-memory-source span {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #9ca3af;
}

/* Rail */
.zl-memory-rail {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    position: sticky;
    top: 1rem;
}

.zl-memory-domain-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.zl-memory-domain-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0;
    font-size: 0.85rem;
    color: #374151;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.zl-memory-domain-list li:last-child {
    border-bottom: none;
}

.zl-memory-domain-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.zl-memory-people {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.zl-memory-person {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #374151;
}

.zl-memory-person em {
    font-style: normal;
    font-weight: 500;
    color: #9ca3af;
}

/* Coach mode */
.zl-memory-coach-card {
    background: linear-gradient(160deg, rgba(201, 255, 87, 0.18) 0%, #fff 45%);
}

.zl-memory-coach-card p:last-child {
    margin: 0.75rem 0 0;
    font-size: 1.02rem;
    line-height: 1.6;
    color: #374151;
}

.zl-memory-coach-headline {
    margin: 0 0 0.35rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a1f;
}

@media (max-width: 960px) {
    .zl-memory-grid {
        grid-template-columns: 1fr;
    }

    .zl-memory-rail {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 640px) {
    .zl-memory-kbd-hint {
        display: none;
    }

    .zl-memory-rail {
        grid-template-columns: 1fr;
    }
}
