* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(
        180deg,
        #0f172a 0%,
        #151a2e 60%,
        #1b1f33 100%
    );
    color: #eaeaea;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 1000px;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    color: #ff5a5f;
    margin-bottom: 8px;
}

.subtitle {
    text-align: left;
    color: #aaa;
    margin-bottom: 20px;
    font-size: 1rem;
}

.mode-selector {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 30px;
    margin-top: 4px; 
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border-radius: 12px;
    border: 2px solid #162f6b;
    background-color: #16213e;
    color: #eaeaea;
    cursor: pointer;
    transition: all 0.2s;
    width: 275px;
    text-align: center;
}

.mode-btn:hover {
    border-color: #3b82f6;
    background-color: #1e2a50;
    transform: translateY(-2px);
}

.mode-btn.active-mode {
    border-color: #3b82f6;
    background-color: #1e2a50;
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.25);
}

.mode-difficulty {
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mode-difficulty.hard {
    color: #e74c3c;
}

.mode-difficulty.medium {
    color: #f39c12;
}

.mode-difficulty.easy {
    color: #2ecc71;
}

.mode-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #eaeaea;
}

.mode-desc {
    font-size: 0.75rem;
    color: #aaa;
    line-height: 1.4;
}

.ebk {
    color: #e94560;
    font-weight: bold;
    letter-spacing: 0.03em;
}

/* ── Stats Table ── */
#stats-container {
    overflow-x: auto;
    margin-bottom: 30px;
    table-layout: fixed;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    background-color: #16213e;
    border-radius: 10px;
    overflow: hidden;
}

thead {
    background-color: #3b82f6;
    color: white;
}

th {
    padding: 6px 10px;
    text-align: center;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

td {
    padding: 4px 10px;
    text-align: center;
    border-bottom: 1px solid #0f3460;
    white-space: nowrap;
}

tbody tr:hover {
    background-color: #0f3460;
}

/* ── Guess Area ── */
.guess-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    position: relative;
    margin-bottom: 20px;
}

#guess-input {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #3b82f6;
    background-color: #16213e;
    color: #eaeaea;
    font-size: 1rem;
    outline: none;
}

#suggestions {
    list-style: none;
    width: 100%;
    max-width: 500px;
    background-color: #16213e;
    border: 1px solid #3b82f6;
    border-radius: 8px;
    overflow: hidden;
    position: absolute;
    top: 52px;
    z-index: 10;
}

#suggestions:empty {
    border: none;
}

#suggestions li {
    padding: 10px 16px;
    cursor: pointer;
}

#suggestions li:hover {
    background-color: #0f3460;
}

#guess-btn {
    padding: 12px 40px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

#guess-btn:hover {
    background-color: #3b82f6;
}

/* ── Result Message ── */
#result {
    text-align: center;
    font-size: 1.3rem;
    font-weight: bold;
    display: none;
    margin-bottom: 20px;
}

.correct {
    color: #2ecc71;
}

.wrong {
    color: #e94560;
}

/* ── Guess History Grid ── */
#guess-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 30px;
}

.guess-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr;
    gap: 8px;
}

.guess-cell {
    padding: 12px 8px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: bold;
    background-color: #16213e;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    word-break: break-word;
}

.header-row .guess-cell {
    background-color: #0f3460;
    color: #aaa;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-height: 40px;
}

/* ── Wordle Colors ── */
.green {
    background-color: #2ecc71;
    color: #1a1a2e;
}

.yellow {
    background-color: #f39c12;
    color: #1a1a2e;
}

.grey {
    background-color: #4a4a6a;
    color: #eaeaea;
}

/* ── Give Up ── */
#give-up-area {
    text-align: center;
    margin-top: 10px;
}

#give-up-btn {
    padding: 10px 30px;
    background-color: transparent;
    color: #aaa;
    border: 1px solid #aaa;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

#give-up-btn:hover {
    background-color: #aaa;
    color: #1a1a2e;
}

/* ── Arrow ── */
.arrow {
    font-size: 1.4rem;
    font-weight: bold;
    line-height: 1;
}

/* ── Win Modal ── */
#win-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

#win-overlay.hidden {
    display: none;
}

#win-card {
    background-color: #16213e;
    border: 2px solid #3b82f6;
    border-radius: 20px;
    padding: 48px 56px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.25);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 460px;
    width: 90%;
}

#win-emoji {
    font-size: 4rem;
    animation: spin 0.6s ease;
    line-height: 1;
}

#win-title {
    font-size: 2.2rem;
    color: #2ecc71;
    font-weight: bold;
    line-height: 1.2;
}

#win-player-name {
    font-size: 1.5rem;
    color: #eaeaea;
    font-weight: bold;
    background-color: #0f3460;
    padding: 14px 28px;
    border-radius: 10px;
    width: 100%;
    letter-spacing: 0.02em;
}

#win-stats {
    display: flex;
    gap: 14px;
    justify-content: center;
    width: 100%;
}

.win-stat-box {
    background-color: #0f3460;
    border-radius: 12px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.win-stat-label {
    font-size: 0.7rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: bold;
}

.win-stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #eaeaea;
    line-height: 1.3;
}

.stat-bold {
    font-weight: 900;
    color: #f39c12;
}

/* ── Award Badges ── */
.awards-cell {
    white-space: normal;
    max-width: 120px;
    padding: 4px 6px;
    vertical-align: middle;
}

.award-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.60rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    margin: 2px 2px;
    white-space: nowrap;
}

/* ── Title Bar ── */
#title-bar {
    position: relative;
    text-align: center;
    margin-bottom: 8px;
}

h1 {
    font-size: 2.5rem;
    color: #3b82f6;
    margin-bottom: 4px;
}

.subtitle {
    color: #aaa;
    text-align: center;
    margin-bottom: 16px;
}

/* ── Title Bar ── */
#title-bar {
    text-align: center;
    margin-bottom: 8px;
}

h1 {
    font-size: 2.5rem;
    color: #3b82f6;
    margin-bottom: 4px;
}

/* ── Streak Line ── */
#streak-line {
    font-size: 0.9rem;
    font-weight: bold;
    color: #eaeaea;
    letter-spacing: 0.03em;
    line-height: 1.8;
    text-align: center;
    margin-bottom: 12px; /* was 24px */
}

.subtitle {
    color: #aaa;
    text-align: center;
    margin-bottom: 8px; /* was 18px */
}

#streak-line span {
    color: #f39c12;
}

@media (min-width: 900px) {
    #title-bar {
        position: relative;
    }

    #streak-line {
        position: absolute;
        right: 0;
        top: 0;
        text-align: right;
        margin-bottom: 0;
        white-space: nowrap;
    }

    .subtitle {
        margin-bottom: 24px; /* add this — bumps gap on desktop only */
    }
}

#win-streak-line {
    font-size: 0.95rem;
    font-weight: bold;
    color: #eaeaea;
    letter-spacing: 0.03em;
    text-align: center;
    line-height: 1.8;
    margin-top: -6px;
}

#win-streak-line span {
    color: #f39c12;
    font-weight: 900;
}

#win-close-btn {
    margin-top: 4px;
    padding: 14px 48px;
    background-color: #3b82f6;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

#win-close-btn:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

@keyframes spin {
    0%   { transform: rotate(0deg)   scale(0.5); }
    60%  { transform: rotate(20deg)  scale(1.2); }
    100% { transform: rotate(0deg)   scale(1);   }
}

.difficulty-all_time { color: #e74c3c; }
.difficulty-active   { color: #f39c12; }
.difficulty-all_star { color: #2ecc71; }

@media (max-width: 600px) {

    #guess-history {
        width: 100%;
        max-width: 100%;
    } /* ✅ CLOSE IT */

    /* Shrink font sizes */
    h1 { font-size: 1.99rem; }
    .subtitle { font-size: 0.95rem; }

    /* Stack mode selector vertically */
    .mode-selector {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .mode-btn {
        width: 100%;
        max-width: 365px;

        display: flex;
        flex-direction: row;
        flex-wrap: wrap;

        align-items: center;
        text-align: left;
        padding: 14px 16px;
        gap: 6px 10px;
    }

    /* Guess history grid */
    .guess-row {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .guess-row .guess-cell:first-child {
        grid-column: 1 / -1;
        font-size: 0.9rem;
    }

    .guess-cell {
        display: flex;
        justify-content: center;
        align-items: center;

        width: auto;
        min-width: 0;
    }

    .guess-row > * {
        min-width: 0;
    }

    .header-row .guess-cell {
        font-size: 0.72rem;
        padding: 6px 4px;
        min-height: 32px;
    }

    .header-row {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto;
    }

    .header-row .guess-cell:first-child {
        grid-column: 1 / -1;
    }

    .arrow { font-size: 1rem; }
}