html {
    -webkit-text-size-adjust: 100%;
    --bottom-banner-height: 4rem;
    --ink: #172033;
    --navy: #202844;
    --paper: #fff8e8;
    --paper-deep: #f3e5c7;
    --board: #8585ad;
    --board-deep: #70749b;
    --coral: #d95749;
    --sky: #87c9e8;
    --gold: #efd271;
    --green: #9bd58f;
    --shadow: rgba(23, 32, 51, 0.34);
    overflow-x: clip;
}

body {
    min-height: 100dvh;
    margin: 0;
    color: var(--ink);
    background-color: var(--board);
    background-image: none;
    overflow-x: clip;
}

@font-face {
    font-family: Montserrat;
    src: url(../assets/fonts/Montserrat-VariableFont_wght.ttf) format("truetype");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: Montserrat;
    src: url(../assets/fonts/Montserrat-Italic-VariableFont_wght.ttf) format("truetype");
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
}

div {
    font-family: Montserrat, sans-serif;
}

h1,
button,
label,
textarea,
p,
h2,
h3,
h4,
#calendar_year,
#calendar_year_label,
.notification_app_name,
.notification_text,
.notification_time  {
    font-family: Montserrat, sans-serif;
}

button {
    background-color: transparent;
    background-repeat:no-repeat;
    border: none;
    box-sizing: border-box;
    cursor:pointer;
    object-fit: contain;
    padding: 0;
}

button:focus-visible,
#back_button:focus-visible {
    outline: 3px solid var(--gold);
    outline-offset: 4px;
}

.button_img {
    width: 100%;
    height: 100%;
}

#title {
    position: absolute;
    top: clamp(0.5rem, 1.5vmin, 1rem);
    left: calc(clamp(3rem, 10vmin, 5.5rem) + 1.25rem);
    right: calc(clamp(4rem, 15vmin, 7rem) + 1.25rem);
    min-width: 0;
    min-height: clamp(3.5rem, 12vmin, 6.5rem);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.45rem clamp(0.5rem, 2vw, 1.5rem);
    color: var(--ink);
    font-size: clamp(1rem, 3.8vmin, 3.1rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: 0;
    overflow-wrap: anywhere;
    text-align: center;
    text-wrap: balance;
}

#back_button {
    position: absolute;
    top: clamp(0.65rem, 1.5vmin, 1rem);
    left: clamp(0.65rem, 1.5vmin, 1rem);
    z-index: 4;
    width: clamp(3rem, 10vmin, 5.5rem);
    height: clamp(3rem, 10vmin, 5.5rem);
    transition: transform 160ms ease, filter 160ms ease;
    filter: drop-shadow(0 5px 5px var(--shadow));
}

#back_button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#back_button:hover {
    transform: translateY(-2px);
    filter: drop-shadow(0 8px 6px var(--shadow));
}

#back_button:active {
    transform: translateY(2px);
    filter: drop-shadow(0 2px 3px var(--shadow));
}

#calendar_button{
    position: absolute;
    top: clamp(0.5rem, 1.5vmin, 1rem);
    right: clamp(0.5rem, 1.5vmin, 1rem);
    z-index: 2;
    width: clamp(4rem, 15vmin, 7rem);
    height: clamp(4rem, 15vmin, 7rem);
    filter: drop-shadow(0 8px 8px var(--shadow));
    transition: transform 160ms ease, filter 160ms ease;
}
#calendar_button:hover {
    transform: translateY(-3px) rotate(1deg);
    filter: drop-shadow(0 12px 10px var(--shadow));
}
#calendar_button:active {
    transform: translateY(2px);
    filter: drop-shadow(0 3px 4px var(--shadow));
}

#canvas {
    position: absolute;
    left: 50%;
    top: clamp(6.5rem, 16dvh, 9.5rem);
    bottom: calc(var(--bottom-banner-height) + 0.75rem);
    width: min(94%, 68rem);
    min-height: 18rem;
    transform: translateX(-50%);
}

#canvas.canvas_flow {
    position: relative;
    left: auto;
    top: auto;
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.75rem, 2dvh, 1.25rem);
    min-height: 0;
    margin: clamp(6.5rem, 16dvh, 9.5rem) auto 0;
    padding-bottom: calc(2rem + var(--bottom-banner-height));
    transform: none;
}

/* Home Buttons */
.home_button {
    position: absolute;
    overflow: hidden;
    background-color: var(--sky);
    background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.36), transparent 52%);
    border: 2px solid rgba(23, 32, 51, 0.72);
    width:40%;
    height:40%;
    border-radius: 7px;
    justify-items: center;
    align-items: center;
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.28),
        0 7px 0 #59677b,
        0 14px 24px var(--shadow);
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.home_button:hover {
    background-color: #9bd5ed;
    transform: translateY(-4px);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.36),
        0 10px 0 #59677b,
        0 18px 28px var(--shadow);
}

.home_button:active {
    transform: translateY(4px);
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.24),
        0 2px 0 #59677b,
        0 6px 12px var(--shadow);
}

.home_button_img {
    position: absolute;
    width: 80%;
    height: 80%;
    object-fit: contain;
    margin: auto;
}

/* Shadow */
.shadow_perspective {
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 9px 7px rgba(23, 32, 51, 0.38));
    transition: transform 180ms ease, filter 180ms ease;
}

.home_button:hover .shadow_perspective {
    transform: translate(-50%, -52%) scale(1.025);
    filter: drop-shadow(0 11px 8px rgba(23, 32, 51, 0.34));
}

.home_button:active .shadow_perspective {
    transform: translate(-50%, -49%) scale(0.99);
    filter: drop-shadow(0 4px 4px rgba(23, 32, 51, 0.34));
}

#letter_home_button
{
    top:5%;
    left:5%;
} 
#news_home_button
{
    top:5%;
    left:55%;
} 
#spinner_home_button
{
    top:55%;
    left:5%;
} 
#test_home_button
{
    top:55%;
    left:55%;
}

/* Letters */
.colored_letter_button {
    position: absolute;
    left: 15%;
    width: 70%;
    height: 16%;
    border: 3px solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 6px 0 #59677b, 0 12px 20px var(--shadow);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.colored_letter_button:hover {
    transform: translateY(-3px);
    box-shadow: 0 9px 0 #59677b, 0 16px 24px var(--shadow);
}

.colored_letter_button:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 #59677b, 0 6px 10px var(--shadow);
}

#letter_blue {
    top: 5%;
    background-color: var(--sky);
}
#letter_gray {
    top: 23%;
    background-color: #aeb4bd;
}
#letter_yellow {
    top: 41%;
    background-color: var(--gold);
}
#letter_green {
    top: 59%;
    background-color: var(--green);
}
#letter_gray_help {
    top: 19%;
    left: 83%;
    position: absolute;
    height: 8%;
    width: 8%;
    object-fit: contain;
    /* transform: translate(-50%, -50%) */
}
#letter_gray_help_img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 90%;
    height: 90%;
    object-fit: contain;
    /* transform: translate(-50%, -50%); */
}

.colored_letter_text {
    position: absolute;
    top: 75%;
    left: 8%;
    width: 88%;
    height: 25%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.7rem 1rem 0.7rem 2.5rem;
    color: var(--paper);
    font-size: clamp(0.9rem, 2.5vmin, 1.4rem);
    line-height: 1.55;
    background-color: rgba(32, 40, 68, 0.88);
    border: 2px solid var(--paper-deep);
    border-radius: 6px;
}

.colored_letter_text li + li {
    margin-top: 0.2em;
}

#canvas.canvas_flow .colored_letter_button {
    position: relative;
    top: auto;
    left: auto;
    width: min(88%, 48rem);
    height: clamp(5rem, 14dvh, 8rem);
}

#canvas.canvas_flow .colored_letter_text {
    position: relative;
    top: auto;
    left: auto;
    width: min(92%, 52rem);
    height: auto;
}

.colored_letter_img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80%;
    height: 80%;
    object-fit: contain;
    transform: translate(-50%, -50%);
}

#letter,
#citizenship_test {
    position: relative;
    width: min(92%, 70rem);
    box-sizing: border-box;
    margin: clamp(6.5rem, 16dvh, 9.5rem) auto 0;
    color: #20242b;
    background-color: var(--paper);
    background-image: repeating-linear-gradient(0deg, rgba(84, 69, 42, 0.025) 0 1px, transparent 1px 5px);
    background-clip: content-box;
    border-radius: 5px;
    filter: drop-shadow(0 14px 18px var(--shadow));
}

#letter {
    padding-bottom: calc(3vh + var(--bottom-banner-height));
}

#citizenship_test {
    padding-bottom: calc(5vh + var(--bottom-banner-height));
}

#citizenship_test_question_container,
.test_results {
    box-sizing: border-box;
    padding: 1rem clamp(0.5rem, 3vw, 2rem) 2rem;
}

.test_progress {
    color: var(--navy);
    font-size: clamp(1.125rem, 3vw, 1.75rem);
    font-weight: 700;
    text-align: center;
}

.test_prompt {
    margin: 1.5rem 0;
    border-block: 2px solid var(--navy);
    padding: clamp(1rem, 4vw, 2rem) 0;
}

#citizenship_test_question,
#citizenship_test_answer,
#citizenship_test_result_heading {
    font-size: clamp(1.5rem, 5vw, 3rem);
}

#citizenship_test_answer_panel {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: rgba(255, 255, 255, 0.7);
    border-left: 5px solid var(--gold);
}

.test_answer_label {
    margin-top: 0;
    color: #444;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
}

.test_actions,
#citizenship_test_grade_actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

#citizenship_test_grade_actions[hidden] {
    display: none;
}

.test_action_button {
    min-width: min(12rem, 100%);
    border: 2px solid var(--navy);
    border-radius: 4px;
    background-color: var(--paper);
    padding: 0.75rem 1.25rem;
    color: var(--navy);
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 700;
    box-shadow: 0 4px 0 rgba(23, 32, 51, 0.25);
    transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.test_action_button:hover,
.test_action_button:focus-visible {
    background-color: #edf5f8;
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.test_action_button:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(23, 32, 51, 0.25);
}

.test_right_button {
    border-color: #176b3a;
    color: #176b3a;
}

.test_wrong_button {
    border-color: #9b2929;
    color: #9b2929;
}

.test_results {
    text-align: center;
}

.test_result_icon {
    display: inline-block;
    margin-right: 0.3em;
    font-weight: 900;
}

.test_result_icon_passed {
    color: #176b3a;
}

.test_result_icon_failed {
    color: #9b2929;
}

.letter_seal {
    margin-left: 10px;
    margin-right: 10px;
    margin-top: 30px;
    width: clamp(4.5rem, 11%, 7rem);
    height: auto;
}

.letter_head {
    margin-left: clamp(1rem, 4vw, 3rem);
    margin-right: clamp(1rem, 4vw, 3rem);
    text-align: right;
}

#letter_body_div,
#pre_test_instructions {
    margin-inline: clamp(0.5rem, 3vw, 2rem);
}

#letter_footer {
    margin-left: 10px;
    margin-right: 10px;
    margin-bottom: 40px;
}

#letter_sources {
    margin-top: 2rem;
    font-size: clamp(0.9rem, 2.2vw, 1.25rem);
    line-height: 1.4;
    overflow-wrap: anywhere;
    text-align: left;
}

#letter_body_div {
    padding-block: 1rem;
    text-align: left;
}

h2, h3, h4, p {
    margin-left: 10px;
    margin-right: 10px;
    font-size: clamp(1rem, 2.6vw, 1.5rem);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

h2, h3, h4 {
    color: var(--navy);
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    line-height: 1.18;
}

.test_version_actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(0.75rem, 3vw, 1.25rem);
    width: min(90%, 34rem);
    margin: 1rem auto 0;
}

.test_version_button {
    display: grid;
    gap: 0.2rem;
    justify-items: center;
    border: 3px solid var(--navy);
    border-radius: 6px;
    background-color: var(--sky);
    background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.36), transparent 52%);
    padding: clamp(0.6rem, 2vw, 1rem);
    color: var(--ink);
    font-size: clamp(0.9rem, 2.6vw, 1.2rem);
    font-weight: 700;
    box-shadow: 0 6px 0 rgba(23, 32, 51, 0.28), 0 12px 22px var(--shadow);
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.test_version_button:hover {
    background-color: #9bd5ed;
    transform: translateY(-3px);
    box-shadow: 0 9px 0 rgba(23, 32, 51, 0.28), 0 16px 26px var(--shadow);
}

.test_version_button:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 rgba(23, 32, 51, 0.28), 0 5px 10px var(--shadow);
}

.test_version_image {
    width: 100%;
    aspect-ratio: 19 / 10;
    object-fit: cover;
    border: 2px solid var(--navy);
    border-radius: 4px;
}

.test_version_year {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 900;
    line-height: 1;
}

/* News */
.news_icon {
    position: absolute;
    width: 80vmin;
    height: 80vmin;
    left: 50%;
    top: 50dvh;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 12px 12px var(--shadow));
    background-color: transparent;
}

#news_blank {
    transition: 160ms ease transform, 160ms ease filter;
}

#news_blank:hover {
    transform: translate(-50%, calc(-50% - 4px));
    filter: drop-shadow(0 17px 14px var(--shadow));
}

#news_blank:active{
    transform: translate(-50%, calc(-50% + 3px));
    filter: drop-shadow(0 6px 7px var(--shadow));
}

.notification_num {
    position: absolute;
    left: calc(80dvw - max(0dvw, 30dvw - 30dvh));
    top: calc(20dvh + max(0dvh, 30dvh - 30dvw));
    transform: translate(-50%, -50%)
}

#notification_num1 {
    width: 20vmin;
    height: 20vmin;
}
#notification_num2 {
    width: 25vmin;
    height: 25vmin;
}
#notification_num3 {
    width: 30vmin;
    height: 30vmin;
}

#notification_container {
    position: relative;
    width: min(80%, 68rem);
    box-sizing: border-box;
    margin: clamp(6.5rem, 16dvh, 9.5rem) auto 0;
    padding-bottom: calc(3vh + var(--bottom-banner-height));
}

.notification {
    width: 100%;
    box-sizing:border-box;
    margin-top: 5%;
    margin-bottom: 5%;
    padding: 20px;
    padding-bottom: 5vh;
    color: var(--ink);
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(23, 32, 51, 0.24);
    border-radius: 18px;
    box-shadow: 0 7px 0 rgba(23, 32, 51, 0.22), 0 13px 24px var(--shadow);
    font-size: clamp(1rem, 3vw, 1.5rem);
}

.notification_icon {
    width: 1em;
    height: auto
}

.notification_app_name,
.notification_time {
    font-weight: 700;
}

.notification_time {
    float: right;
}

#calendar_year,
#calendar_year_label {
    font-weight: 700;
}

#spinner_container {
    margin-top: clamp(7rem, 18dvh, 10rem);
    height: auto;
    
    text-align: center;
    justify-items: center;
    align-items: center;
}

#spinner_svg {
    left:0%;
    right:0%;
    height:100%;
    
    width: min(90%, 65dvh);
}

.spinner_slice {
    cursor: pointer;
}

.spinner_slice:focus-visible {
    outline: none;
    stroke: var(--gold);
    stroke-width: 2;
    opacity: 0.85;
}

#spinner_results {
    width: min(92%, 58rem);
    box-sizing: border-box;
    margin: 0 auto;
    height: auto;
    color: var(--ink);
    background-color: var(--paper);
    background-clip: content-box;
    padding-bottom: calc(3vh + var(--bottom-banner-height));
    border-radius: 5px;
    filter: drop-shadow(0 12px 15px var(--shadow));
}

#spin_button {
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 5px 0 #59677b, 0 10px 18px var(--shadow);
}

#spin_button text {
    font-weight: 700;
}

#spin_button_hover {
    opacity: 0;
    transition: 0.4s ease-in-out opacity;
    border-radius: 4px;
}

#spin_button_hover:hover {
    opacity: .5;
}

#spin_button_hover:active {
    opacity: .5;
    filter: invert(100);
}

/* The Modal (background) */
.modal {
  display: block; /* Hidden by default */
  position: fixed; /* Stay in place */
    z-index: 10; /* Sit above persistent controls */
  left: 0;
    right: 0;
  top: 0;
  height: 100dvh; /* Full height */
  max-height:100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: rgba(23, 32, 51, 0.76);
    backdrop-filter: blur(3px);
}

/* Modal Content */
.modal-content {
    color: var(--ink);
    background-color: var(--paper);
    background-image: repeating-linear-gradient(0deg, rgba(84, 69, 42, 0.025) 0 1px, transparent 1px 5px);
    width: min(70rem, calc(100% - 2rem));
    box-sizing: border-box;
    margin: clamp(1rem, 10dvh, 6.25rem) auto;
  padding: 20px;
    border: 3px solid var(--ink);
    border-radius: 6px;
    box-shadow: 0 12px 0 rgba(10, 15, 28, 0.3), 0 24px 55px rgba(10, 15, 28, 0.5);
    overflow-x: hidden;
    overflow-y: auto;
}

/* The Close Button */
.close {
    width: 2.75rem;
    height: 2.75rem;
    background: var(--paper);
    color: var(--ink);
  float: right;
    border: 2px solid var(--ink);
    border-radius: 50%;
    box-shadow: 0 3px 0 rgba(23, 32, 51, 0.25);
    font-size: 1.75rem;
  font-weight: bold;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: var(--coral);
  text-decoration: none;
  cursor: pointer;
}

#popup_title_image {
    width: 100%;
    border: 2px solid var(--ink);
    border-radius: 4px;
}

#welcome_title {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    line-height: 1.2;
}

.modal_purchase {
    font-size: clamp(1rem, 3.5vw, 1.35rem);
}

.modal_news_title {
    font-size: clamp(1.35rem, 5vw, 2.25rem);
    font-weight: 700;
    line-height: 1.2;
}

.news_archive {
    font-size: 1rem;
}

.news_archive img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-inline: auto;
}

.date {
    font-size: clamp(1rem, 3vw, 1.2rem);
    text-decoration: underline;
    color: gray;
}

.modal_contact {
    font-size: clamp(0.95rem, 2.8vw, 1.1rem);
}

#bottom_banner {
    position:fixed;
    bottom:0dvh;
    left:0dvh;
    right:0;
    box-sizing: border-box;
    color: #111;
    background-color: #fff;
    border-top: 1px solid rgba(23, 32, 51, 0.3);
    box-shadow: 0 -4px 14px rgba(23, 32, 51, 0.18);
    padding-bottom:calc(1dvh + env(safe-area-inset-bottom));
    padding-top:1dvh;
    padding-left: 1rem;
    padding-right: 1rem;
    text-align: center;
    font-family: Montserrat, sans-serif;
    font-size: clamp(0.75rem, 1.8vw, 1rem);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
}

#bottom_banner a {
    font-size: inherit;
    font-weight: 650;
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

@media (max-width: 38rem) {
    #title {
        left: calc(clamp(3rem, 10vmin, 5.5rem) + 0.75rem);
        right: calc(clamp(4rem, 15vmin, 7rem) + 0.75rem);
        border-width: 2px;
    }

    .home_button {
        width: 44%;
        border-width: 2px;
    }

    #letter_home_button,
    #spinner_home_button {
        left: 2%;
    }

    #news_home_button,
    #test_home_button {
        left: 54%;
    }

    .colored_letter_button {
        left: 6%;
        width: 88%;
    }

    .colored_letter_text {
        left: 4%;
        width: 92%;
    }

    .modal-content {
        width: calc(100% - 3rem);
        margin-block: 1.5rem;
        padding: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}