body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

/* topbar branding and switcher */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}
.branding {
    font-size: 24px;
    font-weight: bold;
}
.brand-lingo1 { color: #3498db; }
.brand-lingo2 { color: #e74c3c; }

.header-lang-switcher select {
    padding: 4px 8px;
    font-size: 14px;
}

/* group pronunciation + switcher and push right */
.header-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-lang-switcher .switch-label {
    margin-right: 4px;
    font-size: 14px;
}

.header-pronunciation button {
    padding: 4px 8px;
    font-size: 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.header-pronunciation button:hover {
    background: #2980b9;
} 

/* utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* footer styling */
footer {
    text-align: center;
    padding: 12px 0;
    margin-top: 20px;
    border-top: 1px solid #ddd;
    color: #777;
    font-size: 14px;
}

h1 {
    color: #555;
}

form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* language selection prompt on index page */
#langPrompt {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
#langPrompt span {
    white-space: nowrap;
}

label {
    font-weight: bold;
}

select, button {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

button {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    line-height: 1;
    min-width: 40px;
    text-align: center;
}

#controls button.active {
    background-color: #4CAF50 !important;  /* 使用 !important 强制生效 */
    color: white;
    border-color: #45a049;
}

#controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 36px;
    height: 36px;
    background-color: #f0f0f0;
}
#controls button img {
    width: 36px;
    height: 36px;
}

/* Icon buttons: ensure consistent icon sizing and touch target */
.icon-btn, .sentence-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 36px;
    height: 36px;
}
.icon-btn img, .sentence-controls button img {
    width: 36px;
    height: 36px;
}

button:hover {
    background-color: #e0e0e0;
    color: #000;
}

button.active {
    background-color: #4CAF50;
    color: white;
    border-color: #45a049;
}

#scenariosList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.scenario {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: center;
    cursor: pointer;
}

.scenario img {
    max-width: 100%;
    height: auto;
}

#cover {
    text-align: center;
}

#cover img {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

#subtitles {
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.subtitle {
    margin: 8px 0;
    font-size: 32px;
    text-align: center;
    max-width: 90%;
}

/* status toast message */
.status-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 1000;
}

.status-toast.show {
    opacity: 1;
}


/* Subtitle backgrounds and clear boundaries between target/native */
#targetSub, #nativeSub {
    background-color: #f3f4f5; /* light gray */
    border: 1px solid #d6d6d6;
    padding: 10px 16px;
    border-radius: 8px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
    width: 100%;
    box-sizing: border-box;
}

/* Slightly different tint so the two areas are visually distinct */
#nativeSub {
    background-color: #efefef;
    margin-top: 6px;
}
/* Clickable word styles */
.kw {
    cursor: pointer;
    text-decoration: underline dotted;
    color: #3498db; /* unified blue for annotated words */
}

/* Word popup */
.word-popup {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 10px;
    border-radius: 6px;
    z-index: 1000;
    min-width: 160px;
}
.word-title {
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.play-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: background-color 0.2s;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-icon:hover {
    background-color: #f0f0f0;
}
.word-icons {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.search-icon {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: background-color 0.2s;
    min-width: 20px;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-icon:hover {
    background-color: #f0f0f0;
}
.word-def {
    font-size: 13px;
    color: #555;
}
.word-popup .defs {
    margin: 6px 0 0 0;
    padding-left: 18px;
}
.word-popup .defs li {
    margin: 4px 0;
}

#controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

/* back button in header: top-left, symbol-only */
header > #backBtn {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 6px 8px;
    min-width: 36px;
    height: 36px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    font-size: 18px;
}

header > #backBtn:hover {
    background-color: #e8e8e8;
}

/* Tag list under scenarios header */
.tag-list {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.tag-btn {
    padding: 6px 10px;
    border-radius: 16px;
    border: 1px solid #ccc;
    background: #e0e0e0;
    color: #333;
    cursor: pointer;
    font-size: 14px;
}
.tag-btn.active {
    background-color: #4CAF50;
    color: white;
    border-color: #45a049;
}
.tag-btn.inactive {
    background-color: #efefef;
    color: #666;
}

#subtitleToggles {
    margin: 20px 0;
}

#phrases {
    margin-top: 20px;
}

/* each category box similar to sentence panel */
.phrase-category {
    position: relative;
    padding: 16px;
    margin: 12px 0;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fff;
}
.phrase-category h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #333;
}
.phrase-category ul {
    list-style: disc inside;
    margin: 0;
    padding: 0;
}
.phrase-category li {
    margin: 4px 0;
}

/* Sentences list removed; related styles cleaned up */

.phrase-category {
    margin-bottom: 16px;
}
.phrase-category h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #333;
}
.phrase-category ul {
    list-style: disc inside;
    margin: 0;
    padding: 0;
}
.phrase-category li {
    margin: 4px 0;
}

.sentence-number {
    position: absolute;
    left: 12px;
    top: 12px;
    color: #666;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    background: none;
    width: auto;
    height: auto;
}

.sentence-text {
    flex: 1;
    font-size: 20px;
    padding-left: 36px; /* leave space for the number */
}

.sentence-controls {
    display: flex;
    gap: 10px;
}

.word-card {
    position: relative;
    padding: 16px;
    margin: 12px 0;
    border: 1px solid #eee;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    background: #fff;
}

.word-card h2 {
    margin: 0 0 8px;
    font-size: 24px;
    color: #333;
}

.word-card p {
    margin: 0;
    color: #666;
}

.waveform-container {
    position: relative;
    margin: 16px 0;
}

#userWaveform {
    position: absolute;
    top: 0;
    left: 0;
}