body {
    color: var(--default-black);
    margin: 0;
    font-family: "Söhne", "ui-sans-serif", "system-ui", "-apple-system", "Segoe UI", "Roboto", "Ubuntu", "Cantarell", "Noto Sans", "sans-serif", "Helvetica Neue", "Arial", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "KaiTi";
}
.view {
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    width: 100dvw;
    display: grid;
    grid-template-rows: auto 1fr; /* heading study-screen-parent */
    place-items: center;
}

/* Title bar */
.title-bar {
    width: 100%;
    background-color: var(--default-blue);
    color: #FFFFFF;
    display: grid;
    align-items: center; /* So that the menu icon and title text line up correctly. */
    grid-template-columns: auto 1fr auto;
    column-gap: 0.5em;
}

.menu-icon-container {
    cursor: pointer;
    width: 3rem;
    height: 3rem;
    display: grid;
    justify-items: center;
    align-items: center;
}
.menu-icon {
    font-size: 2rem;
    padding-bottom: 0.2rem; /* Adjusts for the fact that the menu icon character has more space above than below within the font. */
}

.title-container {
    width: 100%;
    display: grid;
    justify-items: left;
    align-items: center;
}
.title {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 2rem;
    font-weight: 500;
/*    letter-spacing: -0.5px;*/
}

.brand-link { color: inherit; text-decoration: none; }

.fullscreen-button-container {
    cursor: pointer;
    width: 3rem;
    height: 3rem;
    display: grid;
    justify-items: center;
    align-items: center;
}
.fullscreen-button-image {
    width: 3rem;
    height: 3rem;
}

.study-screen-parent{
    width: 100%;
    height: 100%;
}
.loading {
    width: 100%;
    height: 100%;
    place-items: center;
    display: grid;
}

/*****************************/
/* Study Screen */
/*****************************/


.study-screen {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto; /* skill-chooser skill-study-holder button-bar */
    place-items: center;
}

/********* Skill Study Component *********/

.study-session-holder {
    width: 100%;
    height: 100%;
}

.study-session-loading {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.skill-study {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    grid-template-rows: auto auto 1fr;
    row-gap: 0.5em;
}

/******* Status Bar ***********/
.status-bar {
    width: 100%;
    box-sizing: border-box; /* Ensures the border doesn't affect the element's dimensions */
    display: grid;
    place-items: center;
    grid-template-columns: auto 1fr;
    column-gap: 1em;
}
.vocab-chooser {
    padding-left: 0.5em;
    display: grid;
    place-items: center;
    grid-template-columns: auto auto;
    column-gap: 0.5em;
}
.integer-chooser {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--light-grey);
    border-radius: 4px;
}
.integer-chooser button {
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.1em 0.5em;
}
.integer-chooser input {
    padding: 0 0.5em;
    border: none;
    background: none;
    text-align: center;
    color: var(--default-black);
}
/* Hidden span for measuring the text width in the input above.
   Any styles that affect the size should match. */
.integer-chooser-measure {
    visibility: hidden;
    position: absolute;
    height: auto;
    width: auto;
    white-space: nowrap;
    border: none;
    background: none;
    text-align: center;
}

.vocab-state-summary {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
}
.vocab-state-summary .vocab {
    height: 100%;
    display: grid;
}
.vocab-state-summary .vocab div {
    align-self: center;
    justify-self: right;
    padding-right: 0.5em;
}
.vocab-state-summary .unseen {
    background-color: var(--pastel-yellow);

}
.vocab-state-summary .urgent {
    background-color: var(--pastel-red);
}
.vocab-state-summary .stable {
    background-color: var(--pastel-green);
}

/*********** Token add rate slider ************/

.token-add-rate {
    width: 100%;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    padding: 0 0.5em;
    box-sizing: border-box;
}

.slider-container {
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.slider {
    width: 100%;
    height: 20px;
    display: grid;
    position: relative;
    cursor: grab;
}

.slider-track {
    width: 100%;
    height: 5px;
    place-self: center;
    background-color: var(--light-grey);
    border-radius: 5px;
}

.slider .slider-handle {
    width: 20px;
    height: 20px;
    background-color: var(--default-blue);
    border-radius: 50%;
    position: absolute;
    /* We use translate here because the ordinary coordinates are controlled by JavaScript. */
    transform: translate(-10px, -10px);
}

/********** Challenge ************/

.challenge-holder {
    width: 100%;
    height: 100%;
/*    padding: 0.5em;*/
    box-sizing: border-box;
    display: grid;
    grid-template-rows: 1fr;
    place-items: center;
}
.challenge {
    /* Fallback value for older browsers */
    font-size: calc(max(
        1rem,
        min(4vw, calc(9vh - 0.99rem)), 
        min(5vw, calc(8vh - 0.88rem)), 
        min(7vw, calc(7vh - 0.77rem)),
        min(8vw, calc(6vh - 0.66rem)),
        min(9vw, calc(5vh - 0.55rem))
    ) * var(--study-text-scale, 1));
    /* Preferred value for newer browsers */
    font-size: calc(max(
        1rem,
        min(4dvw, calc(9dvh - 0.99rem)), 
        min(5dvw, calc(8dvh - 0.88rem)), 
        min(7dvw, calc(7dvh - 0.77rem)),
        min(8dvw, calc(6dvh - 0.66rem)),
        min(9dvw, calc(5dvh - 0.55rem))
    ) * var(--study-text-scale, 1));
    line-height: 1.5em;

    display: grid;
    grid-template-columns: 2em 1em 1fr 0.5em;
    grid-template-rows: auto 1px auto;
    row-gap: 1em;
}

.challenge .vertical-line {
    width: 100%;
    border-left: 1px solid;
    grid-column: 2;
    grid-row: 1 / -1;
}
.challenge .spacer {
    height: 100%;
    grid-column: 1 / -1;
}
.challenge .spacer.top {
    grid-row: 1;
}
.challenge .spacer.middle {
    grid-row: 2;
    grid-column: 3;
    border-bottom: 1px solid;
}
.challenge .spacer.bottom {
    grid-row: 5;
}

.challenge .answer-hint {
    grid-row: 3;
    grid-column: 3;
    text-align: left;
    font-style: italic;
    color: var(--default-grey);
}
.challenge .answer-hint.invisible {
    visibility: hidden;
}


.snippet {
    grid-column: 1 / 4;
    display: grid;
/*    grid-template-columns: subgrid;*/
    grid-template-columns: 2em 1em 1fr;
    row-gap: 0.5em;
}
.snippet.question {
    margin-top: 1em;
    grid-row: 1;
}
.snippet.answer {
    margin-bottom: 1em;
    grid-row: 3;
}

.snippet.hidden {
    display: none;
}
.snippet.invisible .line {
    visibility: hidden;
}
.snippet.invisible .audio {
    visibility: hidden;
}

.audio-control {
    font-size: 0; /* stops the div from expanding beyond the height of the button it contains */
}
.audio-control button {
    padding-left: 2rem;
    padding-right: 2rem;
}

.line {
    grid-column: 1 / -1;
    display: grid;
/*    grid-template-columns: subgrid;*/
    grid-template-columns: 2em 1em 1fr;
}
.line-structure {
    width: 100%;
    height: 100%;
    grid-column: 1;
    display: grid;
    place-items: center;
    font-size: 1em;
    font-weight: bold;
    line-height: 1; /** for better centering of the symbol */
}
.line-structure.selectable {
    cursor: pointer; 
}
.line-structure.selectable.selected {
    background-color: var(--pastel-red);
}
.line-copy-button {
    width: 100%;
    height: 100%;
    grid-column: 1;
    display: grid;
    place-items: center;
    font-size: 1em;
    font-weight: bold;
    line-height: 1; /** for better centering of the symbol */
    cursor: pointer;
    transition: transform 0.15s;
}
.line-copy-button.clicked {
    transform: scale(1.2);
}
.line .line-text {
    width: 100%;
    height: 100%;
    grid-column: 3;
}
.line-text {
    justify-items: left;
    text-align: left;
}
.segment {
    cursor: auto;
}
.segment.unseen {
/*    text-decoration: underline;*/
/*  using they border for underlining; this results in consistent positioning at the bottom of the selected/highlighted sections */
    border-bottom-style: solid;
}
.segment.notblank {
    white-space: nowrap; /* Prevents wrapping in the middle of Chinese words */
}
.segment.selectable {
    cursor: pointer;
}
.segment.selectable.selected {
    background-color: var(--pastel-red);
/*    text-decoration: underline;
    text-underline-offset: 0.2em;*/
}
.disable-user-select {
    user-select: none;
}
/* .cropped-punctuation {
    display: inline-block;
    vertical-align:top;
    width: 0.5em;
    overflow: hidden;
} */



/******** Skill Chooser ***********/



.skill-chooser {
    width: 100%;
    display: flex;
    gap: 0.5em;
    padding: 0.5em 0.5em 0em 0.5em;
    margin-bottom: 0.5em;
    border-bottom: 1px solid var(--default-blue);
    box-sizing: border-box; /* Ensures the border doesn't affect the element's dimensions */
}

.custom-tab {
    box-shadow: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    text-align: center;
    margin: 0;
    padding: 0;
    padding-left: 10px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    user-select: none;
    background-color: white;
    color: var(--default-blue);
    border: 1px solid var(--default-blue);
    border-bottom: 0px none;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    display: block;
    width: 100%;
    height: 2em;
    line-height: 2rem;
    transition: all 0.3s ease;
    box-sizing: border-box; /* Ensures the border doesn't affect the element's dimensions */
}

/* Checked */
.custom-tab.selected {
    background-color: var(--default-blue);
    color: #ffffff;
    border-width: 1px;
}



/******** Button Bar *********/

.button-bar.question.hidden {
    display: none;
}

.button-bar.answer.hidden {
    display: none;
}

.button-bar {
    width: 100%;
    text-align: center;

    padding: 0.5em;
    box-sizing: border-box; /* width and height include padding */
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 0.5rem;
    text-justify: center;
    text-align: center;
}

button {
    font-size: 1rem;
    margin: 0;
    background-color: var(--default-blue);
    color: #ffffff;
    padding: 0;
    text-decoration: none;
    text-align: center;
    border: none;
    border-radius: 3px;
    box-shadow: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.custom-button {
    height: 3rem;
    line-height: 3rem;
    border-radius: 5px;
 }

button:active {
    background-color: var(--active-blue);
}

button:disabled {
    background-color: var(--light-grey);
    cursor: auto;
}

/** Hover styles. Only show them when the device actually supports hover,
    otherwise they can get displayed on click instead, which looks bad. **/
@media (hover:hover) {
    .line-structure.selectable:hover {
        background-color: var(--light-grey);
    }
    .line-structure.selectable.selected:hover {
        background-color: var(--hover-red);
    }
    .segment.selectable:hover {
        background-color: var(--light-grey);
    }
    .segment.selectable.selected:hover {
        background-color: var(--hover-red);
    }
    button:hover {
        background-color: var(--hover-blue);
    }
    button:active:hover {
        background-color: var(--active-blue);
    }
    button:disabled:hover {
        background-color: var(--light-grey);
        cursor: auto;
    }
}
