* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* 메인 메뉴 화면 - natmal.com 스타일 */
.menu-screen, .difficulty-screen {
    width: 100%;
    max-width: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 40px 30px;
    text-align: center;
    position: relative;
    margin: 40px auto;
}

/* 태블릿 이상 반응형 */
@media (min-width: 768px) {
    .menu-screen, .difficulty-screen {
        max-width: 700px;
        padding: 50px 40px;
    }
    
    .menu-title {
        font-size: 32px;
        margin-bottom: 40px;
    }
    
    .vocab-buttons, .difficulty-buttons {
        gap: 25px;
    }
    
    .vocab-btn, .difficulty-btn {
        min-width: 220px;
        padding: 30px 25px;
    }
    
    .vocab-icon, .difficulty-icon {
        font-size: 56px;
    }
    
    .vocab-name, .difficulty-name {
        font-size: 22px;
    }
    
    .difficulty-desc {
        font-size: 15px;
    }
    
    .size-buttons {
        gap: 20px;
        flex-direction: row;
    }
    
    .size-btn {
        padding: 25px 20px;
        flex: 1;
    }
    
    .size-label {
        font-size: 20px;
    }
    
    .size-desc {
        font-size: 13px;
    }
    
    /* 설정 화면 반응형 */
    .settings-screen {
        max-width: 700px;
        padding: 50px 40px;
    }
    
    .settings-container {
        max-width: 650px;
    }
    
    .setting-item {
        padding: 20px 25px;
        font-size: 18px;
    }
}

/* 데스크톱 반응형 */
@media (min-width: 1024px) {
    .menu-screen, .difficulty-screen {
        max-width: 900px;
        padding: 60px 50px;
    }
    
    .menu-title {
        font-size: 36px;
        margin-bottom: 50px;
    }
    
    .vocab-selection h2, .difficulty-container h2 {
        font-size: 24px;
        margin-bottom: 30px;
    }
    
    .vocab-buttons, .difficulty-buttons {
        gap: 30px;
        max-width: 800px;
        margin: 0 auto;
    }
    
    .vocab-btn, .difficulty-btn {
        min-width: 250px;
        max-width: 280px;
        padding: 35px 30px;
        flex: 1;
    }
    
    .vocab-icon, .difficulty-icon {
        font-size: 64px;
    }
    
    .vocab-name, .difficulty-name {
        font-size: 24px;
    }
    
    .difficulty-desc {
        font-size: 16px;
    }
    
    .size-selection {
        max-width: 600px;
        margin: 40px auto 0;
    }
    
    .size-buttons {
        gap: 25px;
        flex-direction: row;
    }
    
    .size-btn {
        padding: 30px 25px;
        min-width: 150px;
        flex: 1;
    }
    
    .size-label {
        font-size: 22px;
    }
    
    .size-desc {
        font-size: 14px;
    }
    
    .btn-start {
        max-width: 400px;
        padding: 25px 50px;
        font-size: 26px;
    }
    
    /* 설정 화면 반응형 */
    .settings-screen {
        max-width: 900px;
        padding: 60px 50px;
    }
    
    .settings-container {
        max-width: 850px;
    }
    
    .setting-item {
        padding: 25px 30px;
        font-size: 20px;
    }
    
    .setting-label {
        font-size: 20px;
    }
}

/* 대형 데스크톱 */
@media (min-width: 1440px) {
    .menu-screen, .difficulty-screen {
        max-width: 1100px;
        padding: 70px 60px;
    }
    
    .menu-title {
        font-size: 40px;
    }
    
    .vocab-buttons, .difficulty-buttons {
        max-width: 1000px;
        gap: 40px;
    }
    
    .vocab-btn, .difficulty-btn {
        min-width: 280px;
        max-width: 320px;
        padding: 40px 35px;
    }
    
    /* 설정 화면 반응형 */
    .settings-screen {
        max-width: 1100px;
        padding: 70px 60px;
    }
    
    .settings-container {
        max-width: 1050px;
    }
    
    .setting-item {
        padding: 30px 35px;
        font-size: 22px;
    }
    
    .setting-label {
        font-size: 22px;
    }
}

.menu-container, .difficulty-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.menu-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 30px;
}

.vocab-selection h2, .difficulty-container h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 20px;
}

.vocab-buttons, .difficulty-buttons, .mode-buttons {
    display: flex;
    flex-direction: row;
    gap: 20px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

/* 모바일에서 세로 배치 */
@media (max-width: 767px) {
    .vocab-buttons, .difficulty-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .vocab-btn, .difficulty-btn {
        width: 100%;
        min-width: auto;
    }
    
    .size-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .size-btn {
        width: 100%;
    }
}

.mode-btn {
    width: 100%;
    padding: 30px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.mode-btn:active {
    transform: translateY(-2px);
}

.mode-icon {
    font-size: 48px;
}

.mode-name {
    font-size: 20px;
    font-weight: bold;
}

.mode-desc {
    font-size: 14px;
    opacity: 0.9;
}

.btn-start {
    width: 100%;
    max-width: 300px;
    padding: 20px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-start:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-start:active {
    transform: translateY(-2px);
}

.vocab-btn, .difficulty-btn {
    flex: 1;
    min-width: 200px;
    padding: 25px 20px;
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.vocab-btn:hover, .difficulty-btn:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.vocab-btn:active, .difficulty-btn:active {
    transform: translateY(0);
}

.vocab-icon, .difficulty-icon {
    font-size: 48px;
}

.vocab-name, .difficulty-name {
    font-size: 20px;
    font-weight: bold;
}

.difficulty-desc {
    font-size: 14px;
    opacity: 0.9;
}

/* 칸수 선택 버튼 */
.size-selection {
    width: 100%;
    margin-top: 20px;
}

.size-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.size-btn {
    flex: 1;
    padding: 20px 15px;
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.size-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.size-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #764ba2;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.size-label {
    font-size: 18px;
    font-weight: bold;
}

.size-desc {
    font-size: 12px;
    opacity: 0.9;
}

.vocab-info {
    font-size: 18px;
    color: #667eea;
    font-weight: bold;
    margin-bottom: 10px;
}

.btn-back {
    margin-top: 20px;
    padding: 12px 30px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #d0d0d0;
}

.btn-back-small {
    background: transparent;
    border: none;
    font-size: 16px;
    color: #666;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-back-small:hover {
    background: #f5f5f5;
    color: #333;
}

/* 스플래시 화면 */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-in;
}

.splash-content {
    text-align: center;
    color: white;
}

.splash-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.splash-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
    animation: slideUp 0.8s ease-out;
}

.splash-subtitle {
    font-size: 20px;
    opacity: 0.9;
    margin-bottom: 40px;
    animation: slideUp 1s ease-out;
}

.splash-loader {
    margin-top: 30px;
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 설정 화면 */
.settings-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.settings-container {
    width: 90%;
    max-width: 400px;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* 설정 화면 반응형 - 태블릿 */
@media (min-width: 768px) {
    .settings-container {
        max-width: 500px;
        padding: 35px;
    }
}

/* 설정 화면 반응형 - 데스크톱 */
@media (min-width: 1024px) {
    .settings-container {
        max-width: 600px;
        padding: 40px;
    }
}

/* 설정 화면 반응형 - 대형 데스크톱 */
@media (min-width: 1440px) {
    .settings-container {
        max-width: 700px;
        padding: 50px;
    }
}

.settings-content {
    margin: 30px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #e0e0e0;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 500;
}

.setting-icon {
    font-size: 24px;
}

.setting-select {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
}

.setting-select:hover {
    border-color: #667eea;
}

.setting-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 토글 스위치 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #667eea;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.btn-settings {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s;
}

.btn-settings:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
}

.btn-settings-small {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #667eea;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-settings-small:hover {
    background: #f0f0f0;
    transform: rotate(90deg);
}

.btn-small {
    padding: 8px 20px;
    font-size: 14px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-small:hover {
    background: #ff5252;
}

.btn-hint {
    background: #ffa726;
    color: white;
}

.btn-hint:hover {
    background: #ff9800;
}

.btn-clear {
    background: #ef5350;
    color: white;
}

.btn-clear:hover {
    background: #e53935;
}

/* 게임 컨테이너 - natmal.com 스타일 */
.game-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 게임 헤더 - 깔끔한 상단 바 */
.game-header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
}

.header-center {
    flex: 1;
    text-align: center;
}

.game-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f5f5f5;
    color: #333;
}

/* 진행률 표시 바 */
/* progress-bar 주석 처리 */
/*
.progress-bar-container {
    padding: 10px 15px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    color: #666;
}

.progress-text {
    font-weight: 600;
}

.progress-percent {
    font-weight: bold;
    color: #667eea;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}
*/

.btn-view-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    color: white;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-view-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 게임 메인 영역 - natmal.com 스타일 */
.game-main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* 모바일 반응형 - natmal.com 스타일 */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .clues-card {
        max-height: 400px;
    }
    
    .game-header {
        padding: 12px 20px;
    }
    
    .game-title {
        font-size: 20px;
    }
    
    .header-stats {
        gap: 15px;
    }
    
    .stat-value {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .game-main {
        padding: 15px 10px;
    }
    
    .game-layout {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
        max-width: 100% !important;
        padding: 0 10px;
    }
    
    .grid-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .clues-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .grid-card {
        padding: 10px;
        width: 100%;
    }
    
    .clues-card {
        max-height: 300px;
        width: 100%;
    }
    
    .clues-header {
        padding: 12px;
    }
    
    .clues-list {
        padding: 10px;
    }
    
    .game-controls {
        padding: 12px;
        flex-wrap: wrap;
    }
    
    .controls-row {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .btn-control {
        padding: 8px 12px;
        font-size: 12px;
        flex: 1 1 auto;
        min-width: calc(50% - 3px);
    }
    
    .header-stats {
        display: none;
    }
    
    /* 힌트 슬라이드 모바일 */
    .hints-slider-container {
        margin-bottom: 15px;
        width: 100%;
        max-width: 100%;
    }
    
    .hint-slide-item {
        padding: 12px 35px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .hint-nav-btn {
        width: 30px;
        height: 30px;
        font-size: 16px;
    }
    
    .hint-prev {
        left: 3px;
    }
    
    .hint-next {
        right: 3px;
    }
    
    .hint-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .hint-prev {
        left: 5px;
    }
    
    .hint-next {
        right: 5px;
    }
    
    .hint-text {
        font-size: 13px;
    }
    
    /* 입력 섹션 모바일 */
    .input-section {
        padding: 12px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .input-field-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .mobile-input {
        font-size: 16px;
        padding: 12px;
        width: 100%;
    }
    
    .btn-check-word-inline {
        padding: 12px;
        font-size: 14px;
        width: 100%;
    }
    
    /* 그리드 컨테이너 모바일 */
    .grid-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 5px;
    }
    
    .grid-cell {
        font-size: 20px;
    }
    
    .cell-number {
        font-size: 10px;
        top: 2px;
        left: 4px;
    }
}

/* 힌트 슬라이드 (그리드 위) */
.hints-slider-container {
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.hints-slider {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    width: 100%;
}

.hint-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hint-nav-btn:hover {
    background: rgba(102, 126, 234, 1);
    transform: translateY(-50%) scale(1.1);
}

.hint-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.hint-prev {
    left: 10px;
}

.hint-next {
    right: 10px;
}

.hints-slides {
    display: flex;
    width: 100%;
    max-width: 100%;
    transition: transform 0.3s ease;
    will-change: transform;
    overflow: visible;
    box-sizing: border-box;
    position: relative;
}

.hint-slide-item {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    flex-shrink: 0;
    padding: 20px 60px;
    box-sizing: border-box;
    opacity: 1;
    transition: opacity 0.3s;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
    overflow: hidden;
}

.hint-content {
    text-align: center;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

.hint-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.hint-difficulty {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.hint-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.hint-text {
    font-size: 16px;
    color: #555;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

.hints-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.3s;
}

.indicator-dot.active {
    background: #667eea;
    width: 24px;
    border-radius: 4px;
}

/* 입력 섹션 (그리드 위) */
.input-section {
    margin-bottom: 20px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.selected-clue-info {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.input-field-wrapper {
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.mobile-input {
    flex: 1;
    padding: 12px 16px;
    font-size: 18px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.btn-check-word-inline {
    flex-shrink: 0;
    padding: 12px 20px;
    white-space: nowrap;
}

.mobile-input:focus {
    outline: none;
    border-color: #667eea;
}

.direction-hint {
    font-size: 13px;
    color: #667eea;
    text-align: center;
    margin-top: 10px;
    padding: 8px;
    background: #f0f4ff;
    border-radius: 6px;
}

/* 그리드 영역 */
.grid-wrapper {
    width: 100%;
}

.grid-card {
    background: #fafafa;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #f0f0f0;
}

/* 단서 영역 */
.clues-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.clues-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: calc(100vh - 200px);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.clues-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.clues-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

/* 가로/세로 단서 섹션 그룹 */
.clues-section-group {
    border-bottom: 1px solid #e0e0e0;
}

.clues-section-group:last-child {
    border-bottom: none;
}

.clues-section-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.clues-section-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
}

.clues-list-across,
.clues-list-down {
    max-height: 300px;
    overflow-y: auto;
}

.grid-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-view {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.clues-list-full {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.clue-group {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.clue-group-title {
    font-size: 18px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e0e0e0;
}

.clue-item-full {
    padding: 12px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.clue-item-full:hover {
    background: #e8edff;
    transform: translateX(5px);
}

.clue-item-full.active {
    background: #e8edff;
    border-left-color: #667eea;
    font-weight: bold;
}

.clue-item-full.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.clues-section {
    border-bottom: 2px solid #f0f0f0;
    background: #f8f9fa;
}

.clues-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.clues-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clue-item {
    padding: 14px 16px;
    background: #fafafa;
    border-radius: 8px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

.clue-item:hover {
    background: #f0f4ff;
    border-left-color: #667eea;
}

.clue-item.active {
    background: #e8edff;
    border-left-color: #667eea;
    border-left-width: 4px;
    font-weight: 600;
    color: #667eea;
}

.clue-number {
    font-weight: bold;
    color: #667eea;
    margin-right: 8px;
    font-size: 16px;
    min-width: 24px;
    display: inline-block;
    text-align: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.clue-item.active .clue-number {
    background: #667eea;
    color: white;
}

.clue-direction {
    font-size: 12px;
    color: #999;
    margin-right: 8px;
    font-weight: normal;
}

.clue-text {
    color: #333;
    font-size: 14px;
}

.clue-item.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.grid-section {
    display: none; /* grid-wrapper로 대체됨 */
}

/* Canvas 컨테이너 */
.canvas-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#crosswordCanvas {
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    touch-action: none;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

#crosswordCanvas:focus {
    outline: 3px solid #764ba2;
    outline-offset: 2px;
}

/* 현재 선택된 단서 카드 */
.word-selection-section {
    max-width: 1200px;
    margin: 20px auto 0;
    padding: 0 30px;
}

.selected-clue-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.selected-clue {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.selected-word {
    font-size: 14px;
    color: #666;
    padding: 10px;
    background: #fafafa;
    border-radius: 6px;
}

.word-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.word-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.word-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
}

.word-btn:active {
    transform: scale(0.95);
}

.word-btn.selected-letter {
    background: #764ba2;
    color: white;
    border-color: #764ba2;
    transform: scale(1.05);
}

.word-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #e0e0e0;
    color: #999;
    border-color: #ccc;
}

.word-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.selected-word {
    text-align: center;
    font-size: 32px;
    font-weight: bold;
    color: #333;
    min-height: 50px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 3px solid #667eea;
    letter-spacing: 8px;
}

.grid-container {
    display: inline-grid;
    gap: 0;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
}

.grid-cell {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    border: 1px solid #e8e8e8;
    text-align: center;
    font-size: 24px;
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 6px;
    padding: 0;
    box-sizing: border-box;
}

.grid-cell:focus {
    outline: none;
    background: #f8f9ff;
    border: 2px solid #667eea;
    z-index: 1;
}

.grid-cell.blocked {
    background: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.5;
    border: 1px solid #e0e0e0;
}

.grid-cell.numbered {
    position: relative;
}

.grid-cell-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
}

.cell-number {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 11px;
    color: #667eea;
    font-weight: 600;
    z-index: 10;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    user-select: none;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    line-height: 1.2;
    min-width: 16px;
    text-align: center;
}

.cell-number:hover {
    background: #667eea;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.cell-number.active-number {
    background: #667eea;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.grid-cell.highlighted {
    background: #fffef0;
    border-color: #ffd54f;
}

.grid-cell.active {
    background: #f0f4ff;
    border: 2px solid #667eea;
    z-index: 1;
}

.grid-cell.correct {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #81c784;
}

.grid-cell.incorrect {
    background: #ffebee;
    color: #c62828;
    border-color: #ef5350;
}

.grid-cell.auto-correct {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #81c784;
    animation: flash-green 0.5s;
}

.grid-cell.auto-incorrect {
    background: #ffebee;
    color: #c62828;
    border-color: #ef5350;
    animation: flash-red 0.5s;
}

@keyframes flash-green {
    0%, 100% { background: #c8e6c9; }
    50% { background: #a5d6a7; }
}

@keyframes flash-red {
    0%, 100% { background: #ffcdd2; }
    50% { background: #ef9a9a; }
}

/* 게임 컨트롤 - natmal.com 스타일 */
.game-controls {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 20px 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 그리드 위 버튼 스타일 */
.grid-wrapper .game-controls {
    border-top: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 15px 20px;
}

.controls-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-control {
    padding: 10px 20px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-control:hover {
    background: #e8edff;
    border-color: #667eea;
    color: #667eea;
}

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

.control-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn {
    /* flex: 1; */
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-hint {
    background: #ffc107;
    color: #333;
}

.btn-hint:active {
    background: #ffb300;
    transform: scale(0.95);
}

.btn-reveal {
    background: #2196f3;
    color: white;
}

.btn-reveal:active {
    background: #1976d2;
    transform: scale(0.95);
}

.btn-check-word {
    background: #4caf50;
    color: white;
}

.btn-check-word:active {
    background: #388e3c;
    transform: scale(0.95);
}

.btn-check-all {
    background: #9c27b0;
    color: white;
}

.btn-check-all:active {
    background: #7b1fa2;
    transform: scale(0.95);
}

.btn-check {
    background: #4caf50;
    color: white;
}

.btn-reset {
    background: #ff9800;
    color: white;
}

.btn-reset:active {
    background: #f57c00;
    transform: scale(0.95);
}

.btn-check:active {
    background: #45a049;
    transform: scale(0.95);
}

.btn-next {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-next:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 15px;
    color: #667eea;
    font-size: 24px;
}

.modal-content p {
    margin-bottom: 20px;
    color: #666;
    font-size: 16px;
    line-height: 1.6;
}

.modal-content p strong {
    color: #667eea;
    font-size: 18px;
    display: block;
    margin-bottom: 8px;
}

/* 모바일 최적화 */
@media (max-width: 480px) {
    .game-main {
        padding: 10px 5px;
    }
    
    .game-layout {
        gap: 10px !important;
        padding: 0 5px;
    }
    
    .grid-cell-wrapper {
        width: 100%;
        aspect-ratio: 1;
    }

    .grid-cell {
        font-size: 18px;
    }

    .cell-number {
        font-size: 9px;
        top: 2px;
        left: 3px;
        padding: 1px 3px;
    }
    
    .grid-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 4px;
    }
    
    .grid-card {
        padding: 8px;
    }

    .clues-list {
        max-height: 150px;
        font-size: 12px;
    }
    
    .clues-section-header {
        font-size: 14px;
        padding: 8px;
    }
    
    .clue-item {
        padding: 8px;
        font-size: 12px;
    }

    .game-header {
        padding: 12px 10px;
    }

    .level-number, .score-value {
        font-size: 18px;
    }
    
    .hint-slide-item {
        padding: 10px 30px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .hint-nav-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .hint-prev {
        left: 2px;
    }
    
    .hint-next {
        right: 2px;
    }
    
    .hint-text {
        font-size: 12px;
    }
    
    .mobile-input {
        font-size: 18px;
        padding: 10px;
    }
    
    .btn-control {
        padding: 8px 10px;
        font-size: 11px;
        min-width: calc(50% - 2px);
    }
    
    .input-section {
        padding: 10px;
    }
}

/* 스크롤바 스타일링 */
.clues-list::-webkit-scrollbar {
    width: 6px;
}

.clues-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.clues-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 3px;
}

.clues-list::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}



/* ✅ 선택된 칸(포커스와 분리된 상태) */
.grid-cell.selected{
  outline: 2px solid var(--primary, #256ef4);
  box-shadow: 0 0 0 2px rgba(37,110,244,.15);
}


/* ✅ 토글이 보이게: 활성 단서 미세 펄스 */
@keyframes cluePulse {0%{transform:translateX(3px) scale(1);}50%{transform:translateX(3px) scale(1.02);}100%{transform:translateX(3px) scale(1);}}
.clue-item.pulse{animation: cluePulse 0.35s ease-out;}

.direction-hint{margin-top:8px;font-size:12px;opacity:.85;}

/* 가상 키보드 스타일 (모바일 입력용) */
.virtual-keyboard {
    width: 100%;
    padding: 15px;
    background: #f8f9fa;
    border-top: 2px solid #e0e0e0;
    margin-bottom: 10px;
    display: none; /* 기본적으로 숨김, 모바일에서만 표시 */
}

.keyboard-row {
    display: flex;
    width: 100%;
}

#mobileInput {
    width: 100%;
    height: 50px;
    text-align: center;
    font-size: 24px;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 10px;
    background: white;
    color: #333;
    outline: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

#mobileInput:focus {
    border-color: #764ba2;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.4);
}

#mobileInput::placeholder {
    color: #999;
    font-size: 18px;
}

/* 모바일에서만 가상 키보드 표시 */
@media (max-width: 768px) {
    .virtual-keyboard {
        display: block;
    }
}


/* 모바일 터치 튐 완화 */
.grid-cell{touch-action: manipulation; -webkit-tap-highlight-color: transparent;}

