:root {
    --borderRadius: 0.7rem;

    --bg: #eee;

    /* color scheme */
    --mainBlue: #2d4e9d;
    --buttonShadow: #1d3e86;
    --cardShadow: #1d3e863c;
    --topbarBg: #d2d8e7;
    --topbarBgHover: #2d4f9d2e;
    --dotcolorLight: #b8bce3;
    --mainTextColor: #213360;
    --accentColor: #fad595;
    --errorRed: #e53935;
    --confirmationGreen: #4caf50;
    /* --confirmationGreen2: #127e12; */

    /* Layout. The mobile values are set once in the RESPONSIVE section at
       the end of this file; everything else derives from these. */
    --pagePadding: 2rem;
    --topbarHeight: 5rem;
    /* Space between the fixed topbar and the page content. */
    --contentTopGap: 2rem;
}

html {
    font-family: system-ui;
}

body {
    background-color: var(--bg);
    
}

/* Page frame: <main> fills at least the viewport, the content (.wrapper)
   takes the free space and the footer sits at the bottom. On short pages
   the footer is visible without scrolling; on long pages it follows the
   content as before. dvh: on phones 100vh includes the area behind the
   browser bars, which would push the footer out of view again. */
main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

footer {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    padding: var(--pagePadding);
}

footer div {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
}

a.mainLink{
    color: var(--mainBlue);
    transition: 0.5s all ease;
    border: 2px solid transparent;
}
a.mainLink:hover {
    padding: 0.2rem 0;
    border-bottom: 2px solid var(--mainBlue);
}

.wrapper {
    flex: 1 0 auto;
    padding: var(--pagePadding);
    padding-top: calc(var(--topbarHeight) + var(--contentTopGap));
}

/* Login: no topbar above it. */
.wrapper.wrapperLogin {
    padding-top: 3.5rem;
}

/* Pages with little content (the lesson overview) sit in the middle of
   the free space instead of sticking to the top. */
.wrapper.wrapperCentered {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: calc(var(--pagePadding) + 2rem);
}

::selection {
  background-color: var(--accentColor);
  color: var(--mainTextColor);
}


/* FONTS */


/*----------------FONTS-----------------*/

@font-face {
    font-family: 'Geoform';
    src: url('../fonts/Geoform.eot');
    src: url('../fonts/Geoform.eot?#iefix') format('embedded-opentype'),
        url('../fonts/Geoform.woff2') format('woff2'),
        url('../fonts/Geoform.woff') format('woff'),
        url('../fonts/Geoform.ttf') format('truetype'),
        url('../fonts/Geoform.svg#Geoform') format('svg');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geoform';
    src: url('../fonts/Geoform-Bold.eot');
    src: url('../fonts/Geoform-Bold.eot?#iefix') format('embedded-opentype'),
        url('../fonts/Geoform-Bold.woff2') format('woff2'),
        url('../fonts/Geoform-Bold.woff') format('woff'),
        url('../fonts/Geoform-Bold.ttf') format('truetype'),
        url('../fonts/Geoform-Bold.svg#Geoform-Bold') format('svg');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Geoform';
    src: url('../fonts/Geoform-Medium.eot');
    src: url('../fonts/Geoform-Medium.eot?#iefix') format('embedded-opentype'),
        url('../fonts/Geoform-Medium.woff2') format('woff2'),
        url('../fonts/Geoform-Medium.woff') format('woff'),
        url('../fonts/Geoform-Medium.ttf') format('truetype'),
        url('../fonts/Geoform-Medium.svg#Geoform-Medium') format('svg');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TangoSans';
    src: url('../fonts/TangoSans.eot');
    src: url('../fonts/TangoSans.eot?#iefix') format('embedded-opentype'),
        url('../fonts/TangoSans.woff2') format('woff2'),
        url('../fonts/TangoSans.woff') format('woff'),
        url('../fonts/TangoSans.ttf') format('truetype'),
        url('../fonts/TangoSans.svg#TangoSans') format('svg');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'TangoSans';
    src: url('../fonts/TangoSans_Bold.eot');
    src: url('../fonts/TangoSans_Bold.eot?#iefix') format('embedded-opentype'),
        url('../fonts/TangoSans_Bold.woff2') format('woff2'),
        url('../fonts/TangoSans_Bold.woff') format('woff'),
        url('../fonts/TangoSans_Bold.ttf') format('truetype'),
        url('../fonts/TangoSans_Bold.svg#TangoSans_Bold') format('svg');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}




h1,
h2 {
    font-family: 'TangoSans', Arial, Helvetica, sans-serif;
    font-weight: normal;
}

button, h3, h4 {
    font-family: 'Geoform', Arial, Helvetica, sans-serif;
    font-weight: bold;
}

p, small {
    font-family: 'Geoform', Arial, Helvetica, sans-serif;
    font-weight: normal;
}



h1 {
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

h2 {
    font-size: 1.25rem;
}


h1,
h2,
h3,
h4,
p,
small {
    color: var(--mainTextColor);
}

h1,
h2 {
    text-align: center;
}

.modal {
    position: absolute;
    background-color: #00000044;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    padding: 2rem;
}

.modal>form {
    max-width: 80%;
    max-height: 80%;
    padding: 2rem;
    margin: auto;
    background-color: var(--bg);
    overflow: scroll;
}

.modal>form>article {
    border: 1px solid black;
    padding: 1rem;
}


/* LOGIN */

div.logo {
    display: flex;
    justify-content: center;
    align-content: center;
}

.logo img {
    width: 20rem;
    max-width: 100%;
    align-self: center;
}

.loginForm {
    display: grid;
    gap: 2rem;
}

.loginForm input {
    width: 100%;
    padding: 0.8rem;
    border-radius: var(--borderRadius);
    background-color: transparent;
    border: 1px solid var(--mainBlue);
}

.loginError {
    color: var(--errorRed);
}

.loginForm label {
    color: var(--mainBlue);
    padding-left: 0.5rem;
}

/* Label above its field, with a little air in between. */
.usernameForm {
    display: grid;
    gap: 0.45rem;
}


/* A login form only needs room for a name: common sign-in pages keep the
   whole card at roughly 400-450px, so the fields stay as wide as the
   things typed into them. On phones the card takes the full width. */
.loginContainer {
    margin: 0 auto;
    display: grid;
    gap: 4rem;
    max-width: 27rem;
}

.containerUnits {
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    max-width: 1200px;
}



/* ___TOPBAR___ */

/* Three columns: start | logo | end. The outer ones share the free width
   equally, so the logo stays centred whatever sits left and right. */
div.topbar {
    background-color: var(--topbarBg);
    height: var(--topbarHeight);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-rows: 100%;
    align-items: center;
    column-gap: 0.5rem;
    padding: 0.5rem;
    position: fixed;
    top: 0;
    z-index: 10;
    width: 100%;
}

.topbarStart,
.topbarEnd {
    display: flex;
    align-items: center;
    height: 100%;
    min-width: 0;
}

.topbarStart {
    justify-content: flex-start;
}

.topbarEnd {
    justify-content: flex-end;
    gap: 0.25rem;
}

.topbar .logoLink {
    height: 80%;
}

/* Back, Admin and Logout look alike: label and symbol, no frame. */
.topbar button,
.topbar .topbarAction {
    background-color: transparent;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: var(--borderRadius);
    color: var(--mainTextColor);
    text-decoration: none;
    transition: 0.5s all ease;
}

.topbar button:hover,
.topbar .topbarAction:hover {
    background-color: var(--topbarBgHover);
    cursor: pointer;
}

/* One line; a very long name ends in "…" (full name in the tooltip)
   instead of wrapping. */
.topbar .username {
    font-family: 'Geoform', Arial, Helvetica, sans-serif;
    font-weight: bold;
    font-size: large;
    padding: 0 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.topbar a img {
  height: 100%;
}

.topbar button img,
.topbar .topbarAction svg.icon {
    height: 100%;
    width: auto;
}

/* Same line weight as the logout symbol. */
.topbar .topbarAction svg.icon {
    stroke-width: 2;
}

form.logoutForm {
    padding: 0;
    height: 100%;
}


/* UI Card Unit */

.containerCard {
    display: grid;
    gap: 2rem;
    width: auto;
}


.card {
    box-shadow: 0 0 1em 0.25em var(--cardShadow);
    border-radius: var(--borderRadius);
    padding: 2rem !important;
    display: grid;
    /* gap: 2rem; */

    position: relative;

    gap: 1.2rem;
}

.video {
    aspect-ratio: 4/3;
    background-color: #767676;
}

.video video {
    aspect-ratio: 4/3;
}

.card.unit {
    padding: 0 !important;
    gap: 0;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    transition: 0.3s all ease;
}

.card.completed {
    outline: 2px solid var(--confirmationGreen);
    background-color: #d8e8c4;
    box-shadow: none;
}

.card.unit.completed {
    background-color: transparent;
    position: relative;
}

.card.unit.completed::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background-color: #d8e8c4;
    z-index: -10;

    animation: completedAnim 1s ease-in-out forwards;
}

@keyframes completedAnim {
    0% { 
        right: 100%;
    }
    100% { 
        right: 0;
    }
}


/* Only on devices with a real pointer: on touch screens :hover sticks
   after a tap and the card would stay enlarged. */
@media (hover: hover) {
    .card.unit:hover {
        transform: scale(1.05);
        cursor: pointer;
    }
}

.card.unit .video img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card.unit .video {
    flex: 0 1;
}

.card.unit .cardContent {
    flex: 1 0;
    padding: 2rem;

    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.card.unit .cardContent h2 {
    text-align: left;
}

.card.unit .mainButton {
    flex: 0 1;
    height: 100%;
}

.card .completion {
    display: flex;
    align-items: center;
    justify-content: center;
}

.completion img {
    height: 1rem;
    margin-right: 0.7rem;
}



/* LOCKED UNIT */

div.lockedUnit {
    width: 100%;
    height: 100%;

    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    z-index: 2;
    display: flex;
    justify-content: center;

    opacity: 0.5;
}

div.lockedUnit img {
    width: 50%;
}

.locked {
    opacity: 0.4;
}




h2 {
    color: var(--mainTextColor);
}


/* Summary */

.summary {
    display: grid;
    gap: 1rem;
}

.summary>p {
    font-weight: bold;
}

.lessons {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    width: 100%;
    column-gap: 1rem;
    row-gap: 0.35rem;
    /* Circle and number line up with the first line of a wrapped name. */
    align-items: start;
}

.circle {
    width: 1rem;
    height: 1rem;
    margin-top: 0.15rem;
    border-radius: 50%;
    background-color:transparent;
    border: 2px dashed var(--mainTextColor);
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle.circleDone {
    background-color: #fff;
    border: none;
}

.circle .check {
    width: 100%;
    height: 100%;
}

.lessons p.lessonNumber {
    font-weight: 500;
    white-space: nowrap;
}




/* Progress Bar */

.progressContainer {
    position: relative;
    width: 100%;
    height: 1.9em;
}

.progressBar {
    width: 100%;
    /* height: 0.7em; */

    height: 0.4rem;
    background-color: var(--accentColor);
    border-radius: 1em;
}

.offset {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1;
}

.progress {
    background-color: var(--mainBlue);
    border-radius: 1em;
    height: 100%;
    width: 25%;
}

.progressText {
    text-align: center;
    margin-top: 0.4rem;
}

/* The fixed height is for the bar with stations, whose parts are positioned
   absolutely. The bar with text has normal flow, so it can size itself. */
.card.unit .progressContainer {
    height: auto;
}


/* with Stations */

.progressStations {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 2;
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    align-items: center;

}


.proStation {
    background-color: var(--accentColor);
    border-radius: 50%;

    width: 1.2rem;
    height: 1.2rem;
}


.testStation {
    border: 1px solid var(--mainBlue);
    width: 2rem;
    height: 2rem;
    display: flex;
    justify-content: end;
    padding: 0.3rem;
}

.testStation img {
    height: 100%;
    fill: white;
}


.reached {
    background-color: var(--mainBlue);
}

.whiteIcon {
    filter: invert(100%);
}


.playButton {
    border: none;
    background-color: var(--mainTextColor);
    color: white;
    transition: 0.3s all ease;
    width: 100%;
    height: 3.3rem;
    font-size: 0.9rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

button.playButton:hover {
    cursor: pointer;
}



/* PRACTICE MODE */


.practiceMode {
    display: grid;
    /* minmax(0, ...): two equal columns regardless of their content. Plain
       1fr grows with it, which pushed Final Practice out of the layout. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto 1fr;
    /* column-gap: 5rem; */

    column-gap: 10%;
    row-gap: 0.7rem;
}

.practiceMode h2 {
    grid-column: 1/3;
    text-align: left;
    font-size: 2.5rem;
}

.practiceMode div {
    grid-row: 2/3;
    aspect-ratio: 4/3;
    background-color: #767676;
}

.practiceMode div video {
    aspect-ratio: 4/3;
}

/* The video keeps its 4:3 shape, but this box also holds the play button.
   Forced to 4:3 as well, the box is too short for both and the grid
   underestimates its height, so the text below runs into the Start button. */
.practiceMode .withPlayButton {
    aspect-ratio: auto;
}

p.word {
    text-transform: uppercase;

    font-size: 1em;
    font-weight: 500;
    text-align: center;
}


/* RECOGNITION MODE */

.recognitionMode {
    width: 100%;
    display: grid;
    /* grid-template-columns: 1fr;
    grid-template-rows: auto 1fr; */

    grid-template-columns: 1fr 1fr 1fr 1fr ;
    grid-template-rows: auto 1fr 1fr;
    row-gap: 0.7rem;
}

.recognitionMode .ownView {
    grid-row: 1/2;
    grid-column: 2/4;
}

.recognitionMode p.word {
    grid-row: 2/3;
    grid-column: 2/4;
}

.recognitionMode .confidenceBar {
    grid-column: 2/4;
    grid-row: 3/4;
}

.recognitionMode .confidencePrediction {
    grid-column: 2/4;
    grid-row: 3/4;
    align-self: end;
    margin: 0;
    margin-top: 1.2rem;
    text-align: center;
}

/* Camera preview. The image must never be distorted, on any device, and
   must not push the page layout around:
   1. The box is always 4:3 landscape, the shape the models were trained
      on, and at most --cameraMaxHeight tall.
   2. The picture inside is scaled uniformly (object-fit: contain). A
      phone held upright delivers a portrait picture, which then sits in
      the middle with grey bars left and right: the same geometry the
      landmarks are mapped to before recognition (hand_tracking.js,
      trainingFrameMapping). Nothing is cut off. */
.ownView {
    --cameraMaxHeight: 60vh;
    aspect-ratio: 4 / 3;
    width: min(100%, calc(var(--cameraMaxHeight) * 4 / 3));
    justify-self: center;
    margin-inline: auto;
    background-color: #767676;
    overflow: hidden;
}

.ownView #processed {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Practice on wide screens: the camera sits next to the 4:3 example video
   and takes the full column width, so both line up. */
.practiceMode .ownView {
    width: 100%;
}

#webcam {
    transform: scaleX(-1);
}

.recognitionMode p.word {
    grid-row: 2/3;
}


/* FINAL RECOGNITION MODE */

.testSentence .testVocab {
    opacity: 0.4;
    transition: opacity 0.2s, color 0.2s;
}

.testSentence .testVocab.current {
    opacity: 1;
    font-weight: bold;
}

.testSentence .testVocab.done {
    opacity: 1;
    color: var(--confirmationGreen);
}

.testMode{
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: auto auto auto auto auto auto;
}

.testMode *{
    grid-column: 2/4;
}

/* Confidence bar internals are absolutely positioned children of the
   bar — exempt them from the universal grid-column rule above. */
.testMode .confidenceBar #confidence-meter,
.testMode .confidenceBar .confidenceThreshold {
    grid-column: auto;
}

.testMode p {
    text-align: center;
}

.testMode .ownView {
    grid-row: 1/2;
}

.testMode .confidenceBar {
    grid-row: 2/3;
}

.testMode .confidencePrediction {
    grid-row: 3/4;
    align-self: start;
    margin: 0;
}

.testMode p.testInstructions {
    grid-row: 4/5;
}

.testMode p.testSentence {
    grid-row: 5/6;
}

.testMode .errorIndicator {
    grid-row: 6/7;
}


/* LESSON */

.layoutLesson {
    display: grid;
    row-gap: 3rem;
    row-gap: 1rem;
    column-gap: 2rem;
    max-width: 800px;

    margin: 0 auto;
    /* grid-template-columns: 1fr 1fr 1fr 1fr; */
    grid-template-rows: auto auto auto auto;

    grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
}

.layLesProgress {
    grid-column: 2/4;
    grid-row: 1/2;

    grid-column: 3/5;
}

.layLesGloss {
    grid-column: 1/5;
    grid-row: 2/3;

    grid-column: 1/7;
}

.layLesPractice {
    grid-column: 1/5;
    grid-row: 3/4;

    grid-column: 1/7;
}

.layLesButton {
    grid-column: 2/4;
    grid-row: 4/5;

    grid-column: 3/5;
}

#lesson-buttons {
    display: contents;
}

/* Two buttons side by side (recognition and test steps). */
.layLesButton.layLesButtonLeft {
    grid-column: 2/4;
}

.layLesButton.layLesButtonRight {
    grid-column: 4/6;
}

.confidenceBar {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius:4px;
    position: relative;
}

#confidence-meter {
    height: 100%;
    background: var(--confirmationGreen);
    border-radius: 4px;
    transition: background 0.2s, width 0.2s;
}

#confidence-meter.error { background: var(--errorRed) }

/* Target threshold marker: a vertical line that overshoots the bar top
   and bottom. Positioned via inline `left: <target>%`. */
.confidenceThreshold {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: var(--mainTextColor);
    transform: translateX(-50%);
    pointer-events: none;
}

/* Current prediction label below the bar, colored to match the meter. */
.confidencePrediction {
    text-transform: uppercase;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 1.2em;
    margin: 0;
    color: var(--confirmationGreen);
}

.confidencePrediction.error {
    color: var(--errorRed);
}


.page2 {
    grid-row: 3/4;
    grid-column: 1/5;
}




/* Button */

button.mainButton {
    border: none;
    background-color: var(--mainBlue);
    box-shadow: 0 -0.2rem var(--buttonShadow) inset;
    border-radius: var(--borderRadius);
    color: white;
    transition: 0.3s all ease;
    width: 100%;
    height: 3.3rem;

    font-size: 0.9rem;
    padding: 1rem;

    /* icon + label, centred */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

/* Icons in buttons (templates/partials/icons.html): as tall as the text
   line, coloured like the text. */
svg.icon {
    width: 1.25em;
    height: 1.25em;
    flex: 0 0 auto;
}

/* The play/pause button holds both icons; only the matching one shows. */
.playButton .iconPause,
.playButton.isPlaying .iconPlay {
    display: none;
}

.playButton.isPlaying .iconPause {
    display: inline;
}

button.mainButton:hover {
    background-color: var(--buttonShadow);
    cursor: pointer;
}

button.mainButton.disabled, button.mainButton[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Repeat-button hint: pulses to suggest practicing again after the user
   has signed the wrong thing for a sustained stretch. Only the box-shadow
   animates — no transform/scale, so the button cannot shift within its
   grid cell. */
@keyframes repeatHintPulse {
    0%   { outline: 0px solid var(--accentColor); }
    50%  { outline: 10px solid var(--accentColor) }
    100% { outline: 0px solid var(--accentColor); }
}

button.mainButton.hint {
    animation: repeatHintPulse 1s ease-in-out infinite;
}


/* SLIDER */

.containerSlider {
    display: grid;
    grid-template-columns: auto auto auto auto auto;
    gap: 10rem;
}

.arrowsCarousel img{
    height: 100%;
}

.arrowForCarousel {
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
    transition: 0.3s all ease;
}

.arrowForCarousel:hover {
    scale: 1.2;
}

.arrowForCarousel.hidden {
    opacity: 0;
    pointer-events: none;
}

div.carousel {
    position: relative;
}

div.arrowsCarousel {
    width: 28rem;
    height: 3rem;

    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -40%);

    display: flex;
    justify-content: space-between;
    z-index: 2;
}


.carousel {
    /* Width of one lesson card. The track's side padding is derived from
       it, so the first and last card can be centred too. */
    --slideWidth: 22rem;
    --slideGap: 4rem;
}

.carousel-window {
    width: 100%;
    overflow: hidden;
    /* Horizontal swipes move the slider (slider.js), vertical ones still
       scroll the page. */
    touch-action: pan-y;
}

.carousel-window.dragging .carousel-track {
    transition: none;
}


.carousel-track {
    display: flex;
    align-items: center;
    gap: var(--slideGap);
    width: max-content;
    transition: transform 0.45s ease;
    padding: 1.1rem calc(50vw - var(--slideWidth) / 2);
}

.carousel-slide {
    flex: 0 0 auto;
    width: var(--slideWidth);
    opacity: 0.45;
    transform: scale(0.88);
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.carousel-slide.active {
    opacity: 1;
    transform: scale(1);
}

.carousel-slide:not(.active) {
    cursor: pointer;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 4rem;
    margin-top: 1rem;
}

.dot {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    border: none;
    padding: 0;
    background-color: var(--dotcolorLight);
    cursor: pointer;
}

.dot.active {
    background-color: var(--mainBlue);
}



/* ----- IMPRINT ----- */

div#imprint {
    padding: 2rem;
}

/* ----- PRIVACY ----- */

div.privacyBlock h2 {
    text-align: left;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

div.privacyBlock h3 {
    margin-top: 1rem;
}

div.privacyBlock p,
ul.privacyList {
    margin-bottom: 0.6rem;
}

ul.privacyList {
    padding-left: 1.5rem;
}

/* reset.css removes markers from lists and their items. */
ul.privacyList li {
    list-style: disc;
}

/* Placeholders that must be filled in before going live. Deliberately
   conspicuous so none is overlooked. */
mark.privacyTodo {
    background-color: #ffe08a;
    color: #000;
    padding: 0 0.2rem;
}

/* =========================================================================
   RESPONSIVE
   =========================================================================
   Desktop is the default above; this block adapts it to phones and small
   tablets. One breakpoint keeps the behaviour predictable. To fine-tune:
   - spacing and sizes: change the variables in the first rule,
   - a component: edit its group below (they follow the order of the
     desktop styles above).
   Breakpoint: 700px covers phones in both orientations and small tablets
   in portrait; tablets in landscape and laptops get the desktop layout.
   ========================================================================= */

@media (max-width: 700px) {

    /* --- Tokens --------------------------------------------------------- */
    :root {
        --pagePadding: 1rem;
        --topbarHeight: 3.75rem;
        --contentTopGap: 1.25rem;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 1.25rem;
    }

    /* --- Login ---------------------------------------------------------- */
    .wrapper.wrapperLogin {
        padding-top: 2rem;
    }

    .loginContainer {
        gap: 2rem;
    }

    .logo img {
        width: 14rem;
    }

    .card {
        padding: 1.25rem !important;
    }

    /* --- Topbar: back, admin and logout shrink to their symbol ----------- */
    .topbar button,
    .topbar .topbarAction {
        min-width: 2.75rem;
        padding: 0.5rem;
    }

    .topbar button h3,
    .topbar .topbarAction h3 {
        display: none;
    }

    .topbar .username {
        font-size: 0.95rem;
        padding: 0 0.25rem;
    }

    .topbar .username .greetingExtra {
        display: none;
    }

    /* --- Unit card: picture on top, content below ------------------------ */
    .containerUnits {
        gap: 2rem;
    }

    .card.unit {
        flex-direction: column;
    }

    .card.unit .video {
        flex: none;
        width: 100%;
    }

    .card.unit .cardContent {
        padding: 1.25rem;
    }

    /* --- Lesson slider ---------------------------------------------------- */
    /* The window spans the full screen width, so neighbouring cards peek in
       from the screen edge instead of being cut off at the page padding.
       The active card always fits completely. */
    .carousel {
        /* Narrow enough that the neighbouring cards peek in at the screen
           edges (a hint that the slider can be swiped). */
        --slideWidth: min(22rem, calc(100vw - 5rem));
        --slideGap: 0.25rem;
    }

    .carousel-window {
        width: auto;
        margin-inline: calc(-1 * var(--pagePadding));
    }

    /* Swipe and the dots replace the arrows, which would cover the card. */
    div.arrowsCarousel {
        display: none;
    }

    .carousel-dots .dot {
        width: 0.8rem;
        height: 0.8rem;
    }

    /* --- Lesson page ------------------------------------------------------ */
    .layoutLesson {
        grid-template-columns: 1fr;
        column-gap: 0;
    }

    .layLesProgress,
    .layLesGloss,
    .layLesPractice,
    .layLesButton,
    .layLesButton.layLesButtonLeft,
    .layLesButton.layLesButtonRight {
        grid-column: 1 / -1;
        /* One column: everything in document order, two buttons stack. */
        grid-row: auto;
    }

    .layLesProgress {
        padding: 0 0.5rem;
    }

    /* Practice: the example video and the own camera below each other. */
    .practiceMode {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        row-gap: 0.75rem;
    }

    .practiceMode h2 {
        grid-column: 1;
        font-size: 1.6rem;
    }

    .practiceMode div {
        grid-row: auto;
    }

    /* Stacked: same size rule as in the other steps. */
    .practiceMode .ownView {
        width: min(100%, calc(var(--cameraMaxHeight) * 4 / 3));
    }

    /* Recognition and test: the camera uses the full width. */
    .recognitionMode,
    .testMode {
        grid-template-columns: minmax(0, 1fr);
    }

    .recognitionMode .ownView,
    .recognitionMode p.word,
    .recognitionMode .confidenceBar,
    .recognitionMode .confidencePrediction,
    .testMode * {
        grid-column: 1;
    }
}
