/* ============================================
   Practice Mode Game 스타일
   ============================================ */

/* 연습 화면의 기본 배치와 cqmin 크기. 최종 이미지·공통 조작은 theme 스타일에서 적용한다. */
#practice-mode-game {
    container-type: size;
    container-name: practice-game;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: var(--app-height, 100vh);
    display: flex;
    flex-direction: column;
    background: var(--game-bg);
    z-index: var(--layer-game);
}

.practice-memorization-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 연습 배경과 범위·단어 순서를 표시하는 아레나. */
.practice-memorization-arena {
    flex: 0 0 25%;
    background: var(--color-black) url('../../images/theme/library.webp?v=6bc816130648') center/cover no-repeat;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px 30px;
    border-bottom: 2px solid var(--neutral-800);
    background-size: cover;
    overflow: hidden;
    max-width: 100vw;
    min-height: 160px;
}

/* 아레나의 학습 범위와 단어 순서 표시. 조작 버튼은 별도 gameplay-header에 둔다. */
.practice-memorization-header {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 15;
    pointer-events: none;
}

.music-info-overlay {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 12px;
    border-radius: 20px;
    color: var(--color-white);
    font-size: 12px;
    z-index: 20;
    pointer-events: auto; /* Enable clicks */
    cursor: pointer;
    border: 1px solid rgba(255, 213, 79, 0.3);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    max-width: 150px;
    overflow: hidden;
}

.music-select-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
    -webkit-appearance: menulist-button;
    appearance: menulist-button;
}

.music-info-content {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.music-icon {
    flex-shrink: 0;
}

.music-text-container {
    overflow: hidden;
    flex: 1;
}

.music-filename {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 10s linear infinite;
}

/* 레이아웃 비율: 컨테이너(cqmin) 기준 — 밝은 톤 */
.practice-day-info {
    background: rgba(255, 255, 255, 0.95);
    padding: clamp(4px, 1.2cqmin, 12px) clamp(6px, 2cqmin, 16px);
    border-radius: 12px;
    border: 1px solid var(--game-card-border);
    font-size: clamp(14px, 3cqmin, 20px);
    color: var(--game-text);
    line-height: clamp(14px, 3cqmin, 20px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.practice-word-counter {
    background: rgba(255, 255, 255, 0.95);
    padding: clamp(4px, 1.2cqmin, 12px) clamp(6px, 2cqmin, 16px);
    border-radius: 12px;
    border: 1px solid var(--game-card-border);
    font-size: clamp(14px, 3cqmin, 20px);
    color: var(--game-text);
    line-height: clamp(14px, 3cqmin, 20px);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 이전 아레나 나가기 영역의 배치. 현행 나가기는 공통 gameplay-header에 둔다. */
.practice-arena-exit-wrap {
    position: absolute;
    bottom: clamp(10px, 2.5cqmin, 20px);
    right: clamp(10px, 2.5cqmin, 24px);
    z-index: 20;
    pointer-events: auto;
}

.practice-arena-exit-wrap .practice-nav-btn {
    min-width: auto;
    padding: clamp(8px, 2cqmin, 12px) clamp(14px, 3cqmin, 22px);
    font-size: clamp(14px, 2.8cqmin, 18px);
}

/* 필터 칩의 기본 크기와 선택 상태. */
.practice-chip {
    flex: 1;
    min-width: 0;
    padding: clamp(6px, 1.5cqmin, 10px) clamp(4px, 1cqmin, 8px);
    font-size: clamp(12px, 2.5cqmin, 16px);
    font-weight: bold;
    color: var(--game-text);
    background: var(--game-card);
    border: 2px solid var(--game-card-border);
    border-radius: clamp(6px, 1.5cqmin, 10px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    outline: none;
}

/* 선택된 칩: 배경·테두리로 강조, 글자는 진하게 해서 잘 보이게 */
.practice-chip-active {
    background: rgba(255, 193, 7, 0.35);
    border-color: #c9a227;
    color: #1a1a1a;
    font-weight: 800;
}

/* 필터 칩과 발음 버튼을 담는 행. 외움 표시는 하단 탐색 버튼 사이에 둔다. */
.practice-memorized-row {
    flex-shrink: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: clamp(4px, 1cqmin, 8px);
    margin-top: clamp(12px, 3cqmin, 24px);
    padding: clamp(4px, 1cqmin, 8px) clamp(6px, 1.5cqmin, 10px);
    background: transparent;
    width: 100%;
    box-sizing: border-box;
}

.practice-memorized-row .practice-memorized-btn,
.practice-memorized-row .practice-speak-btn {
    flex-shrink: 0;
}

/* 초이스 칩 행 안의 음성 버튼 — 칩과 비슷한 높이 */
.practice-memorized-row .practice-speak-btn {
    width: clamp(40px, 9cqmin, 56px);
    height: clamp(40px, 9cqmin, 56px);
    font-size: clamp(20px, 4.5cqmin, 28px);
}

.practice-memorized-btn {
    padding: clamp(8px, 2cqmin, 12px) clamp(10px, 2.5cqmin, 18px);
    font-size: clamp(14px, 2.8cqmin, 18px);
    font-weight: bold;
    line-height: 1.2;
    color: var(--game-text);
    background: var(--game-card);
    border: 2px solid var(--game-card-border);
    border-radius: clamp(8px, 2cqmin, 12px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    outline: none;
}

.practice-memorized-btn.practice-memorized-active {
    background: #2e7d32 !important;
    border-color: #1b5e20 !important;
    color: var(--color-white) !important;
}

/* 콘텐츠 영역 — 배틀 모드 quiz-area처럼 섹션 간 간격 */
.practice-memorization-content {
    flex: 1;
    background: var(--game-bg);
    padding: 15px clamp(6px, 1.5cqmin, 15px);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 12px;
}

/* 단어·뜻·영문 해석 — 각각 독립 박스 (배틀 모드 question-box와 동일 스타일) */
.practice-word-section,
.practice-meaning-section,
.practice-explanation-section {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid var(--game-card-border);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

/* 단어·뜻 — 배틀 모드 question-box와 동일 레이아웃 */
.practice-word-section,
.practice-meaning-section {
    text-align: center;
}

.practice-explanation-section {
    text-align: left;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.practice-explanation-hint {
    margin-top: 6px;
    font-size: clamp(11px, 2.2cqmin, 14px);
    color: var(--game-text-muted);
    opacity: 0.85;
    text-align: right;
}
.practice-explanation-text {
    display: block;
}

.practice-label {
    font-size: 16px;
    color: var(--game-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* 영어 단어의 가로 배치. 발음 버튼은 별도 필터 행에 둔다. */
.practice-word-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(8px, 2cqmin, 14px);
    flex-wrap: nowrap;
}

.practice-speak-btn {
    flex-shrink: 0;
    width: clamp(36px, 8cqmin, 52px);
    height: clamp(36px, 8cqmin, 52px);
    padding: 0;
    border: 2px solid var(--game-card-border);
    border-radius: 50%;
    background: var(--game-card);
    color: var(--game-text);
    font-size: clamp(18px, 4cqmin, 26px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    outline: none;
}

.practice-speak-btn:active {
    transform: scale(0.98);
}

/* 단어·뜻·풀이의 기본 글자 크기와 정렬. */
.practice-word-text {
    flex: 1;
    font-size: clamp(18px, 6.5cqmin, 38px);
    font-weight: bold;
    color: var(--game-text);
    text-align: center;
    word-break: keep-all;
    line-height: 1.4;
    min-width: 0;
}

.practice-meaning-text {
    font-size: clamp(16px, 5.5cqmin, 34px);
    color: var(--game-text);
    text-align: center;
    word-break: keep-all;
    line-height: 1.5;
    font-weight: bold;
}

.practice-explanation-text {
    font-size: clamp(15px, 4cqmin, 28px);
    color: var(--game-text-muted);
    text-align: left;
    word-break: break-word;
    line-height: 1.6;
    font-style: normal;
}

/* 네비게이션 버튼 — 초이스칩과 동일한 좌우 간격, 3개 동일 크기 */
.practice-memorization-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: clamp(6px, 1.5cqmin, 10px);
    padding: clamp(6px, 1.5cqmin, 12px) clamp(6px, 1.5cqmin, 10px);
    margin-top: auto;
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border-top: none;
    flex-shrink: 0;
    min-height: 0;
}

.practice-nav-btn {
    width: 100%;
    min-width: 0;
    padding: clamp(10px, 2.5cqmin, 16px) clamp(6px, 1.5cqmin, 10px);
    font-size: clamp(16px, 3.2cqmin, 22px);
    font-weight: bold;
    color: var(--game-text);
    background: var(--game-card);
    border: 2px solid var(--game-card-border);
    border-radius: clamp(8px, 2cqmin, 12px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    min-height: 0;
    line-height: 1.2;
    outline: none;
}

.practice-nav-btn:active {
    transform: translateY(0);
}

.practice-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

.practice-nav-exit {
    background: rgba(229, 115, 115, 0.9);
    border-color: rgba(239, 83, 80, 0.85);
    color: var(--color-white);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .practice-memorization-arena {
        min-height: 25vh;
        padding: 15px 20px;
    }

    /* 초이스칩과 동일한 좌우 간격 유지 */
    .practice-memorization-content {
        padding: 12px clamp(6px, 1.5cqmin, 10px);
        gap: 12px;
    }

    .practice-word-section,
    .practice-meaning-section,
    .practice-explanation-section {
        padding: 12px;
    }

    .practice-memorization-navigation {
        padding: 12px clamp(6px, 1.5cqmin, 10px);
        gap: 6px;
    }
}

.practice-recall-prompt {
    margin: 4px 0 12px;
    color: var(--game-text-muted);
    font-size: 16px;
}
.practice-reveal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--game-card-border);
    background: var(--primary);
    color: var(--game-text);
    font: inherit;
    font-size: 16px;
    cursor: pointer;
    min-height: 44px;
}
.practice-meaning-text {
    margin-top: 8px;
}
@media (max-height: 550px) {
    .practice-memorization-arena {
        flex-basis: 25%;
        min-height: 110px;
    }
}
