/* ─── Reset & Root ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
* { outline: none; }

:root {
    /* Backgrounds */
    --bg-primary:  #1A1A1A;
    --bg-surface:  #242424;
    --bg-elevated: #2E2E2E;
    --bg-dim:      rgba(0, 0, 0, 0.75);

    /* Text */
    --text-primary:   #F0F0F0;
    --text-secondary: #A0A0A0;
    --text-muted:     #555555;

    /* Brand / Focus */
    --color-focus:    #00AAFF;
    --color-focus-bg: rgba(0, 170, 255, 0.12);
    --color-accent:   #FFD700;

    /* Typography */
    --text-quote:   56px;
    --text-author:  32px;
    --text-button:  28px;
    --text-body:    28px;
    --text-small:   24px;

    /* Safe zone — 5% overscan margins */
    --safe-h: 54px;   /* top & bottom */
    --safe-v: 96px;   /* left & right */
}

html, body {
    width: 1920px;
    height: 1080px;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: Arial, Helvetica, sans-serif;
    font-size: var(--text-body);
    line-height: 1.4;
    font-weight: 400;
    user-select: none;
    -webkit-user-select: none;
}

#app {
    width: 1920px;
    height: 1080px;
    position: relative;
}

/* ─── Safe Zone ──────────────────────────────────────────────────── */
.safe-zone {
    position: absolute;
    top: var(--safe-h);
    left: var(--safe-v);
    right: var(--safe-v);
    bottom: var(--safe-h);
    /* Usable area: 1728px × 972px */
}

/* ─── Focusable Base ─────────────────────────────────────────────── */
.focusable {
    border: 3px solid transparent;
    border-radius: 6px;
    transition: transform 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
    cursor: default;
}

.focusable.is-focused {
    border-color: var(--color-focus);
    background-color: var(--color-focus-bg);
    transform: scale(1.05);
}

/* ─── Quote Screen ───────────────────────────────────────────────── */
.quote-screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Decorative gradient background */
.quote-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(0, 100, 200, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(100, 0, 200, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.quote-screen > * { position: relative; z-index: 1; }

/* ── Header bar ── */
.quote-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--safe-h) var(--safe-v) 0;
    height: 100px;
}

.app-title {
    font-size: var(--text-small);
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 400;
}

.quote-counter {
    font-size: var(--text-small);
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Quote body (center section) ── */
.quote-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 calc(var(--safe-v) + 80px);
    gap: 40px;
    text-align: center;
}

.quote-mark {
    font-size: 96px;
    line-height: 1;
    color: var(--color-focus);
    opacity: 0.4;
    font-family: Georgia, serif;
    display: block;
    margin-bottom: -40px;
}

.quote-text {
    font-size: var(--text-quote);
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.5;
    max-width: 1400px;
    /* Fade in when quote changes */
    transition: opacity 0.3s ease;
}

.quote-text.loading-quote {
    opacity: 0.3;
}

.quote-author {
    font-size: var(--text-author);
    color: var(--text-secondary);
    font-style: italic;
    transition: opacity 0.3s ease;
}

.quote-author.loading-quote {
    opacity: 0.3;
}

.quote-category {
    display: inline-block;
    font-size: var(--text-small);
    color: var(--color-focus);
    text-transform: uppercase;
    letter-spacing: 2px;
    padding: 4px 16px;
    border: 1px solid rgba(0, 170, 255, 0.3);
    border-radius: 20px;
}

/* ── Navigation buttons ── */
.quote-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--safe-v);
    height: 100px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 40px;
    font-size: var(--text-button);
    color: var(--text-secondary);
    background: var(--bg-surface);
    border-radius: 8px;
    min-width: 220px;
    justify-content: center;
    transition: color 0.12s ease;
}

.nav-btn.is-focused {
    color: var(--text-primary);
}

.nav-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

.nav-arrow {
    font-size: 32px;
    line-height: 1;
}

/* ── Ad banner ── */
.ad-section {
    padding: 0 var(--safe-v) var(--safe-h);
    height: 140px;
    display: flex;
    align-items: center;
}

.ad-banner {
    width: 100%;
    height: 100px;
    background: var(--bg-surface);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    overflow: hidden;
    gap: 0;
}

.ad-banner.ad-empty {
    background: transparent;
    border-color: transparent;
}

.ad-image {
    width: 200px;
    height: 100px;
    object-fit: cover;
    flex-shrink: 0;
    border-radius: 8px 0 0 8px;
}

.ad-image.ad-placeholder-img {
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-text {
    flex: 1;
    padding: 0 32px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ad-label {
    font-size: 18px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.ad-title {
    font-size: var(--text-small);
    color: var(--text-primary);
    font-weight: 400;
}

.ad-subtitle {
    font-size: 22px;
    color: var(--text-secondary);
}

/* ─── Exit Dialog ────────────────────────────────────────────────── */
.exit-dialog-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.exit-dialog-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.exit-dialog {
    background: var(--bg-elevated);
    border-radius: 16px;
    padding: 64px 80px;
    min-width: 700px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.exit-dialog-overlay.visible .exit-dialog {
    transform: scale(1);
}

.exit-dialog-title {
    font-size: 48px;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-weight: 400;
}

.exit-dialog-subtitle {
    font-size: var(--text-body);
    color: var(--text-secondary);
    margin-bottom: 56px;
}

.exit-dialog-buttons {
    display: flex;
    gap: 40px;
    justify-content: center;
}

.dialog-btn {
    padding: 20px 64px;
    font-size: var(--text-button);
    border-radius: 8px;
    min-width: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dialog-btn-exit {
    background: rgba(244, 67, 54, 0.15);
    color: #F44336;
    border-color: rgba(244, 67, 54, 0.3);
}

.dialog-btn-exit.is-focused {
    background: rgba(244, 67, 54, 0.25);
    border-color: #F44336;
}

.dialog-btn-stay {
    background: var(--bg-surface);
    color: var(--text-primary);
}
