#game-stage:focus {
    outline: none;
}

#game-stage .ty-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 343px;
    margin: 0 auto;
    color: var(--text-color);
}

#game-stage .ty-wrap p,
#game-stage .ty-wrap div {
    margin: 0;
}

/* コースの選択 */
#game-stage .ty-course {
    display: flex;
    justify-content: center;
    gap: 8px;
    height: 44px;
}

#game-stage .ty-course-btn {
    flex: 1 1 0;
    min-width: 0;
    max-width: 104px;
    height: 44px;
    padding: 0 2px;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    color: var(--primary-color);
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
}

#game-stage .ty-course-btn[aria-pressed="true"] {
    color: #ffffff;
    background: var(--primary-color);
}

#game-stage .ty-course-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 情報の行 */
#game-stage .ty-info {
    display: flex;
    justify-content: space-around;
    height: 28px;
    font-size: 16px;
    line-height: 28px;
    padding: 0;
}

#game-stage #time,
#game-stage #score,
#game-stage #miss {
    font-weight: bold;
    font-variant-numeric: tabular-nums;
}

/* 単語の箱 */
#game-stage .ty-word-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 120px;
    border-radius: 10px;
    background: var(--bg-color);
    text-align: center;
}

#game-stage .ty-word {
    margin: 0;
    padding: 0;
    font-size: 32px;
    font-weight: bold;
    line-height: 1.4;
    text-align: center;
}

#game-stage .ty-romaji {
    margin: 0;
    padding: 0;
    font-family: monospace;
    font-size: 22px;
    line-height: 1.4;
    text-align: center;
    overflow-wrap: anywhere;
}

#game-stage .ty-romaji .typed {
    color: var(--text-color);
    font-weight: bold;
}

#game-stage .ty-romaji .rest {
    color: var(--text-muted);
    opacity: 0.6;
}

#game-stage .ty-result {
    display: none;
    margin: 0;
    padding: 0;
    text-align: center;
}

#game-stage .ty-result div {
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

#game-stage .ty-result .ty-result-score {
    font-size: 24px;
    font-weight: bold;
}

#game-stage .ty-result .ty-result-new {
    font-weight: bold;
    color: #c05621;
}

#game-stage .ty-wrap[data-state="result"] .ty-word,
#game-stage .ty-wrap[data-state="result"] .ty-romaji {
    display: none;
}

#game-stage .ty-wrap[data-state="result"] .ty-result {
    display: block;
}

/* 状態のことば */
#game-stage .ty-status {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

/* スタート／もう一度 */
#game-stage .ty-buttons {
    display: flex;
    justify-content: center;
    height: 52px;
}

#game-stage .ty-main-btn {
    width: 200px;
    max-width: 100%;
    height: 52px;
    padding: 0;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    color: #ffffff;
    background: var(--primary-color);
    border: none;
    border-radius: 26px;
    cursor: pointer;
    touch-action: manipulation;
}

#game-stage .ty-main-btn[hidden] {
    display: none;
}

/* キーボード（ABC順・1段7個） */
#game-stage .ty-keys {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 194px;
    width: 100%;
    max-width: 338px;
    margin: 0 auto;
}

#game-stage .ty-key-row {
    display: flex;
    justify-content: center;
    column-gap: min(5px, calc((100% - 280px) / 6));
    height: 44px;
}

#game-stage .ty-key {
    flex: 0 1 44px;
    min-width: 40px;
    height: 44px;
    padding: 0;
    font-family: monospace;
    font-size: 20px;
    line-height: 1;
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-bottom-width: 3px;
    border-radius: 8px;
    cursor: pointer;
    touch-action: manipulation;
    transition: background-color 0.1s;
}

#game-stage .ty-key[data-next="true"] {
    color: #ffffff;
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(214, 158, 46, 0.9);
}

#game-stage .ty-key[data-miss="true"] {
    color: #ffffff;
    background: #e53e3e;
    border-color: #c53030;
}

#game-stage .ty-course-btn:focus-visible,
#game-stage .ty-main-btn:focus-visible,
#game-stage .ty-key:focus-visible {
    outline: 3px solid #d69e2e;
    outline-offset: 2px;
}

/* 記録 */
#game-stage .ty-record {
    margin: 0;
    padding: 0;
    min-height: 17px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
    text-align: center;
}
