body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background: #f9f9f9;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2em;
}

header {
    text-align: center;
    margin-bottom: 1em;
}

header h1 {
    margin: 0;
    color: #333;
    font-size: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.1em;
}

header h1 .char-block {
    display: inline-block;
    text-align: center;
    margin: 0;
    padding: 0.05em 0.2em;
    border-radius: 3px;
    vertical-align: baseline;
    position: relative;
}

header h1 .char-block .pinyin {
    font-size: 0.5em;
    color: #888;
    margin: 0 0 0px 0;
    line-height: 1;
    font-weight: 500;
}

header h1 .char-block .character {
    font-size: 0.9em;
    font-weight: normal;
    margin: -2px 0 0 0;
}

header p {
    margin: 0.2em 0 0 0;
    color: #666;
    font-size: 1.1em;
}

.input-section {
    text-align: center;
    margin-bottom: 2em;
}

.input-section textarea {
    width: 100%;
    max-width: 600px;
    padding: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1em;
    resize: vertical;
}

.input-section button {
    margin-top: 0.2em;
    padding: 0.5em 2em;
    background: #888;
    color: white;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
}

.input-section button:hover {
    /* background: #999;
    border-bottom: 3px dashed #666; */
    background-color: rgba(200, 200, 200, 0.2);
    border-bottom: 3px dashed #ccc;

    /* background-color: rgba(200, 200, 200, 0.6);
    border-bottom: 3px dashed #aaa; */
    color: #666;
}

.instructions {
    margin-top: 0.8em;
    color: #555;
    font-size: 0.9em;
    text-align: center;
    line-height: 1.4;
}

.main-content {
    display: flex;
    gap: 2em;
}

.sidebar {
    flex: 0.6;
    background: transparent;
    padding: 1.5em;
    border-radius: 4px;
    height: fit-content;
}

.lyrics-display {
    flex: 2;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 8px;
    padding: 1.5em;
}

.lyrics-display h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5em;
}

.lyrics-container {
    display: flex;
    gap: 2em;
    width: 100%;
}

#lyrics-output {
    text-align: left;
    line-height: 1.8;
    font-size: 1.1em;
    flex: 1;
}

.chinese-line {
    position: relative;
    padding-left: 35px;
    cursor: pointer;
}

#translation-output {
    text-align: left;
    line-height: 1.8;
    font-size: 1em;
    flex: 0 0 auto;
    color: #666;
    font-style: italic;
    width: fit-content;
}

.translation-line {
    position: relative;
    padding-left: 35px;
    margin-bottom: 0.2em;
    cursor: pointer;
}

.speaker-icon {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-image: url('assets/speaker_inactive.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.4;
    visibility: visible;
    transition: all 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.speaker-icon:hover {
    background-image: url('assets/speaker_active.png');
    opacity: 0.6;
}

.speaker-icon.playing {
    background-image: url('assets/speaker_active.png');
    /* animation: pulse 1s infinite; */
}

/* @keyframes pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.2); }
    100% { transform: translateY(-50%) scale(1); }
} */

.tooltip {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    color: #333;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9em;
    max-width: 400px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #eee;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

.sidebar h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5em;
}

.char-block {
    display: inline-block;
    text-align: center;
    margin: 0 1px;
    padding: 1px 5px;
    border-radius: 2px;
    vertical-align: baseline;
    position: relative;
    cursor: pointer;
}
 
.character {
    font-size: 1.3em;
    font-weight: normal;
    margin: -2px 0 0 0;
}

.pinyin {
    font-size: 0.7em;
    color: #999;
    margin: 0 0 0px 0;
    line-height: 1;
}

.definition {
    display: none;
}

.hsk-1 { 
    background-color: rgba(255, 217, 240, 0.3);
    border-bottom: 4px solid #ffd9f0;
}
.hsk-2 { 
    background-color: rgba(254, 220, 177, 0.3);
    border-bottom: 4px solid #fedcb1;
}
.hsk-3 { 
    background-color: rgba(254, 245, 199, 0.3);
    border-bottom: 4px solid #fef5c7;
}
.hsk-4 { 
    background-color: rgba(213, 239, 196, 0.3);
    border-bottom: 4px solid #d5efc4;
}
.hsk-5 { 
    background-color: rgba(187, 227, 246, 0.3);
    border-bottom: 4px solid #bbe3f6;
}
.hsk-6 { 
    background-color: rgba(232, 218, 255, 0.3);
    border-bottom: 4px solid #e8daff;
}
.hsk-unknown { 
    background-color: rgba(200, 200, 200, 0.2);
    border-bottom: 2px dashed #ccc;
}

.hsk-label {
    font-size: 0.75em;
    color: #666;
    margin-top: 2px;
}

.hsk-level-section {
    margin-bottom: 1em;
}

.hsk-level-section h4 {
    margin: 0 0 0.3em 0;
    color: #333;
    font-size: 0.9em;
    font-weight: bold;
}

.hsk-words {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.common-word {
    padding: 0.3em;
    border-radius: 3px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.word-char {
    font-weight: normal;
    font-size: 1em;
    min-width: 1.2em;
    text-align: center;
}

.word-info {
    color: #666;
    font-size: 0.7em;
    line-height: 1.2;
}

/* Mobile responsive layout */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        gap: 1em;
    }
    
    .sidebar {
        flex: none;
        order: 2;
    }
    
    .lyrics-display {
        flex: none;
        order: 1;
    }
    
    .lyrics-container {
        flex-direction: column;
        gap: 1em;
    }
    
    #lyrics-output {
        flex: none;
    }
    
    #translation-output {
        flex: none;
        width: 100%;
    }
}