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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f3f4f6;
    --white: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--dark);
    color: var(--white);
    min-height: 100vh;
}

/* Flash Messages */
.flash-messages {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.flash {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    animation: slideIn 0.3s ease;
}

.flash-success { background: var(--secondary); }
.flash-error { background: var(--danger); }
.flash-warning { background: var(--warning); color: var(--dark); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Player Pages */
.player-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
}

.logo h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.card p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input {
    width: auto;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: var(--secondary);
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Game View */
.game-header {
    text-align: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.timer {
    font-size: 3rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
}

.timer.warning { color: var(--warning); }
.timer.danger { color: var(--danger); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.5s ease;
}

.puzzle-content {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.puzzle-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.puzzle-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.puzzle-type-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

.badge-digital { background: var(--primary); }
.badge-physical { background: var(--secondary); }

.answer-form {
    display: flex;
    gap: 0.5rem;
}

.answer-form input {
    flex: 1;
    text-transform: uppercase;
    font-size: 1.25rem;
    letter-spacing: 2px;
    text-align: center;
}

.hint-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hint-box {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    display: none;
}

.hint-box.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Completed View */
.completed-container {
    text-align: center;
    padding: 3rem 1rem;
}

.trophy {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Admin Pages */
.admin-body {
    background: #0f172a;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: rgba(255, 255, 255, 0.03);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
}

.admin-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2rem;
}

.admin-nav {
    list-style: none;
}

.admin-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.25rem;
    transition: all 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.admin-main {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-header h1 {
    font-size: 1.75rem;
}

/* Tables */
.table-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-active {
    color: var(--secondary);
}

.status-inactive {
    color: rgba(255, 255, 255, 0.4);
}

/* Puzzle Cards */
.puzzle-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.puzzle-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: grab;
}

.puzzle-card:active {
    cursor: grabbing;
}

.puzzle-order {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.puzzle-info {
    flex: 1;
}

.puzzle-info h3 {
    margin-bottom: 0.25rem;
}

.puzzle-info p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

.puzzle-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--dark);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Live Status */
.live-teams {
    display: grid;
    gap: 1rem;
}

.live-team-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
}

.live-team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.live-team-name {
    font-weight: 600;
}

.live-team-game {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
}

/* QR Code Display */
.qr-container {
    text-align: center;
    padding: 2rem;
}

.qr-image {
    background: white;
    padding: 1rem;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 1rem;
}

.qr-image img {
    display: block;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }

    .admin-main {
        padding: 1rem;
    }

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

    .table-container {
        overflow-x: auto;
    }
}

/* Game List */
.game-list {
    display: grid;
    gap: 1rem;
}

.game-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.game-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.game-item h3 {
    margin-bottom: 0.5rem;
}

.game-item p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
}

.game-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
}

.tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--white);
}

.tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
