:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #38bdf8;
    --correct: #10b981;
    --present: #f59e0b;
    --absent: #475569;
    --text: #f8fafc;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

header {
    text-align: center;
    padding: 1rem 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#stats {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    opacity: 0.8;
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1rem;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: white;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.small-input {
    width: 60px;
    margin-bottom: 0;
    text-align: center;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.input-group label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.glass-btn {
    width: 100%;
    background: var(--primary);
    color: #0f172a;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s, background-color 0.3s;
}

.primary-btn {
    background: linear-gradient(135deg, #38bdf8, #818cf8);
    margin-top: 10px;
}

.glass-btn:active {
    transform: scale(0.98);
}

.hidden {
    display: none !important;
}

/* Wordle Board */
#board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-gap: 5px;
    padding: 10px;
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
}

.row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-gap: 5px;
}

.tile {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--absent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    transition: all 0.3s;
}

.tile[data-status='correct'] {
    background: var(--correct);
    border-color: var(--correct);
}

.tile[data-status='present'] {
    background: var(--present);
    border-color: var(--present);
}

.tile[data-status='absent'] {
    background: var(--absent);
    border-color: var(--absent);
}

/* Keyboard */
#keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
    padding-bottom: 1rem;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.kb-key {
    background: var(--absent);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 15px 10px;
    font-weight: bold;
    cursor: pointer;
    flex: 1;
    max-width: 40px;
    text-transform: uppercase;
    user-select: none;
    transition: background-color 0.3s, transform 0.1s;
}

.kb-key.wide {
    max-width: 65px;
}

.kb-key:disabled {
    opacity: 0.3;
    pointer-events: none;
    background: #1e293b;
}

.kb-key[data-status='correct'] {
    background: var(--correct);
}

.kb-key[data-status='present'] {
    background: var(--present);
}

.kb-key[data-status='absent'] {
    background: var(--absent);
    opacity: 0.5;
}

.kb-key:active {
    transform: scale(0.9);
}

.kb-key.wide {
    max-width: 65px;
}

/* Overlays */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.glass-modal {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 1.5rem;
    text-align: center;
    max-width: 90%;
}

@media (max-height: 700px) {
    .tile {
        font-size: 1.5rem;
    }

    #board {
        margin: 10px auto;
    }
}