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

/* 컨테이너 쿼리: 레이아웃이 줄어들면 글자도 같이 줄어들게 (cqmin 기준) */
#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: 200;
}

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

/* 배틀 아레나 스타일 (배틀 모드와 동일) */
.practice-memorization-arena {
    flex: 0 0 40%;
    background: #000 url('../images/practice_mode/background.webp') center/cover no-repeat;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px 30px;
    border-bottom: 2px solid #333;
    background-size: cover;
    overflow: hidden;
    max-width: 100vw;
    min-height: 28vh;
}

/* 헤더 영역 (배틀 모드의 info-badge 스타일) */
.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: #fff;
    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);
}

/* 나가기: 아레나(이미지) 우하단 고정 */
.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: #fff !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: #fff;
}

/* 모바일 반응형 */
@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;
    }
}
