.amprle-page {
    overscroll-behavior-y: none;
}

.amprle-board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 0.35rem;
    padding: 0.5rem;
    box-sizing: border-box;
    width: 100%;
    max-width: 350px;
}

.amprle-board-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
}

.amprle-cell {
    width: 100%;
    aspect-ratio: 1;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.5rem, 6vw, 2rem);
    font-weight: 700;
    font-family: var(--font-headline);
    text-transform: uppercase;
    box-sizing: border-box;
    
    /* Default empty state */
    border: 2px solid var(--color-outline-variant);
    background-color: var(--color-surface-container-lowest);
    color: var(--color-on-background);
}

/* Cell states */
.amprle-cell[data-state="tbd"] {
    border: 2px solid var(--color-outline);
    color: var(--color-on-background);
}

.amprle-cell[data-state="correct"] {
    background-color: #538d4e;
    border-color: #538d4e;
    color: white;
}

.amprle-cell[data-state="present"] {
    background-color: #b59f3b;
    border-color: #b59f3b;
    color: white;
}

.amprle-cell[data-state="absent"] {
    background-color: #3a3a3c;
    border-color: #3a3a3c;
    color: white;
}

/* Animations */
.amprle-cell[data-animation="pop"] {
    animation: pop 0.1s;
}

@keyframes pop {
    from { transform: scale(0.8); opacity: 0; }
    40% { transform: scale(1.1); opacity: 1; }
}

.amprle-cell[data-animation="flipIn"] {
    animation: flipIn 0.25s ease-in forwards;
}

.amprle-cell[data-animation="flipOut"] {
    animation: flipOut 0.25s ease-in forwards;
}

@keyframes flipIn {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-90deg); }
}

@keyframes flipOut {
    0% { transform: rotateX(-90deg); }
    100% { transform: rotateX(0deg); }
}

.amprle-row-shake {
    animation: shake 0.5s;
}

@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* Keyboard */
.amprle-keyboard {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.5rem;
    user-select: none;
}

.kb-row {
    display: flex;
    width: 100%;
    gap: 0.35rem;
    touch-action: manipulation;
}

.kb-spacer-half {
    flex: 0.5;
}

.kb-key {
    font-family: var(--font-label);
    font-weight: 700;
    font-size: 0.8rem;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 58px;
    border-radius: 4px;
    border: 0;
    background-color: var(--color-surface-container);
    color: var(--color-on-surface);
    cursor: pointer;
    text-transform: uppercase;
}

.kb-key-lg {
    flex: 1.5;
    font-size: 0.75rem;
}

.kb-key:hover {
    filter: brightness(0.9);
}

.kb-key[data-state="correct"] {
    background-color: #538d4e;
    color: white;
}

.kb-key[data-state="present"] {
    background-color: #b59f3b;
    color: white;
}

.kb-key[data-state="absent"] {
    background-color: #3a3a3c;
    color: white;
}

/* Toast */
.amprle-toast {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-on-background);
    color: var(--color-surface);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    font-family: var(--font-label);
    font-weight: 700;
    font-size: 0.875rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.amprle-toast.show {
    opacity: 1;
}
