/* Reset */
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
    display: block;
}

body {
    line-height: 1;
}

ol,
ul {
    list-style: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: '';
    content: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

a {
    text-decoration: none;
}



/* Root styles */
:root {

    /* Colors */
    --black: #000000;
    --white: #FFFFFF;

    --primary-white: #FAFAFA;
    --primary-black: #09090B;

    --secondary-lightgrey: #E2E8F0;
    --secondary-grey: #656565;
    --secondary-darkgrey: #27272A;
    --secondary-green: #95C198;
    --secondary-red: #e27676;

    /* Font sizes */
    --fs-xs: 0.625rem;
    --fs-s: 0.75rem;
    --fs-base: 0.875rem;
    --fs-xl: 2rem;

    /* Font weights */
    --fw-regular: 400;
    --fw-medium: 500;

    /* Line heights */
    --lh-xs: 1rem;
    --lh-base: 1.25rem;
    --lh-xl: 2.625rem;

    /* Gaps */
    --gap-200: 0.25rem;
    --gap-300: 0.5rem;
    --gap-400: 0.75rem;
    --gap-500: 1rem;
    --gap-550: 1.25rem;
    --gap-600: 1.5rem;
    --gap-700: 2rem;
    --gap-725: 2.5rem;
    --gap-750: 3rem;
    --gap-800: 4rem;
    --gap-950: 10rem;

    /* Dynamic Heights */
    --before-height: 350px;
    --list-flag-max-height: 500px; 
}


/* General styles */
html {
    font-family: Inter;
    margin: 0px 80px;
}

html, body {
    height: 100%;
}

/* Layout */
.layout-base {
    display: grid;
    position: relative;
    grid-template-columns: repeat(12, minmax(0px, 1fr));
    column-gap: 1rem;
    z-index: 2;
}

.layout-bottom {
    display: grid;
    position: absolute;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: 1.3rem;
    row-gap: 20px;
    bottom: 0;
    margin-bottom: 25px;
    width: calc(100% - 160px);
}

.second-row {
    grid-row: 2 / 2;
}

.gap-400 {
    margin-top: var(--gap-400);
}

.gap-600 {
    margin-top: var(--gap-600);
}

.gap-725 {
    margin-top: var(--gap-725);
}

.gap-750 {
    margin-top: var(--gap-750);
}

.gap-950 {
    margin-top: var(--gap-950);
}

/* Components */
h1 {
    font-size: var(--fs-xl);
    font-weight: var(--fw-regular);
    line-height: var(--lh-xl);
    color: var(--primary-white);
    grid-column: 1 / 12;
}

h2 {
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    color: var(--primary-white);
    padding-top: var(--gap-700);
}

p {
    font-size: var(--fs-base);
    font-style: normal;
    font-weight: var(--fw-regular);
    line-height: var(--lh-base);
    color: var(--primary-white);
}

button {
    min-width: 95px;
    height: 40px;
    justify-content: center;
    align-items: center;
    font-size: var(--fs-base);
    cursor: pointer;
}

button:disabled {
    background-color: var(--secondary-grey);
    color: var(--primary-white);
    border: none;
}

.container-button {
    display: flex;
    flex-direction: row;
    grid-column: 1 / 6;
    gap: 10px;
}

.btn-primary {
    background-color: var(--primary-white);
    color: var(--primary-black);
    border: 0px;
    border: 1px solid var(--secondary-lightgrey);
}

.btn-primary:hover {
    background-color: var(--secondary-lightgrey);
}

.btn-primary:disabled:hover {
    background-color: var(--secondary-grey);
}

.btn-secondary {
    background-color: var(--black);
    color: var(--primary-white);
    border: 1px solid var(--secondary-darkgrey);
}

.btn-secondary:hover {
    border: 1px solid var(--secondary-grey);
}

input {
    width: 312px;
    height: 36px;
    padding: 0px 12px;
    border: 1px solid var(--secondary-darkgrey);
    background: #000;
    color: var(--primary-white);
    font-family: Inter;
    font-size: var(--fs-base);
    font-weight: var(--fw-regular);
}

input:focus {
    border: 1px solid var(--primary-white);
    border-radius: 0px;
    outline: none;
}

/* Index */
.bg-black {
    background-color: var(--primary-black);
}

.bg-white {
    background-color: var(--primary-white);
}

#link-leaderboard {
    color: var(--primary-white);
}

#link-leaderboard:hover {
    color: var(--secondary-lightgrey);
}

#last-updated {
    grid-column: 3 / 9;
    color: var(--secondary-grey);
}

#powered-by {
    grid-column: 10 / span 5;
    justify-self: end;
    align-self: end;
}

.icon {
    margin-bottom: -0.45rem;
    width: 22px;
    height: 22px;
}

.icon-supabase {
    margin-bottom: -4px;
    width: 18px;
    height: 18px;
}

#link-supabase {
    text-decoration: none;
    color: var(--primary-white);
    font-weight: var(--fw-medium);
}


/* Game */
#body-header {
    overflow: hidden;
}

.wrapper-header {
    top: 0px;
    height: var(--before-height);
    width: 100%;
}



.section-header {
    height: var(--before-height);
    background-color: var(--primary-black);
    z-index: 1;
    position: absolute;
    margin-right: 80px;
}

#information-bar {
    grid-column: 1 / 13;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

#top-bar {
    position: absolute;
}

.navigation-back {
    display: flex;
    flex-direction: row;
}

.back-icon {
    margin-top: 1px;
    width: 18px;
    height: 18px;
    margin-left: -5px;
}

.game-icon {
    margin-top: 1px;
    margin-left: 15px;
    margin-right: 3px;
    width: 18px;
    height: 18px;
}

#container-score {
    display: flex;
    flex-direction: row;
}

#focused-flag {
    grid-column-start: 1;
    height: 120px;
}

#user-input-container {
    grid-column-start: 1;
    grid-row-start: 3;
    margin-top: -0.25rem;
}

#user-input {
    text-transform: capitalize;
}

#btns-game-control {
    grid-column: 1 / 13;
    grid-row-start: 4;
    margin-top: -1.25rem;
    display: flex;
    flex-direction: row;
}

.icon-checkmark {
    position: absolute;
    width: 26px;
    height: 26px; 
    background: url(/assets/images/icon-checkmark.svg) no-repeat;
    margin: -2.1rem 0 0 19rem;
    opacity: 0;
}

@keyframes fadeIn {
    0%, 100% {
      opacity: 0;
    }
    10%, 80% {
      opacity: 1;
    }
  }

  /* Apply the animation to the icon */
  .show-icon .icon-checkmark {
    animation: fadeIn 0.8s ease-in-out;
  }

#btn-next, #btn-previous {
    padding-bottom: 0.2rem;
}

#btn-finish {
    margin-left: 3rem;
}

#extended-line {
    border-top: 1px solid var(--secondary-darkgrey);
    margin: 0 -80px;
    position: absolute;
    width: 100vw;
}

#list-flag {
    padding-top: var(--gap-700);
    padding-bottom: 4em;
    display: grid;
    grid-template-columns: repeat( auto-fit, minmax(171px, 1fr));
    gap: 40px;
    list-style: none;
    justify-content: center;
    overflow-y: auto;
    bottom: -10%;
    scroll-behavior: smooth;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    max-height: var(--list-flag-max-height);
}

/* Hide scrollbar for Chrome, Safari and Opera */
#list-flag::-webkit-scrollbar {
    display: none;
  }

.container-flag {
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    cursor: pointer;
}

.container-flag > div {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
    height: calc(100% - 20px);
}

.name-it-img-flag {
    margin-top: var(--gap-600);
    width: auto;
    height: 37.5%;
    max-height: 50px;
    object-fit: contain;
}

#focused-flag > img {
    height: 120px;
}

.focused-flag {
border-radius: 6px;
border: 1px solid var(--secondary-darkgrey);
}

.list-item-country {
    display: none;
    font-size: var(--fs-s);
    color: var(--secondary-darkgrey);
    align-self: start;
    text-align: bottom;
    margin-top: -0.25rem;
    margin-left: var(--gap-300);
    text-wrap: nowrap;
}

.answered-flag {
    border-radius: 6px;
    border: 1px solid var(--secondary-green);
    cursor: default;
}

.answered-flag > div > img {
    opacity: 0.6;
    z-index: 0;
}

.answered-flag > p {
    color: var(--secondary-green);
}

.unanswered-flag {
    border-radius: 6px;
    border: 1px solid var(--secondary-red);
    cursor: default;
}

.unanswered-flag > p {
    color: var(--secondary-red);
}

#display-name {
    display: none;
    width: 212px;
}

#btn-submit-score {
    display: none;
}

/* Leaderboard */
#leaderboard-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    color: rgb(163, 163, 163);
    min-height: 620px;
}

.leaderboard-columns {
    display: grid;
    grid-template-columns: repeat(12, minmax(0px, 1fr));
    text-align: left;
    align-items: center;
    border-bottom: 1px solid var(--secondary-grey);
    color: var(--primary-white);
    width: 100%;
    height: 40px;
    font-size: 14px;
    font-weight: var(--fw-regular);
}

.leaderboard-row {
    display: grid;
    grid-template-columns: repeat(12, minmax(0px, 1fr));
    align-items: center;
    border-bottom: 1px solid var(--secondary-grey);
    color: var(--primary-white);
    width: 100%;
    font-size: 14px;
    padding: var(--gap-550) 0;
}

.user-created-at,
.column-date
 {
    grid-column-start: 4;
    grid-column-end: 11;
}

.user-score {
    text-align: right;
    padding-right: calc(100% - 2em);
}

.user-username {
    grid-column-start: 2;
grid-column-end: 4;
}

.pagination {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin-bottom: var(--gap-750);
}

#box-current-page {
    display: flex;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    background-color: var(--secondary-grey);
}

#current-page {
    font-size: 14px;
    color: var(--primary-white);

}

#next-page {
    margin-left: 0.35rem;
}


/* Imprint */
.imprint-container {
    display: flex;
    flex-direction: column;
    color: var(--primary-white);
    font-size: var(--fs-base);
    max-width: 40%;
    margin-bottom: var(--gap-750);
}

#imprint-title {
    padding: 0;
}

#imprint-email {
    padding-top: var(--gap-400);
    padding-bottom: var(--gap-500);
    color: var(--secondary-grey);
}


/* Media queries */
@media (max-width: 768px) {
    html {
        margin: 0px 40px;
    }

    .section-header {
        position: fixed;
        margin-right: 40px;
        z-index: 1;
    }

    #extended-line {
        margin: 0 -40px;
    }

    #about {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    #imprint {
        grid-column: 3;
    }

    #last-updated {
        grid-row: 2;
        grid-column: 1 / 5;
        color: var(--secondary-grey);
    }
    #powered-by {
        grid-row: 2;
        grid-column: 12 / span 5;
    justify-self: end;
    align-self: end;
    }

    .layout-bottom {
        display: grid;
        position: absolute;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        column-gap: 1.3rem;
        row-gap: 20px;
        bottom: 0;
        margin-bottom: 30px;
        width: calc(100% - 80px);
    }

    #last-updated {
        grid-row: 2;
        grid-column: 1 / 12;
    }

    .imprint-container {
        display: flex;
        flex-direction: column;
        color: var(--primary-white);
        font-size: var(--fs-base);
        max-width: 100%;
    }
}

@media (max-width: 685px) {
    .user-username {
        grid-column-start: 2;
    grid-column-end: 9;
    }

    .user-created-at, .column-date {
        display: none;
    }

    .column-score, .user-score {
        grid-column-start: 10;
}

.column-time, .user-elapsed-time {
    grid-column-start: 12;
}
}

@media (max-width: 575px) {
    .column-user, .user-username {
        grid-column-start: 3;
    }

    .column-score, .user-score {
        grid-column-start: 9;
    }

    .column-time, .user-elapsed-time {
        grid-column-start: 11;
    }
}

@media (max-width: 510px) {

    #about {
        grid-column: 1 / 2;
    }

    #last-updated {
        grid-row: 2;
        grid-column: 1 / 7;
    }

    #powered-by {
        grid-row: 3;
        grid-column: 1 / 7;
        margin-top: -0.75rem;
        justify-self: start;
    }
}

@media (max-width: 425px) {

    html {
        margin: 0px 20px;
    }

    .gap-950 {
        margin-top: 6rem;
    }

    .section-header {
        position: fixed;
        margin-right: 20px;
        z-index: 1;
    }

    #user-input-container {
        grid-column-start: 1;
        grid-row-start: 3;
        margin-top: -0.25rem;
    }
    
    #user-input {
        width: calc(100vw - 66px);
    }

    #btns-game-control {
        justify-content: space-between;
    }

    #btn-finish {
        margin-left: 0;
    }

    #list-flag {
        grid-template-columns: repeat( auto-fit, minmax(75px, 1fr));
        gap: 20px;
    }

    .user-created-at {
        display: none;
    }

    #extended-line {
        margin: 0 -20px;
    }

    #display-name {
        display: none;
        width: 100px;
    }

    #focused-flag > img {
        height: 120px;
    }

    .layout-bottom {
        display: grid;
        position: absolute;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        column-gap: 3.5rem;
        row-gap: 20px;
        bottom: 0;
        margin-bottom: 30px;
        width: calc(100% - 80px);
    }
}

@media (max-width: 350px) {

    button {
        min-width: 80px;
    }
}