/* Chalk theme tokens — this page is standalone (doesn't extend base.html /
   load edu-theme.css), so the exact site palette is re-declared here.
   Keep these in sync with static/css/edu-theme.css's :root. */
:root {
    --primary-dark: #F6F4F1;    /* page background ("paper") */
    --secondary-dark: #FFFFFF;  /* surface (cards, panels) */
    --tertiary-dark: #EFEAE6;   /* elevated surface / hover */
    --accent-blue: #96305F;     /* "plum" — primary accent */
    --accent-purple: #D9A441;   /* "gold" — secondary accent, sparing use */
    --accent-green: #2F7A6B;    /* "teal" — tertiary accent, sparing use */
    --accent-deep: #7A2650;     /* darker plum, for accent text on white */
    --text-primary: #1B1720;    /* ink */
    --text-secondary: #565160;  /* ink-soft */
    --text-muted: #8B8494;      /* ink-faint */
    --hairline: #E3DFD9;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--primary-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: var(--secondary-dark);
    border: 1px solid var(--hairline);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 30px 60px -20px rgba(27, 23, 32, 0.2), 0 0 80px -20px rgba(150, 48, 95, 0.15);
    max-width: 1200px;
    width: 90%;
}

h1 {
    text-align: center;
    color: var(--text-primary);
    margin: 0 0 30px 0;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.main-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.left-panel {
    flex: 1;
}

/* Kept dark: this wrapper's background frames the canvas, which the JS
   draws with its own dark backdrop (see plinko.js) — the two need to match
   so the padding doesn't read as a mismatched border around the sim. */
.simulation-wrapper {
    position: relative;
    background: #1a1a2e;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
}

#plinkoCanvas {
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    max-width: 100%;
    height: auto;
}

.stats {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin: 5px 0;
}

.stat-item span:last-child {
    font-weight: bold;
    color: var(--accent-purple);
}

.controls {
    background: var(--secondary-dark);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    padding: 20px;
    width: 350px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.control-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    gap: 8px;
}

.control-group label {
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 5px;
}

.control-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--tertiary-dark);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--accent-blue);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 3px solid var(--accent-blue);
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group span {
    text-align: center;
    font-weight: bold;
    color: var(--accent-blue);
    font-size: 1.1em;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.btn {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-start {
    background: linear-gradient(135deg, var(--accent-deep), var(--accent-blue));
    color: white;
}

.btn-start:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(150, 48, 95, 0.35);
}

/* Kept as a conventional red "stop" affordance rather than forced into the
   brand palette — same reasoning the codebase already uses for danger/stop
   actions elsewhere (see rpg_adventure.css's --rpg-danger). */
.btn-stop {
    background: #e74c3c;
    color: white;
}

.btn-stop:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.btn-reset {
    background: var(--tertiary-dark);
    color: var(--text-secondary);
    border: 1px solid var(--hairline);
}

.btn-reset:hover {
    background: var(--hairline);
    color: var(--text-primary);
}

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

/* Kept dark for the same reason as .simulation-wrapper: it frames a canvas
   the JS draws with its own dark backdrop (see plinko.js). */
.histogram {
    background: #1a1a2e;
    border-radius: 10px;
    padding: 10px;
    border: 1px solid #2a2a3e;
}

#histogramCanvas {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 600px;
    height: auto;
}

@media (max-width: 968px) {
    .main-layout {
        flex-direction: column;
    }

    .controls {
        width: 100%;
        position: static;
        order: -1;
        margin-bottom: 20px;
    }

    .button-group {
        flex-direction: row;
    }

    .container {
        padding: 20px;
        width: 95%;
    }
}

@media (max-width: 768px) {
    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* body is a flex row centering .container; once .back-to-projects
       becomes a static in-flow element (see index.html's inline style),
       it becomes a second flex item sitting beside .container instead of
       above it unless the row is switched to a column here. */
    body {
        flex-direction: column;
    }
}
