*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


@font-face {
    font-family: "Fredoka";
    src: url("fonts/Fredoka-VariableFont_wdth,wght.ttf") format("truetype");
    font-weight: 600;
    font-style: normal;
}

body {
    font-family: 'Fredoka', sans-serif;
    background-color: whitesmoke;
    color: #1a1a1b;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}


#title {
    font-family: "Fredoka";
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    padding: 16px 0 12px;
    color: #1a1a1b;
}

/* hr {
    width: 100%;
    max-width: 500px;
    border: none;
    border-top: 1px solid #d3d6da;
    margin: 0;
} */


#attempts {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #787c7e;
    margin: 20px 0 0;
}


#board-wrapper {
    position: relative;
    display: inline-block;
    margin-top: 40px;
    margin-bottom: 8px;
}


#board {
    display: grid;
    grid-template-columns: repeat(4, 62px);
    grid-template-rows: repeat(4, 62px);
    gap: 6px;
    width: fit-content;
    height: fit-content;
    margin: 0 auto;
}

#subtitle {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #787c7e;
    margin: 4px 0 0;
    padding-bottom: 12px;
    border-bottom: 1px solid #d3d6da;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

.tile {
    width: 62px;
    height: 62px;
    border: 2px solid #d3d6da;
    background-color: transparent;
    border-radius: 5px;
    color: #1a1a1b;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
    user-select: none;
    cursor: pointer;
    position: relative;
    transition: transform 0.08s, box-shadow 0.08s;
    box-shadow: 0 4px 0 #8fa0ad;
}


.tile.active {
    background-color: #fef9c3 !important;
    box-shadow: 0 0 0 2px #a5b4fc;
    border-color: #818cf8;
    transform: translateY(3px);
    box-shadow: 0 1px 0 #8fa0ad;
}


.tile.locked {
    background-color: #f0f0f0 !important;
    border-color: #c0c0c0 !important;
    color: #555 !important;
    cursor: pointer !important;
}

.tile.locked.active {
    background-color: #fef9c3;
    border-color: #999;
    box-shadow: 0 0 0 2px #fde047;
    color: #555;
}

.tile.correct {
    background-color: #538d4e !important;
    border-color: #538d4e !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #2d5a29;
}

.tile.wrong {
    background-color: #f87171 !important;
    border-color: #f87171 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 0 #c0392b;
    animation: shake 0.4s ease;
}

.tile.present {
    background-color: #b59f3b;
    border-color: #b59f3b;
    color: #ffffff;
}

.tile.absent {
    background-color: #787c7e;
    border-color: #787c7e;
    color: #ffffff;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-4px); }
    40%       { transform: translateX(4px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

@keyframes pop {
    0%   { transform: scale(1); }
50%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.tile.pop {
    animation: pop 0.1s ease;
}


.row-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    left: -20px;
    transform: translateY(-50%);
    pointer-events: none;
}

.col-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    top: -20px;
    transform: translateX(-50%);
    pointer-events: none;
}

.dot-red    { background-color: #e74c3c; }
.dot-green  { background-color: #538d4e; }
.dot-yellow { background-color: #b59f3b; }
.dot-blue   { background-color: #2980b9; }

#letter-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 380px;
    margin: 20px auto 0;
    padding: 0 12px;
}

.letter-btn {
    width: 42px;
    height: 58px;
    border: none;
    border-radius: 4px;
    background-color: #d3d6da;
    color: #1a1a1b;
    font-family: inherit;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s, transform 0.08s;
    user-select: none;
    letter-spacing: 0.5px;
}

.letter-btn:hover {
    background-color: #b8bcc0;
}

.letter-btn:active {
    transform: scale(0.95);
}

.backspace-btn {
    width: 58px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    background-color: #c0c4c8;
    color: #1a1a1b;
}

.submit-btn {
    width: 80px;
    background-color: #538d4e;
    color: #ffffff;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.submit-btn:hover {
    background-color: #6aaf65;
}


#answer {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    min-height: 20px;
    margin-top: 18px;
    padding: 8px 20px;
    border-radius: 4px;
}

#answer:not(:empty) {
    background-color: #1a1a1b;
    color: #ffffff;
}

.msg-win     { background-color: #538d4e !important; color: #ffffff !important; }
.msg-lose    { background-color: #787c7e !important; color: #ffffff !important; }
.msg-warn    { background-color: #b59f3b !important; color: #ffffff !important; }
.msg-neutral { background-color: #1a1a1b !important; color: #ffffff !important; }


#help-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #1a1a1b;
    background: transparent;
    color: #1a1a1b;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.1s, color 0.1s;
}

#help-btn:hover {
    background-color: #1a1a1b;
    color: #f9f9f7;
}

#help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

#help-overlay.open {
    display: flex;
}

#help-panel {
    background: #ffffff;
    border-radius: 8px;
    padding: 32px 28px;
    max-width: 420px;
    min-width: 300px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    text-align: left;
    box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

#help-panel h2 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 20px;
    color: #1a1a1b;
}

#help-panel hr {
    border-top: 1px solid #d3d6da;
    margin-bottom: 20px;
}

#help-panel p {
    font-size: 14px;
    line-height: 1.6;
    color: #1a1a1b;
    margin-bottom: 14px;
}

#help-panel .rule {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
    font-size: 14px;
    color: #1a1a1b;
    line-height: 1.5;
}

#help-panel .rule-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.icon-green  { background-color: #538d4e; }
.icon-yellow { background-color: #fde047; color: #1a1a1b !important; }
.icon-red    { background-color: #f87171; }
.icon-grey   { background-color: #f0f0f0; color: #555 !important; border: 1px solid #c0c0c0; }

#help-panel .dot-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    color: #1a1a1b;
}

#help-panel .dot-example {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

#help-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #787c7e;
    line-height: 1;
}

#help-close:hover { color: #1a1a1b; }

#results-panel {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

#results-inner {
    background: #ffffff;
    padding: 32px 28px;
    max-width: 360px;
    width: 90%;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

#results-title {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: black;
    margin-bottom: 4px;
}

#results-subtitle {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #787c7e;
    margin-bottom: 20px;
}

#results-grid {
    font-size: 1.6rem;
    line-height: 1.6;
    margin-bottom: 24px;
    letter-spacing: 2px;
}

#results-percentile {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: red;
    margin-bottom: 16px;
    text-transform: uppercase;
}

#share-btn {
    background-color: #538d4e;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 12px 28px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background-color 0.1s;
}

#share-btn:hover {
    background-color: #68b161;
}

#share-confirm {
    font-size: 12px;
    color: black;
    margin-top: 10px;
    min-height: 18px;
    font-weight: 600;
}

