* {
    margin:0;
    padding: 0;
}

:root {
    --default: #121213;
    --grey-tone-10: #d3d6da;
    --grey-tone-15: #d7dadc;
    --grey-tone-20: #aaa;
    --grey-tone-30: #818384;
    --grey-tone-90: #3a3a3c;
    --yellow: #b59f3b;
    --green: #538d4e;
    --black: #000;
    --white: #fff;
    --gainsboro: #dcdcdc;
    --light-dark: #121213;
    --icon-filter-grey: invert(88%) sepia(100%) saturate(10%) hue-rotate(27deg) brightness(60%) contrast(60%);

    /* defaults */
    --text-color: var(--gainsboro);
    --line-color : var(--grey-tone-90);
    --bg-color : var(--black);

    /* popup */
    --popup-button-color: var(--grey-tone-20);
    --popup-button-hover-color: var(--white);
    --popup-bg-color: var(--light-dark);

    /* notifications */
    --notif-text-color: var(--default);
    --notif-bg-color: var(--grey-tone-10);

    /* board */
    --tile-line-color: var(--grey-tone-90);
    --tile-yellow: var(--yellow);
    --tile-green: var(--green);
    --tile-grey: var(--grey-tone-90);

    /* keyboard */
    --key-color : var(--grey-tone-15);
    --key-bg-color : var(--grey-tone-30);

}

html, body {
    height: 100%;
    font-family: 'IBM Plex Sans KR', 'Noto Sans', 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
}



#container {
    display: flex;
    height: 90%;
    align-items: center;
    flex-direction: column;
}





/*HEADER*/

header {
    border-bottom: 1px solid var(--line-color);

    display: flex;
    justify-content: space-between;
    align-items: center;
    /* background-color: #4CAF50; Green background */
    /* color: white; */
}

.menu {
    display: flex;
    color: white;
    align-items: center;
    margin: 10px 10%;
    gap: 50px;
}

.menu .item {
    display: block;
    
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    text-underline-offset: 6px;
    /* text-decoration: underline; */
}

a:link, a:visited, a:hover, a:active {
    color:white
}

.title {
    color: var(--text-color);
    font-size: 2.5rem;
    font-weight: bold;
    margin: 0.4rem 0;
    text-align: center;
    font-family: 'IBM Plex Sans KR', 'Noto Sans', 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;

    /* OA */
    flex-grow: 1; /* This allows the title to take up available space */
    /* margin: 0; Remove default margin */
    position: absolute;
    left: 50%;
    transform: translateX(-50%); /* Center the title horizontally */
    margin: 0;

    line-height: 25px;
    padding-top: 10px;
}

#puzzle-number {
    font-size: 20px;
    margin-top: 10px;
}

#help-button {
    background-color: transparent;
    color: var(--text-color);
    border: none;
    
    /*OA*/
    margin-left: auto; /* Push the button to the right */
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#stat-button {
    background-color: transparent;
    color: var(--text-color);
    border: none;
    
    /*OA*/
    margin-right: auto; /* Push the button to the right */
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}


/*POPUP*/

.popup-background {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    background-color: rgba(0, 0, 0, 0.5); /* Black with opacity */

    overflow-y: auto; /* Enable vertical scrolling */

    color: var(--text-color)

}

.popup {
    background-color: var(--popup-bg-color);
    margin: 70px auto 15% ; /* 15% from the top and centered */
    padding: 20px 40px;
    /* border: 1px solid #888; */
    /* width: 80%; Could be more or less, depending on screen size */
    font-weight: 200;
    font-size: 18px;
}

.popup h1 {
    text-align: center;
    margin-bottom: 10px;
}

.popup h2 {
    margin-bottom: 10px;
    font-weight: 400;
    font-size: 28px;
    line-height: 30px;
    text-align: left;
}

.popup h3 {
    font-weight: 300;
    font-size: 20px;
    line-height: 24px;
}

.popup-section {
    width: 100%;
    margin: 20px auto;
    padding-top: 20px;
    border-top: 1px solid white;
}

.popup-section .statistics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 4px;
}

.popup ul {
    font-size: 18px;
    line-height: 30px;
    font-weight: 200;
    list-style-type: disc;
    -webkit-margin-before: 1em;
    margin-block-start: 1em;
    -webkit-margin-after: 1em;
    margin-block-end: 1em;
    -webkit-padding-start: 20px;
    padding-inline-start: 20px;
}

.popup ul li {
    margin-bottom: 6px;
}

.popup .board-container {
    justify-content: left;
}

.popup .board-container .board {
    padding: 10px 0px;
}

.popup section#stat-next {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.popup section .stat-popup-subtitle {
    font-size: 20px;
    /* border-top: 1px solid white; */
}

.popup .logo {
    width: 100%;
}

.popup .logo img {
    display:block; 
    margin: 0 auto 10px;
}

.popup .stat-item .stat-title {
    font-size: 1rem;
}

.copyright {
    font-size: small;
}


.close-popup {
    display: flex;
}

.close-popup-button {
    margin-left: auto;
    color: var(--popup-button-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
}

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



/*ALERT NOTIFICATIONS*/
.notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease;
    background-color: var(--notif-bg-color);
    color:var(--notif-text-color);
}

/*GAME*/

.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    overflow: hidden;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 4px;
    padding: 0 10% 0;
    box-sizing: border-box;
}

.character-hint {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 6px;
    height: 4px;

    /* grid-template-columns: repeat(5, 1fr); */
    /* grid-gap: 2px; */
    /* height: 10px; */
    /* grid-row-gap: 2px; */
    /* padding: 8px 4px 1px 4px; */
}

.character-hint div {
    border-radius:50% 50% 0 0;
    height: 12px;
    width: 12px;

}

#game {
    width: 100%;
    max-width: 500px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.guess-number {
    color: gainsboro;
    padding: 10px;
    font-size: 1em;
    font-weight: 300;
}

.square {
    border: 2px solid var(--tile-line-color);
    min-width: 88px;
    min-height: 88px;
    font-size: 2.8rem;
    font-weight: bold;
    color: var(--text-color);
    text-transform: uppercase;

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

    position: relative;
    /* display: inline-block; */
}

.square.grey, .keyboard-row button.grey, .character-hint .grey {
    background: var(--tile-grey);
}
  
.square.yellow, .keyboard-row button.yellow, .character-hint .yellow {
    background: var(--tile-yellow);
}

.square.green, .keyboard-row button.green, .character-hint .green {
    background: var(--tile-green);
}

.square.partial-grey {
    border-color: var(--tile-grey);
}
  
.square.partial-yellow {
    border-color: var(--tile-yellow);
}

.square.partial-green {
    border-color: var(--tile-green);
}

.jamo-count {
    color: var(--grey-tone-90);
}

.hidden {
    display: none;
}

#keyboard-container {
    height:250px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    width: 90%;
    margin: 0 auto 6px;
    touch-action: manipulation;
}

.keyboard-row button {
    font-family: inherit;
    font-weight: bold;
    font-size: 1.2rem;
    padding: 0;
    height: 52px;
    cursor: pointer;
    /* background-color: rgb(129, 131, 132); */
    background-color: var(--key-bg-color);
    /* color: rgb(215, 218, 220); */
    color: var(--key-color);
    flex-grow: 1;
    text-transform: uppercase;
    margin-right: 6px;
    border-radius: 4px;
    user-select: none;
    border:0;
}

.keyboard-row button.wide-button {
    flex-grow: 1.5;
}

.spacer-half {
    flex-grow: .5;
}




@media (max-height: 630px) {
    #keyboard-container {
        height: 210px;
    }
    .keyboard-row button {
        height: 44px;
    }
    .board {
        grid-gap: 3px;
    }
    .character-hint {
        height: 0px;
    }
    .character-hint div {
        height: 6px;
        width: 6px;
    }
    .square {
        min-width: 32px;
        min-height: 32px;
        font-size: 1.4rem;
    }
}

@media (min-height: 631px) {
    #keyboard-container {
        height: 210px;
    }
    .keyboard-row button {
        height: 44px;
    }
    .board {
        grid-gap: 3px;
    }
    .character-hint {
        height: 0px;
    }
    .character-hint div {
        height: 6px;
        width: 6px;
    }
    .square {
        min-width: 36px;
        min-height: 36px;
        font-size: 1.6rem;
    }
}

@media (min-height: 721px) {
    #keyboard-container {
        height: 230px;
    }
    .keyboard-row button {
        height: 48px;
    }
    .character-hint div {
        height: 8px;
        width: 8px;
    }
    .square {
        min-width: 50px;
        min-height: 50px;
        font-size: 1.8rem;
    }
}

@media (min-height: 841px) {
    #keyboard-container {
        height: 230px;
    }
    .keyboard-row button {
        height: 48px;
    }
    .character-hint div {
        height: 10px;
        width: 10px;
    }
    .square {
        border-width: 3px;
        min-width: 66px;
        min-height: 66px;
        font-size: 2.2rem;
    }
}

@media (min-height: 981px) {
    #keyboard-container {
        height: 230px;
    }
    .keyboard-row button {
        height: 48px;
    }
    .character-hint div {
        height: 12px;
        width: 12px;
    }
    .square {
        border-width: 4px;
        min-width: 88px;
        min-height: 88px;
        font-size: 2.8rem;
    }
}

@media (min-width: 530px) {
    .popup {
        width:60%;
    }
}

@media (max-width: 800px) {
    .popup-section .board-container {
        scale: 0.8;
        transform-origin: 0 50%;
        overflow: visible;
    }
}

@media (max-width: 630px) {
    .popup-section .board-container {
        scale: 0.7;
    }
}
@media (max-width: 420px) {
    .popup-section .board-container {
        scale: 0.6;
    }
    .board {
        padding : 0 5% 0;
    }

    .popup-section .statistics {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 380px) {
    .popup-section .board-container {
        scale: 0.5;
    }
    .popup-section .statistics {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 320px) {
    .title {
        font-size: 2rem;
    }
    .popup-section .board-container {
        scale: 0.4;
    }

    .board {
        padding : 0 5% 0;
    }
}

@keyframes flip {
    0% {
        transform: scaleX(1);
    }

    50% {
        transform: scaleX(0);
    }

    100% {
        transform: scaleX(1);
    }
}

.flipIt {
    animation: flip 1s ease;
}

@keyframes shake {
    0% { transform: translateX(0) }
    20% { transform: translateX(5px) }
    40% { transform: translateX(-5px) }
    60% { transform: translateX(5px) }
    80% { transform: translateX(-5px) }
    100% { transform: translateX(0) }
}

.shakeIt {
    animation: shake 0.3s ease;
}

@keyframes beat {
    0% { transform: scale(1.1) }
    100% { transform: scale(1) }
}

.beatIt {
    animation: beat .2s ease;
}

.icon {
    filter: var(--icon-filter-grey);
}

/* .header-button:hover {
    background-color: #ddd; 
} */


/* Basic button style for the link */
a.button-link {
    display: inline-block;
    padding: 10px 20px;
    border: 1px solid var(--popup-button-color);
    color: var(--popup-button-color);
    text-align: center;
    text-decoration: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s ease;
    margin-top: 20px auto;
}

a.button-link#share-button {
    background-color: var(--green);
    color: var(--white);
    border: none;
}

/* Hover effect for the button */
a.button-link:hover {
    border-color: var(--popup-button-hover-color);
    color: var(--popup-button-hover-color);
    transform: scale(1.05);       /* Slightly increase the size on hover */
}