/* =========================================================
   HORIZONTAL SPRING–MASS SYSTEM
========================================================= */

* {
    box-sizing: border-box;
}

:root {
    --page: #f4f7fa;
    --panel: #ffffff;
    --soft: #f5f8fa;
    --line: #d5dfe7;

    --text: #18324a;
    --muted: #718191;

    --blue: #3f718f;
    --blue-dark: #244f69;
    --blue-soft: #e9f1f5;

    --green: #32735b;
    --green-soft: #edf7f2;

    --red: #a44c4c;
    --red-soft: #fff1f1;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

.simulation-page {
    width: min(1220px, 95%);
    margin: 0 auto;
    padding-bottom: 60px;
}


/* =========================================================
   HEADER
========================================================= */

.simulation-header {
    padding: 16px 0 20px;
}

.eyebrow {
    margin: 14px 0 5px;
    color: #597184;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 1.3px;
}

.simulation-header h1 {
    margin: 0 0 7px;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
}

.intro {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}


/* =========================================================
   MODEL BAR
========================================================= */

.model-bar {
    display: flex;
    align-items: center;
    gap: 32px;

    min-height: 66px;

    padding: 10px 16px;
    margin-bottom: 14px;

    background: var(--panel);

    border: 1px solid var(--line);
    border-radius: 12px;
}

.model-title {
    color: var(--blue-dark);
    font-size: 0.78rem;
    font-weight: 800;
}

.model-value span {
    display: block;

    margin-bottom: 3px;

    color: #8492a0;

    font-size: 0.62rem;
}

.model-value strong {
    display: block;

    font-size: 0.76rem;
}


/* =========================================================
   CONTROL BAR
========================================================= */

.control-bar {
    display: flex;
    align-items: center;
    gap: 15px;

    min-height: 58px;

    padding: 9px 14px;
    margin-bottom: 16px;

    background: white;

    border: 1px solid var(--line);
    border-radius: 12px;
}

.playback-controls {
    display: flex;
    gap: 7px;
}

button,
select {
    font: inherit;
}

button {
    min-height: 38px;

    padding: 7px 13px;

    border: 1px solid #b8c6d1;
    border-radius: 7px;

    background: white;

    color: #29445a;

    font-size: 0.76rem;
    font-weight: 700;

    cursor: pointer;
}

button:hover {
    background: #f1f5f7;
}

.primary-button {
    background: var(--blue);
    border-color: var(--blue);
    color: white;
}

.primary-button:hover {
    background: var(--blue-dark);
}

.control-divider {
    width: 1px;
    height: 31px;
    background: #d8e0e7;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-control label {
    font-size: 0.72rem;
    font-weight: 700;
}

.speed-control select {
    padding: 6px 9px;

    border: 1px solid #bdc9d3;
    border-radius: 6px;

    background: white;

    font-size: 0.75rem;
}


/* =========================================================
   MAIN VISUAL GRID
========================================================= */

.visual-grid {
    display: grid;

    grid-template-columns:
        minmax(0, 0.9fr)
        minmax(0, 1.1fr);

    gap: 14px;

    align-items: stretch;
}

.visual-panel {
    min-width: 0;

    padding: 16px;

    background: white;

    border: 1px solid var(--line);
    border-radius: 12px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    margin-bottom: 12px;
}

.panel-label {
    margin: 0 0 5px;

    color: #698092;

    font-size: 0.61rem;
    font-weight: 900;

    letter-spacing: 1.3px;
}

.panel-heading h2,
.questions-heading h2 {
    margin: 0;

    color: #17354e;

    font-size: 1.05rem;
}

.status-badge {
    padding: 6px 9px;

    border-radius: 14px;

    background: var(--blue-soft);

    color: var(--blue-dark);

    font-size: 0.62rem;
    font-weight: 700;
}


/* =========================================================
   MOTION AREA
========================================================= */

.motion-area {
    position: relative;

    height: 275px;

    overflow: hidden;

    border: 1px solid #d4dfe7;
    border-radius: 9px;

    background: #f2f7fa;
}

.motion-area::after {
    content: "";

    position: absolute;

    left: 10%;
    right: 5%;

    top: 55%;

    height: 2px;

    background: #c7d2db;

    z-index: 1;
}


/* =========================================================
   SPACECRAFT
========================================================= */

.spacecraft {
    position: absolute;

    left: 3%;
    top: 74px;

    width: 120px;
    height: 140px;

    z-index: 7;
}

.spacecraft-body {
    position: absolute;

    left: 0;
    top: 15px;

    width: 80px;
    height: 110px;

    border: 3px solid #334b5c;
    border-radius: 10px 3px 3px 10px;

    background: #506576;
}

.spacecraft-window {
    position: absolute;

    left: 15px;
    top: 18px;

    width: 27px;
    height: 19px;

    border-radius: 3px;

    background: #d2e0e7;
}

.spacecraft-body span {
    position: absolute;

    left: 8px;
    bottom: 11px;

    color: white;

    font-size: 0.48rem;
    font-weight: 800;

    letter-spacing: 0.5px;
}

.fixed-wall {
    position: absolute;

    right: 17px;
    top: 0;

    width: 18px;
    height: 140px;

    border: 2px solid #384c5d;

    background:
        repeating-linear-gradient(
            -45deg,
            #738695,
            #738695 5px,
            #a4b1ba 5px,
            #a4b1ba 10px
        );
}


/* =========================================================
   SPRING
========================================================= */

.spring {
    position: absolute;

    left: 14%;
    top: 117px;

    height: 65px;

    color: #617686;

    z-index: 5;
}


/* =========================================================
   MASS
========================================================= */

.mass-block {
    position: absolute;

    left: calc(31% - 39px);
    top: 108px;

    width: 78px;
    height: 78px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    border: 3px solid #234c67;
    border-radius: 9px;

    background: #477d9e;

    color: white;

    z-index: 8;

    will-change: left;
}

.mass-symbol {
    font-size: 1.15rem;
    font-style: italic;
}

.mass-block strong {
    margin-top: 2px;

    font-size: 0.58rem;
}


/* =========================================================
   POSITION MARKERS
========================================================= */

.motion-marker {
    position: absolute;

    top: 23px;

    transform: translateX(-50%);

    text-align: center;

    z-index: 3;
}

.marker-line {
    height: 183px;

    margin: 5px auto;

    border-left: 1px dashed #aebdc8;
}

.motion-marker strong {
    display: block;

    font-size: 0.6rem;
}

.motion-marker span {
    display: block;

    margin-top: 2px;

    color: #758696;

    font-size: 0.56rem;
}

.left-marker {
    left: 31%;
}

.equilibrium-marker {
    left: 56%;
}

.right-marker {
    left: 81%;
}

.equilibrium-marker .marker-line {
    border-left:
        2px dashed #5c7487;
}


/* =========================================================
   LIVE VALUES
========================================================= */

.live-values {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 7px;

    margin-top: 9px;
}

.live-card {
    padding: 10px;

    background: var(--soft);

    border-radius: 7px;
}

.live-card span {
    display: block;

    margin-bottom: 4px;

    color: #7b8996;

    font-size: 0.6rem;
}

.live-card strong {
    font-size: 0.78rem;
}


/* =========================================================
   PARAMETERS
========================================================= */

.parameter-section {
    margin-top: 13px;

    padding-top: 12px;

    border-top: 1px solid #dce4ea;
}

.parameter-section h3 {
    margin: 0 0 10px;

    font-size: 0.75rem;
}

.parameter-row {
    display: grid;

    grid-template-columns: 145px 1fr;

    align-items: center;

    gap: 10px;

    margin-bottom: 9px;
}

.parameter-name {
    display: flex;
    justify-content: space-between;
    gap: 7px;
}

.parameter-name span {
    color: #657687;

    font-size: 0.65rem;
}

.parameter-name strong {
    font-size: 0.65rem;
}

.parameter-row input {
    width: 100%;

    accent-color: var(--blue);
}

.exam-values-button {
    min-height: 32px;

    margin-top: 3px;

    padding: 5px 10px;

    font-size: 0.65rem;
}


/* =========================================================
   GRAPH
========================================================= */

.graph-wrapper {
    height: 365px;

    padding: 7px;

    border: 1px solid #d4dfe7;
    border-radius: 9px;

    background: #fbfdfe;
}

#positionGraph {
    display: block;

    width: 100%;
    height: 100%;
}

.graph-prompt {
    margin-top: 10px;

    padding: 9px 11px;

    border-radius: 6px;

    background: #f1f5f7;

    color: #526b7e;

    font-size: 0.67rem;
}

.concept-box {
    display: grid;

    grid-template-columns:
        repeat(3, 1fr);

    gap: 7px;

    margin-top: 10px;
}

.concept-box > div {
    padding: 9px;

    background: #f7f9fa;

    border-radius: 6px;
}

.concept-box span {
    display: block;

    margin-bottom: 3px;

    color: #7b8996;

    font-size: 0.57rem;
}

.concept-box strong {
    font-size: 0.72rem;
}


/* =========================================================
   QUESTIONS
========================================================= */

.questions-panel {
    margin-top: 16px;

    padding: 18px;

    background: white;

    border: 1px solid var(--line);
    border-radius: 12px;
}

.questions-heading {
    padding-bottom: 13px;

    border-bottom: 1px solid #dfe6ec;
}

.questions-heading p:last-child {
    margin: 6px 0 0;

    color: var(--muted);

    font-size: 0.72rem;
}

.question-card {
    display: grid;

    grid-template-columns: 34px 1fr;

    gap: 11px;

    padding: 16px 0;

    border-bottom: 1px solid #e3e9ee;
}

.question-card:last-child {
    border-bottom: 0;
}

.question-number {
    width: 29px;
    height: 29px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--blue-soft);

    color: var(--blue-dark);

    font-size: 0.7rem;
    font-weight: 800;
}

.question-content h3 {
    margin: 3px 0 10px;

    font-size: 0.78rem;
    line-height: 1.4;
}

.answer-options {
    display: flex;
    flex-direction: column;

    gap: 5px;

    margin-bottom: 9px;
}

.answer-options label {
    display: flex;
    align-items: center;

    gap: 7px;

    color: #5c6e7d;

    font-size: 0.7rem;
}

.answer-options input {
    accent-color: var(--blue);
}

.check-answer {
    min-height: 31px;

    padding: 5px 10px;

    font-size: 0.66rem;
}

.question-feedback {
    margin-top: 9px;

    padding: 9px 11px;

    border-left: 3px solid var(--green);
    border-radius: 5px;

    background: var(--green-soft);

    color: #315f4c;

    font-size: 0.68rem;

    line-height: 1.45;
}

.question-card.incorrect
.question-feedback {
    border-left-color: var(--red);

    background: var(--red-soft);

    color: #814444;
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {

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

    .model-bar {
        flex-wrap: wrap;
    }

    .graph-wrapper {
        height: 330px;
    }
}


@media (max-width: 600px) {

    .simulation-page {
        width: 96%;
    }

    .control-bar {
        align-items: flex-start;
        flex-direction: column;
    }

    .control-divider {
        display: none;
    }

    .playback-controls {
        flex-wrap: wrap;
    }

    .model-bar {
        gap: 18px;
    }

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

    .concept-box {
        grid-template-columns: 1fr;
    }

    .motion-marker span {
        display: none;
    }
}