/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow: hidden;
    min-height: 100vh;
    height: 100vh;
    width: 100vw;
    position: relative;
    margin: 0;
    padding: 0;
}

/* Animated Background Stars */
.stars, .stars2, .stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stars {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="1" fill="white" opacity="0.8"/><circle cx="80" cy="40" r="0.5" fill="white" opacity="0.6"/><circle cx="40" cy="60" r="0.8" fill="white" opacity="0.4"/><circle cx="90" cy="80" r="0.6" fill="white" opacity="0.8"/><circle cx="10" cy="90" r="0.4" fill="white" opacity="0.6"/></svg>') repeat;
    animation: moveStars 50s linear infinite;
}

.stars2 {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="30" cy="30" r="0.6" fill="white" opacity="0.4"/><circle cx="70" cy="20" r="0.8" fill="white" opacity="0.6"/><circle cx="20" cy="70" r="0.4" fill="white" opacity="0.8"/><circle cx="80" cy="80" r="0.5" fill="white" opacity="0.4"/></svg>') repeat;
    animation: moveStars 100s linear infinite;
}

.stars3 {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="60" cy="15" r="0.4" fill="white" opacity="0.6"/><circle cx="25" cy="45" r="0.6" fill="white" opacity="0.4"/><circle cx="75" cy="65" r="0.8" fill="white" opacity="0.8"/></svg>') repeat;
    animation: moveStars 75s linear infinite;
}

@keyframes moveStars {
    from { transform: translateY(0px); }
    to { transform: translateY(-100px); }
}

/* Game Wrapper */
.game-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    overflow: hidden;
}

/* Header Styles */
.game-header {
    text-align: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.game-title {
    font-family: 'Orbitron', monospace;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 5px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

.title-magic {
    color: #ffd700;
    text-shadow: 0 0 30px #ffd700;
}

.title-number {
    color: #ff6b6b;
    font-size: 2.5rem;
    text-shadow: 0 0 30px #ff6b6b;
}

.title-puzzle {
    color: #4ecdc4;
    text-shadow: 0 0 30px #4ecdc4;
}

.subtitle {
    font-size: 1.2rem;
    color: #e0e0e0;
    font-weight: 300;
    letter-spacing: 2px;
    opacity: 0.8;
}

/* Game Container */
.game-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    max-width: 100%;
    width: 100%;
    flex: 1;
    min-height: 0;
    justify-content: center;
}

/* Game Board Section */
.game-board-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.board-wrapper {
    position: relative;
    border-radius: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.board-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ffd700, #ff6b6b, #4ecdc4, #ffd700);
    border-radius: 20px;
    z-index: -1;
    animation: glowRotate 3s linear infinite;
    opacity: 0.7;
}

@keyframes glowRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#game-board {
    width: 320px;
    height: 320px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 8px;
    position: relative;
    z-index: 1;
}

.tile {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tile:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.tile.empty {
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    cursor: default;
}

.tile.empty:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Controls Section */
.controls-section {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.btn {
    padding: 15px 30px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Exo 2', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffd700 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

.btn-secondary {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.6);
}

.btn-icon {
    font-size: 18px;
}

/* Stats Section */
.stats-section {
    flex: 0 0 300px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.stats-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.card-header h3 {
font-size: 1.2rem;
font-weight: 600;
color: #fff;
}
.card-icon {
font-size: 1.5rem;
}
.stats-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
}
.stat-item {
text-align: center;
}
.stat-label {
font-size: 0.9rem;
color: #ccc;
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 1px;
}
.stat-value {
font-size: 2rem;
font-weight: 700;
font-family: 'Orbitron', monospace;
color: #ffd700;
text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.stat-unit {
font-size: 0.8rem;
color: #ccc;
margin-left: 5px;
}
/* Current Game Card */
.current-game {
border-color: rgba(255, 215, 0, 0.5);
}
.current-game .card-icon {
color: #ffd700;
}
/* Best Score Card */
.best-score {
border-color: rgba(255, 107, 107, 0.5);
}
.best-score .card-icon {
color: #ff6b6b;
}
.best-score .stat-value {
color: #ff6b6b;
text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}
/* Win Modal */
.modal {
display: none;
position: fixed;
z-index: 1000;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
backdrop-filter: blur(5px);
}
.modal-content {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
margin: 10% auto;
padding: 0;
border-radius: 20px;
width: 90%;
max-width: 500px;
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
animation: modalSlideIn 0.3s ease;
overflow: hidden;
}
@keyframes modalSlideIn {
from { transform: translateY(-50px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
.modal-header {
background: rgba(255, 255, 255, 0.1);
padding: 25px;
text-align: center;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.modal-header h2 {
font-size: 2rem;
font-weight: 700;
color: #ffd700;
text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}
.modal-body {
padding: 30px;
text-align: center;
}
.modal-body p {
font-size: 1.2rem;
margin-bottom: 25px;
color: #fff;
}
.modal-stats {
display: flex;
justify-content: space-around;
margin-bottom: 25px;
}
.modal-stat {
text-align: center;
}
.modal-stat-label {
display: block;
font-size: 0.9rem;
color: #ccc;
margin-bottom: 5px;
text-transform: uppercase;
letter-spacing: 1px;
}
.modal-stat-value {
font-size: 2rem;
font-weight: 700;
font-family: 'Orbitron', monospace;
color: #4ecdc4;
text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}
.new-record {
font-size: 1.1rem;
font-weight: 700;
color: #ffd700;
text-shadow: 0 0 15px rgba(255, 215, 0, 0.7);
animation: pulse 2s infinite;
display: none;
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.modal-footer {
padding: 25px;
text-align: center;
border-top: 1px solid rgba(255, 255, 255, 0.2);
}
/* Responsive Design */
@media (max-width: 768px) {
.game-container {
flex-direction: column;
gap: 30px;
align-items: center;
}
.stats-section {
    flex: none;
    width: 100%;
    max-width: 400px;
}

.game-title {
    font-size: 2.5rem;
}

.title-number {
    font-size: 3rem;
}

#game-board {
    width: 280px;
    height: 280px;
}

.tile {
    width: 62px;
    height: 62px;
    font-size: 24px;
}

.controls-section {
    flex-direction: column;
    align-items: center;
}

.btn {
    width: 200px;
    justify-content: center;
}
}
@media (max-width: 480px) {
.game-wrapper {
padding: 10px;
}
.game-title {
    font-size: 2rem;
}

.title-number {
    font-size: 2.5rem;
}

#game-board {
    width: 250px;
    height: 250px;
}

.tile {
    width: 55px;
    height: 55px;
    font-size: 20px;
}

.stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
}
}
/* Iframe compatibility for GamePix - 800x450 */
@media (max-width: 850px) and (max-height: 500px) {
.game-wrapper {
padding: 5px;
min-height: 100vh;
height: 100vh;
}
.game-header {
    margin-bottom: 10px;
}

.game-title {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.title-number {
    font-size: 2rem;
}

.game-container {
    gap: 15px;
    flex-direction: row;
    align-items: stretch;
    height: calc(100vh - 80px);
}

.game-board-section {
    gap: 10px;
    flex: 0 0 auto;
}

#game-board {
    width: 240px;
    height: 240px;
}

.tile {
    width: 54px;
    height: 54px;
    font-size: 20px;
}

.controls-section {
    gap: 10px;
}

.btn {
    padding: 8px 16px;
    font-size: 12px;
}

.stats-section {
    flex: 1;
    min-width: 200px;
    gap: 15px;
}

.stats-card {
    padding: 15px;
}

.stat-value {
    font-size: 1.5rem;
}
}
