:root {
    --ink: #16201d;
    --muted: #68736e;
    --line: #dde3df;
    --paper: #fffdf8;
    --mist: #f3f7f4;
    --sage: #2f5d50;
    --sage-dark: #1f4239;
    --gold: #b88a2c;
    --rose: #a65f62;
    --blue: #466173;
    --shadow: 0 20px 60px rgba(22, 32, 29, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(184, 138, 44, 0.12), transparent 28rem),
        linear-gradient(135deg, #f8faf6 0%, #edf4f0 46%, #fff8ef 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
textarea {
    font: inherit;
}

.shell {
    width: min(1120px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px;
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 24px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.brand {
    display: grid;
    gap: 4px;
}

.brand strong {
    font-size: 1.05rem;
    letter-spacing: 0.08em;
}

.brand span {
    color: var(--muted);
    font-size: 0.88rem;
}

.mode-nav {
    display: flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid rgba(47, 93, 80, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.58);
}

.mode-btn,
.mode-link {
    min-height: 36px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    padding: 0 14px;
    cursor: pointer;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.mode-btn.active {
    background: var(--sage);
    color: #ffffff;
}

.mode-link {
    border: 1px solid rgba(184, 138, 44, 0.32);
    color: var(--sage-dark);
    background: rgba(184, 138, 44, 0.1);
}

.mode-link:hover {
    background: rgba(184, 138, 44, 0.18);
}

.status-chip {
    color: var(--sage-dark);
    border: 1px solid rgba(47, 93, 80, 0.28);
    border-radius: 999px;
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.58);
    font-size: 0.86rem;
    white-space: nowrap;
}

.stage {
    align-self: center;
    display: grid;
    gap: 22px;
}

.panel {
    background: rgba(255, 253, 248, 0.88);
    border: 1px solid rgba(221, 227, 223, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.intro {
    padding: clamp(24px, 5vw, 52px);
    display: grid;
    gap: 24px;
}

h1 {
    margin: 0;
    max-width: 850px;
    font-size: clamp(2.15rem, 6vw, 5.3rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.lead {
    max-width: 660px;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.7;
    margin: 0;
}

.mood-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--ink);
    padding: 10px 16px;
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.pill:hover {
    transform: translateY(-1px);
    border-color: rgba(47, 93, 80, 0.42);
}

.pill.active {
    background: var(--sage);
    border-color: var(--sage);
    color: #ffffff;
}

.dump-area {
    display: grid;
    gap: 14px;
}

textarea {
    width: 100%;
    min-height: 220px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: #ffffff;
    color: var(--ink);
    line-height: 1.65;
    outline: none;
}

textarea:focus {
    border-color: rgba(47, 93, 80, 0.64);
    box-shadow: 0 0 0 4px rgba(47, 93, 80, 0.12);
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.counter {
    color: var(--muted);
    font-size: 0.86rem;
}

.primary {
    border: 0;
    border-radius: 8px;
    background: var(--sage);
    color: white;
    min-height: 48px;
    padding: 0 22px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.03em;
}

.primary:hover {
    background: var(--sage-dark);
}

.primary:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.loading {
    padding: clamp(36px, 8vw, 72px);
    min-height: 460px;
    display: none;
    place-items: center;
    text-align: center;
}

.breath {
    width: 118px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid rgba(47, 93, 80, 0.22);
    display: grid;
    place-items: center;
    margin: 0 auto 24px;
    animation: breathe 2.8s ease-in-out infinite;
}

.breath::after {
    content: "";
    width: 54px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sage), var(--gold));
}

@keyframes breathe {
    0%, 100% {
        transform: scale(0.92);
        opacity: 0.72;
    }

    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

.loading-text {
    color: var(--sage-dark);
    font-size: clamp(1.25rem, 3vw, 2rem);
    font-weight: 700;
}

.matrix {
    display: none;
    gap: 18px;
}

.journal {
    display: none;
    gap: 18px;
}

.reflection {
    padding: clamp(22px, 4vw, 36px);
    display: grid;
    gap: 10px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.reflection span,
.card span {
    color: var(--gold);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.reflection p,
.card p,
.card li {
    margin: 0;
    color: #34413d;
    line-height: 1.72;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.card {
    min-height: 340px;
    padding: 24px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    align-content: start;
    gap: 16px;
    box-shadow: 0 12px 36px rgba(22, 32, 29, 0.08);
}

.card h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: 0;
}

.ikhtiar {
    border-top: 4px solid var(--blue);
}

.tawakkal {
    border-top: 4px solid var(--rose);
}

.jangkar {
    border-top: 4px solid var(--gold);
}

ol {
    margin: 0;
    padding-left: 22px;
    display: grid;
    gap: 12px;
}

.arab {
    margin: 4px 0 0;
    direction: rtl;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.85rem;
    line-height: 2.1;
    color: #111815;
}

.audio-panel {
    display: none;
    gap: 8px;
}

.audio-panel select {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--ink);
    padding: 0 10px;
}

.audio-panel audio {
    width: 100%;
    height: 42px;
}

.audio-panel span {
    color: var(--sage-dark);
}

.ref {
    color: var(--sage-dark);
    font-weight: 800;
}

.support {
    display: none;
    padding: 16px 18px;
    border-radius: 8px;
    border: 1px solid rgba(166, 95, 98, 0.35);
    background: rgba(166, 95, 98, 0.08);
    color: #6b3437;
    line-height: 1.6;
}

.error {
    min-height: 24px;
    color: #8a2f33;
    font-size: 0.92rem;
}

.secondary {
    border: 1px solid var(--sage);
    border-radius: 8px;
    background: transparent;
    color: var(--sage-dark);
    min-height: 44px;
    padding: 0 18px;
    font-weight: 700;
    cursor: pointer;
}

.matrix-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 10px;
}

.journal-form {
    padding: clamp(20px, 4vw, 34px);
    display: grid;
    gap: 16px;
}

.journal-form label {
    display: grid;
    gap: 8px;
}

.journal-form label span {
    color: var(--sage-dark);
    font-size: 0.88rem;
    font-weight: 800;
}

.journal-form textarea {
    min-height: 96px;
}

.journal-summary {
    display: none;
}

@media (max-width: 820px) {
    .shell {
        padding: 18px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .mode-nav {
        width: 100%;
    }

    .mode-btn,
    .mode-link {
        flex: 1;
    }

    .status-chip {
        white-space: normal;
    }

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

    .card {
        min-height: auto;
    }
}
