/**
 * RAGTIME THEME v5.0.0 — Dark Arcade Shell
 *
 * Black backgrounds, white text, purple blacklight glow.
 * Header top-aligned, footer bottom-aligned, content fills the middle.
 * Responsive from vertical smartphone to 4K horizontal TV.
 */

/* ═══════════════════════════════════════════════════════════
   TOKENS
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg:          #000000;
    --surface:     #0a0a0c;
    --surface-alt: #101014;
    --border:      #1a1a22;
    --text:        #f0f0f2;
    --text-dim:    #707080;
    --accent:      #8b5cf6;
    --accent-dim:  rgba(139, 92, 246, 0.25);
    --accent-glow: rgba(139, 92, 246, 0.12);
    --glow-edge:   rgba(139, 92, 246, 0.35);
    --danger:      #ef4444;
    --hdr:         44px;
    --ftr:         28px;
    --radius:      6px;
}

/* ═══════════════════════════════════════════════════════════
   RESET — kill all WordPress default spacing and containers
   ═══════════════════════════════════════════════════════════ */

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

html {
    width: 100%; height: 100%;
    overflow: hidden;
    background: var(--bg);
    color-scheme: dark;
}

body {
    width: 100%; height: 100%;
    overflow: hidden;
    display: flex; flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Kill WordPress core container widths and alignment classes */
.wp-site-blocks,
.wp-block-group,
.entry-content,
.page-content,
.post-content,
article {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* WordPress block editor alignment overrides */
.alignwide, .alignfull {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* WordPress admin bar offset — if logged in and admin bar is showing */
body.admin-bar .ragtime-header { top: 32px; }
body.admin-bar .ragtime-site-main { top: calc(var(--hdr) + 32px); }
@media (max-width: 782px) {
    body.admin-bar .ragtime-header { top: 46px; }
    body.admin-bar .ragtime-site-main { top: calc(var(--hdr) + 46px); }
}

/* ═══════════════════════════════════════════════════════════
   PURPLE BLACKLIGHT EDGE GLOW
   All four edges — renders above header and footer
   ═══════════════════════════════════════════════════════════ */

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10000;
    border: 1px solid rgba(139, 92, 246, 0.18);
    box-shadow:
        inset 0 0 40px rgba(139, 92, 246, 0.07),
        inset 0 0 100px rgba(139, 92, 246, 0.04),
        0 0 20px rgba(139, 92, 246, 0.1),
        0 0 50px rgba(139, 92, 246, 0.05);
}

/* ═══════════════════════════════════════════════════════════
   HEADER — full-width, top-aligned, minimalist
   3-column grid: title left · hamburger center · sound right
   ═══════════════════════════════════════════════════════════ */

.ragtime-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--hdr);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 12px rgba(139, 92, 246, 0.06);
}

.ragtime-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: start;
    min-width: 0;
}

.ragtime-header-center { justify-self: center; }

.ragtime-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-self: end;
}

.ragtime-title {
    font-size: 0.92em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ragtime-title:hover { color: var(--accent); }

/* Header icon buttons */
.ragtime-hdr-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.ragtime-hdr-btn:hover { background: rgba(139, 92, 246, 0.1); color: var(--text); }
.ragtime-hdr-btn:active { transform: scale(0.92); }
.ragtime-hdr-btn svg { width: 20px; height: 20px; }

.ragtime-menu-btn { color: var(--text); }

/* ── Desktop primary nav (center header) ────────────────────
   Visible on desktop, hidden on mobile.                      */

.ragtime-primary-nav { display: flex; align-items: center; }

.ragtime-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.ragtime-nav-links li a {
    display: block;
    padding: 6px 14px;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.ragtime-nav-links li a:hover,
.ragtime-nav-links li.current-menu-item a,
.ragtime-nav-links li.current_page_item a {
    background: rgba(139, 92, 246, 0.1);
    color: var(--text);
}

/* Hamburger hidden on desktop */
.ragtime-menu-btn { display: none; }

/* ── Mobile primary nav (inside overlay panel) ─────────────  */

.ragtime-mobile-nav-links {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}
.ragtime-mobile-nav-links li a {
    display: block;
    padding: 12px 20px;
    font-size: 0.9em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
}
.ragtime-mobile-nav-links li:last-child a { border-bottom: none; }
.ragtime-mobile-nav-links li a:hover,
.ragtime-mobile-nav-links li.current-menu-item a,
.ragtime-mobile-nav-links li.current_page_item a {
    background: rgba(139, 92, 246, 0.08);
    color: var(--accent);
}

/* On mobile: show hamburger, hide desktop nav */
@media (max-width: 768px) {
    .ragtime-primary-nav { display: none; }
    .ragtime-menu-btn    { display: flex; }
}

/* ═══════════════════════════════════════════════════════════
   MAIN CONTENT — fills all space between header and footer
   ═══════════════════════════════════════════════════════════ */

.ragtime-site-main {
    position: fixed;
    top: var(--hdr);
    bottom: var(--ftr);
    left: 0; right: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* WordPress page/post content — scrolls inside the main area, full width, zero padding */
.ragtime-content {
    flex: 1 1 auto;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    margin: 0;
}

/* Game iframe — fill the entire middle, no scrolling */
.ragtime-game-wrapper {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
}
.ragtime-game-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ═══════════════════════════════════════════════════════════
   FOOTER — full-width, bottom-aligned, minimalist
   ═══════════════════════════════════════════════════════════ */

.ragtime-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 100;
    height: var(--ftr);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    font-size: 0.68em;
    color: var(--text-dim);
    box-shadow: 0 -1px 12px rgba(139, 92, 246, 0.06);
}

.ragtime-footer-left { justify-self: start; display: flex; align-items: center; }
.ragtime-footer-center { justify-self: center; }
.ragtime-footer-right { justify-self: end; }
.ragtime-footer-version { opacity: 0.6; }

/* Footer sound toggle */
.ragtime-footer-sound {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.15s;
    padding: 0;
    flex-shrink: 0;
}
.ragtime-footer-sound:hover { color: var(--text); }

/* Volume slider */
.ragtime-volume-slider {
    width: 60px;
    height: 12px;              /* match thumb height so WebKit centers it */
    -webkit-appearance: none; appearance: none;
    background: transparent;   /* track drawn via pseudo-element */
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
}
.ragtime-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
    margin-top: -4px;          /* (thumb - track) / 2 = (12 - 4) / 2 */
}
.ragtime-volume-slider::-moz-range-thumb {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}
.ragtime-volume-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}
.ragtime-volume-slider::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
}

/* ═══════════════════════════════════════════════════════════
   USER AVATAR & DROPDOWN
   ═══════════════════════════════════════════════════════════ */

.ragtime-user-btn { position: relative; }

.ragtime-user-avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    object-fit: cover;
}

.ragtime-user-dropdown {
    position: fixed;
    top: var(--hdr);
    right: 8px;
    z-index: 600;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 220px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 12px rgba(139, 92, 246, 0.06);
    animation: ragtime-fadeIn 0.12s ease;
}

.ragtime-user-dropdown-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
}

.ragtime-user-dropdown-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    object-fit: cover;
    flex-shrink: 0;
}

.ragtime-user-dropdown-name {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text);
}

.ragtime-user-dropdown-email {
    font-size: 0.72em;
    color: var(--text-dim);
}

.ragtime-user-dropdown-divider {
    height: 1px;
    background: var(--border);
}

.ragtime-user-dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.82em;
    color: var(--text);
    text-decoration: none;
    transition: background 0.12s;
}
.ragtime-user-dropdown-item:hover {
    background: rgba(139, 92, 246, 0.08);
}

/* ═══════════════════════════════════════════════════════════
   GAME MENU OVERLAY
   ═══════════════════════════════════════════════════════════ */

.ragtime-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: calc(var(--hdr) + 12px);
    animation: ragtime-fadeIn 0.15s ease;
}

.ragtime-menu-panel {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 380px;
    max-height: calc(100vh - var(--hdr) - var(--ftr) - 48px);
    display: flex;
    flex-direction: column;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(139, 92, 246, 0.08);
}

.ragtime-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.ragtime-menu-heading {
    font-size: 0.92em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ragtime-menu-list {
    overflow-y: auto;
    padding: 6px;
    flex: 1 1 auto;
}

.ragtime-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.12s;
    text-decoration: none;
    color: var(--text);
}
.ragtime-menu-item:hover { background: rgba(139, 92, 246, 0.08); }
.ragtime-menu-item-active { background: rgba(139, 92, 246, 0.12); }

.ragtime-menu-item-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    flex-shrink: 0;
}

.ragtime-menu-item-info { min-width: 0; flex: 1; }
.ragtime-menu-item-name {
    font-size: 0.86em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ragtime-menu-item-desc {
    font-size: 0.7em;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ragtime-menu-empty {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85em;
    padding: 24px 12px;
}

/* Category colors */
.ragtime-cat-card     { background: #1a0a0a; color: #e06060; }
.ragtime-cat-puzzle   { background: #0a1a0a; color: #60c060; }
.ragtime-cat-strategy { background: #0a0a1a; color: #6080e0; }
.ragtime-cat-arcade   { background: #1a1a0a; color: #d0c050; }
.ragtime-cat-board    { background: #1a0a1a; color: #c060c0; }
.ragtime-cat-action   { background: #1a1208; color: #e0a040; }

/* ═══════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════ */

.ragtime-btn {
    font-family: inherit;
    font-size: 0.82em;
    font-weight: 500;
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all 0.12s;
}
.ragtime-btn:active { transform: scale(0.97); }

.ragtime-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.ragtime-btn-primary:hover { filter: brightness(1.15); }

.ragtime-btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-dim);
}
.ragtime-btn-ghost:hover { color: var(--text); border-color: #333; }

/* ═══════════════════════════════════════════════════════════
   DARK FORM CONTROLS
   All inputs, selects, textareas — dark themed
   ═══════════════════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="tel"],
input[type="date"],
textarea,
select {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.9em;
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5L6 8L9 5' fill='none' stroke='%23707080' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

select option {
    background: var(--surface-alt);
    color: var(--text);
}

/* ═══════════════════════════════════════════════════════════
   WORDPRESS CONTENT STYLING
   Headings, paragraphs, links, lists inside page content
   ═══════════════════════════════════════════════════════════ */

.ragtime-content h1, .ragtime-content h2, .ragtime-content h3,
.ragtime-content h4, .ragtime-content h5, .ragtime-content h6 {
    color: var(--text);
    margin-bottom: 0.5em;
    font-weight: 600;
}
.ragtime-content h1 { font-size: 1.8em; }
.ragtime-content h2 { font-size: 1.4em; }
.ragtime-content h3 { font-size: 1.15em; }

.ragtime-content p { margin-bottom: 1em; color: var(--text); }

.ragtime-content a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s;
}
.ragtime-content a:hover { color: #a78bfa; text-decoration: underline; }

.ragtime-content ul, .ragtime-content ol {
    margin: 0 0 1em 1.5em;
    color: var(--text);
}

.ragtime-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 8px 16px;
    margin: 0 0 1em 0;
    color: var(--text-dim);
    background: var(--surface-alt);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.ragtime-content code {
    background: var(--surface-alt);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.88em;
    color: var(--accent);
}

.ragtime-content pre {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 1em;
}

.ragtime-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.ragtime-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
}
.ragtime-content th, .ragtime-content td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}
.ragtime-content th {
    background: var(--surface-alt);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   GAME GALLERY — [ragtime_arcade] shortcode
   Retro 80s arcade, Exo 2 sans-serif, neon accents
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700;800&display=swap');

/* ── Gallery container ── */
.rag-gallery {
    position: relative;
    width: 100%;
    min-height: 100%;
    font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Header ── */
.rag-header {
    position: relative;
    z-index: 2;
    max-width: 1060px;
    margin: 0 auto;
    padding: 14px 36px 0;
}

.rag-tagline {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Exo 2', sans-serif;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(139, 92, 246, 0.40);
}

.rag-divider {
    height: 1px;
    margin-bottom: 20px;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.30), rgba(139, 92, 246, 0.05) 60%, transparent);
}

/* ── Genre filter bar ── */
.rag-filters {
    position: relative;
    z-index: 2;
    max-width: 1060px;
    margin: 0 auto 24px;
    padding: 0 36px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rag-filter-btn {
    padding: 5px 14px;
    border-radius: 3px;
    border: 1px solid rgba(139, 92, 246, 0.10);
    background: transparent;
    color: rgba(240, 240, 242, 0.35);
    font-family: 'Exo 2', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.rag-filter-btn:hover {
    color: rgba(240, 240, 242, 0.6);
    border-color: rgba(139, 92, 246, 0.25);
}

.rag-filter-btn--active {
    border-color: rgba(139, 92, 246, 0.50);
    background: rgba(139, 92, 246, 0.10);
    color: var(--accent);
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.40);
}

/* ── Cards — shared ── */
.rag-card {
    position: relative;
    z-index: 2;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease;
}

.rag-card:hover {
    border-color: color-mix(in srgb, var(--accent, #8b5cf6) 35%, transparent);
    box-shadow:
        0 0 24px color-mix(in srgb, var(--accent, #8b5cf6) 8%, transparent),
        inset 0 0 40px rgba(139, 92, 246, 0.02);
    transform: translateY(-2px);
}

.rag-card__link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 22px;
}
.rag-card__link:hover,
.rag-card__link:focus,
.rag-card__link:visited,
.ragtime-content .rag-card__link:hover {
    text-decoration: none;
    color: inherit;
}

/* ── Featured card ── */
.rag-card--featured {
    max-width: 1060px;
    margin: 0 auto 20px;
    padding: 0 36px;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
.rag-card--featured:hover {
    transform: none;
    box-shadow: none;
}

.rag-card--featured > .rag-card__link {
    display: flex;
    gap: 28px;
    align-items: center;
    padding: 32px 36px;
    border-radius: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.15s ease;
}
.rag-card--featured:hover > .rag-card__link {
    border-color: color-mix(in srgb, var(--accent, #8b5cf6) 40%, transparent);
    box-shadow:
        0 0 30px color-mix(in srgb, var(--accent, #8b5cf6) 10%, transparent),
        inset 0 0 60px rgba(139, 92, 246, 0.03);
    transform: translateY(-1px);
}

.rag-card--featured .rag-card__body { flex: 1; }

.rag-card--featured .rag-card__title {
    font-size: 26px;
    margin: 0 0 6px;
    text-shadow: 0 0 20px color-mix(in srgb, var(--accent, #8b5cf6) 20%, transparent);
}

.rag-card--featured .rag-card__desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 0 16px;
}

/* ── Standard card top row ── */
.rag-card__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
}

/* ── Icon ── */
.rag-card__icon {
    display: block;
    border-radius: 6px;
    object-fit: cover;
    width: 56px;
    height: 56px;
}
.rag-card__icon--lg {
    width: 100px;
    height: 100px;
}

/* Icon letter fallback */
.rag-card__icon-fallback {
    width: 56px; height: 56px; min-width: 56px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent, #8b5cf6) 10%, transparent);
    border: 1.5px solid color-mix(in srgb, var(--accent, #8b5cf6) 35%, transparent);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800;
    color: var(--accent, #8b5cf6);
    text-shadow: 0 0 12px color-mix(in srgb, var(--accent, #8b5cf6) 55%, transparent);
    font-family: 'Exo 2', monospace;
}
.rag-card__icon-fallback--lg {
    width: 100px; height: 100px; min-width: 100px;
    font-size: 44px;
}

/* ── Badges ── */
.rag-card__badges {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}
.rag-card__badges--right {
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin-bottom: 0;
}

.rag-badge {
    display: inline-block;
    border-radius: 3px;
    font-family: 'Exo 2', monospace;
    white-space: nowrap;
}
.rag-badge--genre {
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: color-mix(in srgb, var(--badge-color, #8b5cf6) 14%, transparent);
    color: var(--badge-color, #8b5cf6);
    border: 1px solid color-mix(in srgb, var(--badge-color, #8b5cf6) 28%, transparent);
}
.rag-badge--era {
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── Card title & description ── */
.rag-card__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    font-family: 'Exo 2', sans-serif;
    color: var(--text);
    letter-spacing: 0.01em;
    line-height: 1.25;
}

.rag-card__desc {
    margin: 0;
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.55;
    font-family: 'Exo 2', sans-serif;
}

/* ── Card footer (play link + version) ── */
.rag-card__footer {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.rag-card__version {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.15);
    font-family: 'Exo 2', monospace;
}
.rag-card--featured .rag-card__version {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.20);
}

/* Play link — standard cards */
.rag-play-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent, #8b5cf6);
    opacity: 0.5;
    font-family: 'Exo 2', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: opacity 0.2s ease, text-shadow 0.2s ease;
}
.rag-card:hover .rag-play-link {
    opacity: 1;
    text-shadow: 0 0 8px color-mix(in srgb, var(--accent, #8b5cf6) 40%, transparent);
}

/* Play button — featured card */
.rag-play-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 22px;
    border-radius: 3px;
    background: var(--accent, #8b5cf6);
    color: #0A0A0F;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-family: 'Exo 2', sans-serif;
    box-shadow: 0 0 16px color-mix(in srgb, var(--accent, #8b5cf6) 35%, transparent);
    transition: box-shadow 0.3s ease;
}
.rag-card--featured:hover .rag-play-btn {
    box-shadow: 0 0 24px color-mix(in srgb, var(--accent, #8b5cf6) 50%, transparent);
}

/* ── Game grid ── */
.rag-grid {
    position: relative;
    z-index: 2;
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 36px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* ── Empty state ── */
.rag-empty {
    text-align: center;
    padding: 80px 20px;
    font-size: 14px;
    font-family: 'Exo 2', sans-serif;
    color: var(--text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Gallery responsive ── */
@media (max-width: 768px) {
    .rag-header { padding: 10px 20px 0; }
    .rag-tagline { font-size: 10px; margin-bottom: 10px; }
    .rag-filters { padding: 0 20px; margin-bottom: 18px; }
    .rag-card--featured { padding: 0 20px; }
    .rag-card--featured > .rag-card__link {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        gap: 16px;
    }
    .rag-card__icon--lg { width: 72px; height: 72px; }
    .rag-card__icon-fallback--lg { width: 72px; height: 72px; min-width: 72px; font-size: 32px; }
    .rag-card--featured .rag-card__title { font-size: 22px; }
    .rag-grid { padding: 0 20px; grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 479px) {
    .rag-filter-btn { padding: 4px 10px; font-size: 11px; }
}

@media (min-width: 2000px) {
    .rag-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        max-width: 1400px;
    }
}

/* ── Fallback for browsers without color-mix ── */
@supports not (color: color-mix(in srgb, red, blue)) {
    .rag-card:hover {
        border-color: rgba(139, 92, 246, 0.25);
        box-shadow: 0 0 24px rgba(139, 92, 246, 0.08);
    }
    .rag-card--featured:hover > .rag-card__link {
        border-color: rgba(139, 92, 246, 0.30);
        box-shadow: 0 0 30px rgba(139, 92, 246, 0.10);
    }
    .rag-badge--genre {
        background: rgba(139, 92, 246, 0.14);
        border-color: rgba(139, 92, 246, 0.28);
    }
    .rag-card__icon-fallback {
        background: rgba(139, 92, 246, 0.10);
        border-color: rgba(139, 92, 246, 0.35);
    }
    .rag-play-btn { box-shadow: 0 0 16px rgba(139, 92, 246, 0.35); }
    .rag-play-link { color: var(--accent); }
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR — dark themed
   ═══════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */

@keyframes ragtime-fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 1200px) {
    :root { --hdr: 48px; --ftr: 30px; }
    .ragtime-title { font-size: 1em; }
}

@media (min-width: 2000px) {
    :root { --hdr: 52px; --ftr: 32px; }
    .ragtime-title { font-size: 1.1em; }
    body { font-size: 17px; }
}

@media (max-width: 767px) {
    .ragtime-title { font-size: 0.85em; }
}

@media (max-width: 479px) {
    :root { --hdr: 40px; --ftr: 24px; }
    .ragtime-title { font-size: 0.78em; letter-spacing: 0.02em; }
    .ragtime-hdr-btn { width: 32px; height: 32px; }
    .ragtime-hdr-btn svg { width: 18px; height: 18px; }
    .ragtime-footer { font-size: 0.6em; }
}

@media (max-height: 500px) and (orientation: landscape) {
    :root { --hdr: 36px; --ftr: 20px; }
    .ragtime-title { font-size: 0.78em; }
}

/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════ */

.ragtime-hdr-btn:focus-visible,
.ragtime-btn:focus-visible,
.ragtime-menu-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═══════════════════════════════════════════════════════════
   PULL-TO-REFRESH — mobile touch only
   ═══════════════════════════════════════════════════════════ */

.ragtime-ptr {
    position: fixed;
    top: -44px;
    left: 50%;
    margin-left: -20px;
    width: 40px; height: 40px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform: translateY(0);
    will-change: transform;
}

.ragtime-ptr-spinner {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 50%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4), 0 0 8px rgba(139, 92, 246, 0.15);
    color: var(--accent);
    opacity: 0;
}

.ragtime-ptr--refreshing .ragtime-ptr-spinner {
    opacity: 1 !important;
    animation: ragtime-ptr-spin 0.7s linear infinite;
}

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

/* Hide on non-touch / desktop — if pointer is fine (mouse), no PTR */
@media (pointer: fine) {
    .ragtime-ptr { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════ */

@media print {
    .ragtime-header, .ragtime-footer, .ragtime-menu-overlay { display: none; }
    body::before { display: none; }
    body { background: #fff; color: #000; }
}

/* ═══════════════════════════════════════════════════════════
   PROFILE PAGE
   ═══════════════════════════════════════════════════════════ */

.ragtime-profile { padding: 0; }
.rp-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 20px 48px;
}

.rp-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 36px;
}

.rp-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
    flex-shrink: 0;
}

.rp-info { min-width: 0; }
.rp-name {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}
.rp-meta {
    font-size: 0.78em;
    color: var(--text-dim);
    margin: 0;
}

.rp-section { margin-bottom: 32px; }
.rp-section-title {
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Edit form */
.rp-form { display: flex; flex-direction: column; gap: 14px; }
.rp-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78em;
    color: var(--text-dim);
}
.rp-input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}
.rp-input:focus { border-color: var(--accent); }

.rp-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.rp-btn {
    display: inline-block;
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.82em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
    text-decoration: none;
}
.rp-btn:hover { opacity: 0.85; }
.rp-btn--ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
}
.rp-btn--ghost:hover { border-color: var(--accent); color: var(--text); }

.rp-status { font-size: 0.78em; color: var(--text-dim); }
.rp-status--ok { color: #22c55e; }
.rp-status--err { color: var(--danger); }

/* Game stats grid */
.rp-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.rp-game-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.rp-game-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.rp-game-icon {
    width: 36px; height: 36px;
    border-radius: 4px;
    object-fit: cover;
}

.rp-game-icon-fallback {
    width: 36px; height: 36px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.rp-game-name {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.rp-game-saves {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rp-save-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78em;
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.rp-save-key { color: var(--text-dim); }
.rp-save-val { color: var(--text); font-weight: 500; }
.rp-save-json { color: var(--text-dim); font-style: italic; }

.rp-game-updated {
    margin-top: 8px;
    font-size: 0.7em;
    color: var(--text-dim);
    opacity: 0.7;
}

.rp-empty {
    font-size: 0.82em;
    color: var(--text-dim);
    padding: 24px 0;
}

@media (max-width: 479px) {
    .rp-header { flex-direction: column; text-align: center; }
    .rp-avatar { width: 64px; height: 64px; }
}

/* ═══════════════════════════════════════════════════════════
   SCOREBOARD — [ragtime_scores] shortcode
   ═══════════════════════════════════════════════════════════ */

.ragtime-scoreboard {
    max-width: 560px;
    margin: 0 auto 32px;
    font-family: inherit;
}

.ragtime-scoreboard__loading {
    text-align: center;
    color: var(--text-dim);
    padding: 24px 0;
    font-size: 0.85em;
    letter-spacing: 0.05em;
}

.ragtime-scoreboard__title {
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 4px;
}

.ragtime-scoreboard__subtitle {
    font-size: 0.78em;
    color: var(--text-dim);
    margin: 0 0 16px;
    letter-spacing: 0.04em;
}

.ragtime-scoreboard__empty {
    color: var(--text-dim);
    font-size: 0.85em;
    padding: 16px 0;
    font-style: italic;
}

.ragtime-scoreboard__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88em;
}

.ragtime-scoreboard__table thead tr {
    border-bottom: 1px solid var(--border);
}

.ragtime-scoreboard__table th {
    text-align: left;
    padding: 6px 10px;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.ragtime-scoreboard__table td {
    padding: 9px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
}

.ragtime-scoreboard__row--top td {
    color: var(--text);
}

.ragtime-scoreboard__row--top:first-child td {
    color: #ffd700;
}

.ragtime-scoreboard__rank {
    width: 36px;
    font-size: 1.1em;
    text-align: center;
    padding-left: 4px;
}

.ragtime-scoreboard__score {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
}

.ragtime-scoreboard__date {
    font-size: 0.78em;
    color: var(--text-dim);
    white-space: nowrap;
}

.ragtime-scoreboard__anon {
    color: var(--text-dim);
    font-style: italic;
}

.ragtime-scoreboard__legend {
    font-size: 0.72em;
    color: var(--text-dim);
    margin-top: 12px;
    text-align: center;
    letter-spacing: 0.03em;
}

@media (max-width: 479px) {
    .ragtime-scoreboard__date { display: none; }
    .ragtime-scoreboard__table th:last-child { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   AD SLOTS  (v5.0)
   Three visual modes: placeholder, live, hidden. CSS handles the
   placeholder + live styling; hidden is just display:none via PHP.
   ═══════════════════════════════════════════════════════════ */

.rag-ad {
    display: block;
    margin: 20px auto;
    width: 100%;
    max-width: 728px;
    min-height: 90px;
    box-sizing: border-box;
}

/* Between grid rows — span the full width of the grid */
.rag-ad--grid {
    grid-column: 1 / -1;
    max-width: none;
    margin: 8px 0;
}

/* Around game iframe — tighten margin so it hugs the play field */
.rag-ad--above-game { margin: 4px auto 16px; }
.rag-ad--below-game { margin: 16px auto 4px; }

/* Footer ad — appears above the small copyright bar */
.ragtime-footer-ad {
    width: 100%;
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.ragtime-footer-ad .rag-ad--footer {
    margin: 0;
}
/* Hide the footer ad wrapper entirely when the slot renders nothing */
.ragtime-footer-ad:empty { display: none; }

/* ── Placeholder mode ──────────────────────────────────────── */
.rag-ad--placeholder {
    padding: 22px 16px;
    border: 2px dashed rgba(255, 255, 255, 0.14);
    background:
        repeating-linear-gradient(
            45deg,
            rgba(255, 255, 255, 0.015),
            rgba(255, 255, 255, 0.015) 8px,
            transparent 8px,
            transparent 16px
        );
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.38);
    font-family: 'Courier New', 'Consolas', monospace;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rag-ad--placeholder .rag-ad__inner {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.rag-ad--placeholder .rag-ad__tag {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 5px;
    color: rgba(139, 92, 246, 0.55);
}
.rag-ad--placeholder .rag-ad__name {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
}
.rag-ad--placeholder .rag-ad__size {
    font-size: 10px;
    opacity: 0.55;
    letter-spacing: 1px;
}

/* Placeholder variants per location */
.rag-ad--placeholder.rag-ad--top       { margin-top: 14px; }
.rag-ad--placeholder.rag-ad--grid      { min-height: 120px; }
.rag-ad--placeholder.rag-ad--above-game,
.rag-ad--placeholder.rag-ad--below-game {
    max-width: 728px;
    min-height: 90px;
}

/* ── Live mode ─────────────────────────────────────────────── */
.rag-ad--live {
    background: transparent;
    border: none;
    padding: 0;
    display: block;
    min-height: 90px;
}
.rag-ad--live ins.adsbygoogle { display: block !important; }

/* ═══════════════════════════════════════════════════════════
   COOKIE CONSENT BANNER
   ═══════════════════════════════════════════════════════════ */
.ragtime-cookie-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 80px;
    max-width: 640px;
    margin: 0 auto;
    background: #14141a;
    color: #e8e8ee;
    border: 1px solid rgba(139, 92, 246, 0.45);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 9998;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.ragtime-cookie-banner.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.ragtime-cookie-banner__inner {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.ragtime-cookie-banner__msg {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    flex: 1 1 280px;
}
.ragtime-cookie-banner__msg a {
    color: #b49aff;
    text-decoration: underline;
}
.ragtime-cookie-banner__btn {
    background: #8b5cf6;
    color: #fff;
    border: none;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.ragtime-cookie-banner__btn:hover { background: #7c4df0; }
.ragtime-cookie-banner__btn:active { transform: translateY(1px); }

@media (max-width: 479px) {
    .ragtime-cookie-banner { bottom: 72px; left: 8px; right: 8px; }
    .ragtime-cookie-banner__inner { padding: 12px 14px; }
    .ragtime-cookie-banner__msg { font-size: 12px; }
}
