/* =========================================================
   wordle style — 보드(타일 그리드) + 가상 키보드
   ========================================================= */

/* ---------- 상단: 입력 보드 ---------- */
.board-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

.board {
    display: grid;
    gap: 5px;
    padding: 8px 0;
}

.board__row {
    display: grid;
    gap: 5px;
    grid-auto-flow: column;
    justify-content: center;
}

.tile {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    text-transform: none;
    user-select: none;
    border: 2px solid var(--color-empty-border);
    color: var(--color-text);
    background: #fff;
}

/* 글자가 입력된 빈 타일 */
.tile.tile--filled {
    border-color: var(--color-tile-border);
    animation: pop 0.1s ease;
}

/* 판정 색상 */
.tile.state-correct { background: var(--color-correct); border-color: var(--color-correct); color: #fff; }
.tile.state-present { background: var(--color-present); border-color: var(--color-present); color: #fff; }
.tile.state-absent  { background: var(--color-absent);  border-color: var(--color-absent);  color: #fff; }

/* 뒤집기 애니메이션 */
.tile.flip { animation: flip 0.5s ease forwards; }

@keyframes pop {
    0% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
@keyframes flip {
    0%   { transform: rotateX(0); }
    50%  { transform: rotateX(-90deg); }
    100% { transform: rotateX(0); }
}

.board__row.shake { animation: shake 0.5s; }
@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

/* 좁은 화면에서 타일 축소 (7칸까지 대응) */
@media (max-width: 400px) {
    .tile { width: 44px; height: 44px; font-size: 26px; }
}
@media (max-width: 340px) {
    .tile { width: 38px; height: 38px; font-size: 22px; }
}

/* 토스트 메시지 */
.toast-wrap {
    position: fixed;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.toast {
    background: #1a1a1b;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    animation: toastIn 0.12s ease;
}
@keyframes toastIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 하단: 가상 키보드 ---------- */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    user-select: none;
}
.keyboard__row {
    display: flex;
    justify-content: center;
    gap: 6px;
}
.key {
    flex: 1 1 auto;
    height: 58px;
    min-width: 0;
    max-width: 44px;
    border: 0;
    border-radius: 4px;
    background: var(--color-key-bg);
    color: var(--color-key-text);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: manipulation;
    transition: background 0.05s;
}
.key:active { filter: brightness(0.92); }

.key--wide {
    flex: 1.5 1 auto;
    max-width: 68px;
    font-size: 12px;
    font-weight: 700;
}

.key.state-correct { background: var(--color-correct); color: #fff; }
.key.state-present { background: var(--color-present); color: #fff; }
.key.state-absent  { background: var(--color-absent);  color: #fff; }

.key.key--shift-active { background: #9aa0a6; color: #fff; }

@media (max-width: 400px) {
    .key { height: 50px; font-size: 16px; }
}
