/* complexity.css - Big-O Complexity Sorting game styles */
body {
    background-color: #f8fafc;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.comp-container {
    max-width: 950px;
    margin: 15px auto;
    padding: 10px 20px;
    text-align: center;
}

.comp-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.btn-back {
    text-decoration: none;
    color: #06b6d4;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.btn-back:hover {
    color: #0891b2;
}

.btn-help {
    background: none;
    border: none;
    color: #64748b;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s;
}

.btn-help:hover {
    color: #475569;
}

.comp-title-area {
    margin-bottom: 10px;
}

.comp-title {
    font-size: 1.8rem;
    color: #1e293b;
    font-weight: 800;
    margin: 0;
}

.comp-title span {
    color: #06b6d4;
    font-weight: 300;
    display: block;
    font-size: 1.1rem;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Stats panel */
.comp-stats {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 12px 20px;
    margin-bottom: 15px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-item .label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-item .value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
}

.stat-item .value.text-cyan {
    color: #06b6d4;
}

.stat-item .value.text-red {
    color: #ef4444;
}

/* Arena Grid Layout */
.comp-arena {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 20px;
    margin-bottom: 15px;
}

/* Growth Panel (Left) */
.growth-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 15px;
    text-align: left;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 320px;
    box-sizing: border-box;
}

.panel-subtitle {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 1.05rem;
    font-weight: 700;
}

.growth-chart-box {
    flex-grow: 1;
    background: #0f172a;
    border-radius: 10px;
    position: relative;
    padding: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chart-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    transform-origin: bottom left;
    display: flex;
    justify-content: flex-end;
    padding-right: 15px;
    box-sizing: border-box;
}

.chart-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(15, 23, 42, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    position: relative;
    bottom: 8px;
}

/* Growth plots rotation representations */
.curve-n2 {
    height: 85%;
    border-left: 2px solid #ef4444;
    transform: rotate(5deg);
}
.curve-n2 .chart-label { color: #f87171; border: 1px solid #ef4444; }

.curve-nlogn {
    height: 70%;
    border-left: 2px solid #f59e0b;
    transform: rotate(25deg);
}
.curve-nlogn .chart-label { color: #fbbf24; border: 1px solid #f59e0b; }

.curve-n {
    height: 50%;
    border-left: 2px solid #6366f1;
    transform: rotate(45deg);
}
.curve-n .chart-label { color: #818cf8; border: 1px solid #6366f1; }

.curve-logn {
    height: 25%;
    border-left: 2px solid #10b981;
    transform: rotate(65deg);
}
.curve-logn .chart-label { color: #34d399; border: 1px solid #10b981; }

.curve-1 {
    height: 10px;
    border-bottom: 2px solid #06b6d4;
    width: 100%;
    bottom: 10px;
}
.curve-1 .chart-label { color: #22d3ee; border: 1px solid #06b6d4; }

/* Operation card (Right) */
.operation-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 15px;
    text-align: left;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 320px;
    box-sizing: border-box;
}

.op-card-header {
    margin-bottom: 8px;
}

.op-card-badge {
    background: #06b6d4;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.op-card-body h3 {
    margin: 4px 0;
    color: #1e293b;
    font-size: 1.15rem;
    font-weight: 800;
}

.op-card-body p {
    margin: 0;
    color: #64748b;
    font-size: 0.88rem;
    line-height: 1.4;
}

.operation-panel .question-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-badge {
    background: #06b6d4;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

.question-text {
    margin: 0;
    font-weight: 700;
    color: #334155;
    font-size: 0.85rem;
}

/* Choices Grid */
.operation-panel .choices-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    flex-grow: 1;
}

.choice-btn {
    background: white;
    border: 2px solid #cbd5e1;
    color: #1e293b;
    font-size: 1.1rem;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Consolas', monospace;
}

.choice-btn:hover {
    border-color: #06b6d4;
    background: rgba(6, 182, 212, 0.05);
    transform: translateY(-1px);
}

.choice-btn.correct {
    background: #ecfdf5 !important;
    border-color: #10b981 !important;
    color: #047857 !important;
}

.choice-btn.wrong {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #b91c1c !important;
    animation: compShake 0.4s ease-in-out;
}

@keyframes compShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-4px); }
    40%, 80% { transform: translateX(4px); }
}

/* Result modal overrides */
/* Modal Styling & Result Overrides */
.result-rank-box {
    color: #0891b2;
    background: #ecfeff;
    border-color: #67e8f9;
    font-size: 1.4rem;
    font-weight: 800;
    margin: 20px 0;
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed #67e8f9;
    text-align: center;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.glass-panel-modal {
    background: rgba(255, 255, 255, 0.96);
    padding: 40px 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: slideUp 0.4s ease-out;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close-x {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 26px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 5px;
    z-index: 10;
}

.modal-close-x:hover {
    color: #ef4444;
}

.modal-scroll-body {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 15px;
}

.modal-scroll-body::-webkit-scrollbar {
    width: 6px;
}

.modal-scroll-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.modal-scroll-body::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.3);
    border-radius: 4px;
}

.modal-scroll-body::-webkit-scrollbar-thumb:hover {
    background: rgba(6, 182, 212, 0.5);
}

.btn-restart {
    background: #06b6d4;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-restart:hover {
    background: #0891b2;
}

.btn-share {
    background: #e2e8f0;
    color: #334155;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-share:hover {
    background: #cbd5e1;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

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

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

@media (max-width: 800px) {
    .comp-arena {
        grid-template-columns: 1fr;
    }
    .growth-panel, .operation-panel {
        height: auto;
    }
}
