/* Optional tools remain collapsed so the homepage stays a personal card. */
.ip-card-shell {
    position: relative;
    aspect-ratio: 720 / 340;
}

.ip-card-link {
    display: block;
    border: 0;
    border-radius: inherit;
    line-height: 0;
}

.ip-card-link:hover {
    border: 0;
}

.ip-card-message {
    display: flex;
    min-height: 112px;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem;
    text-align: center;
    line-height: 1.5;
    color: var(--text-main);
    background: rgba(9, 16, 25, 0.55);
}

.ip-card-link[hidden],
.ip-card-message[hidden],
.ip-card-actions[hidden] {
    display: none;
}

.ip-card-state-title {
    font-size: 0.82rem;
    color: var(--accent);
}

.ip-card-state-note {
    max-width: 26em;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.ip-card-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
    margin-top: 0.15rem;
}

.ip-card-actions button {
    min-height: 36px;
    padding: 0.3rem 0.65rem;
    color: var(--text-main);
    font: inherit;
    font-size: 0.74rem;
    border: 1px solid var(--control-rule);
    border-radius: var(--control-radius);
    background: var(--control-surface);
    cursor: pointer;
}

.ip-card-actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.ip-card-actions a {
    font-size: 0.72rem;
    line-height: 1.6;
}

.ip-card-actions button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.footer-legal {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
}

.footer-support-group {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-legal a {
    line-height: 1.6;
    vertical-align: middle;
}

.footer-divider {
    color: rgba(214, 176, 118, 0.5);
}

.footer-icp {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.footer-icp img {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    object-fit: contain;
}

.footer-support {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    line-height: 1.6;
    white-space: nowrap;
}

.footer-support img {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.85;
}

@media (max-width: 860px) {
    .footer-legal {
        justify-content: center;
    }
}
.time-greeting {
    margin-bottom: 0.9rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
    letter-spacing: 0.05em;
}

.search-toggle {
    position: absolute;
    z-index: 5;
    top: 1.35rem;
    right: max(1.5rem, calc((100% - 1120px) / 2));
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--text-main);
    border: 1px solid var(--control-rule);
    border-radius: var(--control-radius);
    background: var(--control-surface);
    cursor: pointer;
    transition: color 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.search-toggle svg {
    width: 21px;
    height: 21px;
}

.search-toggle:hover,
.dialog-close:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--control-hover);
}

.search-toggle:focus-visible,
.site-dialog button:focus-visible,
.search-form input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.poem-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.exam-countdown {
    margin-top: 1.7rem;
    padding: 1.05rem 1.15rem 0.9rem;
    border: 1px solid var(--control-rule);
    border-radius: 16px;
    background: linear-gradient(120deg, rgba(35, 32, 28, 0.65), rgba(9, 16, 26, 0.7));
}

.exam-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem 0.65rem;
}

.exam-heading h2 {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--accent);
    letter-spacing: 0.04em;
}

.exam-motto {
    font-size: 0.68rem;
    color: var(--text-muted);
}

.exam-digits {
    display: grid;
    grid-template-columns: 1.2fr repeat(3, 1fr);
    gap: 0.6rem;
    margin: 0.85rem 0 0.6rem;
}

.exam-digits > span {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
    min-width: 0;
}

.exam-digits > span + span {
    border-left: 1px solid rgba(214, 176, 118, 0.16);
}

.exam-digits strong {
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: clamp(1.25rem, 2.4vw, 1.85rem);
    line-height: 1.25;
    font-weight: 400;
    color: var(--text-main);
}

.exam-digits small {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.exam-target {
    display: block;
    font-size: 0.65rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.site-dialog {
    position: fixed;
    inset: 0;
    width: min(560px, calc(100% - 2rem));
    max-width: none;
    max-height: calc(100dvh - 2rem);
    margin: auto;
    padding: 1.4rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: var(--text-main);
    font: inherit;
    border: 1px solid rgba(214, 176, 118, 0.35);
    border-radius: 20px;
    background: linear-gradient(135deg, #202026, #101822);
    box-shadow: 0 24px 100px rgba(0, 0, 0, 0.55);
}

.site-dialog::backdrop {
    background: rgba(2, 6, 12, 0.76);
    backdrop-filter: blur(5px);
}

body:has(.site-dialog[open]) {
    overflow: hidden;
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dialog-eyebrow {
    margin-bottom: 0.4rem;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--accent);
}

.dialog-header h2 {
    font-size: 1.3rem;
    font-weight: 400;
}

.dialog-close {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    color: var(--text-muted);
    font: 1.5rem/1 sans-serif;
    border: 1px solid var(--control-rule);
    border-radius: var(--control-radius);
    background: var(--control-surface);
    cursor: pointer;
}

.search-form {
    display: flex;
    gap: 0.6rem;
}

.search-form input {
    flex: 1;
    min-width: 0;
    width: 0;
    padding: 0.8rem;
    color: var(--text-main);
    font: inherit;
    font-size: 16px;
    border: 1px solid var(--control-rule);
    border-radius: var(--control-radius);
    background: rgba(5, 11, 18, 0.7);
}

.search-form input::placeholder {
    color: #a7a298;
}

.dialog-primary,
.dialog-secondary {
    min-height: 44px;
    padding: 0.65rem 1rem;
    color: #181611;
    font: inherit;
    font-size: 0.85rem;
    border: 1px solid var(--accent);
    border-radius: var(--control-radius);
    background: var(--accent);
    cursor: pointer;
    transition: background-color 180ms ease, border-color 180ms ease;
}

.dialog-secondary {
    color: var(--text-main);
    background: var(--control-surface);
    border-color: var(--control-rule);
}

.dialog-primary:hover:not(:disabled) {
    background: #e6c799;
    border-color: #e6c799;
}

.dialog-secondary:hover {
    border-color: var(--accent);
    background: var(--control-hover);
}

.dialog-primary:disabled {
    opacity: 0.45;
    cursor: wait;
}

.dialog-note {
    margin-top: 0.8rem;
    font-size: 0.74rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.share-dialog {
    width: min(540px, calc(100% - 2rem));
}

.share-preview {
    display: grid;
    place-items: center;
    min-height: 120px;
    margin-top: 1rem;
}

.share-preview img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: min(48dvh, 520px);
    border: 1px solid var(--control-rule);
    border-radius: 8px;
}

.share-preview img[hidden],
.share-actions button[hidden] {
    display: none;
}

#shareStatus:empty {
    display: none;
}

#shareStatus {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.share-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1rem;
}

@media (max-width: 860px) {
    .search-toggle {
        top: 1rem;
        right: 1.25rem;
    }

    .poem-actions {
        gap: 0.3rem;
    }
}

@media (max-width: 520px) {
    .site-main {
        padding-top: 1.35rem;
        padding-bottom: 0.8rem;
    }

    .ip-card[data-state="error"] .ip-card-message {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .time-greeting {
        margin-bottom: 0.6rem;
        padding-right: 3rem;
        font-size: 0.74rem;
    }

    .search-toggle {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .links-row {
        margin-top: 0.85rem;
    }

    .exam-countdown {
        margin-top: 0.85rem;
        padding: 0.75rem 0.85rem 0.65rem;
        border-radius: 13px;
    }

    .exam-heading h2 {
        font-size: 0.76rem;
    }

    .exam-motto,
    .exam-target {
        font-size: 0.62rem;
    }

    .exam-digits {
        margin: 0.65rem 0 0.5rem;
        gap: 0.35rem;
    }

    .exam-digits strong {
        font-size: 1.3rem;
    }

    .exam-digits > span {
        gap: 0.25rem;
    }

    .poem-actions {
        gap: 0.25rem;
    }

    .poem-top {
        gap: 0.4rem;
    }

    .poem-zone {
        padding: 0.85rem;
    }

    .poem-text {
        min-height: 1.75em;
        margin-top: 0.65rem;
        font-size: 1.05rem;
        line-height: 1.75;
    }

    .poem-author {
        margin-top: 0.5rem;
    }

    .ip-card-shell {
        width: min(290px, 100%);
    }

    .poem-copy {
        min-width: 2.9rem;
    }

    .poem-refresh {
        padding-inline: 0.4rem;
    }

    .site-dialog {
        padding: 1rem;
        border-radius: 16px;
    }

    .dialog-header {
        margin-bottom: 1rem;
    }
}

@media (max-width: 520px) and (max-height: 700px) {
    .site-main {
        padding-top: 0.8rem;
        padding-bottom: 0.6rem;
    }

    .content-grid {
        gap: 0.75rem;
    }

    .ip-card-shell {
        width: min(260px, 100%);
    }

    footer {
        padding-top: 0.4rem;
        gap: 0.4rem;
    }
}

@media (max-width: 520px) {
    :root[data-mobile-layout="comfortable"] {
        --fit-poem-padding: 1rem;
        --fit-section-gap: 1.1rem;
        --fit-main-top: 1.35rem;
        --fit-main-bottom: 0.8rem;
        --fit-footer-top: 0.65rem;
    }

    :root[data-mobile-layout="compact"] {
        --fit-poem-padding: 0.75rem;
        --fit-section-gap: 0.8rem;
        --fit-main-top: 0.9rem;
        --fit-main-bottom: 0.6rem;
        --fit-footer-top: 0.45rem;
    }

    :root[data-mobile-layout="tight"] {
        --fit-poem-padding: 0.6rem;
        --fit-section-gap: 0.5rem;
        --fit-main-top: 0.8rem;
        --fit-main-bottom: 0.5rem;
        --fit-footer-top: 0.3rem;
    }

    :root[data-mobile-layout] .site-main {
        padding-top: var(--fit-main-top);
        padding-bottom: var(--fit-main-bottom);
    }

    :root[data-mobile-layout] .content-grid {
        gap: var(--fit-section-gap);
    }

    :root[data-mobile-layout] .poem-zone {
        width: 100%;
        padding: var(--fit-poem-padding);
        border-radius: clamp(12px, 3.5vw, 17px);
    }

    :root[data-mobile-layout] footer {
        padding-top: var(--fit-footer-top);
    }

    :root[data-mobile-layout] .ip-card-shell {
        width: min(var(--fit-ip-width, 80vw), 100%);
        border-radius: clamp(8px, 3vw, 12px);
    }
}

@media (min-width: 861px) {
    .poem-zone {
        padding: clamp(1.1rem, 2.2vw, 1.7rem);
        border-radius: 18px;
    }

    .poem-text {
        margin-top: 1.05rem;
        min-height: 1.75em;
        font-size: clamp(1.15rem, 1.65vw, 1.5rem);
        line-height: 1.75;
        letter-spacing: 0.025em;
    }

    .poem-author {
        margin-top: 0.65rem;
        font-size: 0.8rem;
    }

    .poem-zone::after {
        top: 1.5rem;
        font-size: 5.5rem;
    }

    .ip-card-shell {
        border-radius: 18px;
    }
}

@media (hover: hover) and (pointer: fine) {
    html,
    body {
        cursor: url("cursor-default.svg") 3 2, default;
    }

    html body :is(a, button, summary, [role="button"], input[type="checkbox"], input[type="radio"]) {
        cursor: url("cursor-link.svg") 13 3, pointer;
    }

    html body :is(input[type="text"], input[type="search"], input[type="email"], input[type="password"], textarea, [contenteditable="true"]) {
        cursor: text;
    }

    html body :is(button:disabled, input:disabled) {
        cursor: not-allowed;
    }
}

@media (max-width: 350px) {
    .poem-actions {
        width: 100%;
    }

    .poem-actions .poem-refresh {
        flex: 1 1 auto;
    }
}
