/* ==========================================================================
   Crystal Beads Puzzle - Game Stylesheet (Light Elegant Aesthetic)
   ========================================================================== */

:root {
    --bg-main: #e6ede7;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-border: rgba(148, 163, 184, 0.35);
    --primary: #7c3aed;
    --primary-light: #6d28d9;
    --primary-glow: rgba(124, 58, 237, 0.25);
    --accent: #ec4899;
    --accent-glow: rgba(236, 72, 153, 0.3);
    --success: #059669;
    --gold: #d97706;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Zen Maru Gothic', 'Outfit', sans-serif;
}

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

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow: hidden;
    font-size: 15px;
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(124, 58, 237, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 90% 90%, rgba(16, 185, 129, 0.06) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.6) 0%, transparent 100%);
}

/* ==========================================================================
   Opening Splash Screen
   ========================================================================== */
.splash-screen {
    position: fixed;
    inset: 0;
    background: #e6ede7;
    background-image: 
        radial-gradient(circle at 50% 40%, rgba(124, 58, 237, 0.12) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    max-width: 380px;
}

.splash-logo-icon {
    font-size: 3.5rem;
    margin-bottom: 0.8rem;
    animation: floatGlow 2s ease-in-out infinite alternate;
    filter: drop-shadow(0 6px 16px rgba(124, 58, 237, 0.35));
}

@keyframes floatGlow {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-8px) scale(1.08); }
}

.splash-title {
    font-family: var(--font-heading);
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 1.5px;
    background: linear-gradient(135deg, #4338ca, #7c3aed, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
}

.splash-subtitle {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 1.8rem;
}

.splash-indicator {
    width: 140px;
    height: 4px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.splash-progress-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: var(--radius-full);
    animation: splashProgress 1.4s cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@keyframes splashProgress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(0); }
}

/* ==========================================================================
   Base Container & Screen Architecture
   ========================================================================== */
.game-container {
    max-width: 520px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.5rem;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.game-screen {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.game-screen.active {
    display: flex;
    animation: screenFadeIn 0.3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

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

/* Common App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.9rem;
    min-height: 54px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-md);
    margin-bottom: 0.4rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.brand-title {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.brand-title h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.brand-icon {
    font-size: 1.3rem;
}

/* ==========================================================================
   Screen 1: Home Screen
   ========================================================================== */
.home-hero-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-around;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.4rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    text-align: center;
    margin-bottom: 0.3rem;
    overflow: hidden;
}

.stage-tag {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--primary);
    background: rgba(124, 58, 237, 0.1);
    padding: 3px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(124, 58, 237, 0.25);
}

.next-stage-badge {
    font-family: var(--font-heading);
    font-size: 2.3rem;
    font-weight: 900;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #1e293b, #4338ca, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0.2rem 0;
}

.home-stage-desc {
    font-size: 0.86rem;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.4;
}

.home-artwork-preview {
    position: relative;
    width: 140px;
    height: 195px;
    aspect-ratio: 26 / 38;
    margin: 0.6rem 0;
    border: 2px solid #334155;
    background: #0f172a;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
    overflow: hidden;
}

.home-artwork-preview .preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.home-artwork-preview:hover .preview-img {
    transform: scale(1.05);
}

.preview-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 60%, rgba(15, 23, 42, 0.6));
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0.5rem;
}

.preview-icon {
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.home-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: 320px;
}

.btn-play-huge {
    padding: 0.95rem 1.4rem;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.play-icon {
    font-size: 1.2rem;
}

.btn-collection-link {
    background: #ffffff;
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    color: var(--text-main);
    padding: 0.75rem 1.2rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-collection-link:hover {
    background: #f8fafc;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.12);
}

/* ==========================================================================
   Screen 2: Gameplay Layout
   ========================================================================== */
.header-right-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-stage-chip {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    padding: 4px 10px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: var(--radius-full);
    color: var(--primary);
}

.capsule-progress-badge {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-main);
    font-weight: 800;
}

.capsule-progress-badge .capsule-icon {
    font-size: 1.45rem;
    filter: drop-shadow(0 2px 6px var(--primary-glow));
}

.capsule-progress-badge .count-popped {
    color: var(--primary);
    font-size: 1.45rem;
    font-weight: 900;
    letter-spacing: 0.5px;
}

.capsule-progress-badge .sep {
    color: rgba(100, 116, 139, 0.45);
    margin: 0 1px;
    font-size: 1.15rem;
}

.capsule-progress-badge .count-total {
    color: var(--text-muted);
    font-size: 1.15rem;
    font-weight: 700;
}

.percent-badge {
    font-size: 0.85rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.28);
    color: var(--primary);
    margin-left: 0.3rem;
}

.btn-icon-tool {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-icon-tool:hover {
    background: #ffffff;
    transform: scale(1.08);
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-icon-tool:active {
    transform: scale(0.92);
}

/* Main Bead Puzzle Viewport: Board + Stock Area Below */
.game-viewport.bead-layout {
    flex: 1;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    overflow: hidden;
    padding: 0.1rem 0;
}

/* Unified Board + Stock Unit */
.game-board-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: auto;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    flex: 0 0 auto;
}

/* 1. Bead Board Frame (スタイリッシュ・スリム装飾枠 / 角丸なし) */
.bead-board-frame {
    flex: 0 0 auto;
    min-height: 0;
    min-width: 0;
    position: relative;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: var(--board-aspect, 26 / 38);
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 0;
    overflow: visible;
    box-shadow: 
        0 10px 25px -4px rgba(15, 23, 42, 0.18),
        0 4px 10px -2px rgba(15, 23, 42, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.8) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* 外側と内側のスタイリッシュなスリム装飾フレーム */
.bead-board-frame::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(71, 85, 105, 0.4);
    pointer-events: none;
    z-index: 10;
}

.bead-board-frame::after {
    content: '';
    position: absolute;
    inset: 1px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    pointer-events: none;
    z-index: 10;
}

#beadCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
    touch-action: none;
}

/* 2. Stock Area Card (画像下のストックエリア) */
.stock-area-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(148, 163, 184, 0.45);
    border-radius: 0;
    padding: 0.35rem 0.4rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.stock-slots-grid {
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 3px 2.5px;
    justify-items: center;
    align-items: center;
    width: 100%;
}

.stock-slot {
    width: 100%;
    max-width: 22px;
    aspect-ratio: 1;
    border-radius: var(--radius-full);
    background: radial-gradient(circle at 50% 50%, #f8fafc 0%, #cbd5e1 100%);
    border: 1px solid rgba(100, 116, 139, 0.35);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.22),
        0 1px 2px rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stock-slot:hover {
    border-color: var(--primary);
    transform: scale(1.15);
}

.stock-slot.selected {
    border-color: var(--accent);
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.25),
        0 0 10px var(--accent-glow);
    z-index: 10;
}

.stock-slot .stock-bead {
    width: 84%;
    height: 84%;
    border-radius: 50%;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.3),
        inset -1px -1px 3px rgba(0, 0, 0, 0.4),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.7);
    position: relative;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.stock-slot.selected .stock-bead {
    transform: translateY(-5px);
    box-shadow: 
        0 8px 16px rgba(0, 0, 0, 0.35),
        0 0 10px var(--accent-glow),
        inset -1px -1px 3px rgba(0, 0, 0, 0.4),
        inset 1.5px 1.5px 3px rgba(255, 255, 255, 0.8);
}

.stock-slot .stock-bead::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 14%;
    width: 35%;
    height: 35%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
}

/* Sparkle Layer */
.sparkle-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

/* Flying Bead Travel FX */
.flying-bead-fx {
    position: fixed;
    top: 0;
    left: 0;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    margin-top: -7px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.35),
        inset -1px -1px 2px rgba(0, 0, 0, 0.4),
        inset 1px 1px 2px rgba(255, 255, 255, 0.85);
    transition: transform 0.52s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.flying-bead-fx::after {
    content: '';
    position: absolute;
    top: 12%;
    left: 14%;
    width: 35%;
    height: 35%;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   Screen 3: Collection Screen (4x4 Grid in Descending Order)
   ========================================================================== */
.collection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-back {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #ffffff;
    border-color: var(--primary);
    transform: translateX(-2px);
}

.collection-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collection-title-wrap h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
}

.collection-count-badge {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--primary);
    background: rgba(124, 58, 237, 0.12);
    border: 1px solid rgba(124, 58, 237, 0.25);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.collection-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-lg);
    padding: 0.8rem;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.collection-intro {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.75rem;
}

/* 4x4 Grid */
.collection-grid-4x4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    width: 100%;
}

.collection-item {
    aspect-ratio: 26 / 38;
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    background: #0f172a;
    border: 1.5px solid #334155;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.collection-item:hover {
    transform: scale(1.06);
    border-color: var(--primary);
    box-shadow: 0 8px 18px rgba(124, 58, 237, 0.25);
    z-index: 5;
}

.collection-item .thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.collection-item .stage-num-badge {
    position: absolute;
    bottom: 3px;
    right: 3px;
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 900;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1px 4px;
    border-radius: 3px;
}

.collection-item.locked {
    background: #dbe4dc;
    border: 1.5px dashed rgba(100, 116, 139, 0.35);
    box-shadow: none;
    cursor: not-allowed;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.collection-item.locked:hover {
    transform: none;
    border-color: rgba(100, 116, 139, 0.5);
    box-shadow: none;
}

.collection-item.locked .lock-icon {
    font-size: 1.1rem;
    opacity: 0.5;
}

.collection-item.locked .lock-stage-label {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-dim);
}

/* ==========================================================================
   Modals & Lightbox
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: var(--radius-lg);
    padding: 1.4rem;
    max-width: 420px;
    width: 100%;
    color: var(--text-main);
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.open .modal-card {
    transform: scale(1);
}

/* Fullscreen Artwork Lightbox */
.modal-lightbox {
    background: rgba(10, 12, 20, 0.88);
    backdrop-filter: blur(16px);
    padding: 0.8rem;
}

.lightbox-wrapper {
    position: relative;
    max-width: 440px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.btn-close-lightbox {
    position: absolute;
    top: -12px;
    right: -6px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    z-index: 20;
    transition: all 0.2s ease;
}

.btn-close-lightbox:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

.lightbox-image-container {
    width: 100%;
    max-height: 72vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #334155;
    background: #0f172a;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}

.lightbox-img {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.lightbox-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    color: #ffffff;
}

.lightbox-info h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
}

/* Menu Modal */
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.menu-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-main);
    font-weight: 700;
}

.btn-close-menu {
    background: rgba(0, 0, 0, 0.06);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-close-menu:hover {
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-main);
}

.menu-actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.menu-action-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-action-btn:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.1);
}

.menu-action-btn .action-icon {
    font-size: 1.8rem;
}

.menu-action-btn .action-text strong {
    display: block;
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 2px;
}

.menu-action-btn .action-text p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
}

/* Victory Modal */
.victory-card {
    text-align: center;
}

.confetti-icon {
    font-size: 3rem;
    margin-bottom: 0.4rem;
    animation: bounce 1s infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-8px) scale(1.1); }
}

.victory-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #d97706, #ec4899, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.victory-header p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.2rem;
}

.unlocked-artwork-frame {
    position: relative;
    width: 100%;
    max-width: 240px;
    margin: 0 auto 1.2rem;
    border-radius: 0;
    overflow: hidden;
    border: 2px solid #d97706;
    box-shadow: 0 8px 30px rgba(217, 119, 6, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
}

.unlocked-img {
    max-width: 100%;
    max-height: 260px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.victory-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.stat-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.75rem;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.victory-actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Rules Modal */
.rules-card {
    max-width: 440px;
}

.rules-header {
    text-align: center;
    margin-bottom: 1.2rem;
}

.rules-icon {
    font-size: 2.2rem;
    margin-bottom: 0.3rem;
}

.rules-header h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-main);
    font-weight: 800;
}

.rules-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.4rem;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius-md);
}

.rule-badge {
    background: var(--primary);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 800;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.rule-text strong {
    display: block;
    color: var(--text-main);
    font-size: 0.92rem;
    margin-bottom: 2px;
}

.rule-text p {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.35;
    margin: 0;
}

/* Common Buttons */
.btn {
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-primary {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    font-size: 1.05rem;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px var(--primary-glow);
}

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

.btn-secondary {
    width: 100%;
    padding: 0.8rem;
    background: #ffffff;
    border: 1.5px solid rgba(148, 163, 184, 0.4);
    color: var(--text-main);
    font-size: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.btn-ghost {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.btn-ghost:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.04);
}

.btn-sm {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Toast */
.toast-box {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
    pointer-events: none;
}

.toast-item {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes toastIn {
    from { transform: translateY(20px) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
