/* 훈문장長음 게임 스타일 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* 게임 컨테이너 */
.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

/* 상단 헤더 */
.header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}

.header-title {
    font-size: 40px;
    font-weight: 900;
    flex: 1;
}

.header-title span {
    font-size: 16px;
    font-weight: normal;
    color: #777;
}

.header-icons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 4px;
}

.btn-icon:hover {
    color: #000;
}

/* 문제 + 문장 표시 */
.title-section {
    text-align: center;
    margin-bottom: 24px;
}

.question-text {
    font-size: 16px;
    color: #555;
    margin-bottom: 12px;
    text-align: left;
}

.sentence-display {
    display: inline-block;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 16px 32px;
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 2px;
}

.seg-new {
    color: #e00;
}

/* 게임 바디: 1열 레이아웃 (순위표 없음) */
.game-body {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    margin-bottom: 24px;
}

.sentence-section {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
}

.input-section {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    gap: 12px;
}

/* 문장 섹션 */
.attempt-count {
    color: #e00;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: right;
}

.sentence-list {
    border: 1px solid #ccc;
    border-radius: 4px;
    height: 300px;
    overflow-y: auto;
    padding: 8px 12px;
    background: #fafafa;
}

.sentence-item {
    padding: 6px 0;
    font-size: 15px;
    border-bottom: 1px solid #eee;
}

.sentence-item:last-child {
    border-bottom: none;
}

.sentence-item.new {
    color: #00a000;
    font-size: 17px;
    font-weight: bold;
}

.sentence-item .arrow {
    color: #999;
    margin: 0 4px;
}

.sentence-item .match {
    color: #e00;
    font-weight: bold;
}

/* 입력란 */
.sentence-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
}

.sentence-input:focus {
    border-color: #666;
}

.sentence-input:disabled {
    background: #f0f0f0;
    color: #999;
}

.btn-submit {
    padding: 12px 32px;
    font-size: 16px;
    font-weight: bold;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-submit:hover {
    background: #555;
}

.btn-submit:disabled {
    background: #999;
    cursor: default;
}

/* 하단 네비게이션 */
.bottom-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 16px 0;
}

.nav-btn {
    display: inline-block;
    padding: 10px 28px;
    font-size: 15px;
    font-weight: bold;
    background: none;
    color: #00a000;
    border: 2px solid #00a000;
    border-radius: 0;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
}

.nav-btn:hover {
    background: #00a000;
    color: #fff;
}

/* 모달 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 8px;
    padding: 32px;
    min-width: 320px;
    max-width: 400px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.modal-close:hover {
    color: #000;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #ddd;
}

.modal-message {
    font-size: 16px;
    margin-bottom: 24px;
    margin-top: 8px;
}

.complete-highlight {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 24px;
    margin-top: 8px;
}

/* 완성 팝업 가로 확장 (긴 축하 문구 줄바꿈 방지) */
#modalComplete .modal {
    max-width: 480px;
}

#modalComplete .complete-share-text {
    text-align: center;
    font-size: 14px;
    color: #777;
}

.medal-icon {
    margin-right: 4px;
    flex-shrink: 0;
}

.modal-confirm {
    float: right;
    padding: 8px 24px;
    font-size: 14px;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.modal-confirm:hover {
    background: #555;
}

/* 도움말 모달 */
.modal-hint {
    padding: 28px 32px;
}

.modal-hint-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #ddd;
}

.modal-hint-list {
    list-style: disc;
    padding-left: 20px;
    font-size: 15px;
    line-height: 1.8;
}

.modal-hint-example {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.modal-hint-question {
    font-size: 14px;
    color: #555;
    width: 100%;
}

.modal-hint-sentence {
    display: inline-block;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px 24px;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 2px;
}

.modal-hint-input {
    display: flex;
    gap: 8px;
    width: 100%;
}

.modal-hint-field {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    color: #999;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.modal-hint-btn {
    display: flex;
    align-items: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: bold;
    background: #333;
    color: #fff;
    border-radius: 4px;
}

.modal-hint-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 12px;
    font-size: 14px;
    color: #666;
}

/* 토스트 */
.toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 2000;
}

.toast.show {
    opacity: 1;
}

/* 반응형: 태블릿 */
@media (max-width: 1200px) {
    .game-container {
        border-left: none;
        border-right: none;
    }
}

/* 반응형: 모바일 */
@media (max-width: 640px) {
    .game-container {
        padding: 16px 12px;
    }

    .header-title {
        font-size: 32px;
    }

    .sentence-display {
        font-size: 20px;
        padding: 12px 20px;
    }

    .game-body {
        gap: 16px;
    }

    .sentence-list {
        height: 240px;
    }

    .input-section {
        gap: 8px;
    }

    .sentence-input {
        padding: 10px 12px;
        font-size: 16px;
    }

    .btn-submit {
        padding: 10px 20px;
        font-size: 15px;
    }

    .modal {
        min-width: 0;
        max-width: calc(100vw - 32px);
        margin: 0 16px;
        padding: 24px;
    }

    /* 완성 팝업 — 모바일 줄바꿈 방지용 폰트 축소 */
    .complete-highlight {
        font-size: 16px;
    }

    #modalComplete .complete-share-text {
        font-size: 13px;
    }
}
