/*
 * Home is the signed-out state of the dashboard: the same flat page, one
 * 640px column and the dashboard card surface, so nothing jumps after sign-in.
 */
body:has([data-home]) {
    background: var(--color-page);
}

[data-home].home {
    --footer-margin-top: 10px;
    --footer-padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 640px;
    margin-inline: auto;
}

[data-home] .home-card {
    padding: 22px 24px;
    background: var(--color-surface);
    border-radius: var(--radius-dashboard-card);
    box-shadow: var(--shadow-dashboard-card);
}

[data-home] .home-create {
    padding: 26px 24px 24px;
}

/* Sign-in and import appear together with the claim form, never while the session is checked. */
[data-home]:has(#homeEntry.hidden) .home-return {
    display: none;
}

[data-home] .home-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
}

[data-home] .home-title {
    margin-top: 18px;
    color: var(--color-text);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-wrap: balance;
}

[data-home] .home-lede {
    max-width: 34em;
    margin-top: 8px;
    color: var(--color-text-muted);
    font-size: 16px;
    line-height: 1.5;
}

[data-home] .help-link-row {
    margin-top: 10px;
}

[data-home] .home-status {
    margin-top: 22px;
    color: var(--color-text-muted);
    font-size: 14px;
}

[data-home] .home-entry {
    margin-top: 22px;
    padding-top: 22px;
    border-top: var(--border-default);
}

[data-home] .entry-message {
    margin-bottom: 16px;
    color: var(--color-text-muted);
    font-size: 14px;
}

[data-home] .entry-message:empty {
    display: none;
}

[data-home] #homeRetry {
    margin-bottom: 16px;
}

[data-home] .error-message {
    display: none;
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-danger-subtle);
    color: var(--color-danger);
    font-size: 14px;
}

[data-home] .error-message.show {
    display: block;
}

[data-home] .claim-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

[data-home] .loading {
    display: none;
}

[data-home] .loading.show {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: home-spin 0.8s linear infinite;
}

@keyframes home-spin {
    to {
        transform: rotate(360deg);
    }
}

[data-home] .home-card-title {
    color: var(--color-text);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

[data-home] .home-card-title + .entry-path {
    margin-top: 14px;
}

/* Drawn battery mark: replaces the emoji logo, same chrome as .battery-visual. */
[data-home] .battery-mark {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
}

[data-home] .battery-mark-body {
    display: block;
    width: 38px;
    height: 20px;
    padding: 2px;
    border: 2px solid var(--battery-case);
    border-radius: 6px;
    background: var(--battery-track);
}

[data-home] .battery-mark-fill {
    display: block;
    width: 72%;
    height: 100%;
    border-radius: 3px;
    background: var(--color-charge-high);
}

[data-home] .battery-mark-terminal {
    width: 3px;
    height: 8px;
    border-radius: 0 2px 2px 0;
    background: var(--battery-case);
}

/* Value tiles (#50) as list rows, each illustrated by the dashboard component it describes. */
[data-home] .home-values {
    padding-bottom: 8px;
}

[data-home] .home-values-title {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.4;
    text-transform: uppercase;
}

[data-home] .home-values-list {
    margin-top: 6px;
    list-style: none;
}

[data-home] .home-value {
    display: grid;
    grid-template-columns: 196px minmax(0, 1fr);
    gap: 20px;
    align-items: center;
    padding: 14px 0;
    border-bottom: var(--border-default);
}

[data-home] .home-value:last-child {
    border-bottom: none;
}

[data-home] .home-value-title {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

[data-home] .home-value-text {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

[data-home] .home-specimen {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

[data-home] .specimen-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: var(--border-default);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-control);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
}

[data-home] .specimen-cost {
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

[data-home] .specimen-link {
    color: var(--color-accent);
    font-size: 12px;
    text-decoration: underline;
}

[data-home] .specimen-copy {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    font-size: 12px;
    font-weight: 600;
}

[data-home] .specimen-figure {
    color: var(--color-text);
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

[data-home] .specimen-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-success-subtle);
    color: var(--color-success);
    font-size: 12px;
    font-weight: 600;
}

[data-home] .specimen-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

[data-home] #keyFeedback {
    min-height: 24px;
    margin-bottom: 12px;
    color: var(--color-text);
}

/* Recovery-key confirmation, resumed until acknowledgement. */
[data-home] .key-overlay {
    --copy-button-width: 100%;
    --copy-button-padding: 14px;
    --copy-button-background: var(--color-action);
    --copy-button-hover-background: var(--color-action-hover);
    --copy-button-radius: var(--radius-md);
    --copy-button-font-size: 16px;
    --copy-button-margin-bottom: 16px;
    border: 0;
    padding: 0;
    background: transparent;
    margin: auto;
    width: min(460px, calc(100% - 24px));
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
}

[data-home] .key-overlay::backdrop { background: var(--color-overlay); }

[data-home] .key-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    max-width: 460px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-dialog);
}

[data-home] .key-card .logo {
    font-size: 56px;
    margin-bottom: 12px;
}

[data-home] .key-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
}

[data-home] .key-warning {
    background: var(--color-warning-subtle);
    border: 1px solid var(--color-warning-border);
    color: var(--color-warning);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    text-align: left;
    margin-bottom: 18px;
    line-height: 1.5;
}

[data-home] .key-value {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    background: var(--color-field);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
    color: var(--color-text);
    margin-bottom: 14px;
}


[data-home] .key-ack {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    text-align: left;
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
    cursor: pointer;
}

[data-home] .btn-continue {
    width: 100%;
    padding: 16px;
    background: var(--color-success-action);
    color: var(--color-on-success);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 17px;
    cursor: pointer;
    font-family: inherit;
}

[data-home] .btn-continue:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 560px) {
    [data-home] .home-card {
        padding-inline: 18px;
    }

    [data-home] .home-create {
        padding-block: 22px;
    }

    [data-home] .home-title {
        font-size: 24px;
    }

    [data-home] .home-value {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    [data-home] .home-specimen {
        order: 2;
    }
}

@media (prefers-reduced-motion: reduce) {
    [data-home] .loading.show {
        animation: none;
    }
}

[data-home] .key-overlay .btn-copy {
    font-family: inherit;
}
