:root {
    --bg-gradient: linear-gradient(135deg, #18122B 0%, #393053 100%);
    --container-bg: linear-gradient(135deg, rgba(24, 18, 43, 0.98) 60%, rgba(57, 48, 83, 0.98) 100%);
    --text-color: #f5f6fa;
    --input-bg: #18122B;
    --input-border: #A084DC;
    --button-bg: linear-gradient(90deg, #393053 0%, #A084DC 100%);
    --button-hover-bg: #A084DC;
    --attempts-color: #A084DC;
}
body {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: #f5f6fa;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.container {
    background: linear-gradient(135deg, rgba(24, 18, 43, 0.98) 60%, rgba(57, 48, 83, 0.98) 100%);
    border-radius: 32px;
    box-shadow: 0 16px 48px 0 #18122Bcc, 0 4px 16px 0 #A084DC55;
    max-width: 520px;
    width: 90vw;
    margin: 0 auto;
    padding: 64px 48px 48px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.3s, background 0.3s;
    position: relative;
}
.container::before {
    content: '';
    position: absolute;
    top: -24px; left: -24px; right: -24px; bottom: -24px;
    z-index: -1;
    border-radius: 40px;
    background: linear-gradient(120deg, #A084DC44 0%, #39305322 100%);
    filter: blur(16px);
}
.header {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 32px;
}
h1 {
    font-size: 3.2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 2px;
    color: #A084DC;
    text-shadow: 0 4px 16px #18122B, 0 2px 4px #A084DC44;
}
input[type="number"] {
    width: 80px;
    padding: 0.6rem;
    margin: 1rem 0 0.5rem 0;
    border: 1px solid var(--input-border);
    border-radius: 6px;
    font-size: 1.1rem;
    outline: none;
    background: var(--input-bg);
    color: var(--text-color);
    transition: border 0.2s, background 0.3s, color 0.3s;
    /* Remove number input spinner for Firefox */
    -moz-appearance: textfield;
}
/* Remove number input spinner for Chrome, Edge, Safari */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"]:focus {
    border: 1.5px solid #007bff;
}
.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
button {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: var(--button-bg);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,123,255,0.12);
    transition: background 0.2s, color 0.2s, transform 0.1s, box-shadow 0.2s;
}
button:hover {
    background: var(--button-hover-bg);
    color: #18122B;
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 4px 16px rgba(0,123,255,0.18);
}
button:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,123,255,0.10);
}
#message {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-color);
    margin: 32px 0 18px 0;
    text-align: center;
}
#attempts {
    color: var(--attempts-color);
    font-size: 1rem;
    margin-top: 0.5rem;
    font-weight: 500;
    letter-spacing: 1px;
}

/* Modern dark background and light font for aesthetic look */
body.dark {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    color: #f5f6fa;
    font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    transition: background 0.5s, color 0.5s;
}

.container {
    background: rgba(30, 30, 40, 0.95);
    border-radius: 18px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    max-width: 400px;
    margin: 60px auto 0 auto;
    padding: 36px 32px 28px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 18px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 1px;
}

#message {
    margin: 18px 0 10px 0;
    font-size: 1.1rem;
    text-align: center;
}

.guess-input {
    width: 80%;
    padding: 24px 28px;
    border-radius: 14px;
    border: 2px solid #A084DC;
    background: #18122B;
    color: #f5f6fa;
    font-size: 2.2rem;
    margin-bottom: 32px;
    outline: none;
    transition: border 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 12px #A084DC33, 0 1px 4px #18122B44;
    text-align: center;
    font-weight: 700;
    letter-spacing: 2px;
}
.guess-input:focus {
    border: 2.5px solid #A084DC;
    box-shadow: 0 0 0 6px #A084DC44, 0 2px 12px #A084DC33;
}

.button-group {
    display: flex;
    gap: 32px;
    margin-bottom: 32px;
    width: 100%;
    justify-content: center;
}

.main-btn {
    background: linear-gradient(90deg, #393053 0%, #A084DC 100%);
    color: #f5f6fa;
    border: none;
    border-radius: 14px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px #18122B88, 0 2px 8px #A084DC55;
    transition: background 0.3s, color 0.3s, transform 0.2s;
    letter-spacing: 1px;
}
.main-btn:hover {
    background: #A084DC;
    color: #18122B;
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 8px 24px #A084DC99, 0 4px 16px #18122B88;
}

#attempts {
    margin-top: 18px;
    font-size: 1.2rem;
    color: #A084DC;
    font-weight: 600;
    letter-spacing: 2px;
}

.container:hover {
    box-shadow: 0 24px 64px 0 #A084DCbb, 0 8px 32px 0 #18122Bcc;
    transform: translateY(-2px) scale(1.01);
    transition: box-shadow 0.3s, transform 0.3s;
}

/* Shake animation for input and card */
@keyframes shake {
  0% { transform: translateX(0); }
  15% { transform: translateX(-10px); }
  30% { transform: translateX(10px); }
  45% { transform: translateX(-8px); }
  60% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
  90% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
.shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes popup-bounce {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    80% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

#congrats-popup {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(24, 18, 43, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
#congrats-popup.show {
    opacity: 1;
    pointer-events: all;
}
#congrats-popup .popup-content {
    background: linear-gradient(135deg, #302b63 0%, #A084DC 100%);
    border-radius: 24px;
    box-shadow: 0 8px 32px #18122Bcc, 0 2px 8px #A084DC55;
    padding: 48px 36px 36px 36px;
    text-align: center;
    color: #fff;
    min-width: 320px;
    max-width: 90vw;
    animation: popup-bounce 0.5s cubic-bezier(.36,.07,.19,.97);
}
#congrats-popup .popup-emoji {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}
#congrats-popup h2 {
    font-size: 2.2rem;
    margin: 0 0 10px 0;
    color: #ffe082;
    letter-spacing: 1px;
}
#congrats-popup p {
    font-size: 1.2rem;
    margin-bottom: 24px;
}
#congrats-popup button {
    background: #ffe082;
    color: #302b63;
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 8px #18122B44;
    transition: background 0.2s, color 0.2s, transform 0.1s;
}
#congrats-popup button:hover {
    background: #fffde4;
    color: #A084DC;
    transform: translateY(-2px) scale(1.04);
}

@media (max-width: 700px) {
    .container {
        padding: 32px 8vw 24px 8vw;
        max-width: 98vw;
    }
    h1 {
        font-size: 2rem;
    }
    .guess-input {
        font-size: 1.1rem;
        padding: 12px 8px;
    }
    .main-btn {
        font-size: 1rem;
        padding: 12px 18px;
    }
}