:root {
    --bg-gradient: radial-gradient(circle at top, #8ec5fc 0%, #e0c3fc 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
    --primary: #6c63ff;
    --primary-dark: #5348d4;
    --text-main: #1f1f3d;
    --text-muted: #6d6a7b;
    --success: #00b894;
    --danger: #ff7675;
    font-family: 'Poppins', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text-main);
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem 3rem;
}

.background {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.2), rgba(255, 99, 171, 0.2));
    backdrop-filter: blur(40px);
    z-index: -1;
}

.game-shell {
    width: min(900px, 100%);
    background: rgba(255, 255, 255, 0.85);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(89, 74, 226, 0.25);
    padding: 2.8rem 2.4rem;
    display: grid;
    gap: 2.4rem;
}

.game-header {
    text-align: center;
}

.game-header h1 {
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    margin: 0;
}

.tagline {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
}

.status-panel {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.status-card {
    flex: 1;
    min-width: 160px;
    background: var(--card-bg);
    border-radius: 20px;
    padding: 1.2rem 1.4rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    display: grid;
    gap: 0.3rem;
}

.status-card .label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.status-card .value {
    font-size: 1.8rem;
    font-weight: 700;
}

.primary-button {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(108, 99, 255, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
    box-shadow: 0 18px 36px rgba(108, 99, 255, 0.4);
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: 0 8px 20px rgba(108, 99, 255, 0.35);
}

.input-panel {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 1.8rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    display: grid;
    gap: 1rem;
}

.instruction {
    font-weight: 600;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

#guess-input {
    flex: 1;
    min-width: 160px;
    border-radius: 16px;
    border: 2px solid transparent;
    padding: 0.9rem 1.2rem;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#guess-input:focus {
    outline: none;
    border-color: rgba(108, 99, 255, 0.65);
    box-shadow: 0 0 0 4px rgba(108, 99, 255, 0.15);
}

.feedback {
    min-height: 1.2rem;
    color: var(--text-muted);
}

.feedback.success {
    color: var(--success);
    font-weight: 600;
}

.feedback.error {
    color: var(--danger);
}

.history-panel {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 1.8rem;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
}

.history-panel h2 {
    margin-top: 0;
}

.history-list {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.8rem;
    max-height: 240px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 18px;
    padding: 0.8rem 1.2rem;
    box-shadow: 0 10px 20px rgba(41, 36, 90, 0.15);
    animation: pop-in 0.25s ease;
}

.history-item strong {
    font-size: 1.2rem;
    letter-spacing: 0.15em;
}

.history-item span {
    color: var(--text-muted);
    font-weight: 600;
}

@keyframes pop-in {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.credits {
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    max-width: 720px;
    line-height: 1.6;
}

@media (max-width: 640px) {
    body {
        padding: 1.5rem 0.6rem 2.5rem;
    }

    .game-shell {
        padding: 1.6rem;
    }

    .status-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .input-wrapper {
        flex-direction: column;
    }

    #guess-input {
        letter-spacing: 0.2em;
    }
}
