:root {
    --kr-red: #CD2E3A;
    --kr-blue: #0047A0;
    --bg: #f8f9fa;
    --key-bg: #ffffff;
    --border: #e0e0e0;
    --text-color: #212529;
    --display-color: var(--kr-blue);
}

body.dark-mode {
    --bg: #212529;
    --key-bg: #343a40;
    --border: #495057;
    --text-color: #f8f9fa;
    --display-color: #e9ecef;
}

#theme-toggle-btn {
    background: #eee;
    border: none;
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 10px;
}

body {
    font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    background-color: var(--bg);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    margin: 0;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

header {
    width: 100%;
    background: linear-gradient(135deg, var(--kr-blue) 0%, var(--kr-red) 100%);
    color: white;
    padding: 40px 0;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    position: relative;
}
header h1 { font-size: 2.5rem; margin: 0; }
header p { font-size: 1rem; opacity: 0.9; margin-top: 5px; }

.container { max-width: 800px; width: 90%; text-align: center; padding-bottom: 50px; }

/* 단어 카드 및 조합창 */
#word-card, #display-area {
    background: var(--key-bg);
    border-radius: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    margin-bottom: 15px;
    transition: background-color 0.3s, border-color 0.3s;
}

#word-card { padding: 20px; position: relative; }
.mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.toggle-btn {
    background: #eee; border: none; padding: 6px 15px; border-radius: 20px;
    cursor: pointer; font-size: 0.8rem; font-weight: bold;
}
.toggle-btn.active { background: #333; color: white; }

body.dark-mode .toggle-btn {
    background-color: #495057;
    color: #f8f9fa;
}

#target-word { font-size: 3rem; margin: 5px 0; transition: 0.2s; }
#target-word.hidden { filter: blur(15px); pointer-events: none; }
#target-meaning { font-size: 1.4rem; color: #888; }

#display-area {
    font-size: 4rem; height: 120px; color: var(--display-color);
    display: flex; justify-content: center; align-items: center;
}

/* 키보드 스타일 */
.keyboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    gap: 8px;
    margin-bottom: 20px;
}

button.key {
    padding: 10px 2px;
    border: 1px solid var(--border);
    background: var(--key-bg);
    color: var(--text-color);
    border-radius: 10px;
    box-shadow: 0 3px 0 #ddd;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center;
    transition: 0.1s;
}
body.dark-mode button.key {
    box-shadow: 0 3px 0 #212529;
}

/* 💡 물리 키보드 입력 시 시각적 효과를 위한 클래스 */
button.key.active-press {
    transform: translateY(3px);
    box-shadow: none;
    background-color: #f0f0f0;
}

body.dark-mode button.key.active-press {
    background-color: #495057;
}

.key .main { font-size: 1.3rem; font-weight: bold; }
.key .sub { font-size: 0.7rem; color: var(--kr-red); margin-top: 2px; font-weight: bold; }

.controls { display: flex; gap: 10px; justify-content: center; }
.btn-action {
    padding: 15px 40px; font-size: 1.1rem; border-radius: 30px;
    border: none; color: white; cursor: pointer; font-weight: bold;
}
.clear { background: #adb5bd; }
.submit { background: var(--kr-red); }

.section-header { display: flex; align-items: center; margin: 15px 0 10px 0; color: #666; font-size: 0.8rem; }
.section-header hr { flex-grow: 1; border: 0; border-top: 1px solid #ddd; margin-left: 10px; }
body.dark-mode .section-header { color: #ced4da; }
body.dark-mode .section-header hr { border-top-color: #495057; }

@keyframes pop { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.success-anim { animation: pop 0.4s ease; color: #27ae60 !important; }