/* Interactive widget button */
.widget-button {
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 8px;

    padding: 0.6rem 1.4rem;

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

    cursor: pointer;

    transition: all 0.2s ease;

    margin-left: 0.5rem;
}

.widget-button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.widget-button:active {
    transform: translateY(0);
}

.widget-input {
    border: 2px solid #2c3e50;
    border-radius: 8px;

    padding: 0.5rem;

    font-size: 1.1rem;
    text-align: center;

    width: 120px;

    outline: none;
}

.widget-input:focus {
    border-width: 3px;
}

.binary-widget-button {
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 8px;

    padding: 0.6rem 1.4rem;

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

    cursor: pointer;
    transition: all 0.2s ease;
}

.binary-widget-button:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}


.binary-widget-input {
    border: 2px solid #2c3e50;
    border-radius: 8px;

    padding: 0.5rem;

    font-size: 1.1rem;
    text-align: center;

    width: 120px;
}


/* =========================================================
   BINARY ARITHMETIC WIDGETS
   Reveal.js slide adaptations

   Load AFTER:
   - twos_complement_converter.css
   - binary_addition_widget.css
   - binary_subtraction_widget.css
   ========================================================= */


/* ---------------------------------------------------------
   Main widget container inside a slide
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget {
    width: 100%;
    max-width: 1180px;

    margin: 0.7rem auto 0;

    box-sizing: border-box;
}


/* ---------------------------------------------------------
   Widget panels
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-widget,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-widget,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-widget {
    width: 100%;

    margin: 0;

    padding: 0.75rem 0.9rem;

    border-radius: 14px;

    box-sizing: border-box;
}


/* ---------------------------------------------------------
   Control grid
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-inputs,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-inputs,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-inputs {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(150px, 1fr));

    gap: 0.55rem;

    margin-bottom: 0.55rem;

    align-items: end;
}


/* ---------------------------------------------------------
   Labels
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget label {
    margin-bottom: 0.2rem;

    font-size: 0.72em;
    line-height: 1.2;
}


/* ---------------------------------------------------------
   Inputs and selectors
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget input[type="text"],
:is(.reveal, .lesson-deck) .slide-widget select {
    width: 100%;

    padding: 0.4rem 0.55rem;

    font-size: 0.72em;

    border-radius: 9px;

    box-sizing: border-box;
}


/* ---------------------------------------------------------
   Animation speed area
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-speed,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-speed,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-speed {
    margin: 0.4rem 0 0.55rem;

    padding: 0.4rem 0.65rem;

    border-radius: 10px;
}


/* Speed label */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-speed label,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-speed label,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-speed label {
    margin-bottom: 0.2rem;

    font-size: 0.68em;
}


/* Speed slider */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-speed input[type="range"],
:is(.reveal, .lesson-deck) .slide-widget .animated-add-speed input[type="range"],
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-speed input[type="range"] {
    width: 100%;
}


/* Faster / Very slow text */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-speed-notes,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-speed-notes,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-speed-notes {
    margin-top: 0.1rem;

    font-size: 0.56em;
}


/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-buttons,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-buttons,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-buttons {
    gap: 0.45rem;

    margin-bottom: 0.5rem;
}


:is(.reveal, .lesson-deck) .slide-widget .animated-twos-buttons button,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-buttons button,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-buttons button {
    padding: 0.38rem 0.8rem;

    font-size: 0.66em;

    border-radius: 999px;
}


/* ---------------------------------------------------------
   Animated working area
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-working,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-working,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-working {
    margin-top: 0.45rem;

    overflow-x: auto;
}


/* ---------------------------------------------------------
   Paper / calculation grid
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-paper,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-paper,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-paper {
    grid-template-columns:
        auto repeat(var(--bit-count), 2.1rem);

    column-gap: 0.22rem;
    row-gap: 0.15rem;

    padding: 0.55rem 0.7rem;

    border-radius: 10px;
}


/* ---------------------------------------------------------
   Row labels
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-label,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-label,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-label {
    padding-right: 0.55rem;

    font-size: 0.62em;
}


/* ---------------------------------------------------------
   Binary bit cells
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-bit,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-bit,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-bit {
    min-height: 1.75rem;

    font-size: 0.88em;

    border-radius: 7px;
}


/* ---------------------------------------------------------
   Result / messages
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .animated-twos-final,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-carry-out {
    margin-top: 0.4rem;

    font-size: 0.68em;
}


:is(.reveal, .lesson-deck) .slide-widget .animated-twos-message,
:is(.reveal, .lesson-deck) .slide-widget .animated-add-message,
:is(.reveal, .lesson-deck) .slide-widget .animated-sub-message {
    margin-top: 0.4rem;
    margin-bottom: 0;

    font-size: 0.64em;
    line-height: 1.25;
}


/* ---------------------------------------------------------
   Errors
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck) .slide-widget .converter-error {
    margin: 0.25rem 0;

    font-size: 0.62em;
}


/* ---------------------------------------------------------
   Slightly reduce the teaching box above the widget
   --------------------------------------------------------- */

:is(.reveal, .lesson-deck)
.slide-full-space
.slide-scroll-frame
> .key-term-box:first-child {
    margin-bottom: 0.55rem;
}


/* ---------------------------------------------------------
   Smaller screens
   --------------------------------------------------------- */

@media (max-width: 900px) {

    :is(.reveal, .lesson-deck) .slide-widget .animated-twos-inputs,
    :is(.reveal, .lesson-deck) .slide-widget .animated-add-inputs,
    :is(.reveal, .lesson-deck) .slide-widget .animated-sub-inputs {
        grid-template-columns:
            repeat(2, minmax(140px, 1fr));
    }


    :is(.reveal, .lesson-deck) .slide-widget .animated-twos-paper,
    :is(.reveal, .lesson-deck) .slide-widget .animated-add-paper,
    :is(.reveal, .lesson-deck) .slide-widget .animated-sub-paper {
        grid-template-columns:
            auto repeat(var(--bit-count), 1.75rem);
    }

}

/* =========================================================
   COMPACT REVEAL WIDGET SLIDES
   Add this at the END of slides_widgets.css

   This affects ONLY widgets inside slides.
   Study-page widgets are unchanged.
   ========================================================= */


/* ---------------------------------------------------------
   Compact the whole widget slide
   --------------------------------------------------------- */

.reveal .slides section.compact-widget-slide {
    padding: 0.35rem 0.65rem !important;
}


/* Smaller slide title */

.reveal .slides section.compact-widget-slide > h2 {
    margin: 0 0 0.25rem !important;

    font-size: 3rem !important;
    line-height: 1.05 !important;
}


/* Give the widget slide more usable vertical space */

.reveal .slides section.compact-widget-slide .slide-scroll-frame {
    max-height: 620px;

    padding: 0.15rem 0.4rem 0.25rem;

    overflow-y: auto;
    overflow-x: hidden;
}


/* ---------------------------------------------------------
   Compact teaching box above widget
   --------------------------------------------------------- */

.reveal .slides section.compact-widget-slide .key-term-box {
    width: min(900px, 92%);
    max-width: 900px;

    margin: 0.2rem auto 0.35rem;

    padding: 0.5rem 0.8rem;

    border-radius: 14px;

    font-size: 1rem;
    line-height: 1.3;

    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);
}


/* ---------------------------------------------------------
   MAIN SIZE RESET

   Important:
   Reveal uses a large presentation font.
   Resetting the widget to 16px prevents em-based controls
   becoming huge.
   --------------------------------------------------------- */

.reveal .compact-widget-slide .slide-widget {
    width: min(900px, 92%);
    max-width: 900px;

    margin: 0.25rem auto 0;

    font-size: 16px !important;

    box-sizing: border-box;
}


/* ---------------------------------------------------------
   Widget card
   --------------------------------------------------------- */

.reveal .compact-widget-slide .slide-widget .animated-twos-widget,
.reveal .compact-widget-slide .slide-widget .animated-add-widget,
.reveal .compact-widget-slide .slide-widget .animated-sub-widget {
    width: 100%;

    margin: 0;

    padding: 0.55rem 0.7rem;

    border-radius: 12px;

    box-sizing: border-box;

    box-shadow: 0 5px 14px rgba(15, 23, 42, 0.06);
}


/* ---------------------------------------------------------
   Input controls
   --------------------------------------------------------- */

.reveal .compact-widget-slide .animated-twos-inputs,
.reveal .compact-widget-slide .animated-add-inputs,
.reveal .compact-widget-slide .animated-sub-inputs {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(130px, 1fr));

    gap: 0.35rem;

    margin-bottom: 0.35rem;

    align-items: end;
}


/* Labels */

.reveal .compact-widget-slide .slide-widget label {
    margin-bottom: 0.15rem !important;

    font-size: 0.88rem !important;
    line-height: 1.15 !important;
}


/* Inputs and selects */

.reveal .compact-widget-slide .slide-widget input[type="text"],
.reveal .compact-widget-slide .slide-widget select {
    width: 100%;

    min-height: 34px;

    padding: 0.3rem 0.45rem;

    border-radius: 7px;

    font-size: 0.95rem !important;
    line-height: 1.1;

    box-sizing: border-box;
}


/* ---------------------------------------------------------
   SPEED CONTROL
   Turn it into ONE compact horizontal row
   --------------------------------------------------------- */

.reveal .compact-widget-slide .animated-twos-speed,
.reveal .compact-widget-slide .animated-add-speed,
.reveal .compact-widget-slide .animated-sub-speed {
    display: grid;

    grid-template-columns:
        auto minmax(180px, 1fr);

    align-items: center;

    column-gap: 0.65rem;

    margin: 0.25rem 0 0.35rem;

    padding: 0.3rem 0.5rem;

    border-radius: 9px;
}


/* "Animation speed: Slow" */

.reveal .compact-widget-slide .animated-twos-speed label,
.reveal .compact-widget-slide .animated-add-speed label,
.reveal .compact-widget-slide .animated-sub-speed label {
    display: flex;

    align-items: center;

    gap: 0.3rem;

    margin: 0 !important;

    font-size: 0.82rem !important;

    white-space: nowrap;
}


/* Slider */

.reveal .compact-widget-slide .animated-twos-speed input[type="range"],
.reveal .compact-widget-slide .animated-add-speed input[type="range"],
.reveal .compact-widget-slide .animated-sub-speed input[type="range"] {
    width: 100%;

    margin: 0;

    padding: 0;
}


/*
   "Faster" and "Very slow" are useful on the study page,
   but unnecessary on the teaching slide.
*/

.reveal .compact-widget-slide .animated-twos-speed-notes,
.reveal .compact-widget-slide .animated-add-speed-notes,
.reveal .compact-widget-slide .animated-sub-speed-notes {
    display: none;
}


/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.reveal .compact-widget-slide .animated-twos-buttons,
.reveal .compact-widget-slide .animated-add-buttons,
.reveal .compact-widget-slide .animated-sub-buttons {
    display: flex;

    gap: 0.35rem;

    margin: 0 0 0.3rem;
}


.reveal .compact-widget-slide .animated-twos-buttons button,
.reveal .compact-widget-slide .animated-add-buttons button,
.reveal .compact-widget-slide .animated-sub-buttons button {
    padding: 0.3rem 0.65rem;

    border-radius: 999px;

    font-size: 0.85rem !important;
    line-height: 1.1;
}


/* ---------------------------------------------------------
   Working / animation area
   --------------------------------------------------------- */

.reveal .compact-widget-slide .animated-twos-working,
.reveal .compact-widget-slide .animated-add-working,
.reveal .compact-widget-slide .animated-sub-working {
    margin-top: 0.25rem;

    overflow-x: auto;
}


/* Calculation grid */

.reveal .compact-widget-slide .animated-twos-paper,
.reveal .compact-widget-slide .animated-add-paper,
.reveal .compact-widget-slide .animated-sub-paper {
    grid-template-columns:
        auto repeat(var(--bit-count), 1.65rem);

    column-gap: 0.22rem;
    row-gap: 0.15rem;

    padding: 0.45rem 0.65rem;

    border-radius: 9px;
}


/* Calculation row labels */

.reveal .compact-widget-slide .animated-twos-label,
.reveal .compact-widget-slide .animated-add-label,
.reveal .compact-widget-slide .animated-sub-label {
    padding-right: 0.45rem;

    font-size: 0.8rem !important;
}


/* Individual bit cells */

.reveal .compact-widget-slide .animated-twos-bit,
.reveal .compact-widget-slide .animated-add-bit,
.reveal .compact-widget-slide .animated-sub-bit {
    min-height: 1.4rem;

    font-size: 1rem !important;

    border-radius: 6px;
}


/* Carry / borrow rows */

.reveal .compact-widget-slide .animated-add-carry-row,
.reveal .compact-widget-slide .animated-sub-borrow-row,
.reveal .compact-widget-slide .animated-sub-carry-row,
.reveal .compact-widget-slide .animated-twos-carry {
    font-size: 0.78rem !important;
}


/* ---------------------------------------------------------
   Final results and messages
   --------------------------------------------------------- */

.reveal .compact-widget-slide .animated-twos-final,
.reveal .compact-widget-slide .animated-add-carry-out {
    margin-top: 0.25rem;

    font-size: 0.85rem !important;
}


.reveal .compact-widget-slide .animated-twos-message,
.reveal .compact-widget-slide .animated-add-message,
.reveal .compact-widget-slide .animated-sub-message {
    margin: 0.25rem 0 0;

    font-size: 0.8rem !important;
    line-height: 1.2;
}


/* Error messages */

.reveal .compact-widget-slide .converter-error {
    margin: 0.15rem 0;

    font-size: 0.78rem !important;
}


/* ---------------------------------------------------------
   Narrow screens
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .reveal .compact-widget-slide .slide-widget {
        width: 96%;
    }


    .reveal .compact-widget-slide .animated-twos-inputs,
    .reveal .compact-widget-slide .animated-add-inputs,
    .reveal .compact-widget-slide .animated-sub-inputs {
        grid-template-columns:
            repeat(2, minmax(120px, 1fr));
    }


    .reveal .compact-widget-slide .animated-twos-paper,
    .reveal .compact-widget-slide .animated-add-paper,
    .reveal .compact-widget-slide .animated-sub-paper {
        grid-template-columns:
            auto repeat(var(--bit-count), 1.4rem);
    }

}

/* =========================================================
   MEDIUM SIZE FOR COMPACT SLIDE WIDGETS
   ========================================================= */

/* Labels */
.reveal .compact-widget-slide .slide-widget label {
    font-size: 1rem !important;
}


/* Inputs and dropdowns */
.reveal .compact-widget-slide .slide-widget input[type="text"],
.reveal .compact-widget-slide .slide-widget select {
    font-size: 1.08rem !important;

    min-height: 40px;

    padding: 0.4rem 0.55rem;
}


/* Animation speed label */
.reveal .compact-widget-slide .animated-twos-speed label,
.reveal .compact-widget-slide .animated-add-speed label,
.reveal .compact-widget-slide .animated-sub-speed label {
    font-size: 0.95rem !important;
}


/* Buttons */
.reveal .compact-widget-slide .animated-twos-buttons button,
.reveal .compact-widget-slide .animated-add-buttons button,
.reveal .compact-widget-slide .animated-sub-buttons button {
    font-size: 0.98rem !important;

    padding: 0.4rem 0.8rem;
}


/* Labels beside calculations */
.reveal .compact-widget-slide .animated-twos-label,
.reveal .compact-widget-slide .animated-add-label,
.reveal .compact-widget-slide .animated-sub-label {
    font-size: 0.95rem !important;
}


/* Binary digits */
.reveal .compact-widget-slide .animated-twos-bit,
.reveal .compact-widget-slide .animated-add-bit,
.reveal .compact-widget-slide .animated-sub-bit {
    font-size: 1.15rem !important;

    min-height: 1.65rem;
}


/* Carry / borrow rows */
.reveal .compact-widget-slide .animated-add-carry-row,
.reveal .compact-widget-slide .animated-sub-borrow-row,
.reveal .compact-widget-slide .animated-sub-carry-row,
.reveal .compact-widget-slide .animated-twos-carry {
    font-size: 0.9rem !important;
}


/* Final result */
.reveal .compact-widget-slide .animated-twos-final,
.reveal .compact-widget-slide .animated-add-carry-out {
    font-size: 1rem !important;
}


/* Messages underneath */
.reveal .compact-widget-slide .animated-twos-message,
.reveal .compact-widget-slide .animated-add-message,
.reveal .compact-widget-slide .animated-sub-message {
    font-size: 0.95rem !important;
}


/* Error messages */
.reveal .compact-widget-slide .converter-error {
    font-size: 0.9rem !important;
}

/* =========================================================
   EASY WIDGET SIZE CONTROL
   Change ONLY --widget-scale
   ========================================================= */

.reveal .compact-widget-slide {
    --widget-scale: 1.40;
}

.reveal .compact-widget-slide .slide-widget {
    zoom: var(--widget-scale);
}

/* =========================================================
   BCD ADDITION — REVEAL SLIDE WIDGET
   ========================================================= */


/* ---------------------------------------------------------
   Widget card
   --------------------------------------------------------- */

.reveal .compact-widget-slide .bcd-slide-add-widget {
    width: 100%;

    padding: 0.65rem 0.75rem;

    box-sizing: border-box;

    border: 1px solid #dbe3ef;
    border-radius: 14px;

    background: rgba(248, 250, 252, 0.96);

    box-shadow:
        0 6px 18px rgba(15, 23, 42, 0.06);
}


/* ---------------------------------------------------------
   Input row
   --------------------------------------------------------- */

.reveal .compact-widget-slide .bcd-add-inputs {
    display: grid;

    grid-template-columns:
        1fr 1fr;

    gap: 0.55rem;

    margin-bottom: 0.45rem;
}


.reveal .compact-widget-slide
.bcd-add-inputs > div {
    display: flex;
    flex-direction: column;

    gap: 0.18rem;
}


.reveal .compact-widget-slide
.bcd-add-inputs label {
    color: #334155;

    font-size: 0.88rem !important;
    font-weight: 800;
}


/* Inputs */

.reveal .compact-widget-slide
.bcd-add-inputs input {
    width: 100%;

    min-height: 36px;

    padding: 0.35rem 0.5rem;

    box-sizing: border-box;

    border: 1px solid #cbd5e1;
    border-radius: 8px;

    background: white;

    color: #0f172a;

    font-family:
        "Courier New",
        monospace;

    font-size: 1rem !important;
    font-weight: 700;
}


/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-add-buttons {
    display: flex;

    gap: 0.4rem;

    margin-bottom: 0.45rem;
}


.reveal .compact-widget-slide
.bcd-add-buttons button {
    padding: 0.34rem 0.72rem;

    border: 1px solid
        rgba(91, 95, 168, 0.35);

    border-radius: 999px;

    background: white;

    color: #34387f;

    font-family: inherit;

    font-size: 0.85rem !important;
    font-weight: 800;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        background 0.15s ease,
        color 0.15s ease;
}


.reveal .compact-widget-slide
.bcd-add-buttons button:hover:not(:disabled) {
    transform: translateY(-1px);

    background: #5b5fa8;

    color: white;
}


.reveal .compact-widget-slide
.bcd-add-buttons button:disabled {
    opacity: 0.4;

    cursor: not-allowed;
}


/* ---------------------------------------------------------
   BCD representations
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-add-representation {
    display: grid;

    gap: 0.25rem;

    margin: 0.3rem 0 0.45rem;

    padding: 0.45rem 0.6rem;

    border-radius: 10px;

    background: #eef2ff;
}


.reveal .compact-widget-slide
.bcd-value-row {
    display: grid;

    grid-template-columns:
        90px 1fr;

    align-items: center;

    gap: 0.6rem;

    color: #334155;

    font-size: 0.85rem;
}


.reveal .compact-widget-slide
.bcd-value-row strong {
    font-family:
        "Courier New",
        monospace;

    color: #34387f;

    font-size: 1rem;
    letter-spacing: 0.04em;
}


/* ---------------------------------------------------------
   Working panel
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-add-working {
    min-height: 155px;

    padding: 0.55rem 0.65rem;

    box-sizing: border-box;

    border: 1px solid #dbe3ef;
    border-radius: 11px;

    background: white;

    color: #334155;

    font-size: 0.84rem;
}


/* Ready state */

.reveal .compact-widget-slide
.bcd-ready-box {
    display: flex;

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

    min-height: 125px;

    text-align: center;

    line-height: 1.35;
}


/* ---------------------------------------------------------
   Step heading
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-step-header {
    margin-bottom: 0.4rem;

    color: #5b5fa8;

    font-size: 0.95rem;
    font-weight: 900;
}


/* ---------------------------------------------------------
   Current digits
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-step-grid {
    display: grid;

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

    gap: 0.35rem;

    margin-bottom: 0.4rem;
}


.reveal .compact-widget-slide
.bcd-step-grid > div {
    padding: 0.35rem 0.45rem;

    border-radius: 8px;

    background: #f8fafc;

    border: 1px solid #e2e8f0;
}


.reveal .compact-widget-slide
.bcd-step-grid span {
    display: block;

    margin-bottom: 0.12rem;

    color: #64748b;

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


.reveal .compact-widget-slide
.bcd-step-grid strong {
    color: #0f172a;

    font-family:
        "Courier New",
        monospace;

    font-size: 0.88rem;
}


/* ---------------------------------------------------------
   Raw sum
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-raw-sum {
    margin: 0.35rem 0;

    padding: 0.35rem 0.5rem;

    border-radius: 8px;

    background:
        rgba(91, 95, 168, 0.08);

    color: #334155;
}


.reveal .compact-widget-slide
.bcd-raw-sum strong {
    font-family:
        "Courier New",
        monospace;
}


/* ---------------------------------------------------------
   Invalid BCD correction
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-correction-box {
    margin-top: 0.35rem;

    padding: 0.4rem 0.55rem;

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

    background: #fff7ed;

    color: #9a3412;
}


.reveal .compact-widget-slide
.bcd-mini-equation {
    display: inline-block;

    margin-top: 0.3rem;
    padding: 0.25rem 0.55rem;

    border-radius: 7px;

    background: white;

    color: #0f172a;

    font-family:
        "Courier New",
        monospace;

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

    text-align: right;
}


/* ---------------------------------------------------------
   Valid result
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-valid-box {
    margin-top: 0.35rem;

    padding: 0.4rem 0.55rem;

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

    background: #f0fdf4;

    color: #166534;
}


/* ---------------------------------------------------------
   Stored nibble
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-store-box {
    margin-top: 0.4rem;

    padding-top: 0.35rem;

    border-top: 1px dashed #cbd5e1;

    color: #334155;
}


.reveal .compact-widget-slide
.bcd-store-box strong {
    color: #5b5fa8;

    font-family:
        "Courier New",
        monospace;

    font-size: 1rem;
}


/* ---------------------------------------------------------
   Final result
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-add-final {
    margin-top: 0.4rem;

    padding: 0.35rem 0.55rem;

    border-radius: 9px;

    background:
        rgba(91, 95, 168, 0.10);

    color: #334155;

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


.reveal .compact-widget-slide
.bcd-add-final strong {
    margin-left: 0.3rem;

    color: #34387f;

    font-size: 1.1rem;
}


/* ---------------------------------------------------------
   Message
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.bcd-add-message {
    margin: 0.3rem 0 0;

    color: #5b5fa8 !important;

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


/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .reveal .compact-widget-slide
    .bcd-add-inputs {
        grid-template-columns: 1fr;
    }


    .reveal .compact-widget-slide
    .bcd-step-grid {
        grid-template-columns: 1fr;
    }

}

/* =========================================================
   UTF-8 BYTE STRUCTURE VISUALISER
   ========================================================= */


.reveal .compact-widget-slide
.unicode-utf8-widget {
    width: 100%;

    box-sizing: border-box;

    padding: 0.7rem;

    border: 1px solid #dbeafe;
    border-radius: 16px;

    background:
        rgba(239, 246, 255, 0.82);

    box-shadow:
        0 8px 22px
        rgba(15, 23, 42, 0.07);
}


/* =========================================================
   CONTROLS
   ========================================================= */

.reveal .compact-widget-slide
.utf8-controls {
    display: flex;

    align-items: end;
    flex-wrap: wrap;

    gap: 0.45rem;

    margin-bottom: 0.45rem;
}


.reveal .compact-widget-slide
.utf8-character-control {
    display: flex;
    flex-direction: column;

    gap: 0.15rem;

    min-width: 250px;

    flex: 1 1 280px;
}


.reveal .compact-widget-slide
.utf8-character-control label {
    color: #334155;

    font-size: 0.85rem !important;
    font-weight: 800;
}


.reveal .compact-widget-slide
.utf8-character-control select {
    min-height: 38px;

    padding: 0.35rem 0.5rem;

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

    background: white;

    color: #0f172a;

    font-size: 0.95rem !important;
    font-weight: 700;
}


/* Buttons */

.reveal .compact-widget-slide
.utf8-controls button {
    padding: 0.4rem 0.8rem;

    border: none;
    border-radius: 999px;

    background: #5b5fa8;

    color: white;

    font-family: inherit;

    font-size: 0.85rem !important;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 7px 18px
        rgba(91, 95, 168, 0.18);

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}


.reveal .compact-widget-slide
.utf8-controls button:hover {
    transform: translateY(-1px);

    background: #4b4f9c;
}


/* =========================================================
   SPEED
   ========================================================= */

.reveal .compact-widget-slide
.utf8-speed-row {
    display: grid;

    grid-template-columns:
        auto minmax(180px, 1fr) auto;

    align-items: center;

    gap: 0.55rem;

    margin-bottom: 0.55rem;

    padding: 0.3rem 0.5rem;

    border-radius: 10px;

    background: rgba(255, 255, 255, 0.72);
}


.reveal .compact-widget-slide
.utf8-speed-row label,
.reveal .compact-widget-slide
.utf8-speed-row strong {
    font-size: 0.8rem !important;

    color: #334155;
}


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

.reveal .compact-widget-slide
.utf8-summary {
    display: grid;

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

    gap: 0.45rem;

    margin-bottom: 0.55rem;
}


.reveal .compact-widget-slide
.utf8-summary-card {
    padding: 0.5rem 0.65rem;

    border: 1px solid #e2e8f0;
    border-radius: 12px;

    background: white;
}


.reveal .compact-widget-slide
.utf8-summary-card span {
    display: block;

    margin-bottom: 0.15rem;

    color: #64748b;

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

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


.reveal .compact-widget-slide
.utf8-summary-card strong {
    color: #0f172a;

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


/* =========================================================
   BYTE CARDS
   ========================================================= */

.reveal .compact-widget-slide
.utf8-byte-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(170px, 1fr)
        );

    gap: 0.45rem;

    margin-bottom: 0.5rem;
}


.reveal .compact-widget-slide
.utf8-byte-card {
    padding: 0.55rem 0.65rem;

    border: 2px solid #dbeafe;
    border-radius: 13px;

    background: white;

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


.reveal .compact-widget-slide
.utf8-byte-card.utf8-byte-dimmed {
    opacity: 0.42;
}


.reveal .compact-widget-slide
.utf8-byte-card.utf8-byte-active {
    opacity: 1;

    transform: translateY(-2px);

    border-color: #5b5fa8;

    box-shadow:
        0 10px 22px
        rgba(91, 95, 168, 0.15);
}


/* Byte heading */

.reveal .compact-widget-slide
.utf8-byte-heading {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 0.35rem;

    margin-bottom: 0.4rem;
}


.reveal .compact-widget-slide
.utf8-byte-heading > strong {
    color: #0f172a;

    font-size: 0.9rem;
}


.reveal .compact-widget-slide
.utf8-byte-type {
    padding: 0.18rem 0.38rem;

    border-radius: 999px;

    background: #dbeafe;

    color: #1d4ed8;

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


/* =========================================================
   BITS
   ========================================================= */

.reveal .compact-widget-slide
.utf8-bit-row {
    display: grid;

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

    gap: 0.18rem;

    margin-bottom: 0.4rem;
}


.reveal .compact-widget-slide
.utf8-bit {
    display: flex;

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

    min-height: 1.7rem;

    border-radius: 7px;

    font-family:
        "Courier New",
        monospace;

    font-size: 0.82rem;
    font-weight: 900;
}


/* Fixed UTF-8 structure bits */

.reveal .compact-widget-slide
.utf8-prefix-bit {
    background: #dbeafe;

    color: #1d4ed8;
}


/* Character-data bits */

.reveal .compact-widget-slide
.utf8-data-bit {
    background: #dcfce7;

    color: #166534;
}


/* Hex */

.reveal .compact-widget-slide
.utf8-byte-hex {
    color: #475569;

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


.reveal .compact-widget-slide
.utf8-byte-hex strong {
    margin-left: 0.25rem;

    color: #0f172a;

    font-family:
        "Courier New",
        monospace;

    font-size: 0.9rem;
}


/* =========================================================
   EXPLANATION MESSAGE
   ========================================================= */

.reveal .compact-widget-slide
.utf8-message {
    padding: 0.5rem 0.65rem;

    border: 1px solid #fed7aa;
    border-radius: 11px;

    background: #fff7ed;

    color: #7c2d12;

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

    line-height: 1.3;
}


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

@media (max-width: 900px) {

    .reveal .compact-widget-slide
    .utf8-summary {
        grid-template-columns: 1fr;
    }


    .reveal .compact-widget-slide
    .utf8-byte-grid {
        grid-template-columns:
            repeat(2, 1fr);
    }

}


/* =========================================================
   SOUND SAMPLING VISUALISER — REVEAL SLIDES
   ========================================================= */


/* ---------------------------------------------------------
   Main card
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.sound-slide-sampling-widget {
    width: 100%;

    padding: 0.7rem;

    box-sizing: border-box;

    border: 1px solid #dbeafe;
    border-radius: 16px;

    background:
        rgba(239, 246, 255, 0.82);

    box-shadow:
        0 8px 22px
        rgba(15, 23, 42, 0.07);
}


/* ---------------------------------------------------------
   Controls
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.sound-slide-controls {
    display: grid;

    grid-template-columns:
        minmax(180px, 1fr)
        minmax(180px, 1fr)
        auto
        auto;

    gap: 0.45rem;

    align-items: end;

    margin-bottom: 0.45rem;
}


.reveal .compact-widget-slide
.sound-slide-controls > div {
    display: flex;

    flex-direction: column;

    gap: 0.15rem;
}


.reveal .compact-widget-slide
.sound-slide-controls label {
    color: #334155;

    font-size: 0.82rem !important;
    font-weight: 800;
}


.reveal .compact-widget-slide
.sound-slide-controls select {
    width: 100%;

    min-height: 38px;

    padding: 0.35rem 0.5rem;

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

    background: white;

    color: #0f172a;

    font-size: 0.9rem !important;
    font-weight: 700;
}


/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.sound-slide-controls button {
    min-height: 38px;

    padding: 0.38rem 0.75rem;

    border: none;
    border-radius: 999px;

    background: #5b5fa8;

    color: white;

    font-family: inherit;

    font-size: 0.8rem !important;
    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 7px 18px
        rgba(91, 95, 168, 0.18);

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}


.reveal .compact-widget-slide
.sound-slide-controls button:hover {
    transform: translateY(-1px);

    background: #4b4f9c;
}


/* ---------------------------------------------------------
   Animation speed
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.sound-slide-speed {
    display: grid;

    grid-template-columns:
        auto minmax(180px, 1fr) auto;

    align-items: center;

    gap: 0.55rem;

    margin-bottom: 0.5rem;

    padding: 0.3rem 0.5rem;

    border-radius: 10px;

    background:
        rgba(255, 255, 255, 0.72);
}


.reveal .compact-widget-slide
.sound-slide-speed label {
    color: #334155;

    font-size: 0.78rem !important;
    font-weight: 800;
}


.reveal .compact-widget-slide
.sound-slide-speed strong {
    color: #5b5fa8;

    font-size: 0.78rem;
}


/* ---------------------------------------------------------
   Canvas frame
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.sound-slide-canvas-frame {
    width: 100%;

    padding: 0.35rem;

    box-sizing: border-box;

    border: 1px solid #dbe3ef;
    border-radius: 14px;

    background: white;

    overflow: hidden;
}


.reveal .compact-widget-slide
.sound-slide-canvas-frame canvas {
    display: block;

    width: 100%;
    height: auto;

    border-radius: 10px;

    background: #f8fafc;
}


/* ---------------------------------------------------------
   Explanation
   --------------------------------------------------------- */

.reveal .compact-widget-slide
.sound-slide-explanation {
    margin-top: 0.5rem;

    padding: 0.5rem 0.65rem;

    border: 1px solid #fed7aa;
    border-radius: 11px;

    background: #fff7ed;

    color: #7c2d12;

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

    line-height: 1.3;
}


/* ---------------------------------------------------------
   Smaller screens
   --------------------------------------------------------- */

@media (max-width: 900px) {

    .reveal .compact-widget-slide
    .sound-slide-controls {
        grid-template-columns:
            repeat(2, 1fr);
    }

}