/* =========================================================
   AREA & PERIMETER PRACTICE
   /interactive-learning-tools/area-and-perimeter/
   ========================================================= */


/* =========================================================
   PAGE VARIABLES
   ========================================================= */

.ap-practice-page {
    --ap-navy: #16324f;
    --ap-navy-dark: #10283f;

    --ap-teal: #159a9c;
    --ap-teal-dark: #117d7f;
    --ap-teal-soft: #e9f7f7;

    --ap-green: #198754;
    --ap-green-dark: #146c43;
    --ap-green-soft: #eaf7ef;

    --ap-red: #dc3545;
    --ap-red-soft: #fcebec;

    --ap-amber: #b7791f;
    --ap-amber-soft: #fff8e7;

    --ap-blue: #2f6ea5;
    --ap-blue-soft: #eef6fc;

    --ap-purple: #7c3aed;
    --ap-purple-soft: #f3efff;

    --ap-text: #263746;
    --ap-muted: #667788;

    --ap-border: #d9e2e8;
    --ap-border-light: #e8eef2;

    --ap-bg: #f5f8fa;
    --ap-white: #ffffff;

    --ap-shadow:
        0 12px 34px rgba(22, 50, 79, 0.10);

    --ap-shadow-small:
        0 5px 18px rgba(22, 50, 79, 0.08);

    color: var(--ap-text);
    font-family: "Inter", sans-serif;
}


/* =========================================================
   GENERAL
   ========================================================= */

.ap-practice-page *,
.ap-practice-page *::before,
.ap-practice-page *::after {
    box-sizing: border-box;
}


.ap-practice-page button,
.ap-practice-page input,
.ap-practice-page select {
    font-family: inherit;
}


.ap-practice-page button {
    -webkit-tap-highlight-color: transparent;
}


.ap-practice-page [hidden] {
    display: none !important;
}


/* =========================================================
   PRACTICE SECTION
   ========================================================= */

.ap-section {
    padding: 4.5rem 1.5rem;

    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #f7fafb 55%,
            #ffffff 100%
        );
}


.ap-app {
    width: min(1180px, 100%);
    margin: 0 auto;
}


/* =========================================================
   EYEBROW
   ========================================================= */

.ap-eyebrow {
    margin: 0 0 0.45rem;

    color: var(--ap-teal-dark);

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

    letter-spacing: 0.11em;
    text-transform: uppercase;
}


/* =========================================================
   TOOLBAR
   ========================================================= */

.ap-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 2rem;

    margin-bottom: 1.75rem;
}


.ap-toolbar-heading {
    max-width: 760px;
}


.ap-toolbar-heading h2 {
    margin: 0 0 0.65rem;

    color: var(--ap-navy);

    font-size: clamp(1.65rem, 3vw, 2.3rem);
    font-weight: 800;

    line-height: 1.15;
}


.ap-toolbar-heading > p:last-child {
    max-width: 720px;

    margin: 0;

    color: var(--ap-muted);

    font-size: 0.98rem;

    line-height: 1.7;
}


.ap-controls {
    display: flex;
    flex-wrap: wrap;

    gap: 1rem;
}


.ap-control-group {
    display: flex;
    flex-direction: column;

    gap: 0.4rem;
}


.ap-control-group label {
    color: var(--ap-navy);

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

    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.ap-select {
    min-width: 180px;

    padding:
        0.75rem
        2.6rem
        0.75rem
        0.9rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 0.65rem;

    background-color:
        var(--ap-white);

    color:
        var(--ap-text);

    font-size: 0.95rem;
    font-weight: 600;

    cursor: pointer;
    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.ap-select:focus {
    border-color:
        var(--ap-teal);

    box-shadow:
        0 0 0 3px
        rgba(21, 154, 156, 0.14);
}


/* =========================================================
   PRACTICE MODE SELECTOR
   ========================================================= */

.ap-mode-selector {
    margin-bottom: 1.6rem;

    padding: 1.15rem;

    border:
        1px
        solid
        var(--ap-border-light);

    border-radius: 1rem;

    background:
        var(--ap-white);

    box-shadow:
        var(--ap-shadow-small);
}


.ap-mode-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    margin-bottom: 0.9rem;
}


.ap-mode-label {
    color:
        var(--ap-navy);

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

    letter-spacing: 0.07em;
    text-transform: uppercase;
}


.ap-mode-help {
    color:
        var(--ap-muted);

    font-size: 0.86rem;

    line-height: 1.5;

    text-align: right;
}


.ap-mode-tabs {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 0.7rem;
}


.ap-mode-button {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 0.55rem;

    min-height: 50px;

    padding: 0.7rem 0.9rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 0.7rem;

    background:
        #f8fafb;

    color:
        var(--ap-navy);

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

    cursor: pointer;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


.ap-mode-button:hover {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal-soft);
}


.ap-mode-button.is-active {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal);

    color:
        #ffffff;

    box-shadow:
        0 5px 14px
        rgba(21, 154, 156, 0.22);
}


.ap-mode-button:active {
    transform:
        translateY(1px);
}


/* =========================================================
   ROUND PROGRESS
   ========================================================= */

.ap-progress-area {
    margin-bottom: 1.1rem;
}


.ap-progress-text {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 0.45rem;

    color:
        var(--ap-muted);

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


.ap-progress-track {
    width: 100%;
    height: 8px;

    overflow: hidden;

    border-radius: 999px;

    background:
        #e7edf1;
}


.ap-progress-bar {
    width: 10%;
    height: 100%;

    border-radius: inherit;

    background:
        var(--ap-teal);

    transition:
        width 0.35s ease;
}


/* =========================================================
   MAIN PRACTICE CARD
   ========================================================= */

.ap-card {
    overflow: hidden;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 1.25rem;

    background:
        var(--ap-white);

    box-shadow:
        var(--ap-shadow);
}


.ap-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 1.5rem;

    padding: 1.35rem 1.6rem;

    border-bottom:
        1px
        solid
        var(--ap-border-light);

    background:
        #fbfcfd;
}


.ap-card-label {
    margin:
        0
        0
        0.3rem;

    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.09em;
    text-transform: uppercase;
}


.ap-step-instruction {
    margin: 0;

    color:
        var(--ap-muted);

    font-size: 0.92rem;

    line-height: 1.55;
}


.ap-card-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;

    gap: 0.45rem;
}


.ap-shape-badge,
.ap-mode-badge,
.ap-difficulty-badge {
    display: inline-flex;
    align-items: center;

    min-height: 28px;

    padding:
        0.35rem
        0.65rem;

    border-radius: 999px;

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

    white-space: nowrap;
}


.ap-shape-badge {
    background:
        var(--ap-blue-soft);

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


.ap-mode-badge {
    background:
        var(--ap-teal-soft);

    color:
        var(--ap-teal-dark);
}


.ap-difficulty-badge {
    background:
        #edf2f6;

    color:
        var(--ap-navy);
}


/* =========================================================
   CURRENT PROBLEM
   ========================================================= */

.ap-current-problem-area {
    padding:
        2rem
        1.6rem
        1.75rem;

    text-align: center;
}


.ap-problem-label {
    display: block;

    margin-bottom: 0.8rem;

    color:
        var(--ap-muted);

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

    letter-spacing: 0.09em;
    text-transform: uppercase;
}


.ap-problem-prompt {
    max-width: 850px;

    margin:
        0
        auto
        1.5rem;

    color:
        var(--ap-navy);

    font-size:
        clamp(
            1.35rem,
            3.5vw,
            2rem
        );

    font-weight: 800;

    line-height: 1.35;
}


/* =========================================================
   SHAPE STAGE
   ========================================================= */

.ap-shape-stage {
    max-width: 920px;

    margin:
        0
        auto;

    overflow: hidden;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 1rem;

    background:
        #ffffff;

    box-shadow:
        var(--ap-shadow-small);
}


.ap-shape-visual {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 300px;

    padding: 2rem;

    overflow: hidden;

    background:
        radial-gradient(
            circle at top,
            rgba(21, 154, 156, 0.07),
            transparent 48%
        ),
        #fbfcfd;
}


.ap-measurement-summary {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 0.75rem;

    padding:
        0.9rem
        1.1rem;

    border-top:
        1px
        solid
        var(--ap-border-light);

    background:
        #ffffff;
}


.ap-measurement-summary-label {
    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.07em;
    text-transform: uppercase;
}


.ap-measurement-summary strong {
    color:
        var(--ap-navy);

    font-size: 0.95rem;
}


/* =========================================================
   PLACEHOLDER RECTANGLE
   ========================================================= */

.ap-placeholder-shape {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;

    min-height: 240px;
}


.ap-demo-rectangle {
    position: relative;

    width: min(360px, 70vw);
    height: 190px;

    border:
        4px
        solid
        var(--ap-navy);

    border-radius: 0.35rem;

    background:
        linear-gradient(
            135deg,
            rgba(21, 154, 156, 0.12),
            rgba(47, 110, 165, 0.08)
        );

    box-shadow:
        inset
        0
        0
        0
        1px
        rgba(255, 255, 255, 0.8),
        0
        7px
        22px
        rgba(22, 50, 79, 0.08);
}


.ap-demo-width {
    position: absolute;

    left: 50%;
    bottom: -2rem;

    transform:
        translateX(-50%);

    color:
        var(--ap-navy);

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

    white-space: nowrap;
}


.ap-demo-height {
    position: absolute;

    top: 50%;
    right: -4.5rem;

    transform:
        translateY(-50%);

    color:
        var(--ap-navy);

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

    white-space: nowrap;
}


/* =========================================================
   JS GEOMETRY VISUAL FOUNDATION
   ========================================================= */

.ap-geometry-figure {
    position: relative;

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

    width: 100%;

    min-height: 240px;
}


.ap-geometry-svg {
    display: block;

    width: min(720px, 100%);
    height: auto;

    overflow: visible;
}


.ap-geometry-shape {
    fill:
        rgba(21, 154, 156, 0.10);

    stroke:
        var(--ap-navy);

    stroke-width: 4;

    stroke-linejoin: round;
}


.ap-geometry-shape-area {
    fill:
        rgba(21, 154, 156, 0.17);
}


.ap-geometry-shape-perimeter {
    fill:
        rgba(47, 110, 165, 0.04);

    stroke:
        var(--ap-teal);

    stroke-width: 6;
}


.ap-dimension-line {
    stroke:
        #617484;

    stroke-width: 2;

    stroke-linecap: round;
}


.ap-dimension-tick {
    stroke:
        #617484;

    stroke-width: 2;
}


.ap-dimension-label {
    fill:
        var(--ap-navy);

    font-family:
        "Inter",
        sans-serif;

    font-size: 16px;
    font-weight: 800;

    text-anchor: middle;
}


.ap-dimension-label-small {
    font-size: 14px;
}


.ap-missing-dimension-label {
    fill:
        var(--ap-amber);

    font-weight: 800;
}


.ap-shape-label {
    fill:
        var(--ap-muted);

    font-family:
        "Inter",
        sans-serif;

    font-size: 14px;
    font-weight: 700;

    text-anchor: middle;
}


/* =========================================================
   AREA GRID / TILE VISUAL
   ========================================================= */

.ap-area-grid {
    fill:
        rgba(21, 154, 156, 0.08);

    stroke:
        rgba(22, 50, 79, 0.18);

    stroke-width: 1;
}


.ap-area-grid-line {
    stroke:
        rgba(22, 50, 79, 0.15);

    stroke-width: 1;
}


/* =========================================================
   HIGHLIGHT STATES
   ========================================================= */

.ap-geometry-highlight-area {
    fill:
        rgba(25, 135, 84, 0.14);

    stroke:
        var(--ap-green);
}


.ap-geometry-highlight-perimeter {
    fill:
        rgba(21, 154, 156, 0.04);

    stroke:
        var(--ap-green);

    stroke-width: 7;
}


.ap-dimension-label.is-active {
    fill:
        var(--ap-amber);
}


.ap-dimension-label.is-complete {
    fill:
        var(--ap-green-dark);
}


/* =========================================================
   SUMMARY CARDS
   ========================================================= */

.ap-summary-grid {
    display: grid;

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

    gap: 0.8rem;

    max-width: 820px;

    margin:
        1.25rem
        auto
        0;
}


.ap-summary-card {
    padding:
        0.95rem
        1rem;

    border:
        1px
        solid
        var(--ap-border-light);

    border-radius: 0.75rem;

    background:
        #f8fafb;
}


.ap-summary-card span {
    display: block;

    margin-bottom: 0.2rem;

    color:
        var(--ap-muted);

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

    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.ap-summary-card strong {
    color:
        var(--ap-navy);

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


/* =========================================================
   FORMULA PANEL
   ========================================================= */

.ap-formula-panel {
    margin:
        0
        1.6rem
        1.6rem;

    padding:
        1.4rem
        1.5rem;

    border:
        1px
        solid
        #cfe5e5;

    border-radius: 1rem;

    background:
        linear-gradient(
            135deg,
            #f4fbfb 0%,
            #edf8f8 100%
        );

    text-align: center;
}


.ap-formula-label {
    display: block;

    margin-bottom: 0.75rem;

    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.09em;
    text-transform: uppercase;
}


.ap-formula {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 1rem;

    color:
        var(--ap-navy);

    font-size:
        clamp(
            1.05rem,
            3vw,
            1.5rem
        );

    font-weight: 700;
}


.ap-formula-choice {
    display: inline-flex;
    align-items: center;

    gap: 0.4rem;
}


.ap-formula-choice strong {
    color:
        var(--ap-teal-dark);
}


.ap-formula-divider {
    width: 1px;
    height: 32px;

    background:
        #c9dcdc;
}


.ap-formula-note {
    max-width: 680px;

    margin:
        0.9rem
        auto
        0;

    color:
        var(--ap-muted);

    font-size: 0.83rem;

    line-height: 1.55;
}


/* =========================================================
   STEP PROGRESS
   ========================================================= */

.ap-step-progress {
    display: flex;
    align-items: flex-start;
    justify-content: center;

    padding:
        0
        1.5rem
        1.75rem;
}


.ap-step-marker {
    display: flex;

    flex:
        0
        0
        74px;

    flex-direction: column;
    align-items: center;

    gap: 0.4rem;

    color:
        #8b99a5;

    text-align: center;
}


.ap-step-marker > span {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    border:
        2px
        solid
        #d8e0e5;

    border-radius: 50%;

    background:
        #ffffff;

    color:
        #84929e;

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

    transition:
        background 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease;
}


.ap-step-marker small {
    font-size: 0.66rem;
    font-weight: 700;

    line-height: 1.3;
}


.ap-step-marker.is-active > span {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal);

    color:
        #ffffff;

    box-shadow:
        0 0 0 4px
        rgba(21, 154, 156, 0.11);
}


.ap-step-marker.is-active small {
    color:
        var(--ap-teal-dark);
}


.ap-step-marker.is-complete > span {
    border-color:
        var(--ap-green);

    background:
        var(--ap-green);

    color:
        #ffffff;
}


.ap-step-marker.is-complete small {
    color:
        var(--ap-green-dark);
}


.ap-step-connector {
    flex:
        1
        1
        52px;

    max-width: 90px;

    height: 2px;

    margin-top: 16px;

    background:
        #dfe6ea;
}


/* =========================================================
   WORK AREA
   ========================================================= */

.ap-work-area {
    padding:
        2rem
        1.6rem;

    border-top:
        1px
        solid
        var(--ap-border-light);

    background:
        #fbfcfd;
}


.ap-work-step-number {
    margin:
        0
        0
        0.35rem;

    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.09em;
    text-transform: uppercase;
}


.ap-work-area > h3 {
    margin:
        0
        0
        0.45rem;

    color:
        var(--ap-navy);

    font-size:
        clamp(
            1.25rem,
            3vw,
            1.6rem
        );

    font-weight: 800;
}


.ap-work-description {
    max-width: 780px;

    margin:
        0
        0
        1.2rem;

    color:
        var(--ap-muted);

    font-size: 0.92rem;

    line-height: 1.65;
}


/* =========================================================
   PROBLEM REMINDER
   ========================================================= */

.ap-problem-reminder {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    margin-bottom: 1.25rem;

    padding:
        0.85rem
        1rem;

    border:
        1px
        solid
        #d5e8e8;

    border-left:
        4px
        solid
        var(--ap-teal);

    border-radius: 0.7rem;

    background:
        var(--ap-teal-soft);
}


.ap-reminder-heading {
    display: flex;
    flex-direction: column;

    gap: 0.25rem;
}


.ap-reminder-label {
    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.07em;
    text-transform: uppercase;

    white-space: nowrap;
}


.ap-problem-reminder strong {
    color:
        var(--ap-navy);

    font-size: 0.92rem;

    line-height: 1.45;
}


.ap-reminder-shape {
    flex: 0 0 auto;

    width: 150px;
    min-height: 82px;

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


.ap-reminder-shape svg {
    display: block;

    max-width: 145px;
    max-height: 80px;
}


/* =========================================================
   WORKBENCH
   ========================================================= */

.ap-workbench {
    overflow: hidden;

    margin-bottom: 1.3rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 1rem;

    background:
        var(--ap-white);

    box-shadow:
        var(--ap-shadow-small);
}


.ap-workbench-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    padding:
        0.85rem
        1rem;

    border-bottom:
        1px
        solid
        var(--ap-border-light);

    background:
        #f7f9fa;
}


.ap-workbench-heading > div {
    display: flex;
    flex-direction: column;

    gap: 0.15rem;
}


.ap-workbench-label {
    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.ap-workbench-heading strong {
    color:
        var(--ap-navy);

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


.ap-workbench-status {
    padding:
        0.3rem
        0.55rem;

    border-radius: 999px;

    background:
        #eaf0f4;

    color:
        var(--ap-muted);

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

    white-space: nowrap;
}


/* =========================================================
   WORKING EXPRESSION
   ========================================================= */

.ap-working-expression {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;

    gap: 0.65rem;

    min-height: 118px;

    padding:
        1.5rem
        1rem;

    color:
        var(--ap-navy);

    font-size:
        clamp(
            1.15rem,
            3vw,
            1.7rem
        );

    font-weight: 800;
}


.ap-working-expression > span:not(.ap-working-arrow) {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 2.3rem;
    min-height: 2.4rem;

    padding:
        0.25rem
        0.45rem;

    border-radius: 0.4rem;
}


.ap-working-arrow {
    color:
        #9aa8b4;

    font-weight: 600;
}


.ap-working-expression .is-active {
    background:
        #fff4cf;

    color:
        #8b6514;

    box-shadow:
        inset
        0
        0
        0
        1px
        #ecd588;
}


.ap-working-expression .is-complete {
    background:
        var(--ap-green-soft);

    color:
        var(--ap-green-dark);
}


/* =========================================================
   FORMULA EXPLANATION
   ========================================================= */

.ap-formula-explanation {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 0.6rem;

    padding:
        0.75rem
        1rem;

    border-top:
        1px
        solid
        var(--ap-border-light);

    background:
        #fbfcfd;

    color:
        var(--ap-muted);

    font-size: 0.82rem;

    line-height: 1.5;

    text-align: center;
}


.ap-formula-explanation svg,
.ap-formula-explanation i {
    color:
        var(--ap-teal);
}


/* =========================================================
   ANSWER FORMS
   ========================================================= */

.ap-answer-form {
    max-width: 700px;

    margin:
        1.3rem
        auto;
}


.ap-input-label {
    display: block;

    margin-bottom: 0.65rem;

    color:
        var(--ap-navy);

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

    text-align: center;
}


.ap-input-row {
    display: flex;

    gap: 0.65rem;
}


.ap-step-input {
    width: 100%;
    min-height: 50px;

    padding:
        0.7rem
        0.85rem;

    border:
        2px
        solid
        var(--ap-border);

    border-radius: 0.7rem;

    background:
        #ffffff;

    color:
        var(--ap-navy);

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

    text-align: center;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


.ap-step-input:focus {
    border-color:
        var(--ap-teal);

    box-shadow:
        0 0 0 3px
        rgba(21, 154, 156, 0.12);
}


.ap-step-input.is-correct {
    border-color:
        var(--ap-green);

    background:
        var(--ap-green-soft);
}


.ap-step-input.is-incorrect {
    border-color:
        var(--ap-red);

    background:
        var(--ap-red-soft);
}


.ap-input-row .ap-step-input {
    flex: 1;
}


/* =========================================================
   DIMENSION INPUTS
   ========================================================= */

.ap-dimension-input-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 0.8rem;

    margin-bottom: 0.85rem;
}


.ap-dimension-input-group {
    display: flex;
    flex-direction: column;

    gap: 0.4rem;
}


.ap-dimension-input-group > span {
    color:
        var(--ap-muted);

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

    letter-spacing: 0.06em;
    text-align: center;
    text-transform: uppercase;
}


/* =========================================================
   CHOICE BUTTONS
   ========================================================= */

.ap-choice-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 0.7rem;
}


.ap-choice-button {
    min-height: 52px;

    padding:
        0.7rem
        0.7rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 0.7rem;

    background:
        #ffffff;

    color:
        var(--ap-navy);

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

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}


.ap-choice-button:hover {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal-soft);
}


.ap-choice-button:active {
    transform:
        translateY(1px);
}


.ap-choice-button.is-selected {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal);

    color:
        #ffffff;

    box-shadow:
        0 5px 14px
        rgba(21, 154, 156, 0.18);
}


.ap-choice-button.is-correct {
    border-color:
        var(--ap-green);

    background:
        var(--ap-green-soft);

    color:
        var(--ap-green-dark);
}


.ap-choice-button.is-incorrect {
    border-color:
        var(--ap-red);

    background:
        var(--ap-red-soft);

    color:
        #a82735;
}


.ap-formula-choice-grid {
    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );
}


.ap-units-choice-grid {
    max-width: 520px;

    margin:
        0
        auto;
}


/* =========================================================
   SUBMIT BUTTONS
   ========================================================= */

.ap-submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 50px;

    padding:
        0.7rem
        1.2rem;

    border:
        1px
        solid
        var(--ap-teal);

    border-radius: 0.7rem;

    background:
        var(--ap-teal);

    color:
        #ffffff;

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

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


.ap-submit-button:hover {
    border-color:
        var(--ap-teal-dark);

    background:
        var(--ap-teal-dark);

    box-shadow:
        0 7px 16px
        rgba(21, 154, 156, 0.18);
}


.ap-submit-button:active {
    transform:
        translateY(1px);
}


.ap-wide-submit {
    width: 100%;

    margin-top: 0.75rem;
}


/* =========================================================
   FEEDBACK
   ========================================================= */

.ap-feedback {
    margin:
        0
        1.6rem
        1.35rem;

    padding:
        0.9rem
        1rem;

    border:
        1px
        solid
        transparent;

    border-radius: 0.75rem;

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

    line-height: 1.55;

    text-align: center;
}


.ap-feedback-neutral {
    border-color:
        #dae2e7;

    background:
        #f5f8fa;

    color:
        var(--ap-muted);
}


.ap-feedback-correct {
    border-color:
        #badfca;

    background:
        var(--ap-green-soft);

    color:
        var(--ap-green-dark);
}


.ap-feedback-incorrect {
    border-color:
        #efc6ca;

    background:
        var(--ap-red-soft);

    color:
        #a12a36;
}


.ap-feedback-warning {
    border-color:
        #ecd9a4;

    background:
        var(--ap-amber-soft);

    color:
        #805d17;
}


/* =========================================================
   ACTION BUTTON ROW
   ========================================================= */

.ap-action-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 0.7rem;

    padding:
        0
        1.6rem
        1.5rem;
}


.ap-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 0.45rem;

    min-height: 44px;

    padding:
        0.6rem
        0.9rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 0.65rem;

    background:
        #ffffff;

    color:
        var(--ap-navy);

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

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        color 0.18s ease;
}


.ap-secondary-button:hover {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal-soft);

    color:
        var(--ap-teal-dark);
}


/* =========================================================
   HINT PANEL
   ========================================================= */

.ap-help-panel {
    display: flex;
    align-items: flex-start;

    gap: 1rem;

    margin:
        0
        1.6rem
        1.5rem;

    padding:
        1rem
        1.1rem;

    border:
        1px
        solid
        #ead89a;

    border-radius: 0.8rem;

    background:
        #fffaf0;
}


.ap-help-panel-icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    border-radius: 50%;

    background:
        var(--ap-amber-soft);

    color:
        var(--ap-amber);
}


.ap-help-panel strong {
    display: block;

    margin-bottom: 0.2rem;

    color:
        #705016;
}


.ap-help-panel p {
    margin: 0;

    color:
        #765b26;

    font-size: 0.88rem;

    line-height: 1.55;
}


/* =========================================================
   REFERENCE PANEL
   ========================================================= */

.ap-reference-panel {
    margin:
        0
        1.6rem
        1.5rem;

    overflow: hidden;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 1rem;

    background:
        #ffffff;

    box-shadow:
        var(--ap-shadow-small);
}


.ap-reference-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;

    padding:
        1rem
        1.15rem;

    border-bottom:
        1px
        solid
        var(--ap-border-light);

    background:
        #f8fafb;
}


.ap-reference-eyebrow {
    margin:
        0
        0
        0.2rem;

    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.08em;
    text-transform: uppercase;
}


.ap-reference-panel-heading h3 {
    margin: 0;

    color:
        var(--ap-navy);

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


.ap-close-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 50%;

    background:
        #ffffff;

    color:
        var(--ap-muted);

    cursor: pointer;
}


.ap-close-button:hover {
    border-color:
        var(--ap-teal);

    color:
        var(--ap-teal-dark);
}


.ap-reference-grid {
    display: grid;

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

    gap: 1rem;

    padding: 1.2rem;
}


.ap-reference-card {
    padding: 1rem;

    border:
        1px
        solid
        var(--ap-border-light);

    border-radius: 0.75rem;

    background:
        #fbfcfd;
}


.ap-reference-card-label {
    display: block;

    margin-bottom: 0.65rem;

    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.ap-reference-formula {
    margin-bottom: 0.55rem;

    color:
        var(--ap-navy);

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


.ap-reference-card p {
    margin: 0;

    color:
        var(--ap-muted);

    font-size: 0.82rem;

    line-height: 1.55;
}


/* =========================================================
   NEXT PROBLEM
   ========================================================= */

.ap-next-problem-area {
    padding:
        0
        1.6rem
        1.6rem;

    text-align: center;
}


.ap-next-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 0.55rem;

    min-height: 50px;

    padding:
        0.75rem
        1.3rem;

    border:
        1px
        solid
        var(--ap-green);

    border-radius: 0.7rem;

    background:
        var(--ap-green);

    color:
        #ffffff;

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

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}


.ap-next-button:hover {
    border-color:
        var(--ap-green-dark);

    background:
        var(--ap-green-dark);

    box-shadow:
        0 7px 16px
        rgba(25, 135, 84, 0.18);
}


.ap-next-button:active {
    transform:
        translateY(1px);
}


/* =========================================================
   RESULTS
   ========================================================= */

.ap-results-panel {
    margin-top: 1.5rem;

    padding:
        2.5rem
        1.5rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 1.25rem;

    background:
        #ffffff;

    box-shadow:
        var(--ap-shadow);

    text-align: center;
}


.ap-results-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 64px;
    height: 64px;

    margin:
        0
        auto
        1rem;

    border-radius: 50%;

    background:
        var(--ap-green-soft);

    color:
        var(--ap-green);

    font-size: 1.5rem;
}


.ap-results-eyebrow {
    margin:
        0
        0
        0.35rem;

    color:
        var(--ap-teal-dark);

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

    letter-spacing: 0.09em;
    text-transform: uppercase;
}


.ap-results-panel h2 {
    margin:
        0
        0
        0.65rem;

    color:
        var(--ap-navy);

    font-size:
        clamp(
            1.6rem,
            4vw,
            2.1rem
        );

    font-weight: 800;
}


.ap-results-message {
    max-width: 650px;

    margin:
        0
        auto
        1.5rem;

    color:
        var(--ap-muted);

    line-height: 1.65;
}


.ap-results-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 0.8rem;

    max-width: 800px;

    margin:
        0
        auto
        1.6rem;
}


.ap-result-stat {
    padding:
        1rem
        0.8rem;

    border:
        1px
        solid
        var(--ap-border-light);

    border-radius: 0.75rem;

    background:
        #f8fafb;
}


.ap-result-stat span {
    display: block;

    margin-bottom: 0.25rem;

    color:
        var(--ap-muted);

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

    letter-spacing: 0.05em;
    text-transform: uppercase;
}


.ap-result-stat strong {
    color:
        var(--ap-navy);

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


/* =========================================================
   INFO / HOW IT WORKS
   ========================================================= */

.ap-info-section {
    padding:
        4.5rem
        1.5rem;

    background:
        #f5f8fa;
}


.ap-info-container {
    width:
        min(
            1120px,
            100%
        );

    margin:
        0
        auto;
}


.ap-info-heading {
    max-width: 760px;

    margin-bottom: 2rem;
}


.ap-info-heading h2 {
    margin:
        0
        0
        0.8rem;

    color:
        var(--ap-navy);

    font-size:
        clamp(
            1.65rem,
            3vw,
            2.25rem
        );

    font-weight: 800;

    line-height: 1.2;
}


.ap-info-heading > p:last-child {
    margin: 0;

    color:
        var(--ap-muted);

    line-height: 1.7;
}


.ap-example-grid {
    display: grid;

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

    gap: 1rem;
}


.ap-example-card {
    padding: 1.4rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 1rem;

    background:
        #ffffff;

    box-shadow:
        var(--ap-shadow-small);
}


.ap-example-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    margin-bottom: 1rem;

    border-radius: 0.75rem;

    background:
        var(--ap-teal-soft);

    color:
        var(--ap-teal-dark);

    font-size: 1.2rem;
}


.ap-example-card h3 {
    margin:
        0
        0
        0.6rem;

    color:
        var(--ap-navy);

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


.ap-example-card p {
    margin:
        0
        0
        1rem;

    color:
        var(--ap-muted);

    font-size: 0.9rem;

    line-height: 1.6;
}


.ap-example-formula {
    padding:
        0.7rem
        0.8rem;

    border-radius: 0.55rem;

    background:
        var(--ap-teal-soft);

    color:
        var(--ap-navy);

    font-weight: 800;

    text-align: center;
}


/* =========================================================
   RELATED RESOURCES
   ========================================================= */

.ap-resources-section {
    padding:
        4rem
        1.5rem;

    background:
        #ffffff;
}


.ap-resource-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 0.8rem;
}


.ap-resource-link {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 58px;

    padding:
        0.85rem
        1rem;

    border:
        1px
        solid
        var(--ap-border);

    border-radius: 0.75rem;

    background:
        #ffffff;

    color:
        var(--ap-teal-dark);

    font-weight: 700;

    text-decoration: none;

    transition:
        border-color 0.18s ease,
        background 0.18s ease,
        transform 0.18s ease;
}


.ap-resource-link:hover {
    border-color:
        var(--ap-teal);

    background:
        var(--ap-teal-soft);

    color:
        var(--ap-teal-dark);

    text-decoration: none;

    transform:
        translateY(-1px);
}


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

@media (max-width: 991.98px) {

    .ap-toolbar {
        align-items: stretch;
        flex-direction: column;
    }


    .ap-controls {
        width: 100%;
    }


    .ap-control-group {
        width: 100%;
    }


    .ap-select {
        width: 100%;
    }


    .ap-mode-tabs {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .ap-step-progress {
        overflow-x: auto;

        justify-content: flex-start;

        padding-bottom: 1.4rem;
    }


    .ap-step-marker {
        flex-basis: 70px;
    }


    .ap-step-connector {
        flex-basis: 38px;

        min-width: 24px;
    }


    .ap-reference-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .ap-example-grid {
        grid-template-columns: 1fr;
    }


    .ap-results-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


@media (max-width: 767.98px) {

    .ap-section,
    .ap-info-section,
    .ap-resources-section {
        padding-right: 1rem;
        padding-left: 1rem;
    }


    .ap-card-top {
        flex-direction: column;
    }


    .ap-card-badges {
        justify-content: flex-start;
    }


    .ap-current-problem-area,
    .ap-work-area {
        padding-right: 1rem;
        padding-left: 1rem;
    }


    .ap-formula-panel,
    .ap-feedback,
    .ap-help-panel,
    .ap-reference-panel {
        margin-right: 1rem;
        margin-left: 1rem;
    }


    .ap-shape-visual {
        min-height: 260px;

        padding:
            1.5rem
            1rem;
    }


    .ap-summary-grid {
        grid-template-columns: 1fr;
    }


    .ap-formula {
        flex-direction: column;

        gap: 0.65rem;
    }


    .ap-formula-divider {
        width: 100%;
        height: 1px;
    }


    .ap-problem-reminder {
        align-items: flex-start;
        flex-direction: column;
    }


    .ap-reminder-shape {
        width: 100%;

        justify-content: flex-start;
    }


    .ap-dimension-input-grid {
        grid-template-columns: 1fr;
    }


    .ap-reference-grid {
        grid-template-columns: 1fr;
    }


    .ap-resource-grid {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 575.98px) {

    .ap-mode-heading {
        align-items: flex-start;
        flex-direction: column;
    }


    .ap-mode-help {
        text-align: left;
    }


    .ap-mode-tabs {
        grid-template-columns: 1fr;
    }


    .ap-input-row {
        flex-direction: column;
    }


    .ap-submit-button {
        width: 100%;
    }


    .ap-choice-grid,
    .ap-formula-choice-grid,
    .ap-units-choice-grid {
        grid-template-columns: 1fr;
    }


    .ap-action-row {
        flex-direction: column;
    }


    .ap-secondary-button {
        width: 100%;
    }


    .ap-results-grid {
        grid-template-columns: 1fr;
    }


    .ap-working-expression {
        align-items: stretch;
        flex-direction: column;
    }


    .ap-working-arrow {
        transform:
            rotate(90deg);
    }


    .ap-demo-rectangle {
        width: 72%;
        height: 145px;
    }


    .ap-demo-height {
        right: -3.8rem;

        font-size: 0.78rem;
    }


    .ap-demo-width {
        font-size: 0.78rem;
    }

}

/* =========================================================
   SIMPLIFIED PRACTICE LAYOUT
   Keep formula reference and step state available to JS,
   but remove the large always-visible panels from the UI.
   ========================================================= */

.ap-formula-panel {
    display: none !important;
}

.ap-step-progress {
    display: none !important;
}

.ap-reminder-shape {
    display: flex;
    flex: 0 0 300px;
    align-items: center;
    justify-content: center;

    width: 300px;
    min-height: 165px;
}

.ap-reminder-shape svg {
    display: block;

    width: 100%;
    max-width: 300px;
    height: auto;
}

.ap-reminder-dimension-label {
    fill: var(--ap-navy);

    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 800;
}

/* =========================================================
   CURRENT PROBLEM REMINDER — DESKTOP GEOMETRY
   ========================================================= */

.ap-reminder-shape {
    flex: 0 0 360px;
    width: 360px;
    min-height: 210px;
}

.ap-reminder-shape svg,
.ap-reminder-geometry-svg {
    display: block;

    width: 100% !important;
    max-width: 360px !important;
    height: auto !important;
    max-height: none !important;
}

.ap-reminder-dimension-label {
    fill: var(--ap-navy);

    font-family: "Inter", sans-serif;
    font-size: 17px;
    font-weight: 800;
}

@media (max-width: 767.98px) {

    .ap-reminder-shape {
        flex: 0 0 auto;
        width: 100%;
        min-height: 170px;
    }

    .ap-reminder-shape svg,
    .ap-reminder-geometry-svg {
        width: 100% !important;
        max-width: 300px !important;
        margin: 0 auto;
    }

}

