/* ========================================
   SETUP SCREEN
======================================== */
.setup-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, #DBAD2B 0%, #F5D876 100%);
    padding: 120px 20px 60px;
    position: relative;
    overflow: hidden;
}

.setup-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="2"/></svg>');
    opacity: 0.3;
    animation: bgMove 20s linear infinite;
}

@keyframes bgMove {
    0% {
        transform: translate(0, 0);
    }

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

.setup-card {
    max-width: 1100px;
    margin: 0 auto;
    background: white;
    border-radius: 30px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    z-index: 2;
    animation: slideUp 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

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

.setup-header {
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
    padding: 50px 30px;
    text-align: center;
    color: white;
}

.setup-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.setup-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 10px;
}

.setup-header p {
    font-size: 1.2rem;
    opacity: 0.95;
}

.setup-body {
    padding: 40px 30px;
}

/* Child Info */
.child-info {
    background: linear-gradient(135deg, rgba(219, 173, 43, 0.1), rgba(245, 216, 118, 0.15));
    border: 2px solid rgba(219, 173, 43, 0.2);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin-bottom: 40px;
}

.child-avatar-large {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(219, 173, 43, 0.3);
}

.child-info h3 {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 15px;
    color: var(--dark);
}

.child-stats-inline {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.1rem;
}

.child-stats-inline span {
    color: var(--gray);
}

.child-stats-inline i {
    color: #DBAD2B;
    margin-left: 5px;
}

.child-stats-inline strong {
    color: var(--dark);
    font-weight: 900;
    font-size: 1.3rem;
}

/* Form Section */
.form-section {
    margin-bottom: 40px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 20px;
}

.section-label i {
    color: #DBAD2B;
    font-size: 1.5rem;
}

/* Mode Grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.mode-option {
    padding: 30px 25px;
    background: white;
    border: 3px solid transparent;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-option:hover {
    transform: translateY(-5px);
    border-color: #DBAD2B;
    box-shadow: 0 10px 30px rgba(219, 173, 43, 0.3);
}

.mode-option.selected {
    border-color: #DBAD2B;
    background: linear-gradient(135deg, rgba(219, 173, 43, 0.1), rgba(245, 216, 118, 0.15));
    box-shadow: 0 8px 25px rgba(219, 173, 43, 0.3);
}

.mode-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.mode-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 8px;
}

.mode-desc {
    font-size: 0.95rem;
    color: var(--gray);
    font-weight: 600;
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.template-item {
    border: 3px solid transparent;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    position: relative;
}

.template-item:hover {
    transform: translateY(-5px);
    border-color: #DBAD2B;
    box-shadow: 0 10px 30px rgba(219, 173, 43, 0.3);
}

.template-item.selected {
    border-color: #DBAD2B;
    box-shadow: 0 8px 25px rgba(219, 173, 43, 0.3);
}

.template-item.selected::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #10B981, #3B82F6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 900;
}

.template-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.template-name {
    padding: 15px;
    text-align: center;
    font-weight: 800;
    color: var(--dark);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

.upload-box {
    text-align: center;
}

.upload-label {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 15px;
}

.file-input {
    display: none;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 20px 40px;
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
    color: white;
    border-radius: 15px;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(219, 173, 43, 0.3);
}

.upload-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(219, 173, 43, 0.4);
}

.upload-preview {
    margin-top: 20px;
    min-height: 200px;
    border: 2px dashed rgba(219, 173, 43, 0.3);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.upload-preview.empty {
    color: var(--gray);
    font-weight: 700;
}

.btn-setup-differences {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #10B981, #3B82F6);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.btn-setup-differences:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px rgba(16, 185, 129, 0.5);
}

/* Difficulty Grid */
.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.difficulty-option {
    padding: 25px 20px;
    background: white;
    border: 3px solid transparent;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-option:hover {
    transform: translateY(-5px);
    border-color: #DBAD2B;
    box-shadow: 0 10px 30px rgba(219, 173, 43, 0.3);
}

.difficulty-option.selected {
    border-color: #DBAD2B;
    background: linear-gradient(135deg, rgba(219, 173, 43, 0.1), rgba(245, 216, 118, 0.15));
    box-shadow: 0 8px 25px rgba(219, 173, 43, 0.3);
}

.difficulty-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.difficulty-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 5px;
}

.difficulty-desc {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 600;
}

/* Start Button */
.btn-start-game {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.5rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(219, 173, 43, 0.4);
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.btn-start-game:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 50px rgba(219, 173, 43, 0.5);
}

.btn-start-game:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: btnGlow 3s linear infinite;
}

@keyframes btnGlow {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.btn-back {
    display: block;
    text-align: center;
    padding: 15px;
    color: var(--gray);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-back:hover {
    color: #DBAD2B;
}

/* ========================================
   DIFFERENCE SETUP SCREEN
======================================== */
.difference-setup-screen {
    min-height: 100vh;
    background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
    padding-top: 80px;
}

.setup-header-bar {
    background: white;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.setup-header-bar h2 {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--dark);
    margin: 0;
}

.setup-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.setup-info span {
    font-size: 1.1rem;
    color: var(--gray);
    font-weight: 700;
}

.setup-info strong {
    color: #DBAD2B;
    font-size: 1.3rem;
}

.btn-done-setup {
    padding: 15px 30px;
    background: linear-gradient(135deg, #10B981, #3B82F6);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-done-setup:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.3);
}

.btn-done-setup:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.setup-images-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding: 0 20px 40px;
}

.setup-image-wrapper {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.setup-image-wrapper.clickable {
    border: 3px solid #DBAD2B;
}

.image-label {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 15px;
    text-align: center;
}

.setup-canvas-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.setup-canvas-wrapper img {
    width: 100%;
    display: block;
    border-radius: 10px;
}

.setup-canvas-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.setup-image-wrapper:not(.clickable) img {
    width: 100%;
    border-radius: 10px;
}

.setup-instructions {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(219, 173, 43, 0.1), rgba(245, 216, 118, 0.15));
    border-radius: 15px;
    margin: 0 20px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
}

/* ========================================
   GAME SCREEN
======================================== */
.game-screen {
    min-height: 100vh;
    background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
    padding-top: 80px;
}

.game-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
    margin-bottom: 20px;
    position: sticky;
    top: 70px;
    z-index: 100;
}

.game-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.student-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.student-info strong {
    font-size: 1.2rem;
    color: var(--dark);
}

.stars-display {
    color: #DBAD2B;
    font-weight: 900;
    font-size: 1.1rem;
}

.game-stats {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    color: var(--gray);
    font-weight: 700;
}

.stat-item i {
    color: #DBAD2B;
    font-size: 1.3rem;
}

.stat-item.success i {
    color: #10B981;
}

.stat-item strong {
    color: var(--dark);
}

.btn-hint {
    padding: 10px 20px;
    background: linear-gradient(135deg, #F59E0B, #EF4444);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-hint:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.3);
}

.btn-hint:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-end-game {
    padding: 12px 25px;
    background: white;
    color: #EF4444;
    border: 2px solid #EF4444;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-end-game:hover {
    background: #EF4444;
    color: white;
}

/* Images Container */
.images-game-container {
    padding: 20px;
}

.images-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.game-image-wrapper {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
}

.image-title {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 15px;
    text-align: center;
}

.image-canvas-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.image-canvas-wrapper img {
    width: 100%;
    display: block;
    border-radius: 10px;
}

.image-canvas-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Completion Overlay */
.completion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.completion-card {
    background: white;
    border-radius: 30px;
    padding: 50px 40px;
    text-align: center;
    max-width: 600px;
    animation: zoomIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes zoomIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

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

.completion-icon {
    font-size: 8rem;
    margin-bottom: 20px;
    animation: rotate 2s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

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

.completion-card h2 {
    font-size: 2.2rem;
    font-weight: 900;
    margin-bottom: 30px;
    color: var(--dark);
}

.completion-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: linear-gradient(135deg, rgba(219, 173, 43, 0.1), rgba(245, 216, 118, 0.15));
    padding: 20px;
    border-radius: 15px;
    border: 2px solid rgba(219, 173, 43, 0.2);
}

.stat-box i {
    font-size: 2rem;
    color: #DBAD2B;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--gray);
    font-weight: 700;
}

.completion-message-text {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 30px;
}

.completion-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-play-again,
.btn-back-menu {
    flex: 1;
    min-width: 200px;
    padding: 18px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-play-again {
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
    color: white;
    box-shadow: 0 10px 30px rgba(219, 173, 43, 0.3);
}

.btn-play-again:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(219, 173, 43, 0.4);
}

.btn-back-menu {
    background: white;
    color: var(--dark);
    border: 2px solid rgba(219, 173, 43, 0.3);
}

.btn-back-menu:hover {
    border-color: #DBAD2B;
    background: rgba(219, 173, 43, 0.05);
}

/* Encouragement Panel */
.encouragement-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.encouragement-buttons {
    display: flex;
    gap: 15px;
    background: white;
    padding: 15px 20px;
    border-radius: 50px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.btn-encourage {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-encourage:hover {
    transform: translateY(-5px) scale(1.1);
}

.btn-encourage.clap {
    background: linear-gradient(135deg, #F59E0B, #EF4444);
}

.btn-encourage.star {
    background: linear-gradient(135deg, #DBAD2B, #F5D876);
}

.btn-encourage.heart {
    background: linear-gradient(135deg, #EC4899, #EF4444);
}

.btn-encourage.trophy {
    background: linear-gradient(135deg, #10B981, #3B82F6);
}

.btn-encourage.excellent {
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
}

.btn-encourage i {
    color: white;
    font-size: 1.5rem;
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.celebration-character {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 15rem;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.celebration-character.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Responsive */
@media (max-width: 1024px) {

    .images-wrapper,
    .setup-images-container {
        grid-template-columns: 1fr;
    }

    .upload-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {

    .mode-grid,
    .difficulty-grid {
        grid-template-columns: 1fr;
    }

    .game-info-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .completion-stats {
        grid-template-columns: 1fr;
    }

    .completion-actions {
        flex-direction: column;
    }

    .btn-play-again,
    .btn-back-menu {
        width: 100%;
    }
}
