/* -- COLORS, SIZES AND OTHER VARS --------------------------------------------------- */
:root {

    /*
        NOTE: define this to make all em and rem units independient of current zoom/scale.
        It assumes that window size will be 1280 x 720px.
    */
    font-size: 1.6vw;
    --pix: 0.10ch;

    --base-color:    black;
    --front-color:   white;
    --light-color:   #b3b3b3;
    --dimm-color:    #797979;
    --dark-color:    #333333;
    --xt-dark-color: #1a1a1a;

    --bubble-error:  #a51d2d;
    --bubble-normal: #613583;
    --status-wait:   #e5a50a;

    --red:           #db3543;
    --red-dark:      #6E2A3A;
    --green:         #86c232;
    --blue:          #0e3152;
    --light-blue:    #2987e4;

    --base-size: 1.9em;
    --button-border: 0.12ch;
    --header-h: max(5ch, 10vh);
}


/* -- GLOBAL STYLES ------------------------------------------------------------------ */
html, body {
    /* Disable browser handling of all panning and zooming gestures. */
    touch-action: none;

    background-color: var(--base-color);
    color: var(--front-color);
    font-size: var(--base-size);
    font-family: "Roboto-Condensed";

    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;

    user-select: none;
}

a, a:hover {
    color: var(--front-color);
    text-decoration: none;
    cursor: pointer;
}

a {
    display: flex;
    flex-direction: row;
    align-items: center;
}

.fa-icon {
    display: inline-block;
    width: 2.5ch;
    height: 2.5ch;
    margin: 0.6ch 0.6ch;

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

    border: var(--button-border) solid var(--front-color);
    border-radius: 50%;
}

.content, .content-flexcol {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.content-flexcol {
    display: flex;
    flex-direction: column;
}

.section-name {
    grid-area: name;

    padding-right: 0.5ch;
    place-self: end;
    align-self: start;
}

.home {
    grid-area: home;

    padding-right: 0.5ch;
    place-self: start;
    align-self: start;
}

.dimm,
.dimm:hover {
    color: var(--dimm-color) !important;
}

.dimm .fa-icon {
    border-color: var(--dimm-color);
}

.scroll-box {
    scrollbar-color: var(--dark-color) transparent;
}

.scroll-box::-webkit-scrollbar {
    width: calc(10 * var(--pix));
    height: calc(10 * var(--pix));
}

.scroll-box::-webkit-scrollbar-thumb {
    background: var(--dark-color);
    border-radius: calc(5 * var(--pix));
}

.scroll-box::-webkit-scrollbar-track {
    background: transparent;
}

#error-message {
    position: absolute;
    width: 100%;
    margin-top: 0.3em;
    font-size: 0.7em;
    z-index: 100;

    display: flex;
    flex-direction: row;
    justify-content: center;
}

#error-message > span {
    border-radius: calc(1em / 2);
    background-color: red;
    color: white;
    padding: 0.2em 0.4em;
}

.message-dlg {
    border: calc(6 * var(--pix)) solid var(--front-color);
    border-radius: calc(25 * var(--pix));
    padding-bottom: 1em;
    width: var(--dlg-size);
    color: var(--front-color);
    background-color: var(--base-color);
    font-size: calc(var(--dlg-size) / 80);
    font-family: "Roboto-Condensed";

    justify-self: center;
    align-self: center;

    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.message-dlg .msg-header {
    position: relative;
    padding: 0.2em;
    text-align: center;
    font-family: "Roboto-Condensed";
    font-size: 3.2em;
    font-weight: bold;
    color: var(--front-color);
    background-color: var(--dark-color);
}

.message-dlg .msg-header img {
    position: absolute;
    left: 1em;
    height: 1.4em;
}

.message-dlg .msg-header .title {
    padding-left: 1em;
}

.message-dlg h1 {
    line-height: 1em;
    font-size: 2em;
    padding: 1em 0.5em 0.9em;
}

.message-dlg h2 {
    line-height: 1em;
    font-size: 1.6em;
    padding: 0em 0.6em 0.5em;
}

.message-dlg a.button,
.message-dlg button {
    color: var(--base-color);
    background-color: var(--front-color);

    text-transform: uppercase;
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 1em;
    padding: 0.3em 1.5em;
    border-radius: 1em;

    align-self: center;
}

.drop-submenu-left::before,
.dropdown-item.checked::before {
    position: absolute;
    left: 0.5ch;
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

.drop-submenu-left::before {     content: "\f104"; }

.dropdown-item.checked::before {
    content: "\f00c";
    font-size: 0.8em;
    line-height: 1.8em;
}

.dropdown-divider {
    border-top: var(--pix) solid #e9ecef;
}

.blur-background {
    position: absolute;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(0.4ch);
    overflow: hidden;
}

.numpad-window {
    --dlg-size: 30em;

    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    justify-content: center;
}

.numpad-window h1.title {
    padding: 1em 0.5em 0;
}

.numpad-window > .message-dlg {
    background-color: var(--base-color);
}

.numpad-window input {
    border: 0;
    outline: 0;
    background-color: transparent;
    border-bottom: calc(2 * var(--pix)) solid var(--front-color);
    color: var(--marine);
    font-size: 2.5em;
    width: 18ch;
    margin: 0 auto 0.4em;
}

.numpad-window .button-bar {
    display: flex;
    gap: 3em;
    justify-content: center;
    margin: .5em 0 0.2em;
}

.numpad-window .button-bar button {
    margin-top: 0;
    padding: 0.4em;
    width: 10ch;
    border: 0;
}

.numpad-window .numpad-kbd {
    margin-bottom: -1em;
    padding: 1.5em 0 1.2em 0;

    display: grid;
    justify-content: center;
    gap: 0.7em;
    grid-template-columns: auto auto auto auto;
}

.numpad-window .numpad-kbd button.key {
    background-color: var(--light-color);
    border: none;
    border-radius: calc(5 * var(--pix));
    font-size: 2.3em;
    color: var(--base-color);

    width: 2.4em;
    height: 1.7em;
    margin: 0;
    padding: 0;
}

.numpad-window .numpad-kbd button.key:active {
    transition: none;
}

.numpad-window .numpad-kbd button.key.key-alt {
    background-color: #2B4355;
    color: var(--front-color);
}

.numpad-window .numpad-kbd button.key.key-del {
    background-color: #6E2A3A;
    color: var(--front-color);
}



/* -- LOGIN PAGE --------------------------------------------------------------------- */
.content:has(div#login-screen) {
    height: 100%;

    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
}

#login-screen {
    width: 90%;

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

#login-screen > h1 {
    align-self: start;

    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 0.5em;
}

#login-screen > h2 {
    align-self: start;

    font-size: 0.8em;
}

#login-screen > hr {
    align-self: start;
    margin: 0 0 0.3em 0;

    border: 0;
    width: 5em;
    height: calc(2 * var(--pix));
    background-color: var(--front-color);
}

#login-screen > .user-list {
    display: flex;
    gap: 1em;
    flex-direction: row;
    justify-content: space-evenly;

    font-size: 0.7em;
    margin-top: 8ch;
}

#login-screen > .user-list > a {
    display: block;
    position: relative;
    border: var(--button-border) solid var(--front-color);
    border-radius: 1ch;
    flex: 1 1 ;
    padding: 1em 0 0 0;
    width: 18vw;
    text-align: center;

    cursor: pointer;
}

#calls-screen .user-list > a > :first-child {
    display: flex;
    width: 100%;
    font-size: 3em;
}

#login-screen > .user-list > a > span:not(.kbd-num) {
    display: block;
    text-align: center;
    margin-top: 2ch;
    padding: 0.5ch;

    text-transform: capitalize;

    background-color: var(--front-color);
    color: var(--base-color);
    font-weight: bold;
    font-size: 0.9em;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom-left-radius: 0.9ch;
    border-bottom-right-radius: 0.9ch;
}

#login-screen .user-list > a > span.kbd-num {
    position: absolute;
    bottom: -2em;
    left: 50%;
    border-top: 0 !important;
    transform: translateX(-50%);
}

#login-screen > .card-reader {
    padding-bottom: 0.1em;

    display: flex;
    flex-direction: column;
    flex-grow: 0.5;

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

    position: absolute;
    bottom: 0;
}


/* -- DASHBOARD PAGE ----------------------------------------------------------------- */
#dash-screen {
    width: 100%;
    height: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "info  actions"
        "clock actions"
        "logout .";
}

#dash-screen .user-info {
    grid-area: info;

    font-size: 0.9em;
    margin-left: 0.6ch;
}

#dash-screen .clock {
    --clock-size: 25vw;

    grid-area: clock;
    align-self: center;
    padding-bottom: 2.5em;
}

#dash-screen .logout {
    grid-area: logout;
    margin-right: auto;
}

#dash-screen .action-bar {
    grid-area: actions;

    display: flex;
    flex-direction: column;
    align-items: flex-end;
}


/* -- CALENDAR PAGE ------------------------------------------------------------------ */
#calendar-screen {
    width: 100%;
    height: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "home  name"
        "clock calendar"
        "clock calendar";
}

#calendar-screen .clock {
    --clock-size: 25vw;

    grid-area: clock;
    align-self: center;
    padding-bottom: 2.5em;
}

#calendar-screen .calendar {
    grid-area: calendar;

    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1em;

    min-width: 0;
    margin-left: 1em;
}

#calendar-screen .reminders {
    height: 70%;
    font-size: 0.6em;
    flex-grow: 1;
    min-width: 0;

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

#calendar-screen .reminders h1 {
    font-size: 1.5em;
    font-weight: bold;
    border-bottom: calc(1 * var(--pix)) solid var(--dimm-color);
}

#calendar-screen .reminders .event-list {
    display: flex;
    flex-direction: column;
}

#calendar-screen .reminders .event-list div {
    display: inline;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#calendar-screen .reminders .event-list h1 {
    display: inline-block;
    border: none;
    font-size: 1em;
    width: 5ch;
    text-align: center;
}

#calendar-screen .reminders .event-list .sep {
    width: 75%;
    height: calc(2 * var(--pix));
    background-color: var(--dark-color);
    margin: 0 0 calc(10 * var(--pix)) 0;
}


/* -- TRAINING PAGE ------------------------------------------------------------------ */
#training-screen {
    width: 100%;
    height: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "home        name"
        "exercises   exercises"
        "nav-pages   nav-pages";

    align-items: center;
    justify-items: center;
}

#training-screen > .exercises {
    grid-area: exercises;

    width: 75%;
    display: grid;
    grid-template-columns: auto auto;
    gap: 1em;
}

#training-screen > .exercises.single-col {
    width: auto;
    grid-template-columns: auto;
}

#training-screen > .exercises a {
    border: var(--button-border) solid var(--front-color);
    background-color: var(--xt-dark-color);
    border-radius: calc(15 * var(--pix));
    position: relative;

    display: flex;
    text-align: center;
    padding: 1ch;
    justify-content: center;

    height: 20vh;
    width: 35vw;
}

#training-screen > .exercises a .link-text {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
    align-items: center;
    justify-content: center;
}

#training-screen > .exercises a .kbd-num {
    position: absolute;
}

#training-screen > .exercises a.left-side .kbd-num { left: -4ch; }
#training-screen > .exercises a.right-side .kbd-num { right: -4ch; }

#training-screen > .nav-pages {
    grid-area: nav-pages;

    display: flex;
    flex-direction: column;
}

#training-screen > .nav-pages div {
    display: flex;
    flex-direction: row;
}

#training-screen > .nav-pages a {
    border: var(--button-border) solid var(--front-color);
    font-size: 0.6em;
    width: 4ch;
    height: 4ch;
    border-radius: 100%;
    margin: 0 1ch;

    display: flex;
    justify-content: center;
}

#training-screen > .nav-pages a.current {
    background-color: var(--front-color);
    color: var(--base-color);
}

#training-screen > .message-dlg {
    --dlg-size: 35em;

    grid-area: exercises;
}


/* -- ROUTINE PAGE ------------------------------------------------------------------- */
#routine-screen {
    width: 100%;
    height: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "home      name"
        "exercises exercises"
        "actions   actions";

    align-items: center;
    justify-items: center;
}

#routine-screen .exercise-list {
    --list-size: 1.2em;
    --mg: 3ch;

    grid-area: exercises;
    align-self: start;
    font-size: var(--list-size);

    /* padding-top: 1ch; */
    margin-top: 1ch;
    /* border: 1px solid red; */
    display: flex;
    flex-direction: column;

    min-height: 0;
    height: 87%;
    width: 48vw;
    overflow: hidden;
}

#routine-screen .exercise-list > .scroll-box {
    height: 100%;
    overflow-y: auto;
    overflow-x: clip;
}

#routine-screen .exercise-list > hr {
    padding: 0;
    border-top: calc(2 * var(--pix)) solid var(--front-color);
    margin-left: calc(0.85 * var(--mg));
    margin-right: calc(1 * var(--mg));
}

#routine-screen .exercise-list > h1 {
    font-size: 0.8em;
    font-weight: bold;
    margin-left: var(--mg);
}

#routine-screen .exercise-item {
    padding: 0.35ch;
    padding-left: 3ch;
    padding-right: 3ch;
    margin: 0;

    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
}

#routine-screen .exercise-item.selected {
    background-color: var(--blue);
}

#routine-screen .exercise-item.selected > .kbd-num {
    font-size: 0.75em;
    position: absolute;
}

#routine-screen .exercise-item.selected .kbd-num.left-side { left: 0; }
#routine-screen .exercise-item.selected .kbd-num.right-side { right: 0; }

#routine-screen .exercise-item .user-menu {
    font-size: 0.4em;

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

    min-width: 5ch;
    height: 4ch;
    margin-right: 1ch;
}

#routine-screen .exercise-item .user-menu a {
    border: calc(2 * var(--pix)) solid var(--front-color);
    border-radius: 100%;
    padding: 0.8ch;
}

#routine-screen .exercise-item > a > h1 {
    position: relative;
    padding-left: 1ch;
}

#routine-screen .exercise-item > a > h1::after {
    --bullet-size: calc(1ch / 2);

    position: absolute;
    top: calc(50% - var(--bullet-size) / 2);
    left: 0;

    width: var(--bullet-size);
    height: var(--bullet-size);
    border-radius: 100%;
    background-color: var(--front-color);
    content: "";
}

#routine-screen .exercise-item > a > h1 {
    font-size: 0.6em;
    margin: 0;
}

#routine-screen .exercise-item a.btn-calib.ready   { color: var(--green); }
#routine-screen .exercise-item a.btn-calib.missing { color: var(--red); }

#routine-screen .actions {
    grid-area: actions;

    display: flex;
    flex-direction: row;
    gap: 1ch;
}

#routine-screen .actions > a {
    --bg-color: var(--front-color);
    --fg-color: var(--base-color);

    color: var(--fg-color);
    background-color: var(--bg-color);
    font-weight: bold;

    flex: 1 1 0px;
    justify-content: center;
    border-radius: 2ch;
    padding: 0 2ch;
    min-width: 0;
    white-space: nowrap;
}

#routine-screen .actions > a .link-text {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

#routine-screen .actions .disabled {
    --fg-color: var(--base-color);
    --bg-color: var(--dimm-color);

    cursor: default;
}

#routine-screen > .message-dlg {
    --dlg-size: 35em;

    grid-area: exercises;
}

#routine-screen > .tips-box {
    position: absolute;
    top: calc(var(--header-h) + 3ch);
    left: 0;
    width: 25vw;

    background-color: var(--blue);
    border: calc(2 * var(--pix)) solid;
    border-radius: 1ch;
    padding: 1ch;
}

#routine-screen > .tips-box > h1 {
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 0.8ch;
}

#routine-screen > .tips-box > p {
    font-size: 0.7em;
    line-height: 1em;
    margin-left: 0.7ch;
}

#routine-screen > .tips-box > button.close {
    color: var(--front-color);
    text-shadow: none;
    opacity: 1;
    font-weight: normal;

    position: absolute;
    top: 0.5ch;
    right: 0.7ch;

    display: flex;
    gap: 0.4ch;
    align-items: center;
}

#recalib-dlg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;

    backdrop-filter: blur(1ch);
}

#recalib-dlg .message-dlg {
    --dlg-size: 45em;

    width: var(--dlg-size);
    font-size: calc(var(--dlg-size) / 120);

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

#recalib-dlg .message-dlg:has(.link-text > b) {
    --dlg-size: 55em;
}

#recalib-dlg .buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 1em 1em;
    gap: 1em;
}

#recalib-dlg .buttons form {
    padding: 0;
    margin: 0;
    display: flex;
    align-items: stretch;
}

#recalib-dlg .buttons button {
    border: none;
    align-self: initial;
    display: flex;
    align-items: center;
    cursor: pointer;
    line-height: 1em;
}

#recalib-dlg .buttons button .link-text {
    display: flex;
    align-items: center;
    gap: 1ch;
}


/* -- CALLS PAGE --------------------------------------------------------------------- */
#calls-screen {
    width: 100%;
    height: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "home     name"
        "contacts contacts";

    align-items: center;
    justify-items: center;
}

#calls-screen input {
    padding: calc(2 * var(--pix));
}

#calls-screen .contact-list {
    grid-area: contacts;

    display: flex;
    gap: 1em;
    flex-direction: row;
    justify-content: space-evenly;
}

#calls-screen .contact-list > a {
    display: block;
    position: relative;
    border: var(--button-border) solid var(--front-color);
    border-radius: 1ch;
    flex: 1 1 ;
    padding: 1em 0 0 0;
    width: 20vw;

    cursor: pointer;
}

#calls-screen .contact-list > a.main > span {
    border-top: calc(10 * var(--pix)) solid var(--red);
}

#calls-screen .contact-list > a:not(.main) > span {
    border-top: calc(10 * var(--pix)) solid var(--base-color);
}

#calls-screen .contact-list > a > :first-child {
    display: flex;
    width: 100%;
    font-size: 3em;
}

#calls-screen .contact-list > a > span:not(.kbd-num) {
    display: block;
    text-align: center;
    margin-top: 2ch;
    padding: 0.5ch;

    text-transform: capitalize;

    background-color: var(--front-color);
    color: var(--base-color);
    font-weight: bold;
    font-size: 0.9em;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom-left-radius: 0.9ch;
    border-bottom-right-radius: 0.9ch;
}

#calls-screen .contact-list > a > .kbd-num {
    position: absolute;
    bottom: -2em;
    left: 50%;
    border-top: 0 !important;
    transform: translateX(-50%);
}

#calls-screen > .error-window {
    --dlg-size: 30em;

    grid-area: contacts;

    position: fixed;
    z-index: 100;

    display: flex;
    justify-content: center;
}

#calls-screen > .error-window > .message-dlg {
    background-color: var(--base-color);
}

#calls-screen > .error-window input {
    border: 0;
    outline: 0;
    background-color: transparent;
    border-bottom: calc(2 * var(--pix)) solid var(--front-color);
    color: var(--marine);
    font-size: 2.5em;
    width: 18ch;
    margin: 0 auto 0.4em;
}

#calls-screen > .error-window .button-bar {
    display: flex;
    gap: 3em;
    justify-content: center;
    margin: .5em 0 0.2em;
}

#calls-screen > .error-window .button-bar button {
    margin-top: 0;
    padding: 0.4em;
    width: 10ch;
    border: 0;
}

#calls-screen > .error-window .numpad-kbd {
    margin-bottom: -1em;
    padding: 1.5em 0 1.2em 0;

    display: grid;
    justify-content: center;
    gap: 0.7em;
    grid-template-columns: auto auto auto auto;
}

#calls-screen > .error-window .numpad-kbd button.key {
    background-color: var(--light-color);
    border: none;
    border-radius: calc(5 * var(--pix));
    font-size: 2.3em;
    color: var(--base-color);

    width: 2.4em;
    height: 1.7em;
    margin: 0;
    padding: 0;
}

#calls-screen > .error-window .numpad-kbd button.key:active {
    transition: none;
}

#calls-screen > .error-window .numpad-kbd button.key.key-alt {
    background-color: #2B4355;
    color: var(--front-color);
}

#calls-screen > .error-window .numpad-kbd button.key.key-del {
    background-color: #6E2A3A;
    color: var(--front-color);
}


/* -- NUTRITION PAGE ----------------------------------------------------------------- */
#nutrition-screen {
    width: 100%;
    height: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "home     name"
        "videos videos";

    align-items: center;
    justify-items: center;
}

#nutrition-screen .loading-message {
    grid-area: videos;
}

#nutrition-screen .loading-message.pulsing {
    color: var(--dimm-color);
    animation: fadeIn;
    animation-duration: 3s;
}

#nutrition-screen .dlg-error-message {
    grid-area: videos;
    font-size: 0.7rem;
}

#nutrition-screen .video-list {
    width: 100%;
    height: 100%;
    grid-area: videos;
    margin-top: 0.2em;
    font-size: 1.5rem;

    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    overflow-y: auto;
}

#nutrition-screen .video-list > .featured {
    width: 30%;
    height: fit-content;
    min-height: 100%;
    border: calc(2 * var(--pix)) solid gray;
    background-color: rgb(46, 46, 46);
    padding: 0.3em;
    border-radius: 0.2em;

    display: flex;
    flex-direction: column;
}

#nutrition-screen .video-list > .featured > h3 {
    font-weight: bold;
    font-size: 0.65em;
    margin-top: -0.2em;
}

#nutrition-screen .video-list > .other {
    width: 70%;
    display: grid;
    align-self: start;

    margin: 1em 0.4em;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.4em;
}

#nutrition-screen .video-list > .other.empty {
    display: block;
    margin-top: 35vh;
    text-align: center;
}

#nutrition-screen .video-item {
    margin: 0.3em 0.3em 0.6em;
    border: 0.25ch solid transparent;
    cursor: pointer;
}

#nutrition-screen .video-item.selected {
    border: 0.25ch solid var(--light-blue);
    border-radius: 0.3em;
    background-color: var(--blue);
}

#nutrition-screen .video-item > .video-thumb {
    position: relative;
}

#nutrition-screen .video-item > .video-thumb > img {
    width: 100%;
    border-radius: 0.3em;
}

#nutrition-screen .video-item.selected > .video-thumb > img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

#nutrition-screen .video-item > .video-title {
    margin-top: 0.1em;
    font-size: 0.75em;
    line-height: 1.1em;
    display: inline-block;
    padding: 0.25ch;
    min-height: 5ch;

    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;

    @supports (-webkit-line-clamp: 2) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: initial;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
}

#nutrition-screen .video-item .video-duration {
    background-color: black;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.1em 0.3em;
    border-radius: 0.5em;
    position: absolute;
    right: 0.6em;
    bottom: 0.6em;
}

#nutrition-screen .video-player {
    position: absolute;
    top: 0;
    left: 0;

    width: 100%;
    height: 100%;
    overflow: hidden;
    backdrop-filter: blur(1ch);
    display: flex;
}

#nutrition-screen .video-player > video {
    width: 100%;
}

#nutrition-screen .video-player .close-button {
    position: absolute;
    top: 0;
    right: 1em;

    color: var(--base-color);
    background-color: var(--front-color);
    text-transform: uppercase;
    font-size: 0.5em;
    font-weight: bold;
    margin-top: 0.5em;
    padding: 0.3em 1.5em;
    border-radius: 1em;
    align-self: center;
}

#nutrition-screen .kbd-wasd {
    position: absolute;
    left: 50%;
    top: 0.5ch;
    transform: translateX(-50%);
}


/* -- RUN PAGE ----------------------------------------------------------------------- */
#run-screen .timer-msg {
    position: absolute;
    left: 1ch;
    bottom: 0;

    font-size: 0.6em;
}


/* -- COMMON TO CALIBRATION / RUN PAGES ---------------------------------------------- */
#calibrate-screen,
#run-screen {
    width: 100%;
    padding: 0.5ch;

    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas:
        "r-name btn  e-name"
        "info   info info";

    align-items: center;
    justify-items: center;
    background-color: black;
}

body:has(#calibrate-screen),
body:has(#run-screen) {
    background-color: transparent;
    height: auto;
}

#calibrate-screen .message-dlg,
#run-screen .message-dlg {
    --dlg-size: 34em;
}

#calibrate-screen .routine-name,
#run-screen .routine-name {
    grid-area: r-name;

    font-size: 0.9em;
    justify-self: start;

    width: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 2ch;
}

#calibrate-screen .exercise-name,
#run-screen .exercise-name {
    grid-area: e-name;

    font-size: 0.9em;
    justify-self: end;
    text-align: end;

    width: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 2ch;
}

#run-screen .button-bar {
    display: flex;
    gap: 0.7ch;
}

#calibrate-screen .exit-button,
#paused-exercise .pause-btn,
#run-screen .button-bar a {
    color: var(--base-color);
    text-transform: uppercase;
    font-size: 0.7em;
    font-weight: bold;

    background-color: var(--front-color);
    border-radius: 2ch;
    padding: 0 2ch;
}

#run-screen .button-bar a {
    padding: 0 1ch;
}

#run-screen .button-bar a.run-next {
    background-color: var(--orange);
    color: white;
}

#run-screen .button-bar a.pause-btn,
#paused-exercise .pause-btn {
    background-color: var(--light-blue);
    color: white;
}

#run-screen .button-bar a.pause-btn .kbd-num,
#run-screen .button-bar a.run-next .kbd-num,
#paused-exercise .pause-btn .kbd-num {
    color: white;
}

#run-screen .button-bar .link-text {
    display: flex;
    align-items: center;
}

#paused-exercise {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1ch;
    margin-top: 2ch;
}

#paused-exercise > b {
    font-size: 2em;
    padding-top: 1ch;
}

#paused-exercise .pause-btn {
    font-size: 1.4rem;
    padding: 0.75ch 2ch;
}

#dlg-error-message,
#dlg-connect-message,
#paused-exercise {
    grid-area: info;

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

.dlg-confirm-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(1ch);

    display: flex;
    justify-content: center;
    z-index: 100;
    font-size: 0.8rem;
}

.dlg-confirm-message > .message-dlg {
    width: 50%;
}

.dlg-confirm-message .button-box {
    display: flex;
    justify-content: center;
    gap: 3ch;
}

#eci-container {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: none;

    z-index: -10;
}

#results {
    grid-area: info;
    margin-top: 3ch;

    width: 100%;

    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
}

#results .report {
    max-width: 50vw;
}

#results .report h1 {
    font-weight: bold;
    margin: 0;
    padding-left: 1rem;
}

#results .report hr {
    margin: 0;
    height: calc(2 * var(--pix));
    width: 85%;
    border: 0;
    background-color: var(--front-color);
}

#results .report .iter-time {
    width: max-content;
    padding-left: 1rem;

    display: grid;
    grid-template-rows: 1fr 1fr;
    grid-template-columns: 1fr 1fr;
    column-gap: 1ch;

    align-items: center;
    justify-items: center;
}

#results .report .iter-time .right-align {
    justify-self: end;
}

#results .report .iter-time .left-align {
    justify-self: start;
}

#results .report .details {
    padding-left: 1rem;
    font-size: 0.8em;
    color: var(--dimm-color);

    padding-top: 2ch;
    line-height: 1.5em;
}

#results .report .details > div {
    position: relative;
    padding-left: 1.5ch;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#results .report .details > div::before {
    content: "";
    position: absolute;
    left: 0;
    top: calc(2ch / 2);

    width: 0.8ch;
    height: 0.8ch;

    background-color: var(--dimm-color);
    border-radius: 100%;
}

#results .report .next-exercise {
    margin-top: 1ch;
}

#results .report .next-exercise span {
    font-weight: bold;
    padding-left: 1rem;
    color: var(--orange);
}

#results .congrats {
    font-family: "Roboto-Condensed";
    font-size: 0.6rem;

    border: var(--button-border) solid var(--front-color);
    border-radius: calc(35 * var(--pix));

    margin-bottom: 3em;
    height: max-content;

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

#results .congrats .stars {
    font-size: 2em;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-content: center;
    align-items: center;
}

#results .congrats .stars > * {
    padding: 0.6em;
    margin-top: 2ch;
}

#results .congrats .star-right,
#results .congrats .star-left {
    width: 3.5em;
}

#results .congrats .star-center {
    background-color: var(--front-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2em;
}

#results .congrats .star-center img {
    width: 3.7em;
}

#results .congrats h1 {
    text-transform: uppercase;
    font-weight: bold;
    font-size: 4.5em;
    color: var(--front-color);
}

#results .congrats hr {
    height: calc(1 * var(--pix));
    width: 80%;
    background-color: var(--front-color);
    margin: 2em;
    border: 0;
}

#results .congrats h2 {
    text-align: center;
    font-style: italic;
    font-size: 2.5em;
    width: 75%;
    padding-bottom: 1em;
}

#results .congrats a {
    position: relative;
    bottom: -1.1em;
    font-size: 2.2em;
    font-weight: bold;

    color: var(--base-color);
    background-color: var(--front-color);
    border-radius: calc(15 * var(--pix));

    padding: 0.3em 0.8em;
    z-index: 10;
}

#results .congrats a.finished {
    position: relative;
    bottom: 0.70em;
    font-size: 2.6em;
    font-weight: bold;
    color: var(--green);
    background-color: initial;
    border-radius: calc(15 * var(--pix));
    padding: 0.3em 0.8em;
    z-index: 10;
}


/* -- REMOTE CONTROLS ---------------------------------------------------------------- */
.kbd-num {
    color: var(--light-blue);
    font-family: monospace;
    font-weight: normal;
}


/* -- EMBEDDED EXTERNAL APPS --------------------------------------------------------- */
#dock-top {
    width: 100%;
    max-height: 10vh;
    height: min-content;
    border: none;
    overflow: hidden;
}

#dock-top.floating {
    position: absolute;
    width: 95vw;
    left: 50%;
    top: 0;
    transform: translateX(-50%) !important;
    border: 2px solid white;
    border-bottom-left-radius: 1ch;
    border-bottom-right-radius: 1ch;
    height: 85vh;
    border-top: none;
    max-height: inherit;
    z-index: 100;
}

#dock-main {
    width: 100vw;
    height: 100vh;
    border: none;
}

#ai-agent-overlay {
    --items-space: 0.4ch;

    position: absolute;
    bottom: 1ch;
    right: 1ch;
    z-index: 9999;

    display: flex;
    gap: var(--items-space);
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 1rch 0;

    animation-duration: 0.2s;
}

#ai-agent-overlay.active {
    width: 100%;
    bottom: 0;
    right: 0;

    background-color: var(--xt-dark-color);
    border-top: 0.20ch solid white;
}

#ai-agent-overlay:not(.active) {
    min-height: 5.6rem;
    bottom: 0;
    padding-bottom: 0;
    padding-top: 2ch;
    box-sizing: content-box;
}

#ai-agent-overlay > .text-feedback {
    width: 60%;
    display: flex;
    flex-direction: row;
    align-items: center;
}

#ai-agent-overlay > .text-feedback .input-group {
    margin: 0 !important;
}

#ai-agent-overlay > .text-feedback input {
    background-color: var(--dark-color);
    border: calc(2.1 * var(--pix)) solid white !important;
    border-radius: 4ch;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none !important;
    font-weight: bold;
    color: var(--light-color);
    font-size: 1.4rem;
    height: 2.7rem;
}

.app.close-button {
    border: calc(2.1 * var(--pix)) solid var(--red);
    background-color: var(--red-dark);
    border-radius: 50%;
    cursor: pointer;
    color: white;
    margin-left: var(--items-space);
    padding: 0;

    width: 2.5rem;
    height: 2.5rem;

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

#ai-agent-overlay .listening {
    background-color: var(--dark-color);
    border: calc(2 * var(--pix)) solid white !important;
    border-radius: 4ch;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none !important;
    height: 2.7rem;
    padding: 0.5ch 0 0.5ch 0.8ch;
}

#ai-agent-overlay:not(.active) > .text-feedback {
    display: none;
}

#ai-agent-overlay #ai-icon {
    --icon-size: 3ch;

    position: relative;
}

#ai-agent-overlay.active #ai-icon {
    --icon-size: 4ch;
}

#ai-agent-overlay #ai-icon > img {
    width: var(--icon-size);
    height: var(--icon-size);
    border: 0.25ch solid white;
    border-radius: 50%;
    cursor: pointer;
}

#ai-agent-overlay #ai-icon > img.waiting {
    border-color: var(--status-wait);
}

#ai-agent-overlay.disabled #ai-icon > img {
    border-color: var(--bubble-error);
}

#ai-agent-overlay .speech-bubble {
    --bg-color: var(--bubble-normal);

    height: fit-content;
    width: max-content;
    background: var(--bg-color);

    position: absolute;
    bottom: calc(var(--icon-size) - 5ch);
    right: calc(var(--icon-size) * 2.6);

    padding: 1.5rch;
    font-size: 0.8rem;
    margin-right: 1.5rch;

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

    border: calc(2.6 * var(--pix)) solid white;
    border-radius: 1rem;

    animation-duration: 0.5s
}

#ai-agent-overlay.active .speech-bubble {
    right: auto;
    bottom: 15ch;
    margin-right: 0;
    transform: translateX(calc(-50% + 4.5ch));
}

#ai-agent-overlay.active .speech-bubble:after {
    border-bottom: inherit;
    border-right: inherit;
    border-top: 0;
    left: calc(50% - 0.25rem);
    bottom: -0.61rem;
}

#ai-agent-overlay .speech-bubble.error {
    --bg-color: var(--bubble-error);
}

#ai-agent-overlay .speech-bubble:after {
    content: "";
    position: absolute;
    left: calc(100% - 0.43rem);
    height: 1rem;
    width: 1rem;
    background: var(--bg-color);
    transform: rotate(45deg);
    border-top: inherit;
    border-right: inherit;
    box-shadow: inherit;
}

#ai-agent-overlay .speech-bubble > h1 {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0;
}