:root {
    --primary-color: #0f766e;
    --secondary-color: #22d3ee;
    --accent-color: #a3ff12;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5f5;
    --text-muted: #8b97b5;
    --bg-primary: #050b1a;
    --bg-secondary: #0f172a;
    --bg-card: #16233d;
    --border-color: #223352;
    --shadow-light: rgba(34, 211, 238, 0.12);
    --shadow-medium: rgba(5, 18, 38, 0.35);
    --shadow-heavy: rgba(5, 12, 26, 0.65);
    --gradient-primary: linear-gradient(140deg, #0f172a 0%, #0f766e 45%, #22d3ee 100%);
    --gradient-accent: linear-gradient(140deg, #d4ff5e 0%, #7fff45 45%, #4ade80 100%);
    --gradient-success: linear-gradient(140deg, #0d9488 0%, #34d399 100%);
    --border-radius: 16px;
    --border-radius-small: 10px;
    --transition-fast: 0.18s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --text-primary: #0f172a;
    --text-secondary: #1f2937;
    --text-muted: #4b5563;
    --bg-primary: #f1f5f9;
    --bg-secondary: #e2e8f0;
    --bg-card: #f8fafc;
    --border-color: #cbd5e1;
    --shadow-light: rgba(15, 118, 110, 0.08);
    --shadow-medium: rgba(15, 23, 42, 0.12);
    --shadow-heavy: rgba(15, 23, 42, 0.18);
    --accent-color: #16a34a;
    --gradient-primary: linear-gradient(135deg, #67e8f9 0%, #22d3ee 45%, #0ea5e9 100%);
    --gradient-accent: linear-gradient(135deg, #bbf7d0 0%, #4ade80 50%, #16a34a 100%);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-nav {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-light);
}

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.control-section {
    margin-bottom: 2rem;
}

.control-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.team-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.team-code {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
}

.layout-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
}

.sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    height: fit-content;
    max-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px var(--shadow-medium);
}

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

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
}

.refresh-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.refresh-btn:hover {
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    transform: rotate(180deg);
}

.task-list {
    overflow-y: auto;
    flex: 1;
}

.task-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid transparent;
    border-radius: var(--border-radius-small);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.task-item:hover {
    background: rgba(34, 211, 238, 0.1);
    transform: translateX(4px);
}

.task-item.active {
    background: rgba(34, 211, 238, 0.15);
    border-left-color: var(--secondary-color);
}

.task-item.COMPLETED {
    border-left-color: var(--success-color);
}

.task-item.OPEN {
    border-left-color: var(--warning-color);
}

.task-item.LOCKED {
    border-left-color: var(--danger-color);
    opacity: 0.5;
    cursor: not-allowed;
}

.task-item-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.task-item-info {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.total-points {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.content-area {
    display: flex;
    flex-direction: column;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab:hover {
    background: rgba(34, 211, 238, 0.1);
    color: var(--text-primary);
}

.tab.active {
    border-bottom-color: var(--accent-color);
    color: var(--text-primary);
    background: rgba(163, 255, 18, 0.05);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

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

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 4px 12px var(--shadow-medium);
}

.content-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.placeholder {
    text-align: center;
    padding: 4rem 2rem;
}

.placeholder-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.placeholder p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.questions-container {
    margin-bottom: 2rem;
}

.kerdes-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.kerdes-item h4 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.kerdes-item p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.kerdes-item pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.kerdes-item label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.kerdes-item input {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.kerdes-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--shadow-light);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-small);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1rem;
}

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

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-light);
}

.btn:active {
    transform: translateY(0);
}

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

.result {
    margin-top: 1rem;
    padding: 1.5rem;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--border-color);
}

.result.success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success-color);
}

.result.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
}

.result h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.result p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.result pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 1rem;
    overflow-x: auto;
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.canvas-container {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

#palyaCanvas {
    border-radius: var(--border-radius-small);
    max-width: 100%;
    height: auto;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.status-text {
    margin-left: 1rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    font-weight: 600;
    color: var(--accent-color);
}

.info-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 1.5rem;
}

.info-panel h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.info-panel p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
    }
    to { 
        opacity: 1; 
    }
}

@media (max-width: 1200px) {
    .layout-grid {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 968px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        max-height: 400px;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .top-nav {
        padding: 0.875rem 1rem;
        flex-wrap: wrap;
    }
    
    .app-title {
        position: static;
        transform: none;
        order: -1;
        width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
        font-size: 1.25rem;
    }
}

@media (max-width: 640px) {
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .team-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .controls {
        flex-wrap: wrap;
    }
}
