/* QuickiePlay Design System - Original Simple Version */

/* Self-hosted app-shell fonts keep the PWA typography and ligature icons
   stable even when external font CDNs are blocked or unavailable. */
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-cyrillic-ext-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-vietnamese-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-ext-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-cyrillic-ext-wght-italic.woff2') format('woff2-variations');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-vietnamese-wght-italic.woff2') format('woff2-variations');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-ext-wght-italic.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: italic;
    font-display: swap;
    font-weight: 200 800;
    src: url('/public/fonts/plus-jakarta-sans/plus-jakarta-sans-latin-wght-italic.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Varela Round';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('/public/fonts/varela-round/varela-round-hebrew-400-normal.woff2') format('woff2');
    unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

@font-face {
    font-family: 'Varela Round';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('/public/fonts/varela-round/varela-round-vietnamese-400-normal.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

@font-face {
    font-family: 'Varela Round';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('/public/fonts/varela-round/varela-round-latin-ext-400-normal.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Varela Round';
    font-style: normal;
    font-display: swap;
    font-weight: 400;
    src: url('/public/fonts/varela-round/varela-round-latin-400-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/public/fonts/material-symbols/material-symbols-outlined.subset.woff2') format('woff2');
}

/* ─── Material Symbols: prevent ligature-text flash during font load ─────────
   The Google Fonts CSS for Material Symbols is loaded asynchronously (non-
   blocking). During the gap between DOM render and CSS application, spans with
   class="material-symbols-outlined" have no font-family set and their text
   content ("notifications", "close", etc.) renders as plain text.

   Fix: pre-declare the class here (applied immediately from this synchronous
   stylesheet) with font-family set and visibility:hidden. The inline script in
   index.html adds html.icons-ready once document.fonts confirms the font has
   loaded, which lifts the hidden state. A 3-second timeout ensures icons are
   always revealed even if the font fails to load.
   ─────────────────────────────────────────────────────────────────────────── */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    /* Hide until font is ready — prevents raw text from briefly showing */
    visibility: hidden;
}

html .material-symbols-outlined {
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    min-width: 1em;
    max-width: 1em;
    overflow: hidden;
    flex: none;
    visibility: visible;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'liga';
}

:root {
    --app-height: 100dvh;
    --qp-content-safe-top: env(safe-area-inset-top);
    --qp-content-safe-bottom: env(safe-area-inset-bottom);
    /* Core QuickiePlay palette */
    --color-brand: #10B981;
    --color-brand-active: #059669;
    --color-brand-play: #7C3AED;
    --color-bg-base: #F9FAFB;
    --color-surface: #FFFFFF;
    --color-surface-alt: #F3F4F6;
    --color-text-primary: #111827;
    --color-text-secondary: #6B7280;
    --color-text-tertiary: #9CA3AF;
    --color-border: #E5E7EB;
    --color-success: #10B981;
    --color-info: #2563EB;
    --color-warning: #D97706;
    --color-error: #DC2626;

    /* Typography: strict sans serif with Noto first emoji fallback order */
    --font-display: 'Plus Jakarta Sans', 'Noto Color Emoji', 'Apple Color Emoji', emoji, sans-serif;
    --font-body: 'Plus Jakarta Sans', 'Noto Color Emoji', 'Apple Color Emoji', emoji, sans-serif;

    /* Spacing */
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;

    /* Shadows */
    --shadow-button: none;
    --shadow-panel: none;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Ink (Legacy/Optional) kept for compatibility but neutralized */
    --color-paper-bg: #000000;
    --color-paper-shadow: #111111;
    --color-ink-primary: #FFFFFF;
    --color-ink-wash: rgba(255, 255, 255, 0.1);
    --font-handwritten: 'Plus Jakarta Sans', 'Noto Color Emoji', 'Apple Color Emoji', emoji, sans-serif;
    /* Override handwritten */
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    min-height: var(--app-height);
    width: 100%;
    font-family: var(--font-body);
    background-color: #F9FAFB !important;
    /* Forced Subtle White (#F9FAFB) */
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    overscroll-behavior: none;
    user-select: none;
}

body:not(.game-mode) {
    --qp-content-safe-top: 0px;
}

body.game-mode {
    --qp-content-safe-top: env(safe-area-inset-top);
}

body.game-mode,
body.game-mode #app,
body.game-mode #main-view,
body.game-mode #main-view * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

body.game-mode #main-view::selection,
body.game-mode #main-view *::selection {
    background-color: transparent !important;
    color: inherit !important;
}

body.game-mode #main-view::-moz-selection,
body.game-mode #main-view *::-moz-selection {
    background-color: transparent !important;
    color: inherit !important;
}

.qp-timer-flash-red {
    color: #DC2626 !important;
    animation: qpTimerFlashRed 0.72s steps(2, end) infinite;
}

@keyframes qpTimerFlashRed {
    0%,
    48% {
        color: #DC2626;
        opacity: 1;
        text-shadow: 0 0 14px rgba(220, 38, 38, 0.34);
    }

    49%,
    100% {
        color: #991B1B;
        opacity: 0.48;
        text-shadow: 0 0 4px rgba(153, 27, 27, 0.2);
    }
}

@media (prefers-reduced-motion: reduce) {
    .qp-timer-flash-red {
        animation: none;
        color: #DC2626 !important;
        text-shadow: 0 0 10px rgba(220, 38, 38, 0.28);
    }
}

/* Floating Background Emojis */
.emoji-float {
    position: fixed;
    font-size: 4rem;
    opacity: 0.15;
    animation: float 10s infinite ease-in-out;
    pointer-events: none;
    filter: grayscale(100%);
    z-index: 1;
    /* Above desktop branding but behind app content */
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-20px);
    }
}

/* Custom/* Text Selection - Highest Priority */
::selection {
    background-color: #BFDBFE !important;
    color: #1E293B !important;
}

::-moz-selection {
    background-color: #BFDBFE !important;
    color: #1E293B !important;
}

/* Layout */
#app {
    display: flex;
    flex-direction: column;
    height: var(--app-height);
    min-height: var(--app-height);
    max-width: 100%;
    /* Changed from 600px for mobile native support */
    width: 100%;
    /* Ensure full width */
    margin: 0 auto;
    background-color: var(--color-bg-base);
    box-shadow: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
    /* aspect-ratio: 9/19.5; REMOVED: Managed by PhoneWrapper for desktop */
}

html.standalone-pwa,
html.standalone-pwa body {
    height: var(--app-height);
    min-height: var(--app-height);
    background-color: var(--color-bg-base) !important;
}

html.standalone-pwa #app {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: var(--app-height) !important;
    min-height: var(--app-height) !important;
}

/* Tablet / "Pad" Mode Constraints */
@media (min-width: 600px) and (max-width: 1099px) {
    #app {
        max-width: 600px;
        /* Constrain width so it doesn't look stretched */
        border-left: 1px solid var(--color-border);
        border-right: 1px solid var(--color-border);
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6,
p {
    margin: 0;
}

/* Game View Reset */
.game-view {
    overflow: hidden !important;
    height: 100%;
    width: 100%;
    position: relative;
    touch-action: none;
    /* Prevent scroll on mobile */
}

/* Global Game Mode Header Hide (Enforced) */
body.game-mode #global-header-container {
    display: none !important;
}

#global-header-container {
    position: relative;
    z-index: 50;
    /* Ensure it stays above #main-view (z-index: 10) so the shadow isn't cropped */
}

/* Global Header */
.global-header {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-top: calc(16px + constant(safe-area-inset-top));
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: 1.5rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    background: white;
    border-bottom: none !important;
    box-shadow: 0 4px 12px -1px rgba(0, 0, 0, 0.12), 0 2px 6px -1px rgba(0, 0, 0, 0.08) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease;
}

/* Clear the notch in desktop/phone-case mode */
/* Clear the notch in desktop/phone-case mode */
.is-desktop-mode .global-header {
    padding-top: 32px !important;
    padding-bottom: 24px !important;
    padding-left: 32px !important;
    padding-right: 32px !important;
}

/* Game Active State: Force Full Viewport (but keep header visible) */
body.game-active #app {
    height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}

html.standalone-pwa body.game-active #app {
    top: 0;
    bottom: 0;
    height: auto !important;
    min-height: 0 !important;
}

html.standalone-pwa body.game-active {
    background: var(--qp-game-active-bg, var(--color-bg-base)) !important;
}

/* Game Playing State: Hide Header Only During Active Gameplay */
body.game-playing .global-header {
    transform: translateY(-100%);
}

/* Global Game Mode Header Hide (Enforced) */
body.game-mode #global-header-container {
    display: none !important;
}

/* Fullscreen Immersion Mode: For short high-focus game rounds */
body.fullscreen-immersion .global-header {
    display: none !important;
}

body.fullscreen-immersion #app {
    margin-top: -44px;
    height: calc(100vh + 44px) !important;
}

/* Ensure 3D canvas stays positioned correctly during fullscreen immersion */
body.fullscreen-immersion #threejs-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Canvas element within threejs-container should fill parent */
body.fullscreen-immersion #threejs-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Remove padding-top from viewport only when actively playing */
body.game-playing #app {
    padding-top: 0 !important;
}

/* Type or Die specific viewport lock */
.type-or-die-container {
    overflow: hidden !important;
    height: 100% !important;
    width: 100% !important;
    position: absolute !important;
    top: 0;
    left: 0;
    z-index: 100;
    background-color: black;
    /* Ensure notch blends */
}

body.game-playing .type-or-die-container {
    margin-top: -45px;
    /* Force into notch area */
    height: calc(100% + 45px) !important;
}

/* Notch Removal Utility */
.notch-removal {
    margin-top: calc(-1 * env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    /* Optional: add padding if we want content safe but background extended */
}

/* Components */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--color-brand);
    /* Subtle border for definition */
    border-radius: 0px;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background-color: var(--color-brand);
    color: #FFFFFF;
}

.btn:active {
    transform: translateY(1px);
    background-color: var(--color-brand-active);
    border-color: var(--color-brand-active);
}

.genre-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #FFFFFF;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.featured-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    color: #111827;
    padding: 2px 6px;
    border-radius: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    letter-spacing: 0.04em;
    white-space: nowrap;
    background: #FACC15;
}

.bg-poly-bg {
    background-color: var(--color-brand);
    color: white;
    border: 1px solid var(--color-brand-active);
}

.btn-primary {
    background-color: var(--color-brand);
    color: white;
    border: 1px solid var(--color-brand-active);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:active {
    background-color: var(--color-surface-alt);
    border-color: var(--color-border);
}

/* Transmission Note - Notch Guard */
.transmission-note {
    padding-top: env(safe-area-inset-bottom);
    padding-bottom: 24px;
    /* Ensure space from bottom edge */
    width: 100%;
    background-color: var(--color-bg-base);
    border-top: 1px solid var(--color-border);
}

/* View Wrapper */
.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    overflow-y: auto;
    animation: fadeIn 0.2s ease-out;
    position: relative;
    z-index: 1;
}

/* Scrollbar Hide */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Simple Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: slideUp 0.3s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.animate-pop {
    animation: pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.animate-shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* Loading Spinner Styles */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.loading-spinner {
    border-style: solid;
    border-color: transparent;
    border-top-color: currentColor;
}

.loading-spinner-overlay {
    backdrop-filter: blur(4px);
}

.loading-spinner-inline {
    min-height: 2rem;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Carousel Utilities */
.snap-center {
    scroll-snap-align: center;
}

.snap-x {
    scroll-snap-type: x mandatory;
}

/* Device Frame & Desktop Mode */
.is-desktop-mode {
    /* Background removed to allow body background to show branding */
    /* background-color: #FFFFFF !important; */
    /* Outside frame: Solid White */
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

/* Desktop Branding */
.desktop-branding {
    position: fixed;
    top: 50%;
    left: 100px;
    transform: translateY(-50%);
    z-index: 20;
    font-family: var(--font-display);
    pointer-events: none;
    opacity: 0.88;
}

/* Responsive Branding - Hide below 1100px */
@media (max-width: 1100px) {
    .desktop-branding {
        display: none !important;
    }
}

.brand-title {
    color: #4B5563;
    /* Slate Gray for high visibility on white */
    font-weight: 800;
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.brand-tagline {
    color: #6B7280;
    font-weight: 400;
    font-size: 16px;
}

/* Global Notch Suppression - Maintenance of "Infinity Display" look */
.notch,
.phone-notch,
.speaker-grille {
    display: none !important;
}

#phone-wrapper {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#phone-wrapper.hidden {
    display: none !important;
}

.device-frame {
    width: clamp(320px, 90vw, 400px);
    aspect-ratio: 9 / 19.5;
    /* iPhone Aspect Ratio */
    background: #000000;
    /* Hardware Black */
    position: relative;
    padding: 12px;
    /* Thicker bezel for premium hardware feel */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.025);
    /* Premium depth shadow */
    border: 2px solid #1a1a1a;
    /* Subtle metallic edge */
    border-radius: 54px;
    /* Matches iPhone radius */
    pointer-events: auto;
    z-index: 10;
    overflow: hidden;
}

.phone-screen {
    width: 100%;
    height: 100%;
    background: #F9FAFB;
    /* Inside: Subtle White */
    overflow: hidden;
    position: relative;
    border-radius: 42px;
    /* Screen corner rounding inside bezel */
}

/* Non game screens need a small inset so bordered cards do not visually merge with the bezel */
.is-desktop-mode:not(.game-mode) .phone-screen {
    padding: 6px;
    box-sizing: border-box;
}

/* Override #app when inside device frame */
.is-desktop-mode #app {
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    max-width: 100% !important;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    position: relative;
    aspect-ratio: auto !important;
}

.is-desktop-mode:not(.game-mode) #app {
    border-radius: 36px;
    background-color: #F9FAFB;
}

.phone-notch,
.notch {
    display: none !important;
}

.phone-chin {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    z-index: 1000;
    pointer-events: none;
}

.phone-reflection {
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.03) 100%);
    pointer-events: none;
    border-radius: 42px;
    z-index: 60;
}

.desktop-bg-hint {
    position: absolute;
    left: 50%;
    top: 15%;
    transform: translateX(-50%);
    z-index: 0;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    white-space: nowrap;
}

.desktop-bg-hint.is-hidden {
    /* Logic disabled */
    opacity: 1;
    visibility: visible;
}

/* Notification Item Hover Effects */
.notification-item {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.notification-item:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

@keyframes bounceSlight {

    0%,
    100% {
        transform: translate(-50%, -25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }

    50% {
        transform: translate(-50%, 0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* Note: modified translate to include X centering for the toast */
.animate-bounce-slight {
    animation: bounceSlight 1s infinite;
}

/* Slim Scrollbar Styles */
.slim-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.slim-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.slim-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.slim-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Firefox */
.slim-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

/* Slot Machine Animation Styles */
.slot-machine-container {
    overflow: hidden;
    position: relative;
}

.slot-machine-emoji {
    animation: slotMachineBlur 1.5s ease-out;
}

.slot-machine-username {
    animation: slotMachineBlur 1.5s ease-out;
}

@keyframes slotMachineBlur {
    0% {
        filter: blur(0px);
    }

    15% {
        filter: blur(4px);
    }

    85% {
        filter: blur(4px);
    }

    100% {
        filter: blur(0px);
    }
}

.slot-reveal {
    transition: opacity 0.5s ease-in-out;
}

.vs-text {
    animation: vsPulse 2s ease-in-out infinite;
}

@keyframes vsPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

.host-avatar img {
    animation: fadeInScale 0.6s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 3D Utilities */
.transform-style-3d {
    transform-style: preserve-3d;
}

/* Skeleton Shimmer Animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.animate-shimmer {
    background: linear-gradient(90deg, #EDF2F7 25%, #E2E8F0 50%, #EDF2F7 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

/* --- Ink & Paper Theme Utilities --- */

.font-ink {
    font-family: var(--font-handwritten);
}

/* Paper Texture Overlay */
.paper-texture {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    mix-blend-mode: multiply;
}

/* Dust Particle Animation */
@keyframes floatUp {
    0% {
        transform: translateY(100vh) translateX(0) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 0.6;
    }

    80% {
        opacity: 0.6;
    }

    100% {
        transform: translateY(-20vh) translateX(20px) rotate(180deg);
        opacity: 0;
    }
}

.dust-particle {
    position: absolute;
    background: #000;
    border-radius: 50%;
    opacity: 0.2;
    pointer-events: none;
    animation: floatUp linear infinite;
}

/* Cel-Shaded / Ink Filter logic */
.filter-ink {
    filter: brightness(1.1) contrast(1.2) drop-shadow(0 0 1px rgba(0, 0, 0, 0.8));
}

/* Game Selection Title Standardization */
.selection-title {
    font-family: var(--font-display);
    font-weight: 900;
    color: #FFFFFF;
    line-height: 1.1;
    font-size: 18px;
    letter-spacing: -0.03em;
}

.library-card-skeleton {
    border: 1px solid var(--color-border);
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(243, 244, 246, 0.95), rgba(229, 231, 235, 0.92));
}

.selection-card {
    --selection-card-media-inset: 1px;
    position: relative;
    width: 100%;
    height: 100%;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
}

.selection-card-featured {
    border-width: 3px;
    border-color: #FACC15;
}

.selection-card-new {
    --selection-card-media-inset: 2px;
    border-width: 2px;
    border-color: #F97316;
}

.selection-card-media {
    position: absolute;
    inset: var(--selection-card-media-inset);
    border-radius: calc(24px - var(--selection-card-media-inset));
    overflow: hidden;
}

.selection-card-media img,
.selection-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selection-card-scrim {
    position: absolute;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.18);
    mix-blend-mode: multiply;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.12) 0%, rgba(15, 23, 42, 0.12) 100%),
        linear-gradient(90deg, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0.12) 42%, rgba(15, 23, 42, 0.03) 100%);
}

.selection-card-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding: 24px;
    gap: 10px;
}

.selection-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.72);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.selection-card-players {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.selection-card-players .material-symbols-outlined {
    color: rgba(255, 255, 255, 0.72);
    font-size: 20px;
}

.selection-card-summary {
    max-width: 320px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
}

.selection-card-tag {
    position: absolute;
    top: 12px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: #FACC15;
    color: #111827;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    box-shadow: none;
}

.selection-card-tag-featured {
    background: #FACC15;
    color: #111827;
}

.selection-card-tag.is-new {
    background: #F97316;
    color: #FFFFFF;
}

.selection-card-media-asset {
    --selection-card-media-scale: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(var(--selection-card-media-scale));
    transition: transform 0.5s ease;
}

.selection-card-media-fallback {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(71, 85, 105, 0.72));
}

.selection-card-scrim-spotlight {
    background-color: rgba(15, 23, 42, 0.24);
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.24) 0%, rgba(15, 23, 42, 0.24) 100%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.02) 0%, rgba(15, 23, 42, 0.42) 100%);
}

.selection-card-scrim-weekly {
    background-color: rgba(15, 23, 42, 0.26);
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.58) 0%, rgba(15, 23, 42, 0.34) 48%, rgba(15, 23, 42, 0.14) 100%);
}

.selection-card-scrim-library {
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.14) 0%, rgba(15, 23, 42, 0.14) 100%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.02) 0%, rgba(15, 23, 42, 0.42) 100%);
}

@keyframes shake-screen {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px) rotate(-1deg);
    }

    40% {
        transform: translateX(5px) rotate(1deg);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

.animate-shake-screen {
    animation: shake-screen 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* Orphaned properties causing lint error
/* letter-spacing: -0.02em; */
/* text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); */
/* } */

/* Subtle Scrollbar for Instruction List */
.instruction-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(229, 231, 235, 0.4) transparent;
}

.instruction-list::-webkit-scrollbar {
    width: 4px;
}

.instruction-list::-webkit-scrollbar-track {
    background: transparent;
}

.instruction-list::-webkit-scrollbar-thumb {
    background-color: rgba(229, 231, 235, 0.4);
    /* Light gray with 40% opacity */
    border-radius: 2px;
    border: none;
}

.instruction-list::-webkit-scrollbar-thumb:hover,
.instruction-list::-webkit-scrollbar-thumb:active {
    background-color: rgba(229, 231, 235, 1);
    /* Full opacity during interaction */
}

.how-to-play-step-shot {
    margin-top: 0.9rem;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background: #FFFFFF;
    aspect-ratio: 16 / 10;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.how-to-play-step-shot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.is-desktop-mode .how-to-play-main {
    padding-bottom: 132px !important;
}

.is-desktop-mode .how-to-play-footer {
    bottom: 0 !important;
    padding-top: 10px !important;
    padding-bottom: 0.5rem !important;
}

/* Game Selection Container Flex Fix */
.game-selection-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.game-selection-scroll {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    gap: 18px;
    padding-bottom: max(24px, var(--qp-content-safe-bottom, env(safe-area-inset-bottom)));
}

.spotlight-section,
.weekly-games-section,
.library-stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selection-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.selection-section-heading-weekly {
    position: relative;
}

.selection-section-title {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.spotlight-grid {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
}

.spotlight-card {
    flex: 1 1 0;
    min-width: 0;
    min-height: 164px;
    text-align: left;
}

.spotlight-card-featured {
    --selection-card-media-inset: 2px;
    border-width: 2px;
    border-color: #FACC15;
}

.spotlight-card-new {
    --selection-card-media-inset: 2px;
    border-width: 2px;
    border-color: #F97316;
}

.spotlight-card:hover .selection-card-media-asset,
.weekly-game-card:hover .selection-card-media-asset,
.library-game-card:hover .selection-card-media-asset {
    transform: scale(calc(var(--selection-card-media-scale, 1) * 1.04));
}

.spotlight-card-content {
    justify-content: flex-end;
    gap: 0;
}

.spotlight-title {
    font-size: 20px;
}

.spotlight-summary {
    display: none;
}

.spotlight-card-label {
    position: absolute;
    top: 12px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 82px;
    padding: 0 10px;
    height: 24px;
    border-radius: 999px;
    background: #FACC15;
    color: #111827;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: none;
}

.spotlight-card-new .spotlight-card-label {
    background: #F97316;
    color: #FFFFFF;
}

.weekly-heading-copy {
    display: flex;
    align-items: center;
    gap: 10px;
}

.weekly-heading-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weekly-heading-kicker {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #f97316;
}

.weekly-section-title {
    color: #111827;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.03em;
    text-transform: none;
}

.weekly-action-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

.browse-all-button {
    border: 1px solid rgba(4, 120, 87, 0.24);
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(4, 120, 87, 0.1);
    color: #047857;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.browse-all-button:active {
    transform: scale(0.98);
}

.weekly-help-trigger {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eef2ff;
    color: #4338ca;
    cursor: pointer;
}

.weekly-help-trigger .material-symbols-outlined {
    font-size: 15px;
}

.weekly-help-popover {
    position: absolute;
    top: 32px;
    left: 0;
    width: min(240px, 80vw);
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);
    color: #475569;
    font-size: 11px;
    line-height: 1.45;
    font-weight: 700;
    z-index: 3;
}

.weekly-games-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.weekly-game-card {
    min-height: 192px;
    text-align: left;
    overflow: hidden;
}

.weekly-rank-pill {
    position: absolute;
    top: 50%;
    left: 14px;
    z-index: 2;
    width: 42px;
    height: 42px;
    margin-top: -21px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 900;
    background: linear-gradient(180deg, #111827, #374151);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

.weekly-games-stack .weekly-game-card:nth-child(1) .weekly-rank-pill {
    background: linear-gradient(180deg, #FBBF24, #D97706);
}

.weekly-games-stack .weekly-game-card:nth-child(2) .weekly-rank-pill {
    background: linear-gradient(180deg, #E5E7EB, #6B7280);
    color: #FFFFFF;
}

.weekly-games-stack .weekly-game-card:nth-child(3) .weekly-rank-pill {
    background: linear-gradient(180deg, #F97316, #C2410C);
}

.weekly-card-content {
    position: relative;
    z-index: 1;
    min-height: 192px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 14px 14px 14px 62px;
}

.weekly-game-card-standard .weekly-card-content {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 18px 16px 16px;
}

.weekly-game-card-standard .weekly-copy {
    flex: 1;
}

.weekly-game-card-standard .weekly-title {
    font-size: 18px;
    line-height: 1.04;
}

.weekly-game-card-standard .weekly-tag-wrap {
    padding-right: 0;
}

.weekly-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.weekly-title {
    margin: 0;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.05;
    text-shadow: 0 2px 12px rgba(15, 23, 42, 0.32);
}

.weekly-summary {
    display: none;
}

.weekly-tag-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    padding-right: 8px;
}

.library-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.library-game-card {
    min-height: 192px;
    text-align: left;
}

.library-card-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    min-height: 192px;
    padding: 18px 16px 16px;
}

.library-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.library-tag-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}

.library-title {
    margin: 0;
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.04;
    flex: 1;
    min-width: 0;
}

.library-summary {
    display: none;
}

.library-empty-state {
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    padding: 20px 18px;
}

.library-empty-state h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 900;
    color: var(--color-text-primary);
}

.library-empty-state p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.weekly-heading-main {
    align-items: flex-end;
}

.weekly-games-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.weekly-footer-action {
    display: flex;
    justify-content: center;
    padding: 6px 0 max(96px, calc(72px + var(--qp-content-safe-bottom, env(safe-area-inset-bottom))));
}

.browse-all-button-footer {
    width: 100%;
    min-width: 0;
    padding: 11px 18px;
    border-radius: 14px;
    font-size: 11px;
}

.weekly-game-card {
    min-height: 228px;
    text-align: left;
}

.weekly-card-content {
    position: relative;
    z-index: 1;
    min-height: 228px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 10px;
    padding: 18px;
}

.weekly-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.personal-best-chip {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.54);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.36);
    color: #FFFFFF;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.weekly-title {
    margin: 0;
    color: #FFFFFF;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.02;
    text-shadow: 0 2px 12px rgba(15, 23, 42, 0.32);
}

.weekly-summary {
    display: block;
    max-width: 92%;
    margin: 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.weekly-tag-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
    padding-right: 0;
}

.new-game-tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #C2410C;
    color: #FFFFFF;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.library-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.library-game-card {
    min-height: 228px;
    text-align: left;
}

.library-card-content {
    position: relative;
    z-index: 1;
    min-height: 228px;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 18px;
}

.library-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    width: 100%;
}

.library-title-wrap {
    min-width: 0;
}

.library-title {
    margin: 0;
    color: #FFFFFF;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.04;
}

.library-meta,
.library-rotation-note,
.library-summary {
    margin: 3px 0 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}

.library-summary {
    max-width: 100%;
    color: rgba(255, 255, 255, 0.84);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.library-rotation-note {
    display: none;
    color: rgba(255, 255, 255, 0.66);
}

.library-tag-wrap {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
}

@media (max-width: 420px) {
    .library-grid {
        gap: 10px;
    }

    .library-game-card {
        min-height: 216px;
    }

    .library-card-content {
        min-height: 216px;
    }

    .spotlight-card,
    .weekly-game-card,
    .weekly-card-content {
        min-height: 216px;
    }

    .weekly-title {
        font-size: 22px;
    }

    .weekly-summary {
        max-width: 100%;
    }
}

.invitation-link-box {
    background: #F1F5F9;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 2px solid #E2E8F0;
    font-size: 0.75rem;
    color: #64748B;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    word-break: break-all;
    text-align: center;
}

/* Neutral Background for Desktop Mode - MATCHED TO REFERENCE */
.is-desktop-mode {
    background-color: var(--color-bg-base) !important;
}

/* Safe Area Bottom Padding (32px above gesture bar) */
.safe-area-bottom {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

/* --- Breach Protocol Glitch Effects --- */
@keyframes breach-jitter {
    0% {
        transform: translate(0, 0);
    }

    25% {
        transform: translate(-2px, 2px);
    }

    50% {
        transform: translate(2px, -2px);
    }

    75% {
        transform: translate(-2px, -2px);
    }

    100% {
        transform: translate(0, 0);
    }
}

.breach-glitch {
    animation: breach-jitter 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite both;
    color: #ff003c !important;
    /* Cyberpunk Red */
    text-shadow: 2px 0 #00E676, -2px 0 #EF4444;
}

/* Waiting Text Active Ellipsis */
.waiting-text::after {
    content: '.';
    animation: ellipsis-dots 1.5s infinite steps(3, end);
    display: inline-block;
    width: 1em;
    /* Allocate space to prevent layout shift */
    text-align: left;
}

@keyframes ellipsis-dots {

    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60% {
        content: '...';
    }

    80%,
    100% {
        content: '';
    }
}

/* --- Wurdgrid Tactile Physics Animations --- */

/* Heavy Drop Animation: Fast descent with subtle bounce/overshoot */
@keyframes heavyDrop {
    0% {
        transform: translateY(-100%);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Time-Tile Landing Pulse: 1.1x scale pulse to highlight availability */
@keyframes timeTilePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* Utility class for heavy drop with bounce easing */
.animate-heavy-drop {
    animation: heavyDrop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Utility class for Time-Tile pulse */
.animate-time-tile-pulse {
    animation: timeTilePulse 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Time-Tile Expiration Warning Pulse (Yellow to Gray blend) */
@keyframes expirePulse {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: grayscale(0%);
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
        filter: grayscale(80%);
        /* Subtle grayscale hint */
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: grayscale(0%);
    }
}

.animate-expire-pulse {
    animation: expirePulse 2s ease-in-out infinite;
}

/* Crown Tile Glow Animation */
@keyframes crownTileGlow {
    0% {
        box-shadow: 0 0 0 0px rgba(236, 72, 153, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 12px 4px rgba(236, 72, 153, 0.3);
        transform: scale(1.02);
    }

    100% {
        box-shadow: 0 0 0 0px rgba(236, 72, 153, 0);
        transform: scale(1);
    }
}

.animate-crown-glow {
    animation: crownTileGlow 2s ease-in-out infinite;
}

/* Winner Bounce Animation */
/* Valentine Invitation Text Highlighting */
.text-valentine-you {
    color: #6B7280;
    /* Much Softer Grey (Slate 500) */
    font-weight: 800;
}

.text-valentine-them {
    color: #6B7280;
    /* Much Softer Grey (Slate 500) */
    font-weight: 800;
}

/* Avatar Loading State */
.avatar-loading {
    opacity: 0.6;
    animation: avatar-shimmer 1.5s ease-in-out infinite;
}

@keyframes avatar-shimmer {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.8;
    }
}

/* Results Screen Animations */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-up {
    animation: scaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bounceSubtle {

    0%,
    100% {
        transform: translate(-50%, 0);
    }

    50% {
        transform: translate(-50%, -10px);
    }
}

.animate-bounce-subtle {
    animation: bounceSubtle 2s infinite ease-in-out;
}

/* Hide iOS Safari Video Play Button Overlay */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-start-playback-button {
    display: none !important;
    -webkit-appearance: none;
}
