/* ANOVA Interactive Visualizer — scoped to #anovaContainer */

#anovaContainer {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    background-color: #0a0a0a;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    border-radius: 8px;
    border: 1px solid #333;
    box-sizing: border-box;
}

#anovaContainer *, #anovaContainer *::before, #anovaContainer *::after { box-sizing: border-box; }

/* === Tab bar === */
#anovaContainer .av-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-bottom: 2px solid #333;
}
#anovaContainer .av-tab {
    padding: 10px 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    color: #888;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -2px;
}
#anovaContainer .av-tab:hover { color: #ccc; }
#anovaContainer .av-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}
#anovaContainer .av-tab-panel { display: none; }
#anovaContainer .av-tab-panel.active { display: block; }

/* === Canvas === */
#anovaContainer .canvas-wrap {
    position: relative;
    width: 100%;
    background: #111;
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
    margin-bottom: 10px;
}

#anovaContainer .canvas-wrap canvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}

/* === F-Gauge row === */
#anovaContainer .f-gauge-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 10px;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #333;
}

#anovaContainer .f-label { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; }
#anovaContainer .f-number { font-size: 28px; font-weight: bold; min-width: 80px; }
#anovaContainer .f-bar-wrap {
    flex: 1;
    height: 20px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
#anovaContainer .f-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.2s, background 0.2s;
}
#anovaContainer .f-crit-line {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #fbbf24;
}
#anovaContainer .f-sig { font-size: 12px; font-weight: bold; min-width: 120px; text-align: right; }

#anovaContainer .fdist-wrap {
    width: 100%;
    background: #111;
    border-radius: 8px;
    border: 1px solid #333;
    overflow: hidden;
    margin-bottom: 10px;
}
#anovaContainer .fdist-wrap canvas { display: block; width: 100%; height: auto; }

/* === ANOVA Table === */
#anovaContainer .anova-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 10px;
}

#anovaContainer .anova-table th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    padding: 6px 8px;
    border-bottom: 2px solid #333;
}

#anovaContainer .anova-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #222;
    font-family: 'Courier New', monospace;
}

#anovaContainer .anova-table .val-between { color: #60a5fa; }
#anovaContainer .anova-table .val-within { color: #f87171; }
#anovaContainer .anova-table .val-total { color: #a78bfa; }

/* === Control panel === */
#anovaContainer .control-panel {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid #333;
}

#anovaContainer .control-panel-title {
    font-size: 11px;
    font-weight: bold;
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

#anovaContainer .control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

#anovaContainer .control-row:last-child { margin-bottom: 0; }

#anovaContainer .control-row label {
    min-width: 110px;
    font-size: 12px;
    color: #b0b0b0;
    white-space: nowrap;
}

#anovaContainer .control-row input[type="range"] {
    flex: 1;
    min-width: 80px;
    height: 6px;
    background: #2a2a2a;
    border-radius: 3px;
    accent-color: #60a5fa;
}

#anovaContainer .control-row .value-display {
    min-width: 36px;
    text-align: right;
    font-size: 12px;
    color: #60a5fa;
}

/* === Buttons === */
#anovaContainer .btn-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

#anovaContainer .btn-action {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #374151;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#anovaContainer .btn-action:hover { background: #4b5563; }

#anovaContainer .btn-primary {
    padding: 7px 14px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background: #1e40af;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

#anovaContainer .btn-primary:hover { box-shadow: 0 0 10px rgba(96, 165, 250, 0.4); }

/* === Summary === */
#anovaContainer .summary-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

#anovaContainer .stat-card {
    background: #111;
    border-left: 4px solid #60a5fa;
    padding: 8px 10px;
    border-radius: 4px;
}

#anovaContainer .stat-card .stat-label {
    font-size: 10px;
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

#anovaContainer .stat-card .stat-value {
    font-size: 14px;
    font-weight: bold;
    color: #60a5fa;
    margin-top: 2px;
}

/* === Insight / Equation === */
#anovaContainer .insight-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: #0f172a;
    border-radius: 6px;
    border: 1px solid #1e3a5f;
    font-size: 12px;
    line-height: 1.5;
    color: #c0c0c0;
}

#anovaContainer .insight-box strong { color: #60a5fa; }

#anovaContainer .eq-panel {
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.6;
    color: #ccc;
}

#anovaContainer .eq-panel .val { color: #fbbf24; }

/* === Calculation breakdown === */
#anovaContainer .calc-step {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #222;
}
#anovaContainer .calc-step:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

#anovaContainer .calc-step-head {
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
#anovaContainer .calc-step-head.between { color: #60a5fa; }
#anovaContainer .calc-step-head.within  { color: #f87171; }
#anovaContainer .calc-step-head.total   { color: #a78bfa; }
#anovaContainer .calc-step-head.neutral { color: #888; }
#anovaContainer .calc-step-head.result  { color: #10b981; }
#anovaContainer .calc-step-head .calc-desc { font-weight: normal; font-size: 10px; color: #fff; text-transform: none; letter-spacing: 0; margin-left: 4px; }

#anovaContainer .calc-formula {
    font-size: 11px;
    line-height: 1.7;
    color: #999;
    padding-left: 10px;
}
#anovaContainer .calc-formula .num   { color: #fbbf24; }
#anovaContainer .calc-formula .grpA  { color: rgb(248,113,113); }
#anovaContainer .calc-formula .grpB  { color: rgb(52,211,153); }
#anovaContainer .calc-formula .grpC  { color: rgb(96,165,250); }
#anovaContainer .calc-formula .grpD  { color: rgb(251,191,36); }
#anovaContainer .calc-formula .res   { color: #e0e0e0; font-weight: bold; }
#anovaContainer .calc-formula .op    { color: #666; }
#anovaContainer .calc-formula .muted { color: #555; }

/* === Checkbox toggle === */
#anovaContainer .toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b0b0b0;
}

#anovaContainer .toggle-row input[type="checkbox"] {
    accent-color: #60a5fa;
    width: 16px;
    height: 16px;
}

/* === Example tab === */
#anovaContainer .ex-scenario {
    background: #0f172a;
    border: 1px solid #1e3a5f;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 13px;
}
#anovaContainer .ex-scenario-title {
    font-size: 15px;
    font-weight: bold;
    color: #60a5fa;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#anovaContainer .ex-scenario p { margin: 6px 0; color: #ccc; }

#anovaContainer .ex-section-title {
    font-size: 13px;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 14px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #333;
}

#anovaContainer .ex-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 12px;
    font-family: 'Courier New', monospace;
}
#anovaContainer .ex-data-table th,
#anovaContainer .ex-data-table td {
    padding: 7px 10px;
    text-align: center;
    border-bottom: 1px solid #222;
}
#anovaContainer .ex-data-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #666;
    border-bottom: 2px solid #333;
}
#anovaContainer .ex-data-table .grpA-head { color: rgb(248,113,113); }
#anovaContainer .ex-data-table .grpB-head { color: rgb(52,211,153); }
#anovaContainer .ex-data-table .grpC-head { color: rgb(96,165,250); }
#anovaContainer .ex-data-table .grpD-head { color: rgb(251,191,36); }
#anovaContainer .ex-data-table .grpA-cell { color: rgb(248,113,113); }
#anovaContainer .ex-data-table .grpB-cell { color: rgb(52,211,153); }
#anovaContainer .ex-data-table .grpC-cell { color: rgb(96,165,250); }
#anovaContainer .ex-data-table .grpD-cell { color: rgb(251,191,36); }

#anovaContainer .ex-data-table td[contenteditable] {
    cursor: text;
    border-radius: 3px;
    transition: background 0.15s;
    outline: none;
    min-width: 36px;
}
#anovaContainer .ex-data-table td[contenteditable]:hover { background: rgba(255,255,255,0.06); }
#anovaContainer .ex-data-table td[contenteditable]:focus { background: rgba(96,165,250,0.15); box-shadow: inset 0 0 0 1px rgba(96,165,250,0.4); }

/* === Scrollbar === */
#anovaContainer ::-webkit-scrollbar { width: 6px; height: 6px; }
#anovaContainer ::-webkit-scrollbar-track { background: transparent; }
#anovaContainer ::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
#anovaContainer ::-webkit-scrollbar-thumb:hover { background: #555; }
#anovaContainer * { scrollbar-width: thin; scrollbar-color: #333 transparent; }
