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

body {
    font-family: 'Segoe UI', 'Malgun Gothic', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 80px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 800px;
    width: 100%;
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2.5em;
    font-weight: 300;
    letter-spacing: -1px;
}

/* 说明文字样式优化 */
.info {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.info p {
    margin: 4px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
}

.input-section {
    margin-bottom: 20px;
}

#koreanInput {
    width: 100%;
    height: 200px;
    padding: 20px;
    border: 2px solid #e1e5e9;
    border-radius: 15px;
    font-size: 18px;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
    background: #fafbfc;
}

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

#koreanInput::placeholder {
    color: #a8b2c1;
    font-style: italic;
}

.button-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

/* 虚拟键盘区域间距优化 */
.virtual-keyboard-section {
    margin-top: 15px;
}

button {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

#copyBtn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

#copyBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

#clearBtn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
}

#clearBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 107, 107, 0.3);
}

button:active {
    transform: translateY(0);
}

.info {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
    line-height: 1.5;
}

.info p {
    margin-bottom: 8px;
}

.info p:last-child {
    margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }
    
    #koreanInput {
        height: 150px;
        font-size: 16px;
        padding: 15px;
    }
    
    .button-section {
        flex-direction: column;
        align-items: center;
    }
    
    button {
        width: 200px;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }
    
    h1 {
        font-size: 1.8em;
    }
    
    #koreanInput {
        height: 120px;
        font-size: 15px;
        padding: 12px;
    }
    
    button {
        width: 100%;
        padding: 15px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    animation: fadeIn 0.6s ease-out;
}

/* 自定义滚动条 */
#koreanInput::-webkit-scrollbar {
    width: 8px;
}

#koreanInput::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#koreanInput::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#koreanInput::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 语言切换器样式 */
.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.language-btn {
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    text-transform: none;
    letter-spacing: normal;
    min-width: 80px;
}

.language-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.language-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 虚拟键盘区域样式 */
.virtual-keyboard-section {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 800px;
    width: 100%;
    text-align: center;
    margin-top: 15px;
}

/* 虚拟键盘样式 */
.virtual-keyboard {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 15px;
    border: 2px solid #e9ecef;
}

/* 键盘包装器 */
.keyboard-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* 内嵌的键盘标题 */
.embedded-keyboard-title {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    pointer-events: none;
    opacity: 0.7;
}

/* 内嵌的Shift控制 */
.embedded-shift-control {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

.embedded-shift-control .shift-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f1f3f4;
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
}

.embedded-shift-control .shift-toggle:hover {
    background: #e5e7eb;
}

.embedded-shift-control input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
    cursor: pointer;
}

.embedded-shift-control .shift-label {
    font-size: 11px;
    font-weight: 500;
    color: #374151;
}

.keyboard-row {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.keyboard-key {
    width: 50px;
    height: 50px;
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border: 1px solid #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    user-select: none;
}

.keyboard-key:hover {
    background: linear-gradient(145deg, #f0f0f0, #d6d6d6);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.keyboard-key:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.keyboard-key.key-active {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

.key-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2px;
}

.english-char {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    line-height: 1;
}

.korean-char {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    line-height: 1;
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
}

.keyboard-key.key-active .english-char,
.keyboard-key.key-active .korean-char {
    color: white;
}

/* 功能键样式 */
.function-row {
    margin-top: 5px;
}

.keyboard-key.function-key {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid #adb5bd;
    color: #495057;
    font-weight: 600;
}

.keyboard-key.function-key:hover {
    background: linear-gradient(145deg, #e9ecef, #dee2e6);
}

.keyboard-key.space-key {
    width: 120px;
    margin: 0 5px;
}

.keyboard-key.backspace-key {
    background: linear-gradient(145deg, #dc3545, #c82333);
    color: white;
}

.keyboard-key.backspace-key:hover {
    background: linear-gradient(145deg, #c82333, #bd2130);
}

.keyboard-key.arrow-key {
    background: linear-gradient(145deg, #28a745, #218838);
    color: white;
    width: 60px;
}

.keyboard-key.arrow-key:hover {
    background: linear-gradient(145deg, #218838, #1e7e34);
}

.function-key-content {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    line-height: 1;
}

/* Shift模式的键盘样式 */
.virtual-keyboard.shift-mode {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-color: #667eea;
}

.virtual-keyboard.shift-mode .keyboard-key {
    background: linear-gradient(145deg, #f9fafb, #e5e7eb);
    border-color: #9ca3af;
}

.virtual-keyboard.shift-mode .keyboard-key:hover {
    background: linear-gradient(145deg, #e5e7eb, #d1d5db);
}

.virtual-keyboard.shift-mode .keyboard-key:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.virtual-keyboard.shift-mode .keyboard-key.key-active {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    border-color: #667eea;
}

.virtual-keyboard.shift-mode .keyboard-key.key-active .english-char,
.virtual-keyboard.shift-mode .keyboard-key.key-active .korean-char {
    color: white;
}

/* 响应式设计更新 */
@media (max-width: 768px) {
    .language-selector {
        position: static;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
    }
    
    .language-buttons {
        justify-content: center;
    }
    
    .language-btn {
        font-size: 12px;
        padding: 6px 10px;
        min-width: 70px;
    }
    
    .container {
        padding: 30px 20px;
        margin: 10px;
        margin-bottom: 20px;
    }
    
    .virtual-keyboard-section {
        padding: 20px;
        margin: 10px;
    }
    
    .keyboard-key {
        width: 40px;
        height: 40px;
    }
    
    .keyboard-row {
        gap: 4px;
    }
    
    .english-char {
        font-size: 10px;
    }
    
    .korean-char {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 20px;
    }
    
    .language-btn {
        font-size: 11px;
        padding: 5px 8px;
        min-width: 60px;
    }
    
    .container {
        padding: 20px 15px;
    }
    
    .virtual-keyboard-section {
        padding: 15px;
    }
    
    .keyboard-key {
        width: 35px;
        height: 35px;
    }
    
    .keyboard-row {
        gap: 3px;
    }
    
    .virtual-keyboard {
        padding: 15px;
        gap: 6px;
    }
    
    .english-char {
        font-size: 9px;
    }
    
    .korean-char {
        font-size: 12px;
    }
    
    /* 移动端触摸反馈 */
    .keyboard-key:active {
        background: linear-gradient(145deg, #e0e0e0, #c0c0c0);
        transform: translateY(1px);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    /* 移动端特殊按键高亮 */
    .keyboard-key.key-active {
        background: linear-gradient(145deg, #667eea, #764ba2) !important;
        color: white !important;
        transform: scale(0.95) !important;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4) !important;
    }
    
    /* 移动端功能键激活状态 */
    .keyboard-key.function-key.key-active {
        transform: scale(0.9) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    }
    
    .keyboard-key.backspace-key.key-active {
        background: linear-gradient(145deg, #bd2130, #a71e2a) !important;
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4) !important;
    }
    
    .keyboard-key.arrow-key.key-active {
        background: linear-gradient(145deg, #1e7e34, #155724) !important;
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4) !important;
    }
    
    /* 改善移动端文本框体验 */
    #koreanInput {
        font-size: 16px; /* 防止iOS缩放 */
        padding: 15px;
    }
    
    /* 移动端虚拟键盘容器优化 */
    .virtual-keyboard-section {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
        margin: 20px -40px -40px -40px;
    }
    
    /* 添加功能键行间距 */
    .function-row {
        justify-content: center;
        gap: 8px;
    }
}

/* 虚拟光标指示器 */
.virtual-cursor-indicator {
    position: absolute;
    width: 2px;
    background-color: #333;
    border-radius: 1px;
    z-index: 1000;
    pointer-events: none;
    transition: all 0.1s ease;
}

.virtual-cursor-indicator.blinking {
    animation: cursorBlink 1s infinite;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 键盘状态指示器 */
.keyboard-state-indicator {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10000;
    display: none;
    transition: all 0.3s ease;
}

.keyboard-state-indicator.active {
    display: block;
    background: rgba(102, 126, 234, 0.9);
}

.keyboard-state-indicator.warning {
    display: block;
    background: rgba(255, 107, 107, 0.9);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.site-footer {
    padding: 20px;
    text-align: center;
    width: 100%;
    margin-top: auto;
}

.site-footer a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.site-footer a:hover {
    color: white;
}

.github-logo {
    fill: currentColor;
}
