:root {
    /* https://www.cmu.edu/brand/brand-guidelines/visual-identity/colors.html */
    --cmu-red: #c41230;
    --cmu-black: #000000;
    --cmu-charcoal: #333333;
    --cmu-darkgray: #6D6E71;
    --cmu-lightgray: #E0E0E0;
    --cmu-rose: #EF3A47;
    --cmu-gold: #FDB515;
    --cmu-green: #009647;
    --cmu-teal: #008F91;
    --cmu-blue: #043673;
    --cmu-skyblue: #007BC0;
    --cmu-tan: #BCB49E;
    --cmu-beige: #E4DAC4;
    --cmu-tealgreen: #1F4C4C;
    --cmu-lightgreen: #719F94;
    --cmu-navy: #182C48;
    --cmu-crimson: #941120;

    --scs-red: #bb0000;
    --scs-darkgray: #666666;

    --cmu-font-family: "Open Sans", Helvetica, Arial, sans-serif;
    --cmu-font-family-serif: "Source Serif Pro", Times, serif;

    --bg-color: var(--cmu-lightgray);

    /* Demo palette — must stay in sync with the COLORS table in pancake_robot.js */
    --arm-color: var(--cmu-skyblue);
    --collide-color: var(--cmu-red);
    --cobstacle-color: var(--cmu-darkgray);
    --goal-color: var(--cmu-green);
    --trail-color: purple;
}

html {
    background-color: var(--bg-color);
    border-width: 1px;
    font-family: var(--cmu-font-family);
    color: var(--cmu-charcoal);
}

h1 {
    font-size: 3em;
    font-weight: normal;
}

h2 {
    font-size: 1.75em;
    font-weight: normal;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.title {
    text-align: center;
}

a {
    color: var(--cmu-skyblue);
}

.grid-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    column-gap: 20px;
    row-gap: 30px;
    margin-left: 10px;
    margin-right: 10px;
}

.two-col {
    grid-column: span 2;
}

.flex-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.panel-title {
    font-size: 1.35em;
    font-weight: normal;
    margin: 0;
}

.demo-canvas {
    display: block;
    width: 100%;
    background-color: white;
    border-radius: 0.5em;
    touch-action: none;
    cursor: grab;
}

/* The kitchen is 12 x 9 world units. The C-space is a 360 x 360 degree square,
   drawn centered in a canvas of the same shape so the two panels line up. */
#workspace,
#cspace {
    aspect-ratio: 4 / 3;
}

.demo-canvas:focus {
    outline: 1px solid var(--cmu-red);
}

.legend {
    font-size: 1.125em;
    color: var(--cmu-darkgray);
}

.legend-swatch {
    display: inline-block;
    width: 0.75em;
    height: 0.75em;
    border-radius: 0.15em;
    vertical-align: middle;
}

.legend-free {
    background-color: white;
    border: 1px solid var(--cmu-darkgray);
}

.legend-cobs {
    background-color: var(--cobstacle-color);
}

.legend-goal {
    background-color: var(--goal-color);
}

.legend-dot {
    background-color: var(--collide-color);
    border-radius: 50%;
}

kbd {
    font-family: "Courier New", monospace;
    background-color: white;
    border: 1px solid var(--cmu-darkgray);
    border-radius: 0.25em;
    padding: 0 0.25em;
    font-size: 0.9em;
}

/* Kitchen and task pickers across the top */
.scene-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 30px;
    row-gap: 15px;
}

.scene-selection {
    display: flex;
    align-items: center;
    font-size: 1.5em;
}

.scene-selection-text {
    margin: 0 0.3em 0 0;
}

select {
    font-size: 1.5em;
    height: 2em;
    margin: 0em;
    padding: 0 0.25em;
    color: var(--cmu-charcoal);
    border: 1px solid var(--cmu-darkgray);
    border-radius: 0.5em;
}

.scene-selection .scene-select,
.knob-selection .scene-select {
    font-size: 1em;
}

.status-text {
    flex: 1 1 15em;
    font-size: 1.25em;
    color: var(--cmu-darkgray);
    min-height: 1.2em;
    font-variant-numeric: tabular-nums;
}

.status-free {
    color: var(--cmu-green);
    font-weight: bold;
}

.status-collide {
    color: var(--cmu-red);
    font-weight: bold;
}

.status-done {
    color: var(--cmu-green);
    font-weight: bold;
}

/* Joint sliders, tool picker, and the trace controls */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 40px;
    row-gap: 20px;
}

.knob-selection {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-size: 1.5em;
}

.knob-text {
    margin: 0 0.3em 0 0;
}

.knob-slider {
    flex: 1 1 auto;
    width: 8em;
    max-width: 20em;
    accent-color: var(--cmu-red);
}

.knob-value {
    color: var(--cmu-darkgray);
    font-variant-numeric: tabular-nums;
    min-width: 3em;
}

.option-row {
    display: flex;
    align-items: center;
    gap: 0.5em;
    cursor: pointer;
    user-select: none;
    font-size: 1.5em;
}

.option-row input[type="checkbox"] {
    width: 1.25em;
    height: 1.25em;
    accent-color: var(--cmu-darkgray);
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.btn {
    margin: 0em;
    height: 3em;
    font-size: 1.5em;
    text-transform: uppercase;
    font-weight: bold;
    padding: 0 0.75em;
    background-color: var(--bg-color);
    color: var(--cmu-darkgray);
    border: 1px solid var(--cmu-darkgray);
    border-radius: 0.5em;
}

.btn:hover {
    background-color: var(--cmu-darkgray);
    color: white;
}

.btn:active {
    transform: translateY(4px);
}

.btn-strong {
    background-color: var(--bg-color);
    color: var(--cmu-red);
    border: 1px solid var(--cmu-red);
}

.btn-strong:hover {
    background-color: var(--cmu-red);
    color: white;
}

.notes-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 20px;
}

.instruction-text {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    font-size: 1.125em;
}

/* Trackpad + step buttons (game-mode controls). The thumb cluster (ACT +
   trackpad) hugs the right edge, where the Among Us trackpad lives. */
.thumb-cluster {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.actbtn {
    width: 3.4em;
    height: 3.4em;
    border-radius: 50%;
    font-size: 1.5em;
    padding: 0;
    color: var(--cmu-green);
    border: 2px solid var(--cmu-green);
}

.actbtn:hover {
    background-color: var(--cmu-green);
    color: white;
}

.actbtn.act-ready {
    background-color: var(--cmu-green);
    color: white;
    box-shadow: 0 0 0.5em var(--cmu-green);
}

.pad-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#trackpad {
    width: 9em;
    height: 9em;
    touch-action: none;
    cursor: grab;
}

.pad-caption {
    font-size: 0.9em;
    color: var(--cmu-darkgray);
}

.stepper-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 8px;
}

.stepbtn {
    min-width: 3.2em;
    height: 2.2em;
    font-size: 1.3em;
    text-transform: none;
    touch-action: none;
}

/* Explore-only controls stay hidden until the checkbox flips them on */
.explore-only {
    display: none;
}

body.explore .explore-only {
    display: flex;
}

/* Media Portrait: single column — kitchen above its C-space view */
@media (orientation: portrait) {
    /* Larger base size on phones — everything is em-based so it all scales */
    html {
        font-size: 1.2em;
    }

    .grid-main {
        grid-template-columns: 1fr;
    }

    .two-col {
        grid-column: span 1;
    }

    .scene-bar { order: 0; }
    .col-workspace { order: 1; }
    .controls-bar { order: 2; }
    .col-cspace { order: 3; }
    .notes-row { order: 4; }

    .notes-row {
        grid-template-columns: 1fr;
    }
}
