:root {
    --bg: #eef2ed;
    --surface: rgba(255, 255, 251, 0.9);
    --surface-strong: #fffffb;
    --text: #252927;
    --muted: #69736c;
    --accent: #b96a3f;
    --accent-strong: #965231;
    --border: rgba(38, 50, 42, 0.14);
    --shadow: 0 18px 54px rgba(52, 67, 58, 0.12);
    --cool: #2f756f;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        linear-gradient(135deg, rgba(47, 117, 111, 0.14), transparent 36%),
        radial-gradient(circle at 74% 6%, rgba(223, 174, 111, 0.38), transparent 32%),
        linear-gradient(160deg, #f8f4ec 0%, #e7eee8 100%);
}

body {
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(47, 117, 111, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(47, 117, 111, 0.04) 1px, transparent 1px);
    background-size: 38px 38px;
    mask-image: linear-gradient(120deg, rgba(0,0,0,0.82), transparent 70%);
}

button,
input {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.wisdom-app {
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 24px 72px;
}

.hero-panel,
.wisdom-shell,
.site-footer {
    position: relative;
    z-index: 1;
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.hero-visual {
    min-height: 230px;
    border-radius: 24px;
    padding: 34px 36px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(248, 244, 236, 0.94) 0%, rgba(248, 244, 236, 0.82) 42%, rgba(248, 244, 236, 0.12) 100%),
        url("../images/wisdom-hero.png") center right / cover no-repeat;
    border: 1px solid rgba(38, 50, 42, 0.12);
    box-shadow: 0 20px 68px rgba(52, 67, 58, 0.14);
}

.eyebrow,
.mini-tag,
.status-pill,
.lock-badge,
.active-badge {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 10px;
    font-weight: 800;
}

.hero-copy h1,
.quote-card,
.modal-header h2,
.shop-card h3 {
    font-family: "Cormorant Garamond", serif;
}

.hero-copy h1 {
    margin: 4px 0 10px;
    font-size: 68px;
    line-height: 0.92;
}

.lead {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
}

.icon-button,
.secondary-button,
.ghost-button,
.shop-card button,
.pack-option,
.theme-option,
.journal-lock {
    transition: 0.22s ease;
}

.icon-button,
.secondary-button,
.ghost-button {
    border-radius: 999px;
    padding: 12px 18px;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 251, 0.74);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(52, 67, 58, 0.08);
}

.icon-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.icon-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.shop-card button:hover:not(:disabled),
.pack-option:hover,
.theme-option:hover,
.journal-lock:hover {
    transform: translateY(-1px);
}

.wisdom-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

.quote-stage,
.mini-card {
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.quote-stage {
    min-height: 420px;
    border-radius: 18px;
    padding: 26px;
    display: grid;
    grid-template-rows: auto minmax(190px, 1fr) auto;
    gap: 24px;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.84), rgba(255,255,255,0.46)),
        linear-gradient(145deg, rgba(47, 117, 111, 0.09), transparent 42%);
}

.wisdom-shell.theme-dawn .quote-stage {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.52)),
        linear-gradient(120deg, rgba(47, 117, 111, 0.12), transparent 34%),
        radial-gradient(circle at 86% 18%, rgba(245, 197, 116, 0.24), transparent 28%);
}

.quote-meta,
.mini-card-head,
.shop-top,
.shop-bottom,
.discount-row,
.footer-links,
.checkout-actions {
    display: flex;
    align-items: center;
}

.panel-toggle {
    width: 100%;
    padding: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.panel-toggle .mini-tag {
    flex: 0 0 auto;
}

.panel-summary {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.panel-content {
    display: block;
    max-height: 900px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.24s ease, opacity 0.2s ease, margin-top 0.24s ease;
}

.collapsible-card.collapsed .panel-content {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.collapsible-card:not(.collapsed) .panel-content {
    margin-top: 18px;
}

.quote-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quote-meta,
.mini-card-head,
.shop-bottom {
    justify-content: space-between;
}

.status-pill,
.mini-tag,
.active-badge {
    color: var(--accent-strong);
}

.active-pack-label {
    color: var(--cool);
}

.save-button {
    background: rgba(255,255,255,0.68);
    color: var(--text);
    border-radius: 999px;
    padding: 9px 14px;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(76, 62, 48, 0.08);
}

.lock-badge {
    margin-left: 10px;
    color: var(--accent-strong);
}

.quote-card {
    align-self: center;
    margin: 0;
    padding: 42px 46px;
    border-radius: 16px;
    background: rgba(255, 255, 251, 0.9);
    border: 1px solid rgba(255,255,255,0.55);
    font-size: 48px;
    line-height: 1.12;
    box-shadow: 0 16px 46px rgba(75, 61, 46, 0.08);
    overflow: hidden;
}

.wisdom-shell.theme-dawn .quote-card {
    border-left: 5px solid rgba(47, 117, 111, 0.38);
}

.quote-text {
    margin: 0;
    transition: opacity 0.16s ease, transform 0.16s ease, filter 0.16s ease;
    will-change: opacity, transform;
}

.quote-text.quote-exit {
    opacity: 0;
    transform: translateY(-10px);
    filter: blur(2px);
}

.quote-text.quote-enter {
    animation: quoteEnter 0.34s ease both;
}

@keyframes quoteEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

.quote-tools {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.primary-button,
.shop-card button,
.journal-lock {
    background: linear-gradient(135deg, var(--accent), #d9864d);
    color: #fff8f3;
    border-radius: 999px;
    padding: 13px 18px;
    box-shadow: 0 14px 30px rgba(185, 106, 63, 0.22);
}

.quote-tools .primary-button,
.quote-tools .secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 48px;
    font-weight: 700;
}

.quote-tools svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.quote-tools .primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(185, 106, 63, 0.3);
}

.secondary-button,
.ghost-button {
    background: rgba(255, 255, 251, 0.82);
    color: var(--text);
    border: 1px solid var(--border);
}

.quote-tools .secondary-button {
    border-radius: 999px;
    padding: 13px 18px;
    box-shadow: inset 0 0 0 1px rgba(38, 50, 42, 0.04);
}

.quote-tools .secondary-button:hover {
    background: rgba(255, 255, 251, 0.96);
}

.side-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.side-panel .mini-card:first-child {
    grid-column: 1 / -1;
}

.mini-card {
    border-radius: 18px;
    padding: 20px;
}

.mini-card h2,
.shop-card h3,
.modal-header h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.05;
}

.theme-grid,
.pack-grid,
.settings-theme-list,
.shop-grid {
    display: grid;
    gap: 10px;
}

.pack-grid,
.theme-grid,
.settings-theme-list {
    margin-top: 18px;
}

.collapsible-card .theme-grid,
.collapsible-card .journal-list {
    margin-top: 0;
}

.pack-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.settings-theme-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pack-option,
.theme-option {
    width: 100%;
    text-align: left;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 14px;
    background: rgba(255, 255, 251, 0.74);
    display: grid;
    gap: 6px;
    position: relative;
}

.pack-option {
    align-content: start;
    min-height: 168px;
}

.pack-option.active,
.theme-option.active {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.pack-marker {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.theme-title {
    font-size: 16px;
    font-weight: 700;
}

.theme-preview,
.journal-summary,
.empty-journal,
.info-copy p,
.shop-card p,
.modal-header p {
    color: var(--muted);
    line-height: 1.55;
}

.theme-preview,
.shop-card p {
    margin: 0;
    font-size: 14px;
}

.pack-summary,
.journal-summary {
    margin: 12px 0 0;
    font-size: 14px;
}

.journal-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.journal-entry {
    border-radius: 18px;
    padding: 16px;
    background: rgba(255, 250, 245, 0.8);
    border: 1px solid var(--border);
}

.modal-layer,
.app-modal {
    position: fixed;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.modal-layer.open,
.app-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-layer {
    background: rgba(33, 24, 18, 0.45);
    transition: opacity 0.2s ease;
    z-index: 9;
}

.app-modal {
    z-index: 10;
    overflow-y: auto;
    padding: 24px;
}

.modal-card {
    position: relative;
    max-width: 920px;
    margin: 32px auto;
    border-radius: 18px;
    background: #fff9f2;
    box-shadow: 0 30px 90px rgba(32, 18, 11, 0.28);
    border: 1px solid rgba(123, 78, 51, 0.14);
}

.checkout-card {
    max-width: 520px;
}

.modal-body {
    padding: 32px;
}

.modal-footer-button {
    margin-top: 24px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: transparent;
    color: rgba(52, 35, 22, 0.6);
    font-size: 32px;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: rgba(52, 35, 22, 1);
}

.shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 26px 0;
}

.shop-card {
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #fffdf9;
    padding: 16px;
    min-height: 190px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 16px;
}

.shop-top {
    gap: 14px;
    align-items: flex-start;
}

.shop-icon,
.checkout-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(182, 106, 66, 0.12);
    color: var(--accent-strong);
    font-size: 24px;
    flex: 0 0 auto;
}

.shop-card button:disabled {
    cursor: default;
    opacity: 0.56;
}

.discount-form {
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    background: rgba(255, 252, 249, 0.85);
}

.discount-row {
    gap: 12px;
    margin: 10px 0 8px;
}

.discount-row input {
    flex: 1;
    min-width: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 14px 16px;
    background: #fff;
}

.discount-message.error {
    color: #9f3d21;
}

.checkout-copy h2 {
    margin: 10px 0 8px;
    font-family: "Cormorant Garamond", serif;
    font-size: 38px;
}

.checkout-price,
.shop-price {
    font-weight: 800;
    color: var(--accent-strong);
}

.checkout-actions {
    gap: 12px;
    margin-top: 24px;
}

.site-footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    color: var(--muted);
}

.footer-links {
    gap: 12px;
    flex-wrap: wrap;
}

.footer-links button,
.site-footer a {
    color: inherit;
    background: transparent;
    text-decoration: none;
}

.theme-ember {
    --surface: rgba(42, 36, 32, 0.92);
    --surface-strong: #352a24;
    --text: #fff5e7;
    --muted: #dfc8b7;
    --accent: #e9793e;
    --accent-strong: #ffb26f;
    --border: rgba(255, 194, 127, 0.2);
    --shadow: 0 24px 70px rgba(55, 31, 18, 0.32);
    --cool: #9bc3a6;
}

.theme-aurora {
    --surface: rgba(8, 33, 45, 0.82);
    --surface-strong: #0f3340;
    --text: #e9fffb;
    --muted: #a7d5d8;
    --accent: #30c6b2;
    --accent-strong: #92ffe4;
    --border: rgba(139, 241, 221, 0.16);
    --shadow: 0 24px 80px rgba(2, 12, 16, 0.42);
}

.wisdom-shell.theme-ember .quote-stage,
.wisdom-shell.theme-ember .mini-card,
.wisdom-shell.theme-aurora .quote-stage,
.wisdom-shell.theme-aurora .mini-card {
    color: var(--text);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0)),
        var(--surface);
    border-color: var(--border);
}

.wisdom-shell.theme-ember .quote-stage {
    background:
        linear-gradient(160deg, rgba(68, 46, 36, 0.98), rgba(34, 29, 27, 0.94)),
        repeating-linear-gradient(135deg, rgba(255, 178, 111, 0.08) 0 1px, transparent 1px 14px);
}

.wisdom-shell.theme-aurora .quote-stage {
    background:
        radial-gradient(circle at 12% 18%, rgba(48, 198, 178, 0.24), transparent 28%),
        radial-gradient(circle at 82% 24%, rgba(99, 123, 255, 0.24), transparent 30%),
        linear-gradient(155deg, rgba(8, 33, 45, 0.92), rgba(10, 18, 36, 0.92));
}

.wisdom-shell.theme-ember .quote-card,
.wisdom-shell.theme-aurora .quote-card,
.wisdom-shell.theme-ember .save-button,
.wisdom-shell.theme-aurora .save-button,
.wisdom-shell.theme-ember .pack-option,
.wisdom-shell.theme-aurora .pack-option,
.wisdom-shell.theme-ember .theme-option,
.wisdom-shell.theme-aurora .theme-option,
.wisdom-shell.theme-ember .journal-entry,
.wisdom-shell.theme-aurora .journal-entry {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--border);
    color: var(--text);
}

.wisdom-shell.theme-ember .quote-card {
    border-left: 5px solid rgba(255, 178, 111, 0.72);
    box-shadow: inset 0 0 0 1px rgba(255, 216, 172, 0.06), 0 18px 48px rgba(25, 15, 10, 0.28);
}

.wisdom-shell.theme-aurora .quote-card {
    border: 1px solid rgba(146, 255, 228, 0.28);
    box-shadow: inset 0 0 28px rgba(48, 198, 178, 0.08), 0 20px 58px rgba(4, 16, 24, 0.34);
}

.wisdom-shell.theme-ember .secondary-button,
.wisdom-shell.theme-aurora .secondary-button,
.wisdom-shell.theme-ember .icon-button,
.wisdom-shell.theme-aurora .icon-button {
    background: rgba(255,255,255,0.24);
    color: var(--text);
    border-color: var(--border);
}

.wisdom-shell.theme-ember .primary-button,
.wisdom-shell.theme-ember .journal-lock,
.wisdom-shell.theme-ember .shop-card button {
    background: linear-gradient(135deg, #e9793e, #b94d2f);
}

.wisdom-shell.theme-aurora .primary-button,
.wisdom-shell.theme-aurora .journal-lock,
.wisdom-shell.theme-aurora .shop-card button {
    background: linear-gradient(135deg, #30c6b2, #4a7dff);
}

@media (max-width: 980px) {
    .side-panel {
        grid-template-columns: 1fr 1fr;
    }

    .pack-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .settings-theme-list {
        grid-template-columns: 1fr;
    }

    .shop-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .wisdom-app {
        padding: 24px 14px 70px;
    }

    .hero-panel {
        flex-direction: column;
    }

    .hero-visual {
        min-height: 245px;
        padding: 24px;
        background:
            linear-gradient(180deg, rgba(248, 244, 236, 0.96) 0%, rgba(248, 244, 236, 0.7) 52%, rgba(248, 244, 236, 0.18) 100%),
            url("../images/wisdom-hero.png") center right / cover no-repeat;
    }

    .hero-actions {
        justify-content: flex-start;
    }

    .quote-stage {
        min-height: auto;
        padding: 18px;
        grid-template-rows: auto auto auto;
    }

    .quote-card {
        padding: 24px;
        font-size: 34px;
    }

    .hero-copy h1 {
        font-size: 48px;
    }

    .mini-card h2,
    .shop-card h3,
    .modal-header h2 {
        font-size: 26px;
    }

    .quote-tools,
    .discount-row,
    .checkout-actions {
        flex-direction: column;
    }

    .quote-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .quote-tools button,
    .discount-row button,
    .checkout-actions button,
    .shop-card button {
        width: 100%;
    }

    .shop-grid {
        grid-template-columns: 1fr;
    }

    .side-panel {
        grid-template-columns: 1fr;
    }

    .pack-grid {
        grid-template-columns: 1fr;
    }

    .modal-body {
        padding: 24px 18px;
    }
}
