.fortune-shell {
    color: #26323f;
}

.fortune-shell * {
    box-sizing: border-box;
}

.fortune-shell button,
.fortune-shell input,
.fortune-shell textarea {
    font: inherit;
}

.is-hidden {
    display: none !important;
}

.fortune-topline,
.fortune-top-actions,
.fortune-mode,
.fortune-choice-grid,
.fortune-next,
.fortune-secondary__actions,
.fortune-date-actions,
.fortune-daily__form {
    display: flex;
    align-items: center;
}

.fortune-topline {
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.fortune-back,
.fortune-top-actions a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.5rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    color: #526274;
    background: #fff;
    font-weight: 800;
    text-decoration: none;
}

.fortune-top-actions {
    gap: 0.5rem;
}

.fortune-hero {
    max-width: 720px;
    margin-inline: auto;
    padding: 1rem 0 1.5rem;
}

.fortune-hero__copy {
    display: grid;
    gap: 0.35rem;
}

.fortune-kicker {
    margin: 0;
    color: #0f766e;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0;
}

.fortune-hero h1,
.fortune-overview h2,
.fortune-section-head h3 {
    margin: 0;
    color: #17212c;
    letter-spacing: 0;
}

.fortune-hero h1 {
    font-size: 3.35rem;
    font-weight: 950;
}

.fortune-hero p:last-child,
.fortune-section-head p,
.fortune-field p,
.fortune-overview__copy > p:not(.fortune-kicker) {
    margin: 0;
    color: #64748b;
}

.fortune-panel,
.fortune-analysis,
.fortune-secondary,
.fortune-next {
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.fortune-panel {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.fortune-panel--form {
    width: min(720px, 100%);
    margin-inline: auto;
}

.fortune-shell > .fortune-alert {
    max-width: 720px;
    margin-inline: auto;
}

.fortune-form {
    display: grid;
    gap: 1rem;
}

.fortune-mode {
    gap: 0.5rem;
    padding: 0.25rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #f8fafc;
}

.fortune-mode__button {
    flex: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    min-height: 2.75rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-weight: 900;
    cursor: pointer;
}

.fortune-mode__button.is-active {
    background: #fff;
    color: #0f766e;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.fortune-field {
    display: grid;
    gap: 0.45rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.fortune-field label,
.fortune-field legend {
    color: #334155;
    font-weight: 900;
}

.fortune-field label span {
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 800;
}

.fortune-input {
    width: 100%;
    min-height: 3rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #17212c;
    font-weight: 800;
}

.fortune-input:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
    outline: 0;
}

.fortune-date-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 0.9fr;
    gap: 0.5rem;
}

.fortune-time-grid,
.fortune-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.fortune-choice-grid label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}

.fortune-choice-grid input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fortune-choice-grid label:has(input:checked) {
    border-color: #0f766e;
    background: #ecfdf5;
    color: #0f766e;
}

.fortune-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 3.25rem;
    border: 0;
    border-radius: 8px;
    background: #0f766e;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 950;
    cursor: pointer;
}

.fortune-primary:hover,
.fortune-next__button:hover,
.fortune-secondary__actions button:hover,
.fortune-date-actions button:hover {
    transform: translateY(-1px);
}

.fortune-primary--small {
    width: auto;
    min-width: 9rem;
}

.fortune-alert {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-weight: 800;
}

.fortune-alert p {
    margin: 0.2rem 0 0;
    font-weight: 700;
}

.fortune-alert--error {
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #be123c;
}

.fortune-result {
    display: grid;
    gap: 1rem;
}

.fortune-result__capture {
    display: grid;
    gap: 1rem;
}

.fortune-overview {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 1.25rem;
    align-items: stretch;
}

.fortune-overview__main {
    display: grid;
    grid-template-columns: minmax(150px, 0.45fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-content: start;
}

.fortune-overview__copy {
    display: grid;
    gap: 0.55rem;
    align-content: center;
}

.fortune-overview h2 {
    font-size: 2.15rem;
    font-weight: 950;
}

.fortune-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.fortune-result-art {
    position: relative;
    min-height: 9rem;
    overflow: hidden;
    border-radius: 8px;
    background: #e0f2fe;
}

.fortune-result-art img {
    width: 100%;
    height: 100%;
    min-height: 9rem;
    object-fit: cover;
}

.fortune-result-art__badge {
    position: absolute;
    right: 0.65rem;
    bottom: 0.65rem;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    background: #17212c;
    color: #facc15;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
}

.fortune-chart-wrap {
    display: flex;
    align-items: center;
}

.fortune-chart {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
}

.fortune-chart__empty {
    grid-column: 1 / -1;
    color: #94a3b8;
    text-align: center;
    font-weight: 800;
}

.fortune-pillar {
    display: grid;
    gap: 0.25rem;
    min-height: 7rem;
    padding: 0.7rem 0.45rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #f8fafc;
    text-align: center;
}

.fortune-pillar strong {
    color: #17212c;
    font-size: 2rem;
    line-height: 1;
}

.fortune-pillar span,
.fortune-pillar small {
    color: #64748b;
    font-weight: 850;
}

.fortune-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(8rem, 1fr));
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.1rem;
}

.fortune-tabs button,
.fortune-date-actions button,
.fortune-secondary__actions button {
    min-height: 2.5rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #fff;
    color: #475569;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
}

.fortune-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 3.25rem;
    font-size: 1rem;
}

.fortune-tabs button.is-active,
.fortune-date-actions button:hover {
    border-color: #2563eb;
    color: #1d4ed8;
    background: #eff6ff;
}

.fortune-analysis,
.fortune-analysis-screen {
    padding: clamp(1rem, 3vw, 1.5rem);
}

.fortune-analysis-screens {
    display: grid;
}

.fortune-analysis-screens[hidden] {
    display: none;
}

.fortune-analysis-screen {
    display: none;
    gap: 1rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.fortune-analysis-screen.is-active {
    display: grid;
}

.fortune-analysis-screen:focus {
    outline: 3px solid rgba(37, 99, 235, 0.18);
    outline-offset: 2px;
}

.fortune-screen-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.fortune-screen-head p,
.fortune-screen-head h3 {
    margin: 0;
}

.fortune-screen-head p {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 900;
}

.fortune-screen-head h3 {
    color: #17212c;
    font-size: 1.45rem;
    font-weight: 950;
}

.fortune-screen-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border-radius: 8px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 1.25rem;
}

[data-analysis-screen="classroom"] .fortune-screen-icon {
    background: #fff7ed;
    color: #c2410c;
}

[data-analysis-screen="work"] .fortune-screen-icon {
    background: #f0f9ff;
    color: #0369a1;
}

[data-analysis-screen="relationship"] .fortune-screen-icon {
    background: #fdf2f8;
    color: #be185d;
}

.fortune-reading-block + .fortune-reading-block {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.fortune-empty-state {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 5rem;
    color: #64748b;
    font-weight: 900;
}

.fortune-markdown {
    color: #334155;
    font-size: 1.03rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.fortune-markdown p {
    margin: 0 0 0.85rem;
}

.fortune-markdown h1,
.fortune-markdown h2,
.fortune-markdown h3 {
    color: #17212c;
    letter-spacing: 0;
}

.fortune-markdown h1 {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
}

.fortune-markdown h2 {
    margin: 0 0 0.75rem;
    font-size: 1.25rem;
}

.fortune-markdown h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.fortune-markdown strong {
    color: #0f766e;
}

.fortune-next {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.75rem;
}

.fortune-next__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 3rem;
    border: 1px solid #dbe3eb;
    border-radius: 8px;
    background: #fff;
    color: #17212c;
    font-weight: 950;
    text-decoration: none;
    cursor: pointer;
}

.fortune-next__button:first-child {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.fortune-daily {
    display: grid;
    gap: 1rem;
}

.fortune-section-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.fortune-section-head h3 {
    font-size: 1.45rem;
    font-weight: 950;
}

.fortune-date-actions {
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fortune-daily__form {
    gap: 0.75rem;
}

.fortune-daily__form input {
    flex: 1;
}

.fortune-daily-result {
    display: grid;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.fortune-secondary {
    padding: 0.75rem;
}

.fortune-secondary summary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #64748b;
    font-weight: 900;
    cursor: pointer;
}

.fortune-secondary__actions {
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.fortune-secondary__actions button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.fortune-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: min(24rem, calc(100vw - 2rem));
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background: #17212c;
    color: #fff;
    font-weight: 900;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.75rem);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.fortune-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.fortune-toast.is-error {
    background: #be123c;
}

.fortune-toast.is-info {
    background: #1d4ed8;
}

.fortune-loading {
    position: fixed;
    inset: 0;
    z-index: 700;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.55);
}

.fortune-loading.is-visible {
    display: flex;
}

.fortune-loading__panel {
    display: grid;
    gap: 0.85rem;
    width: min(24rem, 100%);
    padding: 1.5rem;
    border-radius: 8px;
    background: #fff;
    text-align: center;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.fortune-loading__icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    margin: 0 auto;
    border-radius: 50%;
    background: #f0fdfa;
    color: #0f766e;
    font-size: 1.4rem;
}

.fortune-loading h2,
.fortune-loading p {
    margin: 0;
}

.fortune-loading__bar {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.fortune-loading__bar div {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #0f766e;
    transition: width 0.2s ease;
}

.fortune-loading__notice {
    padding: 0.7rem;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    font-weight: 800;
}

@media (max-width: 760px) {
    .fortune-hero h1 {
        font-size: 2.45rem;
    }

    .fortune-topline {
        align-items: flex-start;
    }

    .fortune-top-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .fortune-overview {
        grid-template-columns: 1fr;
    }

    .fortune-overview__main {
        grid-template-columns: 1fr;
    }

    .fortune-overview h2 {
        font-size: 1.75rem;
    }

    .fortune-result-art,
    .fortune-result-art img {
        min-height: 11rem;
    }

    .fortune-pillar strong {
        font-size: 1.55rem;
    }

    .fortune-next {
        grid-template-columns: 1fr;
    }

    .fortune-daily__form {
        flex-direction: column;
        align-items: stretch;
    }

    .fortune-primary--small {
        width: 100%;
    }
}

@media (max-width: 520px) {
    .fortune-hero h1 {
        font-size: 2rem;
    }

    .fortune-tabs {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .fortune-tabs button {
        gap: 0.25rem;
        min-height: 3rem;
        padding-inline: 0.35rem;
        font-size: 0.92rem;
    }

    .fortune-date-grid {
        grid-template-columns: 1fr;
    }

    .fortune-time-grid,
    .fortune-choice-grid {
        grid-template-columns: 1fr;
    }
}
