:root, [data-theme="light"] {
    --apple-bg: #ffffff;
    --apple-text: #1d1d1f;
    --text-secondary: #6e6e73; /* WCAG AA on white (~4.6:1); was #86868b (~3.4:1, sub-AA) */
    --apple-gray: #f5f5f7;
    --apple-gray-2: #e8e8ed;
    --apple-blue: #0071e3;
    --apple-accent: #ff9500;
    --accent-glow: rgba(255, 149, 0, 0.15);
    --accent-glow-strong: rgba(255, 149, 0, 0.3);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --nav-bg: rgba(255, 255, 255, 0.8);
    --nav-border: rgba(0, 0, 0, 0.1);
    --breadcrumb-bg: rgba(255, 255, 255, 0.9);
    --section-bg: #f5f5f7;
    --footer-glass: rgba(255, 255, 255, 0.85);
    --footer-text: #424245;
    --content-bg: #ffffff;
}
[data-theme="dark"] {
    --apple-bg: #0a0a0a;
    --apple-text: #f0f0f0;
    --text-secondary: #86868b; /* passes AA on near-black (~5.3:1); kept as-is for dark */
    --apple-gray: #1a1a1e;
    --apple-gray-2: #2a2a2e;
    --apple-blue: #2997ff;
    --apple-accent: #ff9f0a;
    --accent-glow: rgba(255, 159, 10, 0.15);
    --accent-glow-strong: rgba(255, 159, 10, 0.3);
    --glass-bg: rgba(0, 0, 0, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --nav-bg: rgba(20, 20, 20, 0.85);
    --nav-border: rgba(255, 255, 255, 0.06);
    --breadcrumb-bg: rgba(20, 20, 20, 0.9);
    --section-bg: #111114;
    --footer-glass: rgba(20, 20, 20, 0.85);
    --footer-text: #a1a1a6;
    --content-bg: #0a0a0a;
}

body {
    background-color: var(--apple-bg);
    color: var(--apple-text);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Loading Spinner */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--apple-bg);
    color: var(--apple-text);
    font-family: 'Inter', sans-serif;
    flex-direction: column;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--apple-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

*:focus-visible {
    outline: 2px solid rgba(255, 170, 50, 0.6);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Apple Nav Styles */
.apple-nav {
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    transition: background-color 0.5s cubic-bezier(0.28, 0.11, 0.32, 1);
}

.apple-nav-link {
    color: var(--apple-text);
    text-decoration: none;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: -0.01em;
    opacity: 0.8;
    transition: opacity 0.3s ease, color 0.3s ease;
    display: flex;
    align-items: center;
}

.apple-nav-link:hover {
    opacity: 1;
    color: var(--apple-accent);
}

/* Search nav item is a <button> for keyboard access; strip native chrome
   so it matches the surrounding <a class="apple-nav-link"> items. */
button.apple-nav-link {
    background: none;
    border: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

/* Skip-to-content link: offscreen until focused (keyboard / screen reader). */
.skip-link {
    position: absolute;
    top: -48px;
    left: 8px;
    z-index: 10010;
    padding: 8px 16px;
    background: var(--apple-blue);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 8px;
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.logo-link {
    opacity: 1;
}

/* MudBlazor Overrides */
.mud-typography {
    font-family: var(--font-family) !important;
    color: var(--apple-text) !important;
}

.mud-paper {
    background-color: var(--apple-gray) !important;
    color: var(--apple-text) !important;
    border: 1px solid var(--glass-border);
    box-shadow: none !important;
    border-radius: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* --- Hero Section --- */
.hero-section {
    height: 100vh;
    width: 100%;
    background-color: var(--apple-bg);
    margin-top: -44px;
    padding-top: 44px;
    /* Respect notched-phone safe areas on the sides */
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
}

.hero-title-gradient {
    font-weight: 700;
    font-size: clamp(2rem, 8vw, 4rem);
    letter-spacing: -0.02em;
    background: -webkit-linear-gradient(45deg, #e8453c, #ff9500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
}

.hero-subtitle-text {
    font-weight: 500;
    color: var(--apple-text);
    max-width: 800px;
    display: inline-block;
    line-height: 1.2;
    margin-bottom: 40px;
    font-size: clamp(1.1rem, 3vw, 1.5rem);
}

/* --- Where to Begin Section --- */
.where-to-begin-section {
    padding: clamp(40px, 8vw, 100px) 0;
}

.fade-in-up {
    animation: fadeInUp 1s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Apple Cards --- */
.apple-card {
    background: #111111;
    border-radius: 18px;
    padding: 0;
    height: 420px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 1px solid transparent;
}

.apple-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15), 0 0 20px var(--accent-glow);
    border-color: rgba(255, 149, 0, 0.25);
}

.card-image {
    width: 100%;
    height: 60%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.apple-card:hover .card-image {
    transform: scale(1.05);
}

.card-content {
    padding: 24px;
    background-color: #111111;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    z-index: 1;
}

.card-content .mud-typography.mud-typography-h5 {
    color: #ffffff !important;
}

.card-content .mud-typography.mud-typography-body2 {
    color: #a1a1a6 !important;
}

/* --- Story Pages --- */
.content-wrapper {
    background: var(--apple-bg);
    min-height: 50vh;
    padding-top: 40px;
    position: relative;
}

.read-time {
    position: fixed;
    /* Clear notched-phone top insets. max() ensures desktop stays at 78px. */
    top: max(78px, calc(env(safe-area-inset-top) + 60px));
    right: max(24px, env(safe-area-inset-right));
    z-index: 98;
    background: rgba(50, 50, 50, 0.85);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.read-time.scrolled {
    opacity: 0;
}
.last-updated {
    position: absolute;
    top: 48px;
    left: 24px;
    font-size: 11px;
    font-weight: 400;
    color: #b0b0b5;
    letter-spacing: 0.3px;
    font-family: var(--font-family);
}
@media (max-width: 600px) {
    .last-updated {
        display: none;
    }
}

.intro-box {
    padding: 60px 20px;
    /* Respect notched-phone safe areas so titles don't hug the bezel */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    text-align: center;
}

.story-text {
    /* Fluid: 1.05rem at narrow widths up to 1.25rem at desktop. Replaces the
       mobile-specific override further down so there's one fluid scale
       instead of a step at 600px. */
    font-size: clamp(1.05rem, 0.9rem + 0.6vw, 1.25rem);
    line-height: 1.8;
    color: #424245;
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Dark-mode override: the hardcoded #424245 above is dark-on-white in
   light mode (correct) but dark-on-dark in dark mode (basically
   invisible). Lift it to a near-white that's slightly muted, so body
   prose reads easily without competing with full-bright headings. */
[data-theme="dark"] .story-text {
    color: rgba(255, 255, 255, 0.86);
}

.story-text a,
.inline-link {
    color: var(--apple-accent);
    text-decoration: none;
    position: relative;
    transition: all 0.2s ease;
}

.story-text a:hover,
.inline-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* --- Reveal on Scroll --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Image Containers --- */
.image-container {
    position: relative;
}

.image-caption {
    position: absolute;
    bottom: 20px;
    left: 16px;
    color: rgba(255, 255, 255, 0.85);
    /* Fluid: 0.85rem at narrow widths up to 1rem at desktop. */
    font-size: clamp(0.85rem, 0.8rem + 0.4vw, 1rem);
    font-family: 'Inter', sans-serif;
    background: rgba(0, 0, 0, 0.6);
    padding: 5px 14px;
    border-radius: 99px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* --- Luxury Next Link Block --- */
.luxury-next-tile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #2a1f0e 0%, #1e2a3a 100%);
    border: 1px solid rgba(255, 179, 64, 0.15);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
}

.luxury-next-tile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at right center, rgba(255, 179, 64, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.luxury-next-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(40, 30, 10, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 179, 64, 0.35);
}

.luxury-next-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    z-index: 1;
}

.luxury-next-text-group {
    display: flex;
    flex-direction: column;
}

.luxury-next-label {
    color: #ffb340;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
    font-weight: 500;
}

.luxury-next-title {
    color: #ffffff;
    font-size: 26px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.luxury-next-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    margin-top: 4px;
}

.luxury-next-arrow {
    color: #ffb340;
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 1;
}

.luxury-next-tile:hover .luxury-next-arrow {
    transform: translateX(8px);
    color: #ffffff;
}

/* --- Fiber Animation (Next Link) --- */
.fiber-container {
    flex-grow: 1;
    height: 48px;
    margin: 0 40px;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
}

.fiber-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.fiber-base {
    stroke: rgba(255, 179, 64, 0.08);
    stroke-width: 1px;
    fill: none;
}

.fiber-path {
    fill: none;
    stroke-linecap: round;
    animation: fiberFlow linear infinite;
}

.fiber-path-1 {
    stroke: #ff9500;
    stroke-width: 2px;
    stroke-dasharray: 40 60;
    animation-duration: 8s;
    opacity: 0.7;
    filter: drop-shadow(0 0 6px #ff9500);
}

.fiber-path-2 {
    stroke: #ffb340;
    stroke-width: 1.5px;
    stroke-dasharray: 25 75;
    animation-duration: 12s;
    opacity: 0.7;
    filter: drop-shadow(0 0 8px #ffb340);
}

.fiber-path-3 {
    stroke: #e07800;
    stroke-width: 2.5px;
    stroke-dasharray: 60 40;
    animation-duration: 10s;
    opacity: 0.5;
    filter: drop-shadow(0 0 10px #e07800);
}

.fiber-path-4 {
    stroke: #ffe0a0;
    stroke-width: 1px;
    stroke-dasharray: 15 85;
    animation-duration: 14s;
    opacity: 0.8;
    filter: drop-shadow(0 0 4px #ffe0a0);
}

@keyframes fiberFlow {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 0; }
}

.dust-particle {
    position: absolute;
    background: #ffcc80;
    border-radius: 50%;
    filter: blur(1px);
    opacity: 0;
    animation: floatDust linear infinite;
}

@keyframes floatDust {
    0% { transform: translate(0, 0); opacity: 0; }
    20% { opacity: 0.4; }
    80% { opacity: 0.4; }
    100% { transform: translate(30px, -15px); opacity: 0; }
}

/* --- Shared Utility Styles --- */
.inline-link {
    color: var(--apple-accent);
    text-decoration: none;
}

/* Search Results */
.search-result-item:hover {
    background-color: var(--section-bg);
}

/* Single highlight rule used by both the in-dialog snippet (rendered
   by SearchDialog.razor) and the on-page landing highlight (injected
   by index.html's highlightSearchTerm when navigating with ?h=...).
   One class, one look, one source of truth. */
.search-highlight {
    color: #ff8f1f;
    font-weight: 800;
    background-color: rgba(255, 143, 31, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

/* Breadcrumb */
.breadcrumb-nav a:hover {
    color: var(--apple-accent);
    text-decoration: none;
}

/* --- Dark Tiles --- */
/* Utility classes extracted from repeated inline styles (maintainability;
   render is pixel-identical). `.fw-600` replaces ~1500 inline copies of
   `style="font-weight: 600;"` on section/card headings; the `.now-hero-*`
   pair is the per-page <h2> title / <h5> subtitle on every "The Now" page.
   !important preserves the old behaviour exactly - an inline style always
   beat MudBlazor's own typography rules, so the utility must too. */
.fw-600 {
    font-weight: 600 !important;
}

.fw-700 {
    font-weight: 700 !important;
}

.story-img {
    width: 100% !important;
    border-radius: 12px !important;
}

.now-hero-title {
    font-weight: 700 !important;
    color: var(--apple-text, #1d1d1f) !important;
    margin-bottom: 12px !important;
}

.now-hero-subtitle {
    font-weight: 400 !important;
    color: var(--text-secondary) !important;
    line-height: 1.45 !important;
    margin-bottom: 48px !important;
}

.dark-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0;
    border-radius: 20px;
    background-color: #111111;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 240px;
    overflow: hidden;
    overflow: hidden;
}

.dark-tile:hover {
    transform: translateY(-6px);
    background-color: #1a1a1c;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2), 0 0 16px var(--accent-glow);
    border-color: rgba(255, 149, 0, 0.2);
}

.dark-tile .mud-typography {
    color: inherit !important;
}

.tile-image-wrapper {
    width: 100%;
    height: 140px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
}

.tile-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.dark-tile:hover .tile-image-wrapper img {
    transform: scale(1.05);
}

.dark-tile-content {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    align-items: flex-start;
}

.tile-title {
    font-weight: 600 !important;
    margin-bottom: 8px;
    color: #ffffff !important;
}

.tile-desc {
    color: var(--text-secondary) !important;
    line-height: 1.4;
}

/* --- Footer --- */
.luxury-footer-static {
    position: relative;
    overflow: hidden;
    padding-top: 40px;
    padding-bottom: 60px;
    background: transparent;
    min-height: 160px;
}

.footer-divider {
    border-color: rgba(255, 179, 64, 0.1) !important;
}

/* --- Project Card (About page) --- */
.project-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #1b1e2e 0%, #2d324d 100%);
    border: 1px solid rgba(138, 180, 248, 0.15);
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 1px 1px rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at right center, rgba(0, 113, 227, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(27, 30, 46, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.12);
    border-color: rgba(138, 180, 248, 0.3);
}

.project-card-content {
    z-index: 1;
}

.project-card .mud-typography {
    color: inherit !important;
}

/* --- Blazor Error UI --- */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* --- Mobile Responsive --- */
@media (max-width: 600px) {
    .apple-card {
        height: 320px;
    }

    .dark-tile {
        min-height: 180px;
    }

    .intro-box {
        padding: 30px 12px;
    }

    .intro-box .mud-typography-h1 {
        font-size: clamp(1.6rem, 7vw, 2.5rem) !important;
    }

    .intro-box .mud-typography-h4 {
        font-size: clamp(0.95rem, 3.5vw, 1.25rem) !important;
    }

    /* story-text font-size now handled by the fluid clamp() in the base rule. */

    .luxury-next-title {
        font-size: 18px;
    }

    .luxury-next-tile {
        padding: 16px;
    }

    .fiber-container {
        display: none;
    }

    .read-time {
        top: max(68px, calc(env(safe-area-inset-top) + 50px));
        right: max(12px, env(safe-area-inset-right));
    }
}

/* ── Break Room ──────────────────────────────────────────────────────── */
/* Cards always dark to match /topics, same visual language */
.breakroom-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    border-radius: 20px;
    background-color: #111111;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 300px;
    overflow: hidden;
    cursor: pointer;
}
.breakroom-card:hover {
    transform: translateY(-6px);
    background-color: #1a1a1c;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25), 0 0 24px rgba(255, 149, 0, 0.08);
}
.breakroom-card .mud-typography {
    color: inherit !important;
}
.breakroom-card-image {
    position: relative;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background-color: #000000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}
.breakroom-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: radial-gradient(ellipse at center, #2e1a0a 0%, #000000 70%);
    display: block;
    transition: transform 0.4s ease;
}
.breakroom-card:hover .breakroom-card-image img {
    transform: scale(1.05);
}
.breakroom-card-emoji {
    font-size: 60px;
    line-height: 1;
}
.breakroom-card-content {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    color: #ffffff;
}
.breakroom-card-title {
    font-weight: 600 !important;
    margin-bottom: 8px !important;
    color: #ffffff !important;
}
.breakroom-card-desc {
    color: var(--text-secondary) !important;
    line-height: 1.4 !important;
    font-size: 13px !important;
}
.breakroom-card-hs {
    color: var(--apple-accent) !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    margin-top: 10px !important;
    display: block !important;
    letter-spacing: 0.3px;
}

/* Nav joystick icon */
.apple-nav-link.breakroom-nav {
    font-size: 18px !important;
    opacity: 0.7;
    padding: 0 4px;
    transition: opacity 0.2s, transform 0.2s;
}
.apple-nav-link.breakroom-nav:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Fullscreen game overlay - theme-aware */
:root, [data-theme="light"] {
    --breakroom-overlay-bg: #f5f5f7;
    --breakroom-overlay-canvas-bg: #fafafa;
    --breakroom-header-bg: rgba(255, 255, 255, 0.92);
    --breakroom-header-border: rgba(0, 0, 0, 0.08);
    --breakroom-header-text: #1d1d1f;
    --breakroom-close-hover: rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] {
    --breakroom-overlay-bg: #000;
    --breakroom-overlay-canvas-bg: #000;
    --breakroom-header-bg: rgba(18, 18, 22, 0.95);
    --breakroom-header-border: rgba(255, 149, 0, 0.15);
    --breakroom-header-text: #f0f0f0;
    --breakroom-close-hover: rgba(255, 255, 255, 0.1);
}

.breakroom-overlay {
    /* Break Room is always dark themed, regardless of the site's [data-theme].
       Override the breakroom theme variables locally so chrome (header, banner,
       canvas bg) matches the dark game scene that getTheme() forces. */
    --breakroom-overlay-bg: #000;
    --breakroom-overlay-canvas-bg: #000;
    --breakroom-header-bg: rgba(18, 18, 22, 0.95);
    --breakroom-header-border: rgba(255, 149, 0, 0.15);
    --breakroom-header-text: #f0f0f0;
    --breakroom-close-hover: rgba(255, 255, 255, 0.1);

    /* Pinned to viewport with explicit dimensions. position:fixed alone isn't
       reliable here: an ancestor in MainLayout (likely a MudBlazor wrapper
       with a transform/filter) creates a containing block, making "top:0;
       bottom:0" span the parent (MudMainContent + footer) instead of the
       viewport. Explicit 100vw/100vh + overflow:hidden bypasses that and
       guarantees the canvas can't exceed viewport bounds. */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 10001;
    background: var(--breakroom-overlay-bg);
    display: flex;
    flex-direction: column;
}
.breakroom-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--breakroom-header-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--breakroom-header-border);
    height: 44px;
    flex-shrink: 0;
}
.breakroom-overlay-title {
    color: var(--breakroom-header-text);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}
.breakroom-score {
    color: var(--apple-accent);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', monospace;
    letter-spacing: 0.5px;
}
.breakroom-close-btn {
    background: none;
    border: none;
    color: var(--breakroom-header-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.breakroom-close-btn:hover {
    background: var(--breakroom-close-hover);
}
.breakroom-overlay canvas {
    /* min-height: 0 is critical here. <canvas> has an intrinsic aspect ratio
       from its width/height attributes; without min-height: 0 the browser
       refuses to shrink it below that aspect-derived natural height, even
       inside a flex column. Result: canvas overflows the overlay vertically
       and Babylon scales game pieces for the larger area. */
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    touch-action: none;
    outline: none;
    background: var(--breakroom-overlay-canvas-bg);
}

/* Mobile-only "designed for tablets/desktops" notice. Hidden at >= 768px so
   only phone users see it. Sits between the overlay header and the canvas
   inside .breakroom-overlay. White text on a rich green background so it
   reads clearly in both light and dark themes. */
.mobile-game-banner {
    display: none;
}
@media (max-width: 767px) {
    .mobile-game-banner {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 8px 12px 4px;
        padding: 10px 14px;
        background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
        border-radius: 10px;
        color: #ffffff;
        font-family: Inter, sans-serif;
        font-size: 12.5px;
        line-height: 1.35;
        font-weight: 500;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
    }
    .mobile-game-banner-icon {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.25);
        color: #ffffff;
        font-weight: 700;
        font-style: italic;
        font-family: Georgia, serif;
        font-size: 13px;
    }
    .mobile-game-banner-text {
        flex: 1;
    }
    /* Dark theme: same green brand but slightly deeper so it doesn't glare
       against a dark page. White text reads just as well. */
    [data-theme="dark"] .mobile-game-banner {
        background: linear-gradient(135deg, #14532d 0%, #166534 100%);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }
}

/* Hide canvases on unsupported (no-WebGL2) devices - the breakroom games
   require WebGL2. Without this, broken/empty canvases show instead. */
.no-webgl .breakroom-overlay canvas { display: none !important; }
