.hidden {
    display: none !important;
}

.restore-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    padding: 40px 20px;
    text-align: center;
}

.restore-prompt h2 {
    color: var(--color-text);
    font-size: 22px;
    line-height: 1.3;
}

.restore-prompt > p {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.restore-icon {
    font-size: 64px;
}

.restore-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.restore-error {
    min-height: 20px;
    color: var(--color-danger);
    font-size: 14px;
}

.secondary-link {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.secondary-link:hover {
    background: var(--color-border);
}

.load-state-feedback {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--color-field);
    color: var(--color-text-muted);
}

.load-state-error {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
}

.load-retry {
    margin-top: var(--space-sm);
    padding: 8px 12px;
    border: 1px solid currentColor;
    border-radius: var(--radius-sm);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.profile-section {
    margin-top: var(--space-lg);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: var(--border-default);
    background: var(--color-accent-subtle);
}

.profile-section h2 {
    margin-bottom: 10px;
    color: var(--color-text);
    font-size: 16px;
}

.profile-description {
    margin-bottom: 15px;
    color: var(--color-text-muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.profile-field {
    display: flex;
    gap: 10px;
}

.profile-input {
    min-width: 0;
    flex: 1;
    padding: 10px 14px;
    border: var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    font-size: 14px;
}

.profile-actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-md);
}

.profile-actions .btn-copy {
    min-width: 110px;
    flex: 1;
}

.message {
    display: none;
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.message.show {
    display: block;
}

.message.success {
    background: var(--color-success-subtle);
    color: var(--color-success);
}

.message.error {
    background: var(--color-danger-subtle);
    color: var(--color-danger);
}

@media (max-width: 768px) {
    .profile-field {
        flex-direction: column;
    }
}

body:has([data-home]),
body:has([data-dashboard]),
body:has([data-settings]) {
    align-items: flex-start;
    padding: 76px 20px 24px;
}

body:has([data-dashboard] > .restore-prompt:not(.hidden):not(.entry-prompt)),
body:has([data-settings] > .restore-prompt:not(.hidden):not(.entry-prompt)) {
    background: var(--background-app);
}

/* Signed-out entry matches Home: the flat page and the dashboard card surface. */
body:has(.entry-prompt:not(.hidden)) {
    background: var(--color-page);
}

[data-dashboard]:has(> #restorePrompt:not(.hidden)),
[data-settings]:has(> #settingsRestorePrompt:not(.hidden)) {
    max-width: 640px;
    background: var(--color-surface);
    border-radius: var(--radius-dashboard-card);
    box-shadow: var(--shadow-dashboard-card);
    padding: 24px;
}

.entry-prompt {
    align-items: stretch;
    text-align: left;
}

.entry-prompt h2 {
    font-size: 20px;
}

.restore-prompt {
    padding: 12px 0;
    gap: 16px;
}

.secondary-link:disabled {
    opacity: 0.6;
    cursor: wait;
}

button.secondary-link {
    border: 0;
    font-family: inherit;
    cursor: pointer;
}

.restore-error:empty { min-height: 0; }

@media (max-width: 480px) {
    body:has([data-home]), body:has([data-dashboard]), body:has([data-settings]) {
        padding: 68px 12px 16px;
    }
}

/*
 * Shared entry components for Home and the signed-out Dashboard and Settings
 * prompts. The button pair is the dashboard's: primary = Start, secondary = Pause.
 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 45px;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn-primary,
.btn-start {
    background: var(--color-action);
    color: var(--color-on-action);
}

.btn-primary:hover:not(:disabled),
.btn-start:hover:not(:disabled) {
    background: var(--color-action-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-action);
}

.btn-secondary,
.btn-pause {
    border-color: var(--color-accent);
    background: var(--color-surface);
    color: var(--color-accent);
}

.btn-secondary:hover:not(:disabled),
.btn-pause:hover:not(:disabled) {
    background: var(--color-accent-subtle);
    transform: translateY(-2px);
    box-shadow: var(--shadow-action);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.field-input {
    width: 100%;
    min-width: 0;
    min-height: 45px;
    padding: 11px 14px;
    border: var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--color-field);
    color: var(--color-text);
    font: inherit;
    font-size: 16px;
    transition: border-color 0.2s;
}

.field-input::placeholder {
    color: var(--color-text-faint);
}

.field-input:focus {
    border-color: var(--color-accent);
}

.field-input.error {
    border-color: var(--color-danger-border);
}

.field-note {
    color: var(--color-text-muted);
    font-size: 14px;
    line-height: 1.45;
    text-wrap: pretty;
}

.field-hint {
    color: var(--color-text-faint);
    font-size: 12px;
    line-height: 1.4;
}

.entry-path + .entry-path {
    margin-top: 18px;
    padding-top: 18px;
    border-top: var(--border-default);
}

.entry-path-title {
    display: block;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.entry-path-note {
    margin-top: 4px;
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.inline-field {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.inline-field > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.inline-field .btn {
    flex: 0 0 auto;
    min-width: 150px;
}

.entry-path .restore-error:not(:empty) {
    margin-top: 6px;
}

/* Native file input, so keyboard, screen readers and the chosen file name keep working. */
.file-input {
    width: 100%;
    min-width: 0;
    min-height: 45px;
    padding: 5px 12px 5px 5px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    transition: border-color 0.2s, background-color 0.2s;
}

.file-input:hover {
    border-color: var(--color-accent);
    background: var(--color-accent-subtle);
}

.file-input::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 6px;
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

@media (max-width: 560px) {
    .inline-field {
        flex-direction: column;
    }

    .inline-field .btn {
        width: 100%;
    }
}
