:root {
    --bg: #0a0c12;
    --panel: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.15);
    --text: #f2efe6;
    --muted: #aab0c0;
    --accent: #c8a24a;
}

* {
    box-sizing: border-box;
}

html,
body,
#app {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background: radial-gradient(1100px 700px at 12% -8%, #1b1d28 0%, transparent 55%),
        radial-gradient(900px 600px at 112% 118%, #241712 0%, transparent 52%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

button,
a {
    font: inherit;
}

.loading-shell,
.deck-shell {
    position: fixed;
    inset: 0;
}

.loading-shell {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.loader {
    max-width: 34rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(8, 9, 14, 0.78);
    text-align: center;
}

.loader.error {
    color: #ffd1d1;
    border-color: rgba(255, 120, 120, 0.5);
}

.deck-shell {
    display: flex;
    flex-direction: column;
}

.stage {
    flex: 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: clamp(0.5rem, 2vw, 1.5rem);
    cursor: pointer;
}

.stage img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

.progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
}

.progress div {
    height: 100%;
    background: linear-gradient(90deg, #b5472d, var(--accent));
    transition: width 0.2s ease;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    padding: 0.6rem;
    background: rgba(8, 9, 14, 0.72);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.controls button,
.controls a {
    min-width: 44px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}

.controls button:hover,
.controls a:hover {
    border-color: var(--accent);
    background: rgba(200, 162, 74, 0.18);
}

.counter {
    min-width: 80px;
    text-align: center;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.counter strong {
    color: var(--text);
}

.overview {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: rgba(6, 7, 12, 0.97);
    backdrop-filter: blur(6px);
}

.overview header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--border);
}

.overview header strong {
    color: var(--accent);
}

.overview header button {
    width: 40px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
}

.overview-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.8rem;
    align-content: start;
    padding: clamp(1rem, 4vw, 2.5rem);
}

.overview-item {
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.overview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #fff;
}

.overview-item span {
    display: block;
    padding: 0.5rem 0.6rem;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.3;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0 0;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: #6d1f1f;
    color: white;
}

.loading-progress,
.loading-progress-text {
    display: none;
}

@media (max-width: 640px) {
    .controls button,
    .controls a {
        min-width: 42px;
        height: 40px;
    }
}
