@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Noto+Sans+KR:wght@300;400;500;700;900&display=swap');

:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.2);
    
    /* Harmonious Vibrant Colors */
    --primary: #6366f1;       /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.35);
    --secondary: #ec4899;     /* Pink */
    --secondary-glow: rgba(236, 72, 153, 0.35);
    --accent: #f59e0b;        /* Amber */
    --accent-glow: rgba(245, 158, 11, 0.35);
    
    --success: #10b981;       /* Emerald */
    --success-glow: rgba(16, 185, 129, 0.35);
    --danger: #ef4444;        /* Red */
    --danger-glow: rgba(239, 68, 68, 0.35);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --font-primary: 'Outfit', 'Noto Sans KR', sans-serif;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-blur: blur(16px);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 10%, rgba(236, 72, 153, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 90%, rgba(16, 185, 129, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Header & Brand */
header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: var(--glass-blur);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.brand-icon {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
}

.brand h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 50%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand span {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 99px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.back-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: translateX(-3px);
}

.hidden {
    display: none !important;
}

/* Dashboard Grid */
.dashboard {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px 60px;
}

.dashboard-header-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    gap: 15px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 28px;
    padding: 24px;
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

@media (min-width: 768px) {
    .dashboard-header-banner {
        flex-direction: row;
        gap: 30px;
        text-align: left;
        justify-content: flex-start;
        padding: 24px 40px;
    }
    .dashboard-header-banner .dashboard-title {
        text-align: left;
        margin-bottom: 0;
    }
}

.mascot-container {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mascot-float 4s ease-in-out infinite;
    flex-shrink: 0;
}

.oz-mascot-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

@keyframes mascot-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.dashboard-title {
    text-align: center;
    margin-bottom: 0;
}

.dashboard-title h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-title p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
}

/* Game Cards */
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 28px;
    backdrop-filter: var(--glass-blur);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--card-color-1, var(--primary)), var(--card-color-2, var(--secondary)));
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px var(--card-glow, var(--primary-glow));
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.game-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.game-icon {
    font-size: 2.5rem;
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
    transform: scale(1.15) rotate(5deg);
}

.game-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.game-student {
    font-size: 0.85rem;
    color: var(--card-color-1, var(--primary));
    font-weight: 600;
    margin-bottom: 12px;
}

.game-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 16px;
}

.math-concept {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.play-btn-card {
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.play-btn-card::after {
    content: '→';
    transition: transform 0.2s ease;
}

.game-card:hover .play-btn-card::after {
    transform: translateX(4px);
}

/* Main Playground Container */
.playground {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px 60px;
}

.game-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 30px;
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.game-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.game-info-title h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.game-info-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    gap: 12px;
}

.info-badge {
    color: var(--primary);
    font-weight: bold;
}

.game-action-buttons {
    display: flex;
    gap: 12px;
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

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

.action-btn.accent {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    box-shadow: 0 4px 15px var(--primary-glow);
}

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

/* Original Sheet Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-container {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 25px 60px rgba(0,0,0,0.8);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 20px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.4rem;
    font-weight: 800;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.close-modal-btn:hover {
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sheet-images-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.sheet-image-wrapper {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: #0f172a;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet-image-wrapper:hover, .sheet-image-wrapper.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-2px);
}

.sheet-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sheet-viewer-main {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
    background: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    max-height: 400px;
}

.sheet-viewer-main img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.sheet-rules-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px;
}

.sheet-rules-box h4 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.sheet-rules-box p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* General Layouts for Games */
.game-play-area {
    display: flex;
    gap: 30px;
    min-height: 520px;
}

.game-board-container {
    flex: 1.6;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-controls-panel {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 24px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.control-section h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 16px;
}

/* Sound Toggle Button */
.sound-toggle-btn {
    font-size: 1.2rem;
    padding: 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition-smooth);
}
.sound-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(3deg); }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* Win / Lose UI Overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: 24px;
}

.overlay-screen.active {
    opacity: 1;
    pointer-events: all;
}

.overlay-card {
    text-align: center;
    max-width: min(520px, calc(100% - 32px));
    padding: 40px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    transform: scale(0.85);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.overlay-screen.active .overlay-card {
    transform: scale(1);
}

.overlay-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1;
}

.overlay-title.win {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: bounce 2s ease-in-out infinite;
}

.overlay-title.lose {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.overlay-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.overlay-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: var(--transition-smooth);
}

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

/* ==========================================================================
   GAME SPECIFIC STYLING
   ========================================================================== */

/* Game 1: Stairs */
.stairs-canvas {
    width: 100%;
    height: 100%;
    border-radius: 24px;
    background: #0f172a;
    display: block;
}

/* Game 2: 글씨 밀기 게임 (Sokoban Jamo Pusher) */
.letters-grid-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px;
}

.letters-workspace {
    flex: 1;
    position: relative;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 8×8 grid cells */
.g2-cell {
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    min-width: 0;
    min-height: 0;
}

/* Target zone - first syllable (blue) */
.g2-cell.g2-target-0 {
    background: rgba(59,130,246,0.12);
    border: 1.5px dashed rgba(59,130,246,0.5);
}
/* Target zone - second syllable (purple) */
.g2-cell.g2-target-1 {
    background: rgba(139,92,246,0.12);
    border: 1.5px dashed rgba(139,92,246,0.5);
}
/* Target correctly filled */
.g2-cell.g2-target-filled-0 {
    background: rgba(16,185,129,0.25);
    border: 2px solid rgba(16,185,129,0.8);
    box-shadow: 0 0 8px rgba(16,185,129,0.4);
}
.g2-cell.g2-target-filled-1 {
    background: rgba(16,185,129,0.25);
    border: 2px solid rgba(16,185,129,0.8);
    box-shadow: 0 0 8px rgba(16,185,129,0.4);
}

/* Ghost char shown in empty target */
.g2-ghost {
    font-size: clamp(1rem, 3.5vw, 1.6rem);
    font-weight: 900;
    opacity: 0.22;
    pointer-events: none;
    line-height: 1;
}
.g2-target-0 .g2-ghost { color: #93c5fd; }
.g2-target-1 .g2-ghost { color: #c4b5fd; }

/* Target label (초성/중성/종성) */
.g2-target-label {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.45rem;
    opacity: 0.5;
    line-height: 1;
    pointer-events: none;
}
.g2-target-0 .g2-target-label { color: #93c5fd; }
.g2-target-1 .g2-target-label { color: #c4b5fd; }

/* Pushable jamo tile */
.g2-cell.g2-tile-cell {
    background: rgba(30,30,60,0.6);
    border: 1.5px solid rgba(255,255,255,0.18);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    cursor: pointer;
}

/* Jamo character inside tile or target-filled */
.g2-jamo {
    font-size: clamp(1.1rem, 4vw, 1.9rem);
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
}
.g2-tile-cell .g2-jamo  { color: #e0e7ff; text-shadow: 0 0 8px rgba(148,163,255,0.6); }
.g2-target-filled-0 .g2-jamo,
.g2-target-filled-1 .g2-jamo { color: #6ee7b7; text-shadow: 0 0 10px rgba(110,231,183,0.7); }

/* Player character cell */
.g2-cell.g2-char-cell {
    background: rgba(251,191,36,0.15);
    border: 1.5px solid rgba(251,191,36,0.4);
    border-radius: 50%;
    z-index: 2;
}
.g2-char-icon {
    font-size: clamp(1rem, 3.5vw, 1.7rem);
    line-height: 1;
    pointer-events: none;
}

/* Item pickup cell */
.g2-cell.g2-item-cell {
    border: 1.5px solid rgba(251,191,36,0.6);
    background: rgba(251,191,36,0.1);
    animation: g2-item-pulse 1.2s ease-in-out infinite;
}
.g2-item-icon {
    font-size: clamp(0.9rem, 3vw, 1.4rem);
    line-height: 1;
}

/* Word guide in controls panel */
.g2-word-guide {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.g2-syl-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1.5px solid;
    min-width: 52px;
}
.g2-syl-box-0 { border-color: rgba(59,130,246,0.5); background: rgba(59,130,246,0.08); }
.g2-syl-box-1 { border-color: rgba(139,92,246,0.5); background: rgba(139,92,246,0.08); }
.g2-syl-name {
    font-size: 1.1rem;
    font-weight: 900;
    color: white;
    line-height: 1;
}
.g2-syl-row {
    display: flex;
    gap: 4px;
}
.g2-syl-slot {
    font-size: 0.75rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 4px;
    line-height: 1.4;
}
.g2-syl-box-0 .g2-syl-slot { color: #93c5fd; background: rgba(59,130,246,0.15); }
.g2-syl-box-1 .g2-syl-slot { color: #c4b5fd; background: rgba(139,92,246,0.15); }

/* Score display */
.g2-score-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 6px;
    color: var(--text-muted);
}
.g2-score-val { font-weight: bold; color: #fbbf24; }

@keyframes g2-item-pulse {
    0%, 100% { box-shadow: 0 0 4px rgba(251,191,36,0.3); }
    50%       { box-shadow: 0 0 12px rgba(251,191,36,0.7); }
}
@keyframes g2-flash-anim {
    0%   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
    80%  { opacity: 1; transform: translate(-50%,-70%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%,-80%) scale(0.9); }
}

.letter-target {
    width: 60px;
    height: 60px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.1);
    position: relative;
    transition: var(--transition-smooth);
}

.letter-target.highlight {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.letter-target.filled {
    border-style: solid;
    border-color: var(--success);
    color: white;
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.word-check-btn {
    background: linear-gradient(135deg, var(--success), #059669);
    border: none;
    color: white;
    font-weight: bold;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 10px var(--success-glow);
}

.word-check-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px var(--success-glow);
}

/* Game 3: Shapes Pushing Grid */
.grid-playfield {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    width: 90%;
    max-width: 440px;
    aspect-ratio: 1/1;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.7);
    position: relative;
    overflow: hidden;
}

.grid-cell {
    border-right: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.grid-shape {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.shape-svg-glow {
    filter: drop-shadow(0 0 10px var(--primary-glow));
    transition: var(--transition-smooth);
}

.grid-goal {
    position: absolute;
    border: 2px dashed var(--success);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    animation: pulse 2s infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-goal::after {
    content: 'Goal';
    color: var(--success);
    font-size: 0.7rem;
    font-weight: bold;
}

.push-controls-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 240px;
    margin: 0 auto;
}

.push-control-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: white;
    font-weight: bold;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

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

.push-control-btn.empty {
    opacity: 0;
    pointer-events: none;
}

/* Game 4: Water Cup */
.cup-arena {
    width: 100%;
    height: 100%;
    position: relative;
}

.dispenser {
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transition: var(--transition-smooth);
}

.dispenser img {
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    object-fit: contain;
}

.dispenser.top-left { top: 20px; left: 20px; border-color: #f97316; background: rgba(249, 115, 22, 0.15); color: #ffedd5; }
.dispenser.top-right { top: 20px; right: 20px; border-color: #8b5cf6; background: rgba(139, 92, 246, 0.15); color: #f5f3ff; }
.dispenser.bottom-left { bottom: 20px; left: 20px; border-color: #10b981; background: rgba(16, 185, 129, 0.15); color: #ecfdf5; }
.dispenser.bottom-right { bottom: 20px; right: 20px; border-color: #f43f5e; background: rgba(244, 63, 94, 0.15); color: #fff1f2; }

.dispenser.active {
    transform: scale(1.1);
    box-shadow: 0 0 25px currentColor;
    border-color: currentColor;
}

.cup-character {
    position: absolute;
    width: 70px;
    height: 90px;
    top: calc(50% - 45px);
    left: calc(50% - 35px);
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px 12px 24px 24px;
    cursor: grab;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
}

.cup-character:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.25);
}

.cup-fluid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%;
    background: rgba(255, 255, 255, 0.3);
    transition: height 0.6s ease, background 0.4s ease;
}

.cup-icon {
    font-size: 2.2rem;
    z-index: 2;
    animation: float 2.5s ease-in-out infinite;
}

/* Game 5: Push Person */
.person-scene {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.fit-wall {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 2px solid rgba(255,255,255,0.1);
    border-bottom: 2px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.fit-hole {
    position: absolute;
    height: 70px;
    width: 70px;
    border: 3px dashed var(--accent);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 15px rgba(245, 158, 11, 0.2);
}

.fit-hole-svg {
    width: 80%;
    height: 80%;
    stroke: var(--accent);
    stroke-width: 3;
    fill: none;
}

.stick-man {
    position: absolute;
    bottom: 30px;
    width: 60px;
    height: 80px;
    transition: left 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stick-svg {
    width: 100%;
    height: 100%;
    stroke: var(--primary);
    stroke-width: 4;
    stroke-linecap: round;
    fill: none;
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.pose-select-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    margin-bottom: 12px;
}

.pose-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pose-btn svg {
    width: 80%;
    height: 80%;
    stroke: var(--text-muted);
    stroke-width: 4;
    fill: none;
}

.pose-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

.pose-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.pose-btn.active svg {
    stroke: var(--primary);
}

.slide-controls {
    display: flex;
    gap: 12px;
    width: 100%;
}

.slide-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: white;
    font-weight: bold;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

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

/* Game 6: Doll Shop */
.doll-workshop {
    width: 100%;
    height: 100%;
    position: relative;
    background: radial-gradient(circle, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.doll-body-base {
    position: absolute;
    width: 160px;
    height: 240px;
    top: calc(50% - 120px);
    left: calc(50% - 80px);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 40px;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.doll-body-base.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.doll-part {
    position: absolute;
    cursor: grab;
    z-index: 5;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5));
    touch-action: none;
}

.doll-part:active {
    cursor: grabbing;
    z-index: 100;
}

.doll-part-placed {
    position: absolute;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    pointer-events: none;
    opacity: 0.3;
}

.doll-part-placed.correct {
    opacity: 1;
}

.ai-evaluator {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 90px;
    height: 90px;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid var(--accent);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--accent-glow);
    z-index: 10;
}

.ai-evaluator svg {
    width: 48px;
    height: 48px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
}

.sewing-line-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.sewing-node {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1e293b;
    border: 3px solid var(--accent);
    cursor: pointer;
    pointer-events: all;
    transform: translate(-50%, -50%);
    z-index: 15;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: transform 0.2s, background-color 0.2s;
}

.sewing-node.active {
    background: var(--accent);
    transform: translate(-50%, -50%) scale(1.3);
    animation: bounce 1.5s infinite;
}

.sewing-node.done {
    background: var(--success);
    border-color: var(--success);
    pointer-events: none;
}

.doll-workshop {
    background:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px),
        radial-gradient(circle at 50% 42%, rgba(245,158,11,0.12), transparent 34%),
        radial-gradient(circle, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.94) 100%);
    background-size: 34px 34px, 34px 34px, 100% 100%, 100% 100%;
    overflow: hidden;
}

.doll-body-base {
    width: 300px;
    height: 390px;
    top: calc(50% - 185px);
    left: calc(50% - 150px);
    border: none;
    background: transparent;
    overflow: visible;
    z-index: 2;
}

.doll-silhouette {
    position: absolute;
    inset: 0;
    filter: drop-shadow(0 18px 22px rgba(0,0,0,0.38));
}

.doll-head,
.doll-body {
    position: absolute;
    background: linear-gradient(145deg, color-mix(in srgb, var(--doll-color) 88%, white), var(--doll-color));
    border: 3px solid rgba(255,255,255,0.18);
    box-shadow: inset 0 -16px 26px rgba(0,0,0,0.16);
}

.doll-head {
    width: 166px;
    height: 144px;
    left: 67px;
    top: 58px;
    border-radius: 48% 48% 45% 45%;
    z-index: 2;
}

.doll-body {
    width: 172px;
    height: 188px;
    left: 64px;
    top: 184px;
    border-radius: 46% 46% 40% 40%;
    z-index: 1;
}

.doll-rabbit .doll-head {
    border-radius: 44% 44% 48% 48%;
}

.doll-face-eye {
    position: absolute;
    top: 56px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #111827;
    box-shadow: inset 0 0 0 4px rgba(255,255,255,0.12);
}

.doll-face-eye.left { left: 48px; }
.doll-face-eye.right { right: 48px; opacity: 0.28; border: 2px dashed #111827; background: transparent; }

.doll-face-mouth {
    position: absolute;
    width: 46px;
    height: 20px;
    left: 60px;
    top: 88px;
    border-bottom: 4px solid #111827;
    border-radius: 0 0 40px 40px;
}

.doll-stitch-wound {
    position: absolute;
    width: 88px;
    height: 58px;
    left: 42px;
    top: 58px;
    border-radius: 20px;
    border: 2px dashed rgba(248,250,252,0.38);
    background:
        linear-gradient(45deg, transparent 46%, rgba(248,250,252,0.5) 47%, rgba(248,250,252,0.5) 53%, transparent 54%),
        linear-gradient(-45deg, transparent 46%, rgba(248,250,252,0.5) 47%, rgba(248,250,252,0.5) 53%, transparent 54%);
    background-size: 18px 18px;
    opacity: 0.55;
}

.doll-socket {
    position: absolute;
    border: 2px dashed rgba(255,255,255,0.24);
    background: rgba(15,23,42,0.16);
    z-index: 0;
}

.doll-socket.ear-left,
.doll-socket.ear-right {
    width: 58px;
    height: 58px;
    top: 34px;
    border-radius: 50%;
}

.doll-socket.ear-left { left: 34px; }
.doll-socket.ear-right { left: 204px; }

.doll-socket.arm-left,
.doll-socket.arm-right {
    width: 46px;
    height: 86px;
    top: 204px;
    border-radius: 999px;
}

.doll-socket.arm-left { left: 0; }
.doll-socket.arm-right { right: 0; }

.doll-part-element,
.doll-part-ghost-element {
    position: absolute;
    width: var(--part-w);
    height: var(--part-h);
    box-sizing: border-box;
    transition: left 0.14s ease, top 0.14s ease, transform 0.14s ease, opacity 0.14s ease;
}

.doll-part-element {
    z-index: 8;
    cursor: grab;
    touch-action: none;
    filter: drop-shadow(0 8px 18px rgba(0,0,0,0.42));
}

.doll-part-element.active {
    box-shadow: 0 0 0 3px rgba(255,255,255,0.72), 0 0 22px rgba(245,158,11,0.78);
}

.doll-part-element.dragging {
    cursor: grabbing;
    transform: scale(1.06);
    transition: none;
}

.doll-part-element.placed {
    pointer-events: none;
    z-index: 6;
}

.doll-part-ghost-element {
    z-index: 3;
    opacity: 0.48;
    filter: grayscale(1);
    pointer-events: none;
}

.doll-piece {
    background: linear-gradient(145deg, color-mix(in srgb, var(--part-color) 85%, white), var(--part-color));
    border: 3px solid rgba(255,255,255,0.24);
    overflow: hidden;
}

.doll-part-ghost-element.doll-piece {
    background: rgba(255,255,255,0.05);
    border: 2px dashed rgba(255,255,255,0.55);
}

.doll-piece .piece-detail {
    position: absolute;
    display: block;
}

.piece-ear {
    border-radius: 50%;
}

.piece-ear .piece-detail {
    inset: 13px;
    border-radius: 50%;
    background: var(--part-accent);
    opacity: 0.9;
}

.piece-rabbit-ear {
    border-radius: 50% 50% 44% 44%;
}

.piece-rabbit-ear .piece-detail {
    inset: 12px 10px 16px;
    border-radius: 50% 50% 42% 42%;
    background: var(--part-accent);
    opacity: 0.86;
}

.piece-arm {
    border-radius: 999px;
}

.piece-arm .piece-detail {
    left: 50%;
    bottom: 9px;
    width: 24px;
    height: 16px;
    border-bottom: 3px solid rgba(255,255,255,0.42);
    border-radius: 0 0 20px 20px;
    transform: translateX(-50%);
}

.piece-button {
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #f8fafc, #94a3b8 70%);
    border-color: #fef3c7;
}

.piece-button .piece-detail,
.piece-button::before,
.piece-button::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #475569;
}

.piece-button .piece-detail { left: 10px; top: 10px; }
.piece-button::before { right: 10px; top: 10px; }
.piece-button::after { left: 15px; bottom: 9px; }

.piece-patch {
    border-radius: 16px;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.26) 50%, transparent 50%),
        linear-gradient(var(--part-accent), color-mix(in srgb, var(--part-accent) 72%, #f59e0b));
    background-size: 14px 100%, 100% 100%;
    border: 3px dashed rgba(255,255,255,0.65);
}

.piece-patch .piece-detail {
    inset: 9px;
    border: 2px dashed rgba(15,23,42,0.28);
    border-radius: 10px;
}

.piece-bow {
    background: transparent;
    border: none;
    overflow: visible;
}

.piece-bow::before,
.piece-bow::after {
    content: "";
    position: absolute;
    top: 8px;
    width: 34px;
    height: 30px;
    background: #ec4899;
    border: 3px solid rgba(255,255,255,0.32);
    transform: rotate(45deg);
}

.piece-bow::before {
    left: 3px;
    border-radius: 16px 6px 16px 6px;
}

.piece-bow::after {
    right: 3px;
    border-radius: 6px 16px 6px 16px;
}

.piece-bow .piece-detail {
    left: 27px;
    top: 14px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #be185d;
    z-index: 2;
}

.doll-control-title {
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--text-main);
}

.doll-control-title span {
    color: var(--accent);
}

.doll-control-copy {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 10px;
}

.doll-vector-card {
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
}

.doll-vector-card span {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.doll-vector-card strong {
    color: var(--text-main);
    font-size: 0.92rem;
}

.doll-vector-card.target strong {
    color: var(--accent);
}

.doll-part-queue {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 12px;
}

.doll-part-pill {
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.04);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 0.72rem;
}

.doll-part-pill.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(245,158,11,0.12);
}

.doll-part-pill.done {
    border-color: rgba(16,185,129,0.6);
    color: #34d399;
}

.doll-submit-btn {
    background: linear-gradient(135deg, #10b981, #059669) !important;
}

.sew-pattern {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 10px 0;
}

.sew-pattern span {
    display: grid;
    place-items: center;
    min-height: 42px;
    border-radius: 12px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 1.35rem;
    color: var(--text-muted);
}

.sew-pattern span.active {
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(245,158,11,0.22);
}

.sew-pattern span.done {
    color: #34d399;
    border-color: rgba(16,185,129,0.6);
}

.sew-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.sewing-node {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 9;
}

.doll-final-summary {
    display: grid;
    place-items: center;
    gap: 4px;
    margin-bottom: 14px;
}

.doll-final-summary strong {
    font-size: 2.8rem;
    line-height: 1;
}

.doll-final-summary.pass strong {
    color: #34d399;
}

.doll-final-summary.fail strong {
    color: #f87171;
}

.doll-final-summary span {
    color: var(--text-main);
    font-weight: 800;
}

.doll-toast {
    position: absolute;
    top: 18px;
    left: 50%;
    max-width: min(360px, calc(100% - 32px));
    transform: translateX(-50%);
    background: rgba(15,23,42,0.96);
    border: 1px solid rgba(129,140,248,0.7);
    color: #f8fafc;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.45;
    z-index: 20;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.doll-toast.fade-out {
    opacity: 0;
    transform: translate(-50%, -8px);
}

.repair-part-box {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.repair-part-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    aspect-ratio: 1/1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    padding: 4px;
    text-align: center;
}

.repair-part-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    color: white;
}

.repair-part-card.placed {
    opacity: 0.4;
    pointer-events: none;
    border-color: var(--success);
}

/* responsive controls for tablet view */
@media (max-width: 900px) {
    .game-play-area {
        flex-direction: column;
    }
    .game-board-container {
        min-height: 400px;
    }
}

/* ==========================================================================
   AI SETTINGS & CHATBOT WIDGET STYLING
   ========================================================================== */

/* Settings button in header */
.settings-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

/* Glassmorphic Modal override */
.modal-content.glassmorphic {
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    color: var(--text-main);
    position: relative;
    width: 100%;
}

/* Floating AI Chat Widget */
.ai-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
    font-family: var(--font-primary);
}

.ai-chat-toggle-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 14px 22px;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 24px var(--primary-glow);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.ai-chat-toggle-btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 12px 32px var(--primary-glow), 0 0 15px rgba(236, 72, 153, 0.3);
}

.ai-chat-toggle-btn .chat-icon {
    font-size: 1.3rem;
    animation: float 2.5s ease-in-out infinite;
}

.ai-chat-container {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 360px;
    height: 480px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
    animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.ai-chat-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.ai-chat-header-info {
    flex: 1;
}

.ai-chat-header-info h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.ai-chat-header-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.pulse-indicator {
    color: #10b981;
    margin-right: 4px;
    display: inline-block;
    animation: pulse 1.8s infinite;
}

.ai-chat-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.ai-chat-close-btn:hover {
    color: white;
    transform: rotate(90deg);
}

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.chat-message.bot {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
    max-width: 80%;
}

.message-avatar {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.message-content {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-main);
}

.chat-message.bot .message-content {
    border-top-left-radius: 4px;
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.15);
}

.chat-message.user .message-content {
    border-top-right-radius: 4px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Typing indicator dots */
.chat-message.bot.typing .message-content {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.chat-message.bot.typing .dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dot-pulse 1.4s infinite ease-in-out;
}

.chat-message.bot.typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-message.bot.typing .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 1; }
}

.ai-chat-input-area {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.95);
}

.ai-chat-input-area input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 12px;
    color: white;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-smooth);
}

.ai-chat-input-area input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 8px var(--primary-glow);
}

.ai-chat-input-area button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.ai-chat-input-area button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px var(--primary-glow);
}

/* AI Diagnostics panel in Game 6 overlay */
.ai-diag-card {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 20px;
    margin-top: 16px;
    box-shadow: 0 8px 32px var(--accent-glow);
    text-align: left;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    animation: diag-slide-up 0.4s ease;
}

@keyframes diag-slide-up {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-diag-robot-avatar {
    font-size: 2.2rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: 14px;
    padding: 8px;
    line-height: 1;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
}

.ai-diag-content h4 {
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-diag-content p {
    color: var(--text-main);
    font-size: 0.85rem;
    line-height: 1.5;
}
