/* Vendored from https://github.com/rc9000/mandarin_html; remote font imports omitted. */

.font-switcher {
    position: fixed;
    top: 1em;
    right: 1em;
    z-index: 1000;
    background: white;
    padding: 0.5em;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.font-switcher select {
    padding: 0.3em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.9em;
    cursor: pointer;
}

.font-switcher select:hover {
    border-color: #666;
}

/* Font classes */
.font-ma-shan-zheng .word {
    font-family: 'Ma Shan Zheng', cursive;
}

.font-klee-one .word {
    font-family: 'Klee One', cursive;
}

.font-zen-old-mincho .word {
    font-family: 'Zen Old Mincho', serif;
}

.font-ibm-plex-sans-jp .word {
    font-family: 'IBM Plex Sans JP', sans-serif;
}

.word {
    display: inline-block;
    margin: 0 0.03em;
    cursor: pointer;
    position: relative;
    width: fit-content;

    font-size: 2em;
    /*font-family: 'Ma Shan Zheng', cursive;*/
    /*font-family: 'Klee One', cursive;*/
    font-family: 'Zen Old Mincho', serif;
}

body {
    /*max-width: 800px;*/
    margin: 0.5em 0.0em;
    padding: 0.5em 2.5em;
    font-family: system-ui, -apple-system, sans-serif;
}

.sentence {
    display: block; /* remove to allow multiple sentences on the same line */
    margin: 2em 0;
    font-size: 2.2em;
    line-height: 1.8;
    position: relative;
    padding: 0.5em 0.8em;
}

.play-button {
    position: absolute;
    left: -1.0em;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 0.8em;
    color: #666;
    cursor: pointer;
    padding: 0.2em;
    border-radius: 50%;
    width: 1.5em;
    height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.play-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.play-button.playing {
    color: #0066cc;
}

.sentence-translation {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2.2em;
    font-size: 0.5em;
    color: #333;
    background: rgba(255, 255, 150, 0.5);
    border-radius: 8px;
    padding: 0.5em 1em;
    text-align: left;
    font-style: normal;
    z-index: 10;
    pointer-events: none;
    font-family: system-ui, -apple-system, sans-serif;
}

.sentence:hover .sentence-translation {
    display: block;
}




.word-translation {
    display: none;
    position: absolute;
    left: 0;
    bottom: 110%;
    transform: none;
    background: rgb(240, 248, 255);
    color: #222;
    font-size: 0.3em;
    border-radius: 6px;
    padding: 0.3em 0.6em;
    white-space: nowrap;
    z-index: 20;
    pointer-events: none;
    font-family: system-ui, -apple-system, sans-serif;
    min-width: max-content;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.word:hover .word-translation {
    display: block;
}

.word:hover {
    background-color: #f0f8ff;
    border-radius: 3px;
}

.sentence-annotation {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: -2.2em;
    font-size: 0.35em;
    color: #999;
    background: rgba(200, 200, 200, 0.4);
    border-radius: 6px;
    padding: 0.3em 0.8em;
    text-align: left;
    font-style: italic;
    z-index: 10;
    pointer-events: none;
    font-family: system-ui, -apple-system, sans-serif;
}

.sentence:hover .sentence-annotation {
    display: block;
}
