/* Base styles — aligned with foto.erl.ing */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    background: none;
    border: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Screen-reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── App shell ── */

.app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

.app__sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
}

.app__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.app__title {
    font-size: 1.125rem;
    font-weight: bold;
    line-height: 1.3;
}

.app__actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.app__counter {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.app__counter[hidden] {
    display: none;
}

.app__action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: background var(--duration-fast) ease;

    &:hover {
        background: var(--bg-elevated);
    }
}

.app__action[hidden] {
    display: none;
}

.app__action-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* ── Loading state ── */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: var(--space-4);
}

.loading-state[hidden] {
    display: none;
}

.loading-state__spinner {
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--bg-tertiary);
    border-top-color: var(--text-secondary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

.loading-state__text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ── Empty state ── */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: var(--space-8);
    text-align: center;
    gap: var(--space-6);
    position: relative;
    overflow: hidden;
}

.empty-state[hidden] {
    display: none;
}

.empty-state__pixel-art {
    width: min(80%, 20rem);
    height: auto;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.empty-state__button {
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
    transition: background var(--duration-fast) ease;

    &:hover {
        background: var(--bg-elevated);
    }
}
