/**
 * Code-Comp - Programming Competition Platform
 * Main Stylesheet
 *
 * Dark competition theme with indigo accent
 */

/* ==================== CSS Variables ==================== */
:root {
    /* Colors */
    --bg-primary: #1e1e2e;
    --bg-secondary: #282839;
    --bg-tertiary: #2e2e42;
    --bg-hover: #363652;

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-primary: #6366f1;
    --accent-hover: #818cf8;
    --accent-muted: #4f46e5;

    /* Verdict colors */
    --verdict-accepted: #22c55e;
    --verdict-wrong: #ef4444;
    --verdict-error: #f97316;
    --verdict-tle: #a855f7;
    --verdict-restriction: #ec4899;
    --verdict-pending: #6b7280;

    /* UI */
    --border-color: #374151;
    --border-light: #4b5563;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --radius: 8px;
    --radius-lg: 12px;

    /* Spacing */
    --header-height: 56px;
    --sidebar-width: 170px;
}

/* ==================== Base Styles ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ==================== Utilities ==================== */
.hidden {
    display: none !important;
}

.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.no-data {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
    font-style: italic;
}

.text-muted {
    color: var(--text-muted);
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #ef4444;
}

.btn-warning {
    background: var(--verdict-error);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #ea580c;
}

.btn-accent {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
}

.btn-accent:hover:not(:disabled) {
    background: linear-gradient(135deg, #a78bfa, #818cf8);
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ==================== Forms ==================== */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.form-group.flex-grow {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.problem-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    cursor: pointer;
}

.problem-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

.problem-checkbox:hover {
    background: var(--bg-hover);
    border-radius: 4px;
}

/* ==================== Sortable Problem List ==================== */
.sortable-problem-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.problem-selector-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: background 0.15s, border-color 0.15s;
}

.problem-selector-item.selected {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent);
}

.problem-selector-item.dragging {
    opacity: 0.5;
    background: var(--accent);
}

.problem-selector-item .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 0 0.25rem;
    font-size: 1rem;
}

.problem-selector-item .drag-handle:active {
    cursor: grabbing;
}

.problem-selector-item .drag-handle.hidden {
    visibility: hidden;
    width: 0;
    padding: 0;
}

.problem-selector-item .problem-checkbox {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    cursor: pointer;
}

.problem-selector-item .problem-checkbox:hover {
    background: transparent;
}

.problem-selector-item .problem-title {
    flex: 1;
}

.problem-selector-item .problem-type-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-transform: uppercase;
}

.problem-order-controls {
    display: flex;
    gap: 0.25rem;
}

.problem-order-controls.hidden {
    display: none;
}

.problem-order-controls .btn-icon {
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

/* ==================== Team Management ==================== */
.team-management-section label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.team-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.team-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.team-name {
    font-weight: 600;
    flex: 1;
}

.team-code {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}

.team-members {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.member-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--accent);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.member-tag .leader-badge {
    background: rgba(255, 255, 255, 0.3);
    padding: 0 0.25rem;
    border-radius: 2px;
    font-size: 0.7rem;
    font-weight: 600;
}

.member-tag .remove-member-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0 0.2rem;
    font-size: 1rem;
    line-height: 1;
}

.member-tag .remove-member-btn:hover {
    color: white;
}

.no-members {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
}

.add-member-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.add-member-row select {
    flex: 1;
    font-size: 0.85rem;
}

/* ==================== Toast Notifications ==================== */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 0.75rem 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 0.875rem;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--verdict-accepted);
    color: white;
}

.toast.error {
    background: var(--verdict-wrong);
    color: white;
}

.toast.warning {
    background: var(--verdict-error);
    color: white;
}

/* ==================== Modals ==================== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.modal-large {
    max-width: 900px;
    width: 90vw;
}

.modal-fullscreen {
    max-width: 95vw;
    max-height: 95vh;
    width: 100%;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

.modal-small {
    max-width: 400px;
    text-align: center;
}

.modal-medium {
    max-width: 550px;
}

/* Contest Entry Modal */
.entry-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.entry-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.entry-info-item {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.entry-info-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.entry-info-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.entry-timer-section {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 1.5rem;
}

.entry-timer-section.upcoming {
    background: linear-gradient(135deg, var(--accent-muted), var(--bg-tertiary));
}

.entry-timer-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.entry-timer {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
}

.entry-timer.warning {
    color: var(--verdict-error);
}

.entry-rules {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--accent-primary);
}

.entry-rules h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.entry-rules ul {
    margin: 0;
    padding-left: 1.25rem;
}

.entry-rules li {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.entry-rules li:last-child {
    margin-bottom: 0;
}

.entry-info-value.status-active {
    color: var(--verdict-accepted);
}

.entry-info-value.status-upcoming {
    color: var(--accent-primary);
}

.entry-info-value.status-ended {
    color: var(--text-muted);
}

/* Entry Modal Header with LIVE badge */
.entry-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.entry-header h2 {
    margin: 0;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--verdict-accepted);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    border-radius: 4px;
    animation: live-pulse 1.5s ease-in-out infinite;
}

.live-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: live-dot 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

@keyframes live-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Timing Notice */
.entry-timing-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-primary);
}

.entry-timing-notice.notice-live {
    border-left-color: var(--verdict-accepted);
    background: rgba(34, 197, 94, 0.1);
}

.entry-timing-notice .notice-icon {
    flex-shrink: 0;
    color: var(--accent-primary);
    margin-top: 2px;
}

.entry-timing-notice.notice-live .notice-icon {
    color: var(--verdict-accepted);
}

.entry-timing-notice .notice-content {
    flex: 1;
}

.entry-timing-notice strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.entry-timing-notice p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Timer section states */
.entry-timer-section.live {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), var(--bg-tertiary));
    border: 1px solid var(--verdict-accepted);
}

.entry-timer-section.live .entry-timer {
    color: var(--verdict-accepted);
}

/* Pulsing Enter button when live */
.btn-enter-ready {
    background: var(--verdict-accepted) !important;
    animation: btn-pulse 2s ease-in-out infinite;
}

.btn-enter-ready:hover:not(:disabled) {
    background: #16a34a !important;
}

@keyframes btn-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
        transform: scale(1.02);
    }
}

/* Modal transition when going live */
.entry-modal-live {
    animation: modal-flash 0.5s ease-out;
}

@keyframes modal-flash {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8);
    }
    50% {
        box-shadow: 0 0 60px 20px rgba(34, 197, 94, 0.4);
    }
    100% {
        box-shadow: var(--shadow);
    }
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.modal-actions .btn {
    min-width: 80px;
    white-space: nowrap;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ==================== Login Screen ==================== */
.screen {
    min-height: 100vh;
}

.login-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 15vh;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
}

.login-form {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.login-form .btn {
    width: 100%;
    margin-top: 1rem;
}

.google-signin {
    display: flex;
    justify-content: center;
    padding: 1rem;
}

.google-signin-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: #fff;
    color: #3c4043;
    border: none;
    border-radius: var(--radius);
    font-family: 'Roboto', 'Inter', sans-serif;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: box-shadow 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.google-signin-btn:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.google-signin-btn:active {
    background: #f8f9fa;
}

.google-signin-btn svg {
    flex-shrink: 0;
}

/* ==================== App Header ==================== */
.app-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.app-header h1 {
    font-size: 1.25rem;
    color: var(--accent-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ==================== Contest Selection ==================== */
.contest-selection {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.contest-selection h2 {
    margin-bottom: 1.5rem;
}

.contest-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contest-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.contest-card h3 {
    margin-bottom: 0.5rem;
}

.contest-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.contest-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.contest-format {
    background: var(--accent-muted);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.contest-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.contest-card-header h3 {
    margin: 0;
}

.contest-status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.contest-status-badge.active {
    background: var(--verdict-accepted);
    color: white;
}

.contest-status-badge.upcoming {
    background: var(--accent-primary);
    color: white;
}

.contest-upcoming {
    border-color: var(--accent-primary);
    opacity: 0.85;
}

.contest-card.contest-active {
    border-color: var(--verdict-accepted);
    box-shadow: 0 0 0 1px var(--verdict-accepted);
}

.contest-card.contest-just-started {
    animation: card-pulse-green 2s ease-out;
}

@keyframes card-pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 1px var(--verdict-accepted);
    }
}

.contest-timing {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.contest-timing.timing-upcoming {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

.contest-timing.timing-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--verdict-accepted);
}

/* ==================== Contest Waiting Screen ==================== */
.contest-waiting {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem;
    min-height: calc(100vh - var(--header-height));
}

.no-contest-view {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 500px;
}

.no-contest-icon {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.no-contest-view h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.no-contest-view p {
    color: var(--text-secondary);
}

/* Contest Selection View */
.contest-selection-view {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.contest-selection-view h2 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.contest-selection-view > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.contest-selection-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contest-selection-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
    transition: border-color 0.2s;
}

.contest-selection-item:hover {
    border-color: var(--accent-primary);
}

.contest-selection-info {
    flex: 1;
}

.contest-selection-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.contest-selection-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.contest-selection-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.contest-status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.contest-status-badge.status-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--verdict-accepted);
}

.contest-status-badge.status-upcoming {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.contest-problem-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.contest-waiting-view {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 600px;
    width: 100%;
}

.contest-waiting-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.contest-waiting-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.contest-waiting-title-row h2 {
    margin: 0;
}

.contest-waiting-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.contest-waiting-timer-section {
    background: var(--bg-tertiary);
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.contest-waiting-timer-section.upcoming {
    background: linear-gradient(135deg, var(--accent-muted), var(--bg-tertiary));
}

.contest-waiting-timer-section.live {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.3), var(--bg-tertiary));
    border: 1px solid var(--verdict-accepted);
}

.waiting-timer-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.waiting-timer {
    font-size: 2.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
}

.contest-waiting-timer-section.live .waiting-timer {
    color: var(--verdict-accepted);
}

.waiting-timer.warning {
    color: var(--verdict-error);
}

.contest-waiting-info {
    margin-bottom: 1.5rem;
}

.contest-waiting-info .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.contest-waiting-info .info-item {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.contest-waiting-info .info-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.contest-waiting-info .info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contest-waiting-info .info-value.status-active {
    color: var(--verdict-accepted);
}

.contest-waiting-info .info-value.status-upcoming {
    color: var(--accent-primary);
}

.contest-waiting-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--accent-primary);
}

.contest-waiting-notice.notice-live {
    border-left-color: var(--verdict-accepted);
    background: rgba(34, 197, 94, 0.1);
}

.contest-waiting-notice .notice-icon {
    flex-shrink: 0;
    color: var(--accent-primary);
}

.contest-waiting-notice.notice-live .notice-icon {
    color: var(--verdict-accepted);
}

.contest-waiting-notice .notice-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.contest-waiting-notice .notice-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.contest-waiting-rules {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.contest-waiting-rules h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.contest-waiting-rules ul {
    margin: 0;
    padding-left: 1.25rem;
}

.contest-waiting-rules li {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
}

.contest-waiting-rules li:last-child {
    margin-bottom: 0;
}

.fullscreen-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.fullscreen-notice svg {
    flex-shrink: 0;
    stroke: var(--accent-primary);
}

.fullscreen-notice strong {
    color: var(--accent-primary);
}

/* Python Runtime Loading Status */
.python-loading-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface-secondary);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.python-loading-status .loading-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.python-loading-status .loading-spinner {
    animation: spin 1s linear infinite;
}

.python-loading-status .loading-check {
    color: var(--verdict-accepted);
}

.python-loading-status.loaded {
    color: var(--verdict-accepted);
    background: rgba(34, 197, 94, 0.1);
}

.python-loading-status.loaded .loading-spinner {
    display: none;
}

.python-loading-status.loaded .loading-check {
    display: block;
}

.python-loading-status.error {
    color: var(--verdict-wrong);
    background: rgba(239, 68, 68, 0.1);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.contest-waiting-action {
    text-align: center;
}

.contest-waiting-action .btn {
    min-width: 200px;
}

.contest-waiting-action .btn-enter-ready {
    background: var(--verdict-accepted);
    animation: btn-pulse 2s ease-in-out infinite;
}

.contest-waiting-view.contest-live {
    border-color: var(--verdict-accepted);
    animation: view-flash-green 0.5s ease-out;
}

@keyframes view-flash-green {
    0% {
        box-shadow: 0 0 30px rgba(34, 197, 94, 0.5);
    }
    100% {
        box-shadow: 0 0 0 rgba(34, 197, 94, 0);
    }
}

.contest-loading {
    text-align: center;
    padding: 3rem;
}

/* ==================== Competition Screen ==================== */
.competition-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    gap: 1rem;
}

.competition-header h1 {
    font-size: 1.125rem;
    flex: 1;
}

.header-center {
    display: flex;
    align-items: center;
}

.contest-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
}

.contest-timer.warning {
    color: var(--verdict-error);
    background: rgba(249, 115, 22, 0.2);
}

.contest-timer.ended {
    color: var(--verdict-wrong);
}

.competition-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr auto;
    height: calc(100vh - var(--header-height));
}

/* Problem Sidebar */
.problem-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 0.5rem;
    overflow-y: auto;
}

.problem-sidebar h3 {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.problem-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.problem-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s ease;
}

.problem-item:hover {
    background: var(--bg-hover);
}

.problem-item.active {
    background: var(--accent-muted);
}

.problem-number {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.problem-title {
    flex: 1;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.problem-status-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-solved .problem-status-badge {
    background: var(--verdict-accepted);
    color: white;
}

.status-partial .problem-status-badge {
    background: var(--verdict-error);
    color: white;
}

.status-attempted .problem-status-badge {
    background: var(--verdict-wrong);
    color: white;
}

/* Main Competition Area */
.competition-main {
    display: grid;
    grid-template-columns: var(--instructions-width, 400px) 6px 1fr;
    grid-template-rows: 1fr auto;
    background: var(--border-color);
}

/* Panel Divider */
.panel-divider {
    grid-row: span 2;
    background: var(--bg-secondary);
    cursor: col-resize;
    position: relative;
    transition: background 0.15s ease;
}

.panel-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 32px;
    background: var(--border-light);
    border-radius: 1px;
    transition: background 0.15s ease;
}

.panel-divider:hover {
    background: var(--bg-hover);
}

.panel-divider:hover::before,
.panel-divider.dragging::before {
    background: var(--accent-primary);
}

.panel-divider.dragging {
    background: var(--bg-hover);
}

.problem-panel,
.editor-panel,
.output-panel {
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
}

.problem-panel {
    grid-row: span 2;
    grid-column: 1;
}

.editor-panel {
    grid-column: 3;
    grid-row: 1;
}

.output-panel {
    grid-column: 3;
    grid-row: 2;
}

.panel-header {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    padding: 0 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
}

.editor-actions {
    display: flex;
    gap: 0.35rem;
}

.editor-actions .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.instructions-frame {
    flex: 1;
    border: none;
    background: var(--bg-primary);
}

.editor-container {
    flex: 1;
    overflow: hidden;
}

.editor-container .CodeMirror {
    height: 100%;
    font-size: 14px;
}

/* Output Panel */
.output-panel {
    min-height: 200px;
    max-height: 300px;
    transition: min-height 0.2s ease, max-height 0.2s ease;
}

.output-panel.collapsed {
    min-height: 36px;
    max-height: 36px;
}

.output-panel.collapsed .tab-content {
    display: none;
}

.output-toggle {
    margin-left: auto;
    padding: 0.25rem;
}

.output-toggle svg {
    transition: transform 0.2s ease;
}

.output-panel.collapsed .output-toggle svg {
    transform: rotate(180deg);
}

.panel-tabs {
    display: flex;
    align-items: center;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    padding: 0 0.75rem;
    height: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    flex: 1;
    overflow: hidden;
}

.tab-pane {
    display: none;
    height: 100%;
    overflow: auto;
}

.tab-pane.active {
    display: block;
}

.console-output {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    padding: 1rem;
    white-space: pre-wrap;
    height: 100%;
    margin: 0;
    background: var(--bg-primary);
}

.console-output.output-error {
    color: var(--verdict-wrong);
}

/* Test Results */
.test-results {
    padding: 1rem;
}

.verdict-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.verdict-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
}

.verdict-accepted {
    background: var(--verdict-accepted);
    color: white;
}

.verdict-wrong {
    background: var(--verdict-wrong);
    color: white;
}

.verdict-error {
    background: var(--verdict-error);
    color: white;
}

.verdict-tle {
    background: var(--verdict-tle);
    color: white;
}

.verdict-restriction {
    background: var(--verdict-restriction);
    color: white;
}

.verdict-pending {
    background: var(--verdict-pending);
    color: white;
}

.verdict-score,
.verdict-tests {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Restriction Violations Display */
.restriction-violations {
    background: rgba(236, 72, 153, 0.1);
    border: 1px solid var(--verdict-restriction);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 0.75rem;
}

.restriction-violations h4 {
    color: var(--verdict-restriction);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.restriction-violations p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

.restriction-violations ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.restriction-violations li {
    padding: 0.375rem 0;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.restriction-violations li::before {
    content: "\2717";
    color: var(--verdict-restriction);
    margin-right: 0.5rem;
}

.restriction-violations code {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--verdict-restriction);
}

.test-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.test-result {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.test-result .test-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
}

.test-result.test-passed .test-status {
    color: var(--verdict-accepted);
}

.test-result.test-failed .test-status {
    color: var(--verdict-wrong);
}

.test-name {
    flex: 1;
    font-size: 0.875rem;
}

.test-points {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.test-body {
    padding: 0.75rem;
}

.test-io {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.test-io h5 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.test-io pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    background: var(--bg-primary);
    padding: 0.5rem;
    border-radius: 4px;
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
}

.test-error {
    color: var(--verdict-wrong);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.test-hidden-msg {
    color: var(--text-muted);
    font-style: italic;
}

.test-hidden-badge {
    font-size: 0.65rem;
    padding: 0.125rem 0.375rem;
    background: var(--bg-hover);
    color: var(--text-muted);
    border-radius: 3px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.test-body-compact {
    padding: 0.5rem 0.75rem;
}

.test-result.test-hidden {
    opacity: 0.85;
}

/* Leaderboard Panel */
.leaderboard-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
}

.leaderboard-panel.collapsed {
    width: 40px;
    min-width: 40px;
}

.leaderboard-panel.collapsed .leaderboard-content,
.leaderboard-panel.collapsed .panel-header h3 {
    display: none;
}

/* Rotate arrow when collapsed - points right to indicate "expand" */
.leaderboard-panel #leaderboard-toggle svg {
    transition: transform 0.2s ease;
}

.leaderboard-panel.collapsed #leaderboard-toggle svg {
    transform: rotate(180deg);
}

/* Center the toggle button when collapsed */
.leaderboard-panel.collapsed .panel-header {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.leaderboard-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem;
}

.leaderboard-mini {
    width: 100%;
    font-size: 0.75rem;
}

.leaderboard-mini th,
.leaderboard-mini td {
    padding: 0.35rem 0.25rem;
    text-align: left;
}

.leaderboard-mini th {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
}

.leaderboard-mini .current-user {
    background: rgba(99, 102, 241, 0.2);
}

.leaderboard-mini .separator td {
    text-align: center;
    color: var(--text-muted);
    padding: 0.25rem;
}

.frozen-notice {
    text-align: center;
    padding: 1rem;
    color: var(--verdict-tle);
    font-weight: 500;
}

/* Full Leaderboard Table */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.leaderboard-table .rank-col {
    width: 60px;
    text-align: center;
}

.leaderboard-table .score-col,
.leaderboard-table .solved-col {
    width: 80px;
    text-align: center;
}

.leaderboard-table .problem-col {
    width: 50px;
    text-align: center;
}

.leaderboard-table .problem-col.solved {
    color: var(--verdict-accepted);
}

.leaderboard-table .problem-col.attempted {
    color: var(--verdict-wrong);
}

.leaderboard-table .current-user {
    background: rgba(99, 102, 241, 0.15);
}

.leaderboard-table .penalty-col,
.leaderboard-table .time-col {
    width: 90px;
    text-align: center;
}

/* Admin Leaderboard View Tabs */
.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.leaderboard-tab-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
}

.leaderboard-tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.leaderboard-tab-btn.active {
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}

.leaderboard-pane {
    display: none;
}

.leaderboard-pane.active {
    display: block;
    max-height: 60vh;
    overflow: auto;
}

.leaderboard-tab-content {
    overflow-x: auto;
}

/* Contest Statistics */
.contest-stats {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.stats-section h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-item {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th,
.stats-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.stats-table th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stats-table td {
    font-size: 0.875rem;
}

/* ==================== Team Modals ==================== */
.team-options {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.team-option {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.team-option h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.divider {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

.join-code-big {
    font-family: 'JetBrains Mono', monospace;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--accent-primary);
    background: var(--bg-tertiary);
    padding: 1rem 2rem;
    border-radius: var(--radius);
    margin: 1.5rem 0;
}

.team-members {
    list-style: none;
    padding: 0;
}

.team-members li {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.join-code {
    margin-bottom: 1rem;
}

.join-code strong {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
}

/* ==================== Admin Styles ==================== */
.admin-body {
    background: var(--bg-primary);
}

.admin-header {
    background: var(--accent-muted);
}

.admin-header h1 {
    color: white;
}

.admin-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
}

/* Primary Tabs (Active Contests, Setup Library, All Contests) */
.admin-primary-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
}

.admin-primary-tab {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.15s ease;
}

.admin-primary-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.admin-primary-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

/* Sub-tabs (within Setup Library and Contest Management) */
.admin-sub-tabs {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
}

.admin-sub-tab {
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.admin-sub-tab:hover {
    color: var(--text-secondary);
}

.admin-sub-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.admin-subtab-pane {
    display: none;
}

.admin-subtab-pane.active {
    display: block;
}

/* Legacy tab styles (for backward compatibility) */
.admin-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
}

.admin-tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
}

.admin-tab-btn:hover {
    color: var(--text-primary);
}

.admin-tab-btn.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.admin-tab-pane {
    display: none;
}

.admin-tab-pane.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tab-header h2 {
    font-size: 1.25rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-tertiary);
}

.card-header h3 {
    font-size: 1rem;
}

.card-body {
    padding: 1rem;
}

.card-body p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.card-timing {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.card-timing.timing-upcoming {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

.card-timing.timing-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--verdict-accepted);
}

.timing-label {
    color: inherit;
    opacity: 0.8;
}

.timing-value {
    font-weight: 600;
}

.card-dates {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.card-dates strong {
    color: var(--text-muted);
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Active Contest Cards */
.active-contest-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.active-contest-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.active-contest-card.contest-live {
    border-color: var(--verdict-accepted);
    box-shadow: 0 0 0 1px var(--verdict-accepted);
}

.card-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.live-indicator {
    width: 8px;
    height: 8px;
    background: var(--verdict-accepted);
    border-radius: 50%;
    animation: live-pulse-dot 1.5s ease-in-out infinite;
}

@keyframes live-pulse-dot {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

/* Contest Management Header */
.contest-mgmt-header {
    background: linear-gradient(135deg, var(--accent-muted), var(--bg-secondary));
}

.contest-mgmt-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contest-mgmt-header h1 {
    font-size: 1.125rem;
}

.contest-mgmt-tabs {
    background: var(--bg-secondary);
}

.contest-mgmt-content {
    padding: 1.5rem;
}

/* Contest Overview Styles */
.contest-overview {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.overview-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.overview-timing {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    align-self: flex-start;
}

.overview-timing.timing-upcoming {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
}

.overview-timing.timing-active {
    background: rgba(34, 197, 94, 0.15);
    color: var(--verdict-accepted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-card .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card.stat-active {
    border-color: var(--verdict-accepted);
}

.stat-card.stat-active .stat-value {
    color: var(--verdict-accepted);
}

.stat-card.stat-pending {
    border-color: #eab308;
}

.stat-card.stat-pending .stat-value {
    color: #eab308;
}

.stat-card.stat-accepted {
    border-color: var(--verdict-accepted);
}

.stat-card.stat-accepted .stat-value {
    color: var(--verdict-accepted);
}

.overview-details {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.overview-details h3,
.overview-actions h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.overview-actions {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* Settings Sub-tab */
.settings-actions {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.settings-actions p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.settings-actions .btn {
    margin: 0.25rem;
}

/* Leaderboard Actions */
.leaderboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.leaderboard-display-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.leaderboard-display-toggle .toggle-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.leaderboard-display-toggle .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* Problem cell styling for leaderboard */
.leaderboard-table .problem-col.solved {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-weight: 500;
}

.leaderboard-table .problem-col.attempted {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.status-badge.active {
    background: var(--verdict-accepted);
    color: white;
}

.status-badge.upcoming {
    background: var(--accent-primary);
    color: white;
}

.status-badge.ended {
    background: var(--text-muted);
    color: white;
}

.status-badge.inactive {
    background: var(--verdict-wrong);
    color: white;
}

.points-badge {
    background: var(--accent-muted);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.restrictions-badge {
    background: var(--verdict-restriction);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.pin-indicator {
    background: #eab308;
    color: #1e1e2e;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* Admin Tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background: var(--bg-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

/* Sortable table headers */
.sortable-table th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-table th.sortable:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.sort-icon {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.sort-icon.sort-asc {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid var(--accent-primary);
}

.sort-icon.sort-desc {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--accent-primary);
}

.admin-table .actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* Problem Screen Header (shared by preview and test) */
.problem-screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.problem-screen-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.problem-screen-header .header-left h1 {
    font-size: 1.25rem;
    margin: 0;
}

.problem-screen-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Problem Preview Screen */
#problem-preview-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.problem-preview-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    overflow: hidden;
}

.problem-preview-info {
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.preview-info-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.preview-info-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.preview-info-item .info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.preview-info-item .info-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.problem-preview-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.problem-preview-body h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.problem-preview-instructions {
    flex: 1;
    min-height: 300px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
}

.problem-preview-starter {
    margin-top: 1.5rem;
    flex-shrink: 0;
}

.problem-preview-starter h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.starter-code-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    margin: 0;
}

.starter-code-preview code {
    color: var(--text-primary);
}

/* Problem Test Screen */
#problem-test-screen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.problem-test-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.problem-test-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.problem-test-instructions {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
}

.problem-test-instructions .panel-header {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.problem-test-instructions .panel-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.problem-test-instructions .instructions-frame {
    flex: 1;
    min-height: 0;
    border: none;
}

.problem-test-editor-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.problem-test-editor-panel .panel-header {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.problem-test-editor-panel .panel-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.problem-test-editor-container {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.problem-test-editor-container .CodeMirror {
    height: 100%;
}

.problem-test-results {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    max-height: 35vh;
    overflow: hidden;
}

.problem-test-results .panel-header {
    flex-shrink: 0;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.problem-test-results .panel-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.test-results-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.test-results-content .verdict-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.test-results-content .verdict-tests,
.test-results-content .verdict-score {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.test-results-content .test-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.test-result {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.test-result.test-passed {
    border-left: 3px solid var(--verdict-accepted);
}

.test-result.test-failed {
    border-left: 3px solid var(--verdict-wrong);
}

.test-result .test-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.test-result .test-status {
    font-weight: 600;
}

.test-result.test-passed .test-status {
    color: var(--verdict-accepted);
}

.test-result.test-failed .test-status {
    color: var(--verdict-wrong);
}

.test-result .test-name {
    font-weight: 500;
    flex: 1;
}

.test-result .test-points {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.test-result .test-hidden-badge {
    font-size: 0.7rem;
    padding: 0.125rem 0.375rem;
    background: var(--bg-primary);
    border-radius: 3px;
    color: var(--text-muted);
}

.test-result .test-body {
    padding: 0.75rem;
}

.test-result .test-body-compact {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.test-result .test-io {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.test-result .test-io h5 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.25rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.test-result .test-io pre {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.test-result .test-error {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    color: var(--verdict-wrong);
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
}

/* Problem Editor */
.problem-editor-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.problem-editor-left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 0;
}

.problem-editor-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.editor-wrapper {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-wrapper .CodeMirror {
    height: 100%;
}

.starter-code-editor {
    max-height: 200px;
}

/* Label with button */
.label-with-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.label-with-button label {
    margin-bottom: 0;
}

.label-with-button .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Instructions Preview */
.instructions-preview {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.instructions-preview .preview-frame {
    width: 100%;
    height: 100%;
    min-height: 300px;
    border: none;
    background: #1e1e2e;
}

/* Restrictions Section */
.restrictions-section {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.restrictions-section h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.restrictions-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.restrictions-section .form-row {
    margin-bottom: 0.5rem;
}

.restrictions-section .form-row:last-child {
    margin-bottom: 0;
}

.restrictions-section input {
    background: var(--bg-secondary);
}

.restrictions-section small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.test-cases-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.test-cases-header h3 {
    font-size: 1rem;
    margin-right: auto;
}

.test-cases-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.test-case-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    overflow: hidden;
}

.test-case-header {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    font-size: 0.8rem;
}

.hidden-checkbox {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.hidden-checkbox input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    flex-shrink: 0;
}

.points-input {
    width: 45px;
    padding: 0.2rem 0.3rem;
    font-size: 0.8rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    color: var(--text-primary);
    text-align: center;
}

.test-case-actions > span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.test-case-body {
    padding: 0.75rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.test-case-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.test-case-field textarea {
    width: 100%;
    height: 80px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    resize: vertical;
}

.test-case-field input[type="text"] {
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    padding: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
}

.test-case-field input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Advanced Test Case Options */
.test-case-options {
    grid-column: 1 / -1;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.toggle-options-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
}

.toggle-options-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.test-case-advanced {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.option-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.option-row:last-child {
    margin-bottom: 0;
}

.option-field {
    flex: 1;
}

.option-field.full-width {
    flex: 1 1 100%;
}

.option-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.option-field label .hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.option-field select,
.option-field input[type="number"] {
    width: 100%;
    padding: 0.4rem;
    font-size: 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
}

.option-field textarea {
    width: 100%;
    height: 60px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding: 0.4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    resize: vertical;
}

.option-field textarea[data-field="validator"] {
    height: 100px;
}

.delete-test-btn {
    color: var(--verdict-wrong);
    font-size: 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0.25rem;
}

.delete-test-btn:hover {
    color: var(--verdict-wrong);
    opacity: 0.8;
}

/* ==================== Test Case Drag and Drop ==================== */
.test-case-item {
    cursor: default;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.test-case-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.drag-handle {
    cursor: grab;
    padding: 0 0.5rem;
    color: var(--text-muted);
    font-size: 1rem;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

.test-case-label {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
}

/* ==================== Test Case Actions ==================== */
.test-case-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.test-case-actions .btn-icon {
    padding: 0.25rem 0.4rem;
    font-size: 0.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 3px;
}

.test-case-actions .btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.test-case-actions .run-test-btn {
    color: var(--verdict-accepted);
}

.test-case-actions .run-test-btn:hover {
    background: rgba(34, 197, 94, 0.15);
    color: var(--verdict-accepted);
}

.test-case-actions .move-up-btn,
.test-case-actions .move-down-btn {
    font-size: 0.7rem;
}

.test-case-actions .duplicate-btn {
    font-size: 0.85rem;
}

/* ==================== Test Result Modal ==================== */
.test-result-modal-content {
    max-width: 900px;
    width: 90vw;
}

.test-result-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.test-result-header .test-number {
    font-size: 1rem;
    font-weight: 600;
}

.test-result-header .test-score,
.test-result-header .test-passed-count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.test-comparison {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.test-column h4 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.code-block {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    white-space: pre-wrap;
    max-height: 200px;
    overflow: auto;
    margin: 0;
}

.code-block.output-mismatch {
    border: 2px solid var(--verdict-wrong);
}

.test-result-content .test-error {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius);
    color: var(--verdict-wrong);
    font-size: 0.875rem;
}

/* All tests result list */
.all-tests-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 1rem;
}

.test-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.test-result-item.test-passed {
    border-left: 3px solid var(--verdict-accepted);
}

.test-result-item.test-failed {
    border-left: 3px solid var(--verdict-wrong);
}

.test-result-item .test-status {
    font-weight: 600;
}

.test-result-item.test-passed .test-status {
    color: var(--verdict-accepted);
}

.test-result-item.test-failed .test-status {
    color: var(--verdict-wrong);
}

.test-result-item .test-num {
    flex: 1;
}

.test-result-item .test-pts {
    color: var(--text-muted);
}

.test-result-item .test-err {
    color: var(--verdict-error);
    font-size: 0.75rem;
}

/* ==================== Function Problem UI ==================== */

/* Function signature section in problem editor */
.function-signature-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.function-signature-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Function name and return type row */
.function-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.function-row .form-group {
    flex: 1;
}

/* Parameters section */
.function-params-section {
    margin-bottom: 1rem;
}

.function-params-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.function-params-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.function-param-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.function-param-row input {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.function-param-row select {
    width: 100px;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.function-param-row .remove-param-btn {
    padding: 0.25rem 0.5rem;
    background: none;
    border: none;
    color: var(--verdict-wrong);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.7;
}

.function-param-row .remove-param-btn:hover {
    opacity: 1;
}

.add-param-btn {
    background: none;
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    width: 100%;
}

.add-param-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Function signature preview */
.function-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent-primary);
}

.function-preview-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-family: inherit;
}

/* Function test case arguments */
.function-args {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.function-args label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.arg-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.arg-label {
    min-width: 80px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.arg-label .arg-type {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.arg-input {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.arg-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Expected return field */
.expected-return-field {
    margin-bottom: 1rem;
}

.expected-return-field label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.expected-return-field input {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.expected-return-field input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Function test result display (in contestant view) */
.function-test-result {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-top: 0.5rem;
}

.function-test-result .result-row {
    display: flex;
    margin-bottom: 0.5rem;
}

.function-test-result .result-label {
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.function-test-result .result-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.function-test-result .result-value.mismatch {
    color: var(--verdict-wrong);
}

/* Function test result in contestant test list */
.test-function {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.test-function .test-args,
.test-function .test-expected,
.test-function .test-actual {
    display: flex;
    flex-direction: column;
}

.test-function h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 500;
}

.test-function pre {
    margin: 0;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Inline Input Styles */
.inline-input-wrapper {
    display: inline;
}

.inline-input-prompt {
    color: var(--text-primary);
}

.inline-input-field {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    color: var(--text-primary);
    padding: 0.125rem 0.375rem;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
}

.inline-input-value {
    color: var(--accent-hover);
}

/* Line Error Highlight */
.line-error {
    background: rgba(239, 68, 68, 0.2) !important;
}

/* Editor Tab Bar */
.editor-tab-bar {
    display: flex;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.editor-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.editor-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-primary);
}

.editor-tab:hover:not(.active) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ==================== Sessions / Live Monitor ==================== */
.sessions-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.sessions-header select {
    min-width: 250px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
}

.sessions-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.session-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    text-align: center;
    min-width: 100px;
}

.session-stat .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.session-stat .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.session-stat-pending {
    border-color: #eab308;
}

.session-stat-pending .stat-value {
    color: #eab308;
}

.session-stat-approved {
    border-color: var(--accent-primary);
}

.session-stat-approved .stat-value {
    color: var(--accent-primary);
}

.session-stat-active {
    border-color: var(--verdict-accepted);
}

.session-stat-active .stat-value {
    color: var(--verdict-accepted);
}

.session-stat-disconnected {
    border-color: var(--verdict-wrong);
}

.session-stat-disconnected .stat-value {
    color: var(--verdict-wrong);
}

.session-stat-finished {
    border-color: var(--text-muted);
}

.session-stat-finished .stat-value {
    color: var(--text-muted);
}

.sessions-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.sessions-table .checkbox-col {
    width: 40px;
    text-align: center;
}

.sessions-table .checkbox-col input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.sessions-table .heartbeat-cell {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.session-row.status-pending {
    background: rgba(234, 179, 8, 0.08);
}

.session-row.status-disconnected {
    background: rgba(239, 68, 68, 0.08);
}

.session-row.status-active {
    background: rgba(34, 197, 94, 0.05);
}

.session-row.status-finished {
    background: rgba(107, 114, 128, 0.05);
    opacity: 0.7;
}

.session-status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.session-status-badge.status-pending {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.session-status-badge.status-approved {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-hover);
}

.session-status-badge.status-active {
    background: rgba(34, 197, 94, 0.2);
    color: var(--verdict-accepted);
}

.session-status-badge.status-disconnected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--verdict-wrong);
}

.session-status-badge.status-finished {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.session-row.status-violation {
    background: rgba(236, 72, 153, 0.08);
}

.session-status-badge.status-violation {
    background: rgba(236, 72, 153, 0.2);
    color: var(--verdict-restriction);
}

/* Session action buttons */
.sessions-table .actions-cell {
    white-space: nowrap;
}

.sessions-table .actions-cell .btn {
    margin-right: 0.25rem;
}

.sessions-table .actions-cell .btn:last-child {
    margin-right: 0;
}

/* ==================== Approval Notice (Contestant) ==================== */
.approval-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(234, 179, 8, 0.1);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-left: 3px solid #eab308;
}

.approval-notice .notice-icon {
    flex-shrink: 0;
    color: #eab308;
}

.approval-notice .notice-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.approval-notice .notice-content p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.approval-notice.notice-disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--verdict-wrong);
}

.approval-notice.notice-disconnected .notice-icon {
    color: var(--verdict-wrong);
}

.approval-notice.notice-finished {
    background: rgba(107, 114, 128, 0.15);
    border-left-color: var(--text-muted);
}

.approval-notice.notice-finished .notice-icon {
    color: var(--text-muted);
}

/* Already Finished Modal */
.already-finished-modal-content {
    text-align: center;
}

.already-finished-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.already-finished-icon svg {
    stroke: var(--verdict-accepted);
}

.already-finished-contest {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.already-finished-message {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* Fullscreen Exit Warning Modal */
.fullscreen-exit-modal-content {
    text-align: center;
}

.fullscreen-exit-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-exit-icon svg {
    stroke: var(--verdict-wrong);
}

.fullscreen-exit-warning {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.fullscreen-exit-notice {
    color: var(--verdict-wrong);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==================== Finish/Completion/Time's Up Modals ==================== */
.modal-medium {
    max-width: 450px;
}

.btn-warning {
    background: #f59e0b;
    color: #1e1e2e;
}

.btn-warning:hover:not(:disabled) {
    background: #fbbf24;
}

/* Finish Modal */
.finish-summary {
    margin: 1.5rem 0;
}

.finish-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.finish-stat {
    text-align: center;
}

.finish-stat .stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.finish-stat .stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.finish-warning {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.15);
    border-radius: var(--radius);
    color: #fbbf24;
    margin-bottom: 1.5rem;
}

.finish-warning svg {
    flex-shrink: 0;
    stroke: currentColor;
}

.finish-no-reentry {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: var(--verdict-wrong);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.finish-no-reentry svg {
    flex-shrink: 0;
    stroke: currentColor;
}

.finish-no-reentry strong {
    color: #f87171;
}

/* Completion Modal */
.completion-modal-content {
    text-align: center;
}

.completion-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: rgba(34, 197, 94, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.completion-icon svg {
    stroke: var(--verdict-accepted);
}

.completion-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.completion-stats {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.completion-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.completion-stat-row .stat-label {
    color: var(--text-secondary);
}

.completion-stat-row .stat-value {
    font-weight: 600;
    color: var(--verdict-accepted);
}

/* Time's Up Modal */
.times-up-modal-content {
    text-align: center;
}

.times-up-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.times-up-icon svg {
    stroke: var(--verdict-wrong);
}

.times-up-message {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.times-up-stats {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.times-up-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.times-up-stat-row:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.times-up-stat-row .stat-label {
    color: var(--text-secondary);
}

.times-up-stat-row .stat-value {
    font-weight: 600;
}

/* ==================== Session Expired Banner ==================== */
.session-expired-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #7c2d12 0%, #9a3412 100%);
    border-bottom: 2px solid #ea580c;
    padding: 0.75rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.session-expired-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.session-expired-icon {
    font-size: 1.25rem;
    color: #fbbf24;
}

.session-expired-message {
    color: #fef3c7;
    font-size: 0.9rem;
    font-weight: 500;
}

.session-expired-banner .btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* Reauth Modal */
.reauth-modal-content {
    max-width: 400px;
    text-align: center;
}

.reauth-modal-content h2 {
    margin-bottom: 0.75rem;
    color: #fbbf24;
}

.reauth-modal-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.reauth-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1.5rem !important;
}

.reauth-signin-container {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}

/* ==================== Responsive ==================== */
@media (max-width: 1200px) {
    .competition-layout {
        grid-template-columns: var(--sidebar-width) 1fr;
    }

    .leaderboard-panel {
        display: none;
    }
}

@media (max-width: 900px) {
    .competition-layout {
        grid-template-columns: 1fr;
    }

    .problem-sidebar {
        display: none;
    }

    .competition-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .panel-divider {
        display: none;
    }

    .problem-panel {
        grid-row: 1;
        grid-column: 1;
        max-height: 40vh;
    }

    .editor-panel {
        grid-row: 2;
        grid-column: 1;
    }

    .output-panel {
        grid-row: 3;
        grid-column: 1;
    }

    .problem-editor-layout {
        grid-template-columns: 1fr;
    }

    /* Function test display responsive */
    .test-function {
        grid-template-columns: 1fr;
    }

    .test-comparison {
        grid-template-columns: 1fr;
    }

    /* Function row responsive */
    .function-row {
        flex-direction: column;
    }
}

/* ===========================================
   Full-Page Contest Editor
   =========================================== */

#contest-editor-screen .app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#contest-editor-screen .app-header h1 {
    flex: 1;
    font-size: 1.25rem;
}

#contest-editor-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.contest-editor-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 60px);
}

.contest-editor-layout.single-column {
    grid-template-columns: 1fr;
    max-width: 800px;
}

.contest-editor-settings {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contest-editor-teams {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.editor-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.editor-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.editor-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.editor-section .section-header h3 {
    margin: 0;
}

.section-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: -0.5rem 0 0.75rem 0;
}

/* Teams List - Full Page Version */
.teams-list-full {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
}

.team-card-full {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.team-card-full .team-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.team-card-full .team-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.team-card-full .team-code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--bg-primary);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
}

.team-card-full .team-members {
    margin-bottom: 0.75rem;
}

.team-card-full .team-members-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.team-card-full .members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.team-card-full .member-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-primary);
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.team-card-full .member-tag .remove-member {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.team-card-full .member-tag .remove-member:hover {
    color: var(--verdict-wrong);
}

.team-card-full .no-members {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
}

.team-card-full .team-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.team-card-full .add-member-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.team-card-full .add-member-form select {
    flex: 1;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
}

.team-card-full .add-member-form button {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

.team-card-full .delete-team-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Responsive for contest editor */
@media (max-width: 900px) {
    .contest-editor-layout {
        grid-template-columns: 1fr;
    }

    .contest-editor-teams {
        order: -1;
    }

    .teams-list-full {
        max-height: 300px;
    }
}
