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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f0ff 0%, #e0f2fe 50%, #fce7f3 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.logo h1 {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: rgba(168, 85, 247, 0.1);
}

.nav-btn.active {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white;
}

/* Main */
.main {
    padding: 2rem 0;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h2 {
    font-size: 2.5rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.1rem;
    color: #6b7280;
}

/* Puzzle Grid */
.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.puzzle-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    cursor: pointer;
}

.puzzle-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.puzzle-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    position: relative;
}

.puzzle-card-content {
    padding: 1rem;
}

.puzzle-card-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.puzzle-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.puzzle-difficulty {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    background: #e5e7eb;
    color: #1f2937;
}

.btn:hover {
    background: #d1d5db;
}

.btn-primary {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: transparent;
    border: 2px solid #a855f7;
    color: #a855f7;
}

.btn-back {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #6b7280;
    transition: all 0.3s;
}

.btn-back:hover {
    color: #1f2937;
}

/* Game View */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

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

.game-container {
    display: grid;
    grid-template-columns: 1fr 1fr 300px;
    gap: 2rem;
}

.game-board-container,
.pieces-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-board-container h3,
.pieces-container h3 {
    margin-bottom: 1rem;
    color: #1f2937;
}

.game-board {
    display: grid;
    gap: 4px;
    background: #e5e7eb;
    padding: 8px;
    border-radius: 8px;
    aspect-ratio: 1;
}

.board-cell {
    background: #f3f4f6;
    border: 2px dashed #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    background-size: cover;
    background-position: center;
    position: relative;
}

.board-cell:hover:not(.filled) {
    background-color: #e5e7eb;
}

.board-cell.filled {
    border: 2px solid #10b981;
    cursor: default;
}

.pieces-list {
    display: grid;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.puzzle-piece {
    aspect-ratio: 1;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    cursor: move;
    transition: all 0.2s;
    background-size: cover;
    background-position: center;
    position: relative;
}

.puzzle-piece:hover {
    border-color: #a855f7;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.puzzle-piece.selected {
    border-color: #a855f7;
    border-width: 3px;
    transform: scale(0.95);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

/* Admin View */
.admin-container {
    display: grid;
    gap: 2rem;
}

.card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #a855f7;
}

.image-preview {
    display: none;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.image-preview.active {
    display: block;
}

.image-preview img {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.admin-puzzle-list {
    display: grid;
    gap: 1rem;
}

.admin-puzzle-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
    transition: all 0.3s;
}

.admin-puzzle-item:hover {
    background: #f3f4f6;
}

.admin-puzzle-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.admin-puzzle-info {
    flex: 1;
}

.admin-puzzle-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.admin-puzzle-meta {
    color: #6b7280;
    font-size: 0.9rem;
}

.btn-delete {
    padding: 0.5rem 1rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #dc2626;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: scaleIn 0.3s;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #1f2937;
}

.modal-content p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.success-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.success-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #a855f7;
}

.success-stat-label {
    color: #6b7280;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-actions .btn {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .game-container {
        grid-template-columns: 1fr;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
    
    .puzzle-grid {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}



/* Preview Container */
.preview-container {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.preview-container h3 {
    margin-bottom: 1rem;
    color: #1f2937;
}

.preview-image {
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.preview-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Drag & Drop Feedback */
.board-cell.drag-over {
    background-color: rgba(168, 85, 247, 0.1);
    border-color: #a855f7;
    border-style: solid;
}

.puzzle-piece[draggable="true"] {
    cursor: grab;
}

.puzzle-piece[draggable="true"]:active {
    cursor: grabbing;
}

/* Rotation Hint */
.puzzle-piece::after {
    content: '🔄';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s;
}

.puzzle-piece:hover::after {
    opacity: 0.7;
}

