@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --secondary: #ec4899;
    --secondary-glow: rgba(236, 72, 153, 0.5);
    --accent: #10b981;
    --bg-dark: #020617;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: #020617;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(99, 102, 241, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.25) 0%, transparent 40%),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 20px),
        repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0px, rgba(255,255,255,0.02) 1px, transparent 1px, transparent 20px);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::after {
    content: "";
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    z-index: 1000;
    pointer-events: none;
    background-size: 100% 4px, 3px 100%;
    opacity: 0.3;
}

/* Glassmorphism */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.neon-border-blue {
    border: 2px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.neon-border-pink {
    border: 2px solid var(--secondary);
    box-shadow: 0 0 15px var(--secondary-glow);
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.animate-float {
    animation: float 4s ease-in-out infinite;
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #db2777);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

/* Tiles */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    padding: 20px;
}

.tile {
    perspective: 1000px;
    cursor: pointer;
    width: 100%;
    height: 100%;
    min-width: 0; /* Allow shrinking */
    min-height: 0;
}

.tile-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.flipped .tile-inner {
    transform: rotateY(180deg);
}

.tile-front, .tile-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tile-front {
    background: linear-gradient(135deg, #1e293b, #020617);
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 900;
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.3);
    text-shadow: 0 0 10px var(--primary-glow);
}

.tile-front::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(45deg, transparent 48%, rgba(255,255,255,0.05) 50%, transparent 52%);
    background-size: 200% 200%;
    animation: shine 4s infinite linear;
}

@keyframes shine {
    0% { background-position: -200% -200%; }
    100% { background-position: 200% 200%; }
}

.tile-back {
    transform: rotateY(180deg);
    background: #000;
    border: 2px solid var(--primary);
}

.tile-back img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tile.wrong {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    border: 2px solid #ef4444 !important;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.tile.used {
    opacity: 0.6;
    filter: grayscale(0.5);
    pointer-events: none;
}

/* Score Board */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-bottom: 20px;
}

.score-card {
    padding: 15px 30px;
    border-radius: 20px;
    text-align: center;
}

.score-card.boys {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.score-card.girls {
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid rgba(236, 72, 153, 0.3);
}

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
}

.current-turn-indicator {
    padding: 10px 25px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* Teacher Dashboard */
.control-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
}

.tile-editor-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
}

.editor-card {
    padding: 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
}

input[type="text"], input[type="file"] {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
}
