/* --------------------- CSS RESET -------------------- */
/* Meyer Reset v2.0 | Public Domain */

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%;
    vertical-align: baseline;
    box-sizing: border-box;
}

article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
    display: block;
}

body {
    line-height: 1.5;
}

ol, ul {
    list-style: none;
}

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

/* ---------------------- VARIABLES ---------------------- */

:root {
    --primary: #512da8;
    --primary-light: #8559da;
    --primary-dark: #140078;
    --secondary: #ffc107;
    --secondary-light: #fff350;
    --secondary-dark: #c79100;
    --text-light: #ffffff;
    --text-dark: #000000;
}

/* ---------------------- BASE LAYOUT ---------------------- */

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.1em;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
}

.container {
    width: 90%;
    max-width: 1000px;
    min-width: 320px;
    margin: 40px auto;
}

footer {
    text-align: center;
    padding: 20px;
    background: var(--primary);
    color: var(--text-light);
}

/* ---------------------- GAME CARD ---------------------- */

.game-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* ---------------------- HEADER ---------------------- */

header {
    background: var(--primary);
    color: var(--text-light);
    padding: 20px;
    border-radius: 12px 12px 0 0;
    text-align: center;
}

h1 {
    font-size: 2.2em;
}

h2 {
    color: var(--primary);
    margin-bottom: 10px;
}

/* ---------------------- SCOREBOARD ---------------------- */

.scoreboard {
    text-align: center;
    font-weight: bold;
    font-size: 1.2em;
    margin: 15px 0 25px 0;
    color: var(--primary-dark);
}

/* ---------------------- WORD DISPLAY ---------------------- */

#word {
    text-align: center;
    font-size: 2.2em;
    letter-spacing: 4px;   /* reduced from 12px */
    font-weight: bold;
    margin: 20px 0;
    white-space: nowrap;   /* prevents wrapping */
}

#guesses {
    text-align: center;
    font-weight: bold;
    margin-bottom: 15px;
}

/* ---------------------- INFO BOXES ---------------------- */

#guessed,
#numbers {
    background: #f4f4f4;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    min-height: 40px;
}

/* ---------------------- IMAGE ---------------------- */

img {
    display: block;
    width: 60%;
    max-width: 250px;
    margin: 20px auto;
}

/* ---------------------- DIFFICULTY ---------------------- */

.difficulty-row {
    text-align: center;
    margin-bottom: 20px;
}

select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 2px solid var(--primary);
    font-size: 1em;
    background: white;
    color: var(--primary-dark);
    cursor: pointer;
}

select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---------------------- INPUT ---------------------- */

input {
    padding: 8px;
    border-radius: 8px;
    border: 2px solid var(--primary-light);
    width: 60px;
    text-align: center;
    font-size: 1.2em;
    margin-top: 5px;
}

/* ---------------------- BUTTONS ---------------------- */

button {
    padding: 8px 15px;
    margin: 8px 5px;
    border-radius: 8px;
    border: none;
    font-size: 1em;
    cursor: pointer;
    transition: 0.2s ease-in-out;
}

#submit {
    background: var(--primary-dark);
    color: var(--text-light);
}

#submit:hover {
    background: var(--secondary);
    color: var(--primary-dark);
}

#playAgain {
    background: var(--secondary);
    color: var(--primary-dark);
}

#playAgain:hover {
    background: var(--secondary-dark);
    color: var(--text-light);
}

/* ---------------------- RESPONSIVE GRID ---------------------- */

.row::after {
    content: "";
    clear: both;
    display: table;
}

[class*="col-"] {
    float: left;
    padding: 15px;
    width: 100%;
}

@media only screen and (min-width: 768px) {
    .col-6 {
        width: 50%;
    }
    .col-12 {
        width: 100%;
    }
}
/* -------- WIN GLOW -------- */

.win-glow {
    animation: glow 1s infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 10px #00ff00; }
    to { box-shadow: 0 0 30px #00ff00; }
}

/* -------- SHAKE ON WRONG -------- */

.shake {
    animation: shake 0.3s;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

/* -------- RESET SCORE BUTTON -------- */

.secondary-btn {
    background: var(--secondary);
    color: var(--primary-dark);
    margin-top: 10px;
}

.secondary-btn:hover {
    background: var(--secondary-dark);
    color: white;
}

/* -------- KEYBOARD -------- */

.keyboard {
    text-align: center;
    margin-top: 25px;
}

.key-btn {
    width: 40px;
    height: 40px;
    margin: 5px;
    border-radius: 6px;
    border: none;
    background: var(--primary-dark);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s ease-in-out;
}

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

.key-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* -------- CONFETTI -------- */

.confetti {
    position: fixed;
    top: -10px;
    width: 8px;
    height: 12px;
    opacity: 0.8;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(100vh) rotate(360deg);
    }
}

/* -------- CLEANER SPACING -------- */

.game-card {
    padding: 35px;
}

.row {
    margin-bottom: 15px;
}

form {
    margin-top: 10px;
}

.keyboard-row {
    margin-bottom: 8px;
}

.keyboard {
    text-align: center;
    margin-top: 20px;
}

/* -------- STRONG SHAKE ANIMATION -------- */

.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%   { transform: translateX(0); }
    15%  { transform: translateX(-20px); }
    30%  { transform: translateX(20px); }
    45%  { transform: translateX(-20px); }
    60%  { transform: translateX(20px); }
    75%  { transform: translateX(-20px); }
    90%  { transform: translateX(20px); }
    100% { transform: translateX(0); }
}