/* ==========================================================================
   Jigsaw Puzzle - Modern Premium Glassmorphic Theme
   ========================================================================== */

:root {
    --bg-dark: #070913;
    --bg-surface: rgba(17, 24, 39, 0.85);
    --bg-surface-elevated: rgba(30, 41, 59, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-glass-hover: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at 50% 10%, #1e1b4b 0%, #090d16 50%, #04060a 100%);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* App Container */
#app-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* ==========================================================================
   Screen Transitions
   ========================================================================== */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.35s ease;
    z-index: 1;
}

.screen.active {
    display: flex;
    opacity: 1;
    z-index: 10;
}

/* ==========================================================================
   1. SETUP SCREEN
   ========================================================================== */
#setup-screen {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-y: auto;
    padding: 1.25rem 2rem;
    width: 100%;
    max-width: 100vw;
}

.setup-wrapper {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
}

/* Header & Top Bar */
.setup-header {
    position: relative;
    text-align: center;
    min-height: 135px;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-auth-widget {
    position: static;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
}

.btn-auth {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
}

.btn-auth:hover {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.user-badge {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-badge:hover,
.user-badge.clickable:hover {
    background: rgba(16, 185, 129, 0.28);
    border-color: rgba(52, 211, 153, 0.7);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

.user-badge:active,
.user-badge.clickable:active {
    transform: translateY(0) scale(0.97);
}

.user-badge .user-avatar-sm {
    transition: transform 0.2s ease, filter 0.2s ease;
}

.user-badge:hover .user-avatar-sm {
    transform: scale(1.08);
    filter: drop-shadow(0 0 6px rgba(52, 211, 153, 0.8));
}

.user-badge-ppm {
    font-size: 0.72rem;
    background: rgba(6, 182, 212, 0.25);
    color: #38bdf8;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.user-badge-hint {
    font-size: 0.75rem;
    opacity: 0.65;
    transition: transform 0.25s ease, opacity 0.25s ease;
    display: inline-flex;
    align-items: center;
}

.user-badge:hover .user-badge-hint {
    opacity: 1;
    transform: rotate(45deg) scale(1.1);
}

.btn-auth-action {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-auth-action:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.brand-logo-container {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), filter 0.25s ease;
}

.brand-logo-container:hover {
    transform: translateY(-50%) scale(1.04);
}

.brand-logo-img {
    height: 160px;
    width: 160px;
    max-width: 160px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    filter: drop-shadow(0 0 24px rgba(99, 102, 241, 0.65)) drop-shadow(0 0 10px rgba(6, 182, 212, 0.65));
    border: 2px solid rgba(99, 102, 241, 0.45);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.75);
}

.header-center-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 175px;
}

.setup-title {
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 50%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.35rem;
}

/* Auth CTA Under Main Title */
.header-auth-cta-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.4rem auto 0.75rem auto;
}

.btn-hero-auth {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.35rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
    border: 1px solid rgba(99, 102, 241, 0.45);
    border-radius: var(--radius-full);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.btn-hero-auth:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(6, 182, 212, 0.45));
    border-color: rgba(6, 182, 212, 0.8);
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.4), 0 4px 20px rgba(99, 102, 241, 0.4);
    transform: translateY(-2px);
}

.btn-hero-icon {
    font-size: 1.05rem;
}

.btn-hero-arrow {
    font-size: 0.85rem;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-hero-auth:hover .btn-hero-arrow {
    opacity: 1;
    transform: translateX(4px);
}

.user-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1.1rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-full);
    color: #34d399;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-hero-chip:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(52, 211, 153, 0.6);
    transform: translateY(-1px);
}

.hero-upload-badge {
    background: rgba(6, 182, 212, 0.25);
    color: #38bdf8;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
}

.upload-zone.requires-auth {
    border-color: rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.04);
}

.upload-zone.requires-auth:hover {
    border-color: rgba(245, 158, 11, 0.65);
    background: rgba(245, 158, 11, 0.08);
}

.upload-quota-pill {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-left: 4px;
}

.setup-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Main Grid Layout */
.setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .setup-grid {
        grid-template-columns: 1fr;
    }
}

.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title i {
    color: var(--primary);
}

/* Dropzone & Preview */
.upload-zone {
    border: 2px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    background: rgba(99, 102, 241, 0.04);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.08);
    transform: translateY(-2px);
}

.upload-icon {
    font-size: 2rem;
    color: var(--accent-cyan);
}

.upload-text {
    font-weight: 600;
    font-size: 0.95rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Preset Gallery Header & Filters */
.preset-header-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.preset-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.preset-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.preset-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-filter-btn:hover {
    color: #fff;
    border-color: var(--accent-cyan);
}

.preset-filter-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.preset-grid::-webkit-scrollbar {
    width: 6px;
}

.preset-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.preset-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.preset-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-cyan);
}

.preset-card {
    position: relative;
    height: 90px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.25s ease;
}

.preset-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.preset-card:hover img {
    transform: scale(1.08);
}

.preset-card.selected {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.preset-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.1) 60%);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.preset-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-tag {
    font-size: 0.65rem;
    color: var(--accent-cyan);
    font-weight: 700;
}

/* Active Preview Box */
.preview-box {
    position: relative;
    width: 100%;
    height: 190px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--border-glass);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.preview-info-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.85rem;
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.8) 65%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2;
}

.preview-title-badge {
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 95%;
}

/* ==========================================================================
   Difficulty Slider & Controls
   ========================================================================== */
.difficulty-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.difficulty-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-pill {
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    color: #fff;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.piece-count-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--accent-cyan);
}

/* Custom Range Slider */
.slider-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.range-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, #10b981 0%, #6366f1 50%, #f43f5e 100%);
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid var(--primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.8), 0 2px 6px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
}

/* Options Switch */
.option-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}

.option-info {
    display: flex;
    flex-direction: column;
}

.option-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.option-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #334155;
    transition: .3s;
    border-radius: 34px;
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider-round {
    background-color: var(--primary);
}

input:checked + .slider-round:before {
    transform: translateX(22px);
}

/* Start Button CTA */
.btn-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--primary-glow);
    transition: all 0.25s ease;
}

.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.55);
}

.btn-cta:active {
    transform: translateY(1px);
}

/* ==========================================================================
   2. GAME SCREEN & CANVAS
   ========================================================================== */
#game-screen {
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 45%, #104327 0%, #0a2e1a 55%, #04140b 100%);
}

/* Top Navigation Bar */
.game-topbar {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.topbar-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
}

.glass-pill {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    padding: 0.45rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-soft);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-item i {
    font-style: normal;
    color: var(--accent-cyan);
}

/* Action Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-soft);
    pointer-events: auto;
}

.btn-icon:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
    transform: translateY(-1px);
}

.btn-icon.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Floating Bottom Control Bar */
.game-bottombar {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-soft);
}

.btn-tool {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-tool.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.ghost-slider-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.5rem;
}

.ghost-slider-box span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.mini-range {
    width: 60px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 3px;
    background: #334155;
    outline: none;
}

.mini-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-cyan);
    cursor: pointer;
}

.hint-penalty-pill {
    font-size: 0.72rem;
    background: rgba(244, 63, 94, 0.25);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.4);
    padding: 0.08rem 0.35rem;
    border-radius: var(--radius-full);
    font-weight: 700;
    margin-left: 2px;
}

.timer-penalty-toast {
    position: absolute;
    top: -20px;
    right: 8px;
    background: rgba(244, 63, 94, 0.95);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    box-shadow: 0 0 14px rgba(244, 63, 94, 0.7);
    pointer-events: none;
    z-index: 100;
    animation: penaltyFloatUp 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes penaltyFloatUp {
    0% { opacity: 0; transform: translateY(6px) scale(0.8); }
    20% { opacity: 1; transform: translateY(-2px) scale(1.1); }
    40% { transform: translateY(-6px) scale(1); }
    100% { opacity: 0; transform: translateY(-22px) scale(0.9); }
}

/* Canvas Area */
#canvas-wrapper {
    flex: 1;
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#puzzle-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
}

#puzzle-canvas:active {
    cursor: grabbing;
}

/* Peek Floating Photo Popup */
#peek-popup {
    position: absolute;
    top: 5rem;
    right: 1.5rem;
    width: 270px;
    max-width: calc(100vw - 2rem);
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid var(--accent-cyan);
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 60;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(6, 182, 212, 0.35);
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease, width 0.28s cubic-bezier(0.16, 1, 0.3, 1), height 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

#peek-popup.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Sizing per zoom level */
#peek-popup.zoom-1x {
    width: 270px;
}

#peek-popup.zoom-2x {
    width: 480px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(6, 182, 212, 0.45);
}

#peek-popup.zoom-3x {
    width: 660px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.9), 0 0 30px rgba(6, 182, 212, 0.55);
}

.peek-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid var(--border-glass);
    cursor: move;
}

.peek-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.peek-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.2rem;
    transition: color 0.15s ease;
}

.peek-close-btn:hover {
    color: #fff;
}

.peek-img-wrapper {
    position: relative;
    width: 100%;
    height: 185px;
    max-height: calc(100vh - 12rem);
    background: #090d16;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: height 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#peek-popup.zoom-1x .peek-img-wrapper {
    height: 185px;
}

#peek-popup.zoom-2x .peek-img-wrapper {
    height: 330px;
}

#peek-popup.zoom-3x .peek-img-wrapper {
    height: 460px;
}

.peek-img-wrapper.is-zoomed {
    cursor: grab;
}

.peek-img-wrapper.is-zoomed:active {
    cursor: grabbing;
}

#peek-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #090d16;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
    transform-origin: center center;
    pointer-events: auto;
}

/* Bottom Right Corner Magnifier Zoom Controls */
.peek-zoom-corner-controls {
    position: absolute;
    bottom: 0.45rem;
    right: 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    z-index: 10;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.3rem;
    border-radius: 9999px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

.btn-peek-zoom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.22rem 0.5rem;
    background: rgba(6, 182, 212, 0.22);
    border: 1px solid rgba(6, 182, 212, 0.45);
    border-radius: 9999px;
    color: #fff;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.btn-peek-zoom:hover {
    background: rgba(6, 182, 212, 0.5);
    border-color: #06b6d4;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
}

.btn-peek-zoom-minus {
    background: rgba(244, 63, 94, 0.22);
    border-color: rgba(244, 63, 94, 0.45);
    color: #fecdd3;
}

.btn-peek-zoom-minus:hover {
    background: rgba(244, 63, 94, 0.5);
    border-color: #f43f5e;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.6);
}

.peek-zoom-badge {
    font-size: 0.72rem;
    font-weight: 800;
    color: #38bdf8;
    padding: 0 0.25rem;
    min-width: 24px;
    text-align: center;
}

/* ==========================================================================
   3. VICTORY MODAL & FULLSCREEN PICTURE CELEBRATION
   ========================================================================== */
#victory-modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

#victory-modal.active {
    display: flex;
    opacity: 1;
}

/* Fullscreen Completed Picture Layer */
.victory-fullscreen-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #060912;
    z-index: 1;
}

.victory-fullscreen-layer img,
.victory-fs-image {
    width: 100vw;
    height: 100vh;
    object-fit: contain;
    animation: victoryPicEntrance 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    filter: drop-shadow(0 0 50px rgba(0, 0, 0, 0.9));
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

@keyframes victoryPicEntrance {
    0% { transform: scale(0.92); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.victory-fullscreen-vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.4) 0%, rgba(4, 6, 12, 0.82) 80%, rgba(0, 0, 0, 0.95) 100%);
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#victory-modal.fullscreen-focus .victory-fullscreen-vignette {
    opacity: 0.15;
}

/* Floating Fullscreen Controls Bar */
.victory-fullscreen-controls {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.65rem;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(99, 102, 241, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#victory-modal.fullscreen-focus .victory-fullscreen-controls {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.victory-fs-toggle-group {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
}

.btn-fs-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 1.15rem;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn-fs-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.btn-fs-toggle.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

.btn-fs-exit {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    color: #e2e8f0;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-fs-exit:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: rgba(244, 63, 94, 0.5);
    color: #fff;
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .victory-fullscreen-controls {
        top: 0.85rem;
        gap: 0.5rem;
        padding: 0.35rem 0.5rem;
        width: 94%;
        max-width: 390px;
        justify-content: space-between;
    }
    .btn-fs-toggle {
        font-size: 0.76rem;
        padding: 0.4rem 0.75rem;
        gap: 0.3rem;
    }
    .btn-fs-exit {
        font-size: 0.76rem;
        padding: 0.4rem 0.75rem;
        gap: 0.3rem;
    }
}

/* Floating Celebration Card */
.victory-card {
    position: relative;
    z-index: 10;
    background: rgba(17, 24, 39, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 480px;
    padding: 2.25rem 2rem;
    text-align: center;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.4);
    animation: modalBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#victory-modal.fullscreen-focus .victory-card {
    transform: translateY(120vh) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

@keyframes modalBounce {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.victory-badge {
    font-size: 3rem;
    line-height: 1;
}

.victory-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Victory New Record Banner */
.victory-record-banner {
    position: relative;
    padding: 0.55rem 1.4rem;
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 50%, #eab308 100%);
    border-radius: var(--radius-full);
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.7), 0 0 50px rgba(239, 68, 68, 0.5);
    animation: recordBannerPulse 1.2s infinite alternate ease-in-out;
    margin-top: -0.35rem;
    margin-bottom: 0.25rem;
}

.victory-record-banner.hidden {
    display: none !important;
}

.record-banner-text {
    font-size: 1.05rem;
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

@keyframes recordBannerPulse {
    0% { transform: scale(0.96); box-shadow: 0 0 15px rgba(245, 158, 11, 0.6); }
    100% { transform: scale(1.04); box-shadow: 0 0 35px rgba(239, 68, 68, 0.9), 0 0 60px rgba(234, 179, 8, 0.7); }
}

.fireworks-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    display: block;
}

/* Setup Card Best Record Badge */
.setup-best-record-row {
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
}

.setup-best-record-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.35);
    padding: 0.22rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    color: #fef08a;
    transition: all 0.25s ease;
}

.setup-best-record-badge.no-record {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

.setup-best-record-badge .record-val {
    color: #facc15;
    font-weight: 800;
}

.setup-best-record-badge.no-record .record-val {
    color: var(--text-muted);
}

.setup-best-record-badge .record-holder {
    font-size: 0.68rem;
    color: rgba(254, 240, 138, 0.75);
    margin-left: 0.2rem;
}

/* In-game Topbar Best Time Pill */
.best-time-pill {
    border-color: rgba(234, 179, 8, 0.4) !important;
    background: rgba(234, 179, 8, 0.1) !important;
}

.best-time-pill #ingame-best-time-display {
    color: #fde047;
    font-weight: 700;
}

.stat-label-dim {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-right: 0.15rem;
}

.victory-preview {
    width: 200px;
    height: 145px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--accent-amber);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.victory-preview:hover {
    transform: scale(1.04);
}

.victory-preview-zoom-hint {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--accent-cyan);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
}

.victory-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.victory-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.vstat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.5rem;
}

.vstat-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.vstat-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.victory-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.victory-actions button {
    flex: 1;
    min-width: 120px;
}

.victory-actions button {
    flex: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-main);
    padding: 0.9rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Confetti */
.confetti-piece {
    position: fixed;
    top: -20px;
    width: 10px;
    height: 14px;
    border-radius: 2px;
    z-index: 1000;
    pointer-events: none;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(105vh) rotate(720deg);
        opacity: 0;
    }
}

/* ==========================================================================
   4. MODALS & AUTH SYSTEM STYLES
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 15, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    display: flex;
    opacity: 1;
}

.glass-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 25px rgba(99, 102, 241, 0.2);
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.92) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
}

.modal-tabs {
    display: flex;
    gap: 0.5rem;
}

.modal-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-tab-btn:hover {
    color: #fff;
}

.modal-tab-btn.active {
    color: #fff;
    background: rgba(99, 102, 241, 0.2);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: #fff;
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.1rem;
    padding: 1.5rem 1.5rem 1.75rem;
}

.auth-form.active {
    display: flex;
}

.auth-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: -0.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    outline: none;
    transition: all 0.2s ease;
}

.auth-input:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.input-hint {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.auth-alert {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.4;
}

.auth-alert.error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.4);
    color: #fda4af;
}

.auth-alert.success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.auth-alert.hidden {
    display: none;
}

/* Personal Picture Cards & Add Button */
.preset-card.add-personal-card {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    text-align: center;
    padding: 0.5rem;
}

.preset-card.add-personal-card:hover {
    border-color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
}

.add-personal-card .add-icon {
    font-size: 1.5rem;
}

.add-personal-card .add-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.add-personal-card .add-quota {
    font-size: 0.65rem;
    color: var(--text-dim);
}

.preset-card-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(244, 63, 94, 0.6);
    color: #f43f5e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.preset-card-delete-btn:hover {
    background: #f43f5e;
    color: #fff;
    transform: scale(1.15);
}

.quota-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.4rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.personal-preview-box {
    width: 100%;
    height: 140px;
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-glass);
}

.personal-preview-box.hidden {
    display: none;
}

.personal-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Unified Upload Modal Layout */
.modal-or-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 0.85rem 0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.modal-or-divider::before,
.modal-or-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.modal-or-divider span {
    padding: 0 0.75rem;
}

.upload-zone.compact-dropzone {
    padding: 1.15rem 1rem;
    gap: 0.35rem;
}

.url-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.url-input-row input {
    flex: 1;
}

.btn-sm {
    padding: 0.5rem 0.85rem !important;
    font-size: 0.82rem !important;
    white-space: nowrap;
}

/* Upgrade modal content */
.upgrade-content {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    text-align: center;
}

.upgrade-badge {
    display: inline-flex;
    padding: 0.4rem 1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent-pink));
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.upgrade-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.upgrade-price-box {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.price-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-cyan);
    font-weight: 700;
}

.price-tag {
    font-size: 1.15rem;
    font-weight: 800;
    color: #fff;
}

/* Custom Confirmation Modal */
#confirm-modal {
    z-index: 2000 !important;
}

.confirm-modal-card {
    padding: 2.2rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    max-width: 440px;
    width: 92%;
}

.confirm-icon {
    font-size: 2.75rem;
    line-height: 1;
    display: inline-block;
    animation: iconPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes iconPop {
    0% { transform: scale(0.6); }
    100% { transform: scale(1); }
}

.confirm-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
}

.confirm-message {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: -0.25rem;
}

.confirm-actions {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
    margin-top: 0.5rem;
}

.confirm-actions button {
    width: 100%;
    padding: 0.8rem 1.2rem;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.confirm-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.confirm-actions .btn-secondary.danger {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: #fda4af;
}

.confirm-actions .btn-secondary.danger:hover {
    background: rgba(244, 63, 94, 0.25);
    border-color: #f43f5e;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

.confirm-btn-cta {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.confirm-btn-cta:hover {
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
    transform: translateY(-1px);
}

.confirm-btn-cta.danger {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.4);
}

.confirm-btn-cta.danger:hover {
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.6);
}

/* ===================================================
   3-COLUMN SETUP DASHBOARD (100% Responsive Widescreen)
   =================================================== */
.setup-grid-3col {
    display: grid;
    grid-template-columns: minmax(0, 2.8fr) minmax(320px, 1.15fr) minmax(300px, 1.05fr);
    gap: 1.25rem;
    align-items: stretch;
    width: 100%;
}

@media (max-width: 1440px) {
    .setup-grid-3col {
        grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1.1fr) minmax(280px, 1fr);
    }
}

@media (max-width: 1200px) {
    .setup-grid-3col {
        grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.1fr);
    }
    .leaderboard-col-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .setup-grid-3col {
        grid-template-columns: 1fr;
    }
}

/* ===================================================
   TREE PICTURE GALLERY
   =================================================== */
.gallery-col-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-height: 600px;
    height: 100%;
}

.gallery-col-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.gallery-search-box {
    flex: 1;
    min-width: 200px;
}

.gallery-search-input {
    width: 100%;
    padding: 0.55rem 0.9rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.25s ease;
}

.gallery-search-input:focus {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.25);
}

.compact-zone {
    padding: 0.6rem 1rem !important;
    min-height: auto !important;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border-style: dashed;
    border-width: 1.5px;
}

.compact-zone .upload-icon {
    font-size: 1.2rem;
    margin-bottom: 0;
}

.compact-zone .upload-text {
    font-size: 0.85rem;
}

.tree-gallery-container {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    flex: 1;
    min-height: 480px;
}

@media (max-width: 700px) {
    .tree-gallery-container {
        grid-template-columns: 1fr;
    }
}

.gallery-tree-sidebar {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 520px;
    overflow-y: auto;
}

.tree-section-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.2rem;
}

.tree-categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    user-select: none;
}

.tree-node:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(2px);
}

.tree-node.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28) 0%, rgba(6, 182, 212, 0.22) 100%);
    border-color: rgba(99, 102, 241, 0.5);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.tree-node.user-node {
    background: rgba(234, 179, 8, 0.12);
    border-color: rgba(234, 179, 8, 0.3);
    color: #fef08a;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.tree-node.user-node:hover {
    background: rgba(234, 179, 8, 0.22);
    color: #fff;
}

.tree-node.user-node.active {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.35) 0%, rgba(249, 115, 22, 0.3) 100%);
    border-color: #eab308;
    color: #fff;
}

.tree-node.most-jigged-node {
    background: rgba(249, 115, 22, 0.12);
    border-color: rgba(249, 115, 22, 0.35);
    color: #fed7aa;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.tree-node.most-jigged-node:hover {
    background: rgba(249, 115, 22, 0.24);
    border-color: rgba(249, 115, 22, 0.6);
    color: #fff;
    box-shadow: 0 0 12px rgba(249, 115, 22, 0.3);
}

.tree-node.most-jigged-node.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35) 0%, rgba(249, 115, 22, 0.35) 100%);
    border-color: #f97316;
    color: #fff;
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
}

.tree-node.most-jigged-node .tree-count-badge {
    background: rgba(249, 115, 22, 0.25);
    color: #ffedd5;
}

.tree-node.community-node {
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.35);
    color: #a5f3fc;
    font-weight: 600;
    margin-bottom: 0.55rem;
    transition: all 0.2s ease;
}

.tree-node.community-node:hover {
    background: rgba(6, 182, 212, 0.24);
    border-color: rgba(6, 182, 212, 0.6);
    color: #fff;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.tree-node.community-node.active {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.35) 0%, rgba(6, 182, 212, 0.35) 100%);
    border-color: #06b6d4;
    color: #fff;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.tree-node.community-node .tree-count-badge {
    background: rgba(6, 182, 212, 0.25);
    color: #cffafe;
}

.preset-play-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(249, 115, 22, 0.5);
    color: #fed7aa;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.preset-card-share-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(6, 182, 212, 0.6);
    color: #67e8f9;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.18rem 0.5rem;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 4;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.preset-card-share-btn:hover {
    background: #06b6d4;
    color: #000;
    transform: scale(1.05);
}

.preset-card-share-btn.is-shared {
    border-color: rgba(16, 185, 129, 0.6);
    color: #34d399;
    background: rgba(16, 185, 129, 0.15);
    cursor: default;
}

.preset-card-share-btn.is-shared:hover {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    transform: none;
}

.preset-author-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: #67e8f9;
}

.tree-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.tree-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-count-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.4rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.tree-node.active .tree-count-badge {
    background: var(--accent-indigo);
    color: #fff;
}

/* Gallery Pictures Area */
.gallery-grid-area {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
    flex: 1;
}

.gallery-active-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.85rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.active-category-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.active-category-icon {
    font-size: 1.15rem;
}

.active-category-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #fff;
}

.active-category-badge {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-weight: 600;
}

.gallery-grid-area .preset-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
    max-height: 540px;
    overflow-y: auto;
    padding-right: 0.4rem;
}

.gallery-grid-area .preset-card {
    height: 125px;
}

@media (max-width: 1100px) {
    .gallery-grid-area .preset-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 650px) {
    .gallery-grid-area .preset-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================================
   HALL OF FAME & PPM LEADERBOARD WIDGET
   =================================================== */
.leaderboard-col-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 600px;
    height: 100%;
}

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    position: relative;
}

/* Interactive Metric Selector Dropdown */
.leaderboard-metric-dropdown {
    position: relative;
    display: inline-block;
}

.leaderboard-metric-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.32rem 0.75rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.18) 0%, rgba(249, 115, 22, 0.22) 100%);
    border: 1px solid rgba(234, 179, 8, 0.45);
    color: #fde047;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    user-select: none;
}

.leaderboard-metric-btn:hover {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.32) 0%, rgba(249, 115, 22, 0.36) 100%);
    border-color: #fde047;
    color: #fff;
    box-shadow: 0 0 14px rgba(253, 224, 71, 0.4);
    transform: translateY(-1px);
}

.metric-dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    opacity: 0.85;
}

.leaderboard-metric-dropdown.open .metric-dropdown-arrow {
    transform: rotate(180deg);
}

.leaderboard-metric-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 225px;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 0 18px rgba(99, 102, 241, 0.25);
    z-index: 120;
    display: none;
    flex-direction: column;
    gap: 4px;
    animation: menuFadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.leaderboard-metric-dropdown.open .leaderboard-metric-menu {
    display: flex;
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.metric-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.metric-menu-item:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.4);
    color: #ffffff;
    transform: translateX(2px);
}

.metric-menu-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(6, 182, 212, 0.35) 100%);
    border-color: rgba(56, 189, 248, 0.6);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.metric-item-icon {
    font-size: 1.15rem;
    flex-shrink: 0;
}

.metric-item-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.metric-item-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #f1f5f9;
}

.metric-item-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    line-height: 1.35;
}

.leaderboard-list-scroll {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex: 1;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 0.25rem;
    margin-top: 0.35rem;
}

.leaderboard-loading {
    padding: 2rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 28px 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.leaderboard-item.is-me {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
    border-color: rgba(234, 179, 8, 0.5);
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.15);
}

.rank-badge {
    font-size: 0.95rem;
    font-weight: 800;
    text-align: center;
    color: var(--text-muted);
}

.rank-badge.top-1 { color: #facc15; font-size: 1.15rem; }
.rank-badge.top-2 { color: #cbd5e1; font-size: 1.15rem; }
.rank-badge.top-3 { color: #d97706; font-size: 1.15rem; }

.leaderboard-avatar-frame {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.leaderboard-avatar-frame .avatar-initial {
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.leaderboard-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.leaderboard-player-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-item.is-me .leaderboard-player-name {
    color: #fde047;
}

.leaderboard-stats-line {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-ppm-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    padding-left: 0.25rem;
}

.ppm-val {
    font-size: 0.95rem;
    font-weight: 900;
    color: var(--accent-cyan);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.ppm-lbl {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===================================================
   USER PROFILE & CREDENTIALS MODAL
   =================================================== */
.profile-modal-card {
    max-width: 440px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    align-items: center;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.avatar-circular-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.avatar-circular-container:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.6);
    transform: scale(1.03);
}

.avatar-circular-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-fallback-initial {
    font-size: 2.25rem;
    font-weight: 900;
    color: #fff;
    text-transform: uppercase;
}

.avatar-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.avatar-circular-container:hover .avatar-hover-overlay {
    opacity: 1;
}

.avatar-hover-overlay span {
    color: #fff;
    font-size: 1.1rem;
}

.avatar-overlay-text {
    font-size: 0.68rem !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-become-master {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.45rem 1.15rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(236, 72, 153, 0.25));
    border: 1px solid rgba(245, 158, 11, 0.6);
    border-radius: var(--radius-full);
    color: #fde047;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.25rem;
}

.btn-become-master:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.45), rgba(236, 72, 153, 0.45));
    border-color: #facc15;
    color: #ffffff;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.5), 0 4px 15px rgba(236, 72, 153, 0.3);
    transform: translateY(-1px);
}

/* Account Type Badge under Avatar */
.account-type-badge-container {
    display: flex;
    justify-content: center;
    margin-top: 0.15rem;
}

.account-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all 0.25s ease;
}

.account-type-badge.tier-free {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
    box-shadow: 0 0 10px rgba(148, 163, 184, 0.15);
}

.account-type-badge.tier-master {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.25) 0%, rgba(245, 158, 11, 0.35) 100%);
    border: 1px solid rgba(251, 191, 36, 0.7);
    color: #fef08a;
    box-shadow: 0 0 16px rgba(234, 179, 8, 0.45);
}

/* PPM Efficiency Card in Profile */
.profile-efficiency-card {
    width: 100%;
    padding: 1rem 1.15rem;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(6, 182, 212, 0.12) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.efficiency-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.efficiency-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.efficiency-tier-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #eab308 0%, #f97316 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3);
}

.ppm-main-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.15rem;
    padding: 0.25rem 0;
}

.ppm-number-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.ppm-number {
    font-size: 2.35rem;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    background: linear-gradient(135deg, #ffffff 0%, #38bdf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ppm-unit {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-cyan);
}

.ppm-desc-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pstat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pstat-val {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.pstat-lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Credentials Box */
.profile-credentials-box {
    width: 100%;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.cred-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cred-row:last-child {
    border-bottom: none;
}

.cred-label {
    color: var(--text-muted);
    font-weight: 500;
}

.cred-val {
    color: #fff;
    font-weight: 600;
}

.cred-val-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.badge-verified {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    line-height: 1;
    user-select: none;
    letter-spacing: 0.02em;
}

.badge-verified.verified {
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(16, 185, 129, 0.45);
    color: #34d399;
}

.badge-verified.unverified {
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fbbf24;
}

.profile-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.profile-actions button {
    flex: 1;
}

/* User topbar avatar chip */
.user-chip-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    margin-right: 0.35rem;
    flex-shrink: 0;
}

/* ==========================================================================
   TIME PENALTIES BUTTON & MODAL
   ========================================================================== */
.btn-penalty-info {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.btn-penalty-info:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--accent-cyan);
    transform: translateY(-1px);
}

.penalty-info-pill {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    border: 1px solid rgba(99, 102, 241, 0.35);
}

.penalty-modal-card {
    max-width: 520px;
    width: 95%;
}

.penalty-modal-content {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    max-height: 78vh;
    overflow-y: auto;
}

.penalty-intro {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
}

.penalty-cards-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.penalty-row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.penalty-row-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.penalty-card-main {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.penalty-icon {
    font-size: 1.35rem;
    line-height: 1;
    flex-shrink: 0;
}

.penalty-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.penalty-name {
    font-size: 0.86rem;
    color: #fff;
    font-weight: 700;
}

.penalty-desc {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.25;
}

.penalty-pill {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.22rem 0.6rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.penalty-pill-danger {
    background: rgba(244, 63, 94, 0.18);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.4);
}

.penalty-pill-warning {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.penalty-pill-success {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.penalty-tip-box {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-left: 3px solid var(--primary);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.4;
}

@media (max-width: 960px) {
    .setup-header {
        flex-direction: column;
        min-height: auto;
        gap: 0.75rem;
    }

    .brand-logo-container {
        position: static;
        transform: none;
        margin-bottom: 0.25rem;
    }

    .brand-logo-container:hover {
        transform: scale(1.04);
    }

    .brand-logo-img {
        height: 96px;
        width: 96px;
    }

    .user-auth-widget {
        position: static;
        margin-bottom: 0.25rem;
    }

    .header-center-info {
        padding: 0;
    }
}

/* ==========================================================================
   Saved Puzzles & Save Progress UI
   ========================================================================== */

.btn-saved-puzzles-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(6, 182, 212, 0.22));
    border: 1px solid rgba(99, 102, 241, 0.55);
    border-radius: 9999px;
    color: #e0e7ff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.2);
}

.btn-saved-puzzles-hero:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(6, 182, 212, 0.38));
    border-color: var(--accent-cyan);
    color: #fff;
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.btn-saved-puzzles-hero .saved-icon {
    font-size: 1rem;
}

.btn-saved-puzzles-hero .saved-count-badge {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 9999px;
    min-width: 1.25rem;
    text-align: center;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.4);
}

.btn-about-game-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(99, 102, 241, 0.22));
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 9999px;
    color: #fef3c7;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.2);
}

.btn-about-game-hero:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.38), rgba(99, 102, 241, 0.38));
    border-color: #fbbf24;
    color: #fff;
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.btn-about-game-hero .about-icon {
    font-size: 1rem;
}

/* In-game Save Progress Button */
.btn-save-progress {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(16, 185, 129, 0.2)) !important;
    border-color: rgba(99, 102, 241, 0.45) !important;
    color: #e2e8f0 !important;
    font-weight: 700;
}

.btn-save-progress:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.45), rgba(16, 185, 129, 0.35)) !important;
    border-color: #34d399 !important;
    color: #fff !important;
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.3) !important;
}

.btn-save-progress.is-paused {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(239, 68, 68, 0.25)) !important;
    border-color: #f59e0b !important;
    color: #fbbf24 !important;
    animation: pausePulse 1.8s infinite ease-in-out;
}

@keyframes pausePulse {
    0%, 100% { box-shadow: 0 0 8px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 18px rgba(245, 158, 11, 0.5); }
}

/* Saved Puzzles Modal */
.saved-puzzles-modal-card {
    max-width: 720px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.saved-puzzles-quota-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
}

.saved-quota-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.saved-quota-pill {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-cyan);
    background: rgba(6, 182, 212, 0.12);
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.saved-quota-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.saved-puzzles-body {
    overflow-y: auto;
    max-height: calc(85vh - 180px);
    padding-right: 0.25rem;
}

.saved-puzzles-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.saved-puzzle-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all 0.25s ease;
}

.saved-puzzle-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(99, 102, 241, 0.45);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.saved-puzzle-thumb {
    width: 90px;
    height: 70px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
    background: #0f172a;
}

.saved-puzzle-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.saved-puzzle-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.saved-pct-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 9999px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.saved-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-puzzle-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.saved-puzzle-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.saved-progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.saved-progress-bar-bg {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    overflow: hidden;
}

.saved-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #06b6d4, #10b981);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.saved-progress-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: #34d399;
    min-width: 42px;
}

.saved-puzzle-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-resume-saved {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.9rem;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-resume-saved:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.45);
}

.btn-delete-saved {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    border-radius: var(--radius-sm);
    color: #fb7185;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete-saved:hover {
    background: rgba(244, 63, 94, 0.28);
    border-color: #f43f5e;
    color: #fff;
    transform: scale(1.08);
}

.saved-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.saved-empty-icon {
    font-size: 2.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

@media (max-width: 640px) {
    .saved-puzzle-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .saved-puzzle-thumb {
        width: 100%;
        height: 120px;
    }
    .saved-puzzle-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .btn-resume-saved {
        flex: 1;
        justify-content: center;
    }
}

/* ==========================================================================
   Game Paused Modal & Blur Effect
   ========================================================================== */

.game-viewport-wrapper.game-blurred {
    filter: blur(12px) brightness(0.55);
    transition: filter 0.3s ease;
    pointer-events: none;
}

.pause-modal-card {
    max-width: 440px;
    width: 90%;
    padding: 2.25rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(99, 102, 241, 0.4);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.25);
    backdrop-filter: blur(20px);
}

.pause-icon-badge {
    font-size: 2.5rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.35);
    animation: iconPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pause-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}

.pause-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: -0.35rem;
}

.pause-meta-chips {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.65rem;
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.pause-chip {
    font-size: 0.8rem;
    font-weight: 700;
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.pause-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-pause-resume {
    width: 100%;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-pause-resume:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.55);
}

.btn-pause-save-exit {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-md);
}

/* ==========================================================================
   Profile Storage Card & Management Actions
   ========================================================================== */

.profile-storage-card {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem;
    margin: 0.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.profile-storage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-storage-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.profile-storage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.storage-item-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
    transition: all 0.2s ease;
}

.storage-item-box:hover {
    border-color: rgba(99, 102, 241, 0.35);
    background: rgba(99, 102, 241, 0.05);
}

.storage-item-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.storage-item-info {
    display: flex;
    flex-direction: column;
}

.storage-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.storage-item-value {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
}

.btn-storage-action {
    margin-top: 0.35rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.btn-storage-action:hover {
    background: rgba(56, 189, 248, 0.22);
    border-color: #38bdf8;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

@media (max-width: 480px) {
    .profile-storage-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Guest Difficulty Lock & Free Registration Banner
   ========================================================================== */

.difficulty-guest-lock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    margin: 0.5rem 0 0.25rem 0;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(99, 102, 241, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: #fef3c7;
    line-height: 1.35;
    animation: pulseLockBorder 3s infinite ease-in-out;
}

@keyframes pulseLockBorder {
    0%, 100% { border-color: rgba(245, 158, 11, 0.35); }
    50% { border-color: rgba(245, 158, 11, 0.7); box-shadow: 0 0 12px rgba(245, 158, 11, 0.2); }
}

.difficulty-guest-lock .lock-text {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.difficulty-guest-lock .lock-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.btn-unlock-free-pill {
    flex-shrink: 0;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #ec4899);
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-unlock-free-pill:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.55);
}

/* ==========================================================================
   Global Game Loading / Wait Overlay
   ========================================================================== */

.loading-overlay {
    z-index: 12000;
}

.loading-modal-card {
    max-width: 380px;
    width: 88%;
    padding: 2.2rem 1.8rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(6, 182, 212, 0.45);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(6, 182, 212, 0.3);
    backdrop-filter: blur(24px);
    border-radius: var(--radius-lg);
}

.loading-spinner-ring {
    position: relative;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner-inner {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid rgba(6, 182, 212, 0.15);
    border-top-color: #06b6d4;
    border-right-color: #6366f1;
    animation: spinRing 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

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

.loading-icon-center {
    font-size: 1.8rem;
    line-height: 1;
    animation: pulseIcon 1.5s infinite ease-in-out;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.15); opacity: 1; }
}

.loading-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
}

.loading-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: -0.25rem;
}

.loading-pulse-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    margin-top: 0.4rem;
}

.loading-pulse-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #6366f1, #06b6d4, #10b981);
    border-radius: 9999px;
    animation: indeterminateLoading 1.4s infinite ease-in-out;
}

@keyframes indeterminateLoading {
    0% { left: -40%; width: 30%; }
    50% { left: 30%; width: 50%; }
    100% { left: 100%; width: 40%; }
}

/* ==========================================================================
   Language Selector (Segmented Button Switcher)
   ========================================================================== */

.setup-header-top-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    z-index: 40;
}

.lang-switch-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    user-select: none;
    flex-shrink: 0;
}

.lang-switch-pill.in-game {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(255, 255, 255, 0.14);
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.lang-btn.active {
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.5);
}

.lang-btn .lang-flag {
    font-size: 0.95rem;
    line-height: 1;
}

.lang-btn .lang-txt {
    letter-spacing: 0.04em;
}

/* ==========================================================================
   About Jigsaw Puzzle Master Modal Styles
   ========================================================================== */
.about-game-modal-card {
    max-width: 680px;
    width: 94%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
}

.about-game-header {
    padding: 1.4rem 1.75rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.14) 0%, transparent 100%);
}

.about-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.about-modal-subtitle {
    font-size: 0.84rem;
    color: #94a3b8;
    font-weight: 500;
}

.about-game-body {
    padding: 1.4rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.about-game-intro {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.15rem;
    margin: 0;
}

.about-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
}

.about-feature-item {
    background: rgba(30, 41, 59, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: all 0.2s ease;
}

.about-feature-item:hover {
    background: rgba(30, 41, 59, 0.75);
    border-color: rgba(99, 102, 241, 0.35);
    transform: translateY(-1px);
}

.about-feature-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.about-feature-desc {
    font-size: 0.8rem;
    line-height: 1.45;
    color: #94a3b8;
}

.about-game-footer {
    padding: 1.1rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.about-footer-note {
    font-size: 0.82rem;
    color: #a5b4fc;
    flex: 1;
    min-width: 200px;
    font-weight: 500;
}

@media (max-width: 640px) {
    .about-game-header {
        padding: 1rem 1.25rem;
    }
    .about-game-body {
        padding: 1rem 1.25rem;
    }
    .about-features-grid {
        grid-template-columns: 1fr;
    }
    .about-game-footer {
        padding: 1rem 1.25rem;
        flex-direction: column;
        align-items: stretch;
    }
    .about-game-footer .btn-cta {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Privacy Policy & Terms Modal Styles
   ========================================================================== */
.privacy-modal-card {
    max-width: 720px;
    width: 94%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
}

.privacy-modal-header {
    padding: 1.4rem 1.75rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.12) 0%, transparent 100%);
}

.privacy-modal-body {
    padding: 1.4rem 1.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.6;
    user-select: text;
    -webkit-user-select: text;
}

.privacy-section {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.privacy-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #38bdf8;
    margin: 0;
}

.privacy-list {
    margin: 0.25rem 0 0 1.25rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.privacy-list li {
    font-size: 0.88rem;
    color: #94a3b8;
}

.privacy-list strong {
    color: #f1f5f9;
}

.privacy-mail-link {
    color: var(--accent-cyan);
    text-decoration: underline;
    font-weight: 600;
}

.privacy-modal-footer {
    padding: 1rem 1.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    justify-content: flex-end;
}

/* ===================================================
   IN-FRAME 5-SECOND PREROLL VIDEO AD OVERLAY
   =================================================== */
.game-preroll-overlay {
    position: absolute;
    inset: 0;
    z-index: 9999;
    background: rgba(3, 7, 18, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
    animation: prerollFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-preroll-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98);
}

@keyframes prerollFadeIn {
    from { opacity: 0; transform: scale(1.02); }
    to { opacity: 1; transform: scale(1); }
}

.preroll-card {
    width: 100%;
    max-width: 680px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(99, 102, 241, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preroll-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    background: rgba(10, 15, 30, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.preroll-sponsor-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sponsor-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.sponsor-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #94a3b8;
    text-transform: uppercase;
}

.preroll-timer-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 600;
}

.preroll-timer-box strong {
    color: #38bdf8;
    font-weight: 800;
    font-size: 0.95rem;
}

.btn-preroll-skip {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-preroll-skip:hover:not(.disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.btn-preroll-skip.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.1);
}

.btn-preroll-skip.pulse-ready {
    animation: skipPulse 1s infinite alternate;
}

@keyframes skipPulse {
    from { transform: scale(1); box-shadow: 0 0 0 rgba(59, 130, 246, 0.4); }
    to { transform: scale(1.04); box-shadow: 0 0 15px rgba(59, 130, 246, 0.8); }
}

.preroll-media-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #020617;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preroll-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.google-h5-ad-slot {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: auto;
    display: none;
}

.preroll-video-controls {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-preroll-sound {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-preroll-sound:hover {
    background: rgba(15, 23, 42, 0.95);
    border-color: #38bdf8;
    transform: scale(1.08);
}

.preroll-learn-more {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    color: #cbd5e1;
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.preroll-learn-more:hover {
    color: #fff;
    border-color: #38bdf8;
}

.preroll-progress-track {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    z-index: 6;
}

.preroll-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    transition: width 0.05s linear;
}

.preroll-footer {
    padding: 0.75rem 1.25rem;
    background: rgba(10, 15, 30, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preroll-upgrade-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #fbbf24;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

.preroll-upgrade-cta:hover {
    color: #fef08a;
    background: rgba(251, 191, 36, 0.1);
    transform: translateY(-1px);
}

/* 100% Ad-Free suppression for Jigsaw Master & Admin accounts */
body.user-is-master .adsbygoogle,
body.user-is-master .game-preroll-overlay,
body.user-is-master .ad-banner-slot,
body.user-is-master .btn-master-upgrade,
body.user-is-master #profile-master-perks-strip {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* ===================================================
   USER PROFILE MODAL (80% SCREEN WIDTH & SCROLLBARS)
   =================================================== */
.profile-modal-card {
    width: 80vw !important;
    max-width: 1080px !important;
    min-width: 320px !important;
    max-height: 90vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

@media (max-width: 900px) {
    .profile-modal-card {
        width: 95vw !important;
        max-width: 95vw !important;
    }
}

.profile-modal-card .profile-content {
    overflow-y: auto !important;
    max-height: calc(90vh - 65px) !important;
    padding: 1.4rem 1.8rem !important;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.profile-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: stretch;
    width: 100%;
}

.profile-dashboard-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
}

@media (max-width: 768px) {
    .profile-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Custom Sleek Scrollbar */
.profile-modal-card .profile-content::-webkit-scrollbar {
    width: 7px;
}

.profile-modal-card .profile-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
}

.profile-modal-card .profile-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-modal-card .profile-content::-webkit-scrollbar-thumb:hover {
    background: rgba(245, 158, 11, 0.5);
}

.profile-top-header-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    margin-bottom: 0.25rem;
}

.profile-tier-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.btn-master-upgrade {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 9999px !important;
    padding: 0.5rem 1.05rem !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.45) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
}

.btn-master-upgrade:hover {
    transform: scale(1.04) translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.65) !important;
}

.profile-master-perks-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fde68a;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.85rem;
    margin-top: 0.25rem;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.1);
}

.profile-master-perks-strip .perk-dot {
    color: rgba(245, 158, 11, 0.6);
    font-size: 0.85rem;
}

/* ===================================================
   UPGRADE TO JIGSAW MASTER MODAL (STRIPE PAYMENTS)
   =================================================== */
    margin-top: 2px;
}

.btn-upgrade-pill {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 0.45rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-upgrade-pill:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.upgrade-modal-card {
    max-width: 520px;
    padding: 0;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.9), 0 0 40px rgba(245, 158, 11, 0.2);
}

.upgrade-header {
    position: relative;
    padding: 1.75rem 1.5rem 1.25rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(245, 158, 11, 0.15) 0%, rgba(15, 23, 42, 0) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.upgrade-crown-badge {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
    animation: crownFloat 3s infinite ease-in-out;
}

@keyframes crownFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-4px) rotate(2deg); }
}

.upgrade-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.upgrade-subtitle {
    font-size: 0.88rem;
    color: #94a3b8;
    margin: 0;
}

.upgrade-body {
    padding: 1.35rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.upgrade-plan-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.plan-tab {
    position: relative;
    background: rgba(30, 41, 59, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.plan-tab:hover {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(30, 41, 59, 0.85);
}

.plan-tab.active {
    border-color: #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(30, 41, 59, 0.9) 100%);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.plan-tab-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #e2e8f0;
}

.plan-tab-price {
    font-size: 1.25rem;
    font-weight: 900;
    color: #fef08a;
    letter-spacing: -0.02em;
}

.plan-tab-price small {
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
}

.plan-save-pill {
    position: absolute;
    top: -10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    font-size: 0.64rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 12px;
    letter-spacing: 0.04em;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.upgrade-benefits-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 1.15rem;
}

.benefits-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: #cbd5e1;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.benefits-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.benefits-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.86rem;
    color: #e2e8f0;
    line-height: 1.4;
}

.benefits-list .b-icon {
    font-size: 1rem;
    line-height: 1.2;
}

.btn-stripe-checkout {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 0.98rem;
    font-weight: 800;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #f59e0b 100%);
    background-size: 200% 200%;
    animation: stripeGrad 4s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.45);
    transition: all 0.25s ease;
    cursor: pointer;
    border: none;
    color: #fff;
}

@keyframes stripeGrad {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.btn-stripe-checkout:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.6);
}

.stripe-trust-footer {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.stripe-secured-text {
    font-size: 0.74rem;
    color: #94a3b8;
    line-height: 1.4;
}

.stripe-badges-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.trust-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 0.02em;
}

/* ===================================================
   GOOGLE ADSENSE FRONT LANDING BANNER (UNDER SETUP-HEADER)
   =================================================== */
.landing-ads-container {
    width: 100%;
    margin: 0 0 1.25rem 0;
    animation: fadeInAd 0.4s ease forwards;
}

@keyframes fadeInAd {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.landing-ads-inner {
    position: relative;
    width: 100%;
    max-width: 100%;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.78) 0%, rgba(30, 41, 59, 0.65) 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 0.65rem 1.15rem 0.85rem 1.15rem;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.landing-ads-inner:hover {
    border-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.45), 0 0 20px rgba(56, 189, 248, 0.1);
}

/* Meta Bar: Badge & AdChoices */
.landing-ads-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.45rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.landing-ads-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.07);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ads-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
}

.landing-ads-info {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.68rem;
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s ease;
}

.landing-ads-info:hover {
    color: #38bdf8;
}

.ads-choices-icon {
    font-size: 0.72rem;
    color: #38bdf8;
}

/* Live Ad Slot Container */
.adsense-live-slot-box {
    width: 100%;
    min-height: 0;
    display: none; /* Auto-shown when live adsbygoogle is populated */
    overflow: hidden;
}

.adsense-live-slot-box.has-ad {
    display: block;
}

/* Placeholder Ad Banner (Showcase & Position Preview) */
.landing-ad-placeholder {
    width: 100%;
    display: block;
}

.ad-sample-card {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.6rem 0.85rem;
    transition: all 0.3s ease;
}

.ad-sample-card:hover {
    background: rgba(15, 23, 42, 0.75);
    border-color: rgba(255, 255, 255, 0.16);
}

.ad-sample-media {
    flex-shrink: 0;
    width: 130px;
    height: 72px;
    border-radius: 8px;
    overflow: hidden;
    background: #0b0f19;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.ad-sample-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.ad-sample-card:hover .ad-sample-img {
    transform: scale(1.05);
}

.ad-sample-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ad-sample-header-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.ad-sample-title {
    margin: 0;
    font-size: 0.96rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.ad-sample-sponsored-tag {
    font-size: 0.62rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.ad-sample-desc {
    margin: 0;
    font-size: 0.8rem;
    color: #cbd5e1;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ad-sample-brand-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.72rem;
    margin-top: 0.1rem;
}

.ad-google-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #94a3b8;
    font-weight: 600;
}

.ad-g-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4285F4, #34A853, #FBBC05, #EA4335);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 900;
}

.ad-sample-domain {
    color: #64748b;
}

.ad-sample-action {
    flex-shrink: 0;
}

.ad-sample-btn {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 0.5rem 0.95rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.ad-sample-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    box-shadow: 0 6px 18px rgba(56, 189, 248, 0.45);
    transform: translateY(-1px);
}

.ad-btn-arrow {
    transition: transform 0.2s ease;
}

.ad-sample-btn:hover .ad-btn-arrow {
    transform: translateX(2px);
}

/* Responsive adjustments for mobile and small screens */
@media (max-width: 768px) {
    .ad-sample-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .ad-sample-media {
        width: 100%;
        height: 110px;
    }
    
    .ad-sample-title {
        white-space: normal;
    }
    
    .ad-sample-action {
        width: 100%;
    }
    
    .ad-sample-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================================
   IN-GAME TOP GOOGLE ADSENSE BANNER (PLAYING SCREEN)
   =================================================== */
.game-ads-container {
    pointer-events: auto;
    flex: 0 1 520px;
    max-width: 540px;
    min-width: 260px;
    margin: 0 0.75rem;
    animation: fadeInAd 0.35s ease forwards;
    z-index: 55;
}

.game-ads-inner {
    position: relative;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.88) 0%, rgba(30, 41, 59, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    padding: 0.35rem 0.75rem 0.45rem 0.75rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: all 0.25s ease;
}

.game-ads-inner:hover {
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 15px rgba(56, 189, 248, 0.15);
}

.game-ads-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.6rem;
}

.game-ads-badge {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.game-ads-info {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.62rem;
    transition: color 0.2s ease;
}

.game-ads-info:hover {
    color: #38bdf8;
}

.adsense-live-game-slot {
    display: none;
    width: 100%;
    overflow: hidden;
}

.adsense-live-game-slot.has-ad {
    display: block;
}

.game-ad-placeholder {
    width: 100%;
    display: block;
}

.game-ad-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-ad-media {
    flex-shrink: 0;
    width: 52px;
    height: 38px;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-ad-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-ad-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.game-ad-title-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.game-ad-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-ad-tag {
    font-size: 0.55rem;
    font-weight: 700;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.25);
    padding: 0 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

.game-ad-desc {
    font-size: 0.7rem;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-ad-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #fff;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.game-ad-btn:hover {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
    transform: translateY(-1px);
}

.game-ad-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.game-ad-btn:hover .game-ad-arrow {
    transform: translateX(2px);
}

/* Responsive Topbar adjustments for game screen */
@media (max-width: 1280px) {
    .game-ads-container {
        flex: 0 1 400px;
        max-width: 420px;
    }
}

@media (max-width: 1024px) {
    .game-topbar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .game-ads-container {
        order: 3;
        flex: 1 1 100%;
        max-width: 100%;
        margin: 0;
    }
}

/* ==========================================================================
   JIGSAW CORPORATE FOOTER (SMURF LTD. INTEGRATION)
   ========================================================================== */

.jigsaw-corporate-footer {
    width: 100%;
    max-width: 1400px;
    margin: 2.5rem auto 1.5rem auto !important;
    align-self: center !important;
    padding: 2.5rem 2rem 1.75rem;
    background: rgba(10, 14, 26, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    user-select: text;
    -webkit-user-select: text;
    box-sizing: border-box;
}

.jigsaw-footer-container {
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.jigsaw-footer-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1.25fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .jigsaw-footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 640px) {
    .jigsaw-footer-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
        text-align: center;
    }

    .jigsaw-footer-brand {
        justify-content: center;
    }

    .footer-corp-pill {
        margin: 0 auto;
    }

    .contact-list li {
        justify-content: center;
    }
}

.jigsaw-footer-col {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.jigsaw-footer-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-brand-icon {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

.footer-brand-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #ffffff;
    display: block;
    letter-spacing: -0.01em;
}

.footer-brand-sub {
    font-size: 0.8rem;
    color: var(--accent-cyan);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.jigsaw-footer-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.55;
}

.footer-corp-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.2));
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-full);
    color: #ffffff;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.2s ease;
    width: fit-content;
}

.footer-corp-pill:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(6, 182, 212, 0.35));
    border-color: var(--accent-cyan);
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.jigsaw-footer-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    padding-bottom: 0.4rem;
    display: inline-block;
}

.jigsaw-footer-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0;
    margin: 0;
}

.jigsaw-footer-list li {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.jigsaw-footer-list a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.jigsaw-footer-list a:hover {
    color: var(--accent-cyan);
    transform: translateX(2px);
}

.contact-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.contact-icon {
    font-size: 0.95rem;
    flex-shrink: 0;
}

.jigsaw-footer-bottom {
    width: 100%;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.82rem;
    color: var(--text-dim);
    text-align: center;
}

.footer-copyright strong {
    color: var(--text-muted);
}

.footer-bottom-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.footer-bottom-links a {
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-bottom-links a:hover {
    color: var(--accent-cyan);
}

.footer-dot {
    color: rgba(255, 255, 255, 0.2);
}

/* Artist Spotlight & Picture Credits */
.victory-artist-box {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    text-align: left;
    backdrop-filter: blur(8px);
}
.artist-badge-icon {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(6, 182, 212, 0.15);
    border-radius: 10px;
    flex-shrink: 0;
}
.artist-meta {
    flex: 1;
    min-width: 0;
}
.artist-label {
    font-size: 0.75rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.artist-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.artist-sub {
    font-size: 0.78rem;
    color: #06b6d4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-artist-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.btn-artist-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
    color: #fff;
}
.credits-dmca-box {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.5;
}














