body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 1rem;
}
.container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    width: 100%;
    max-width: 900px;
    overflow: hidden;
}
.text-content {
    white-space: pre-wrap;
    /* Preserve whitespace and line breaks */
    word-wrap: break-word;
    /* Break long words */
    line-height: 1.6;
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    min-height: 300px;
    max-height: 70vh;
    overflow-y: auto;
}
.text-content span.word-clickable {
    cursor: pointer;
    padding: 2px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}
.text-content span.word-clickable:hover {
    background-color: #e0e7ff;
    /* Light blue on hover */
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.0);
    z-index: 999;
    display: none;
}
.modal-content {
    background-color: #fefefe;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    position: absolute;
    max-width: 280px;
    z-index: 1000;
    border: 1px solid #e5e7eb;
    animation: fadeIn 0.2s ease-out;
    cursor: grab;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.button-base {
    padding: 8px 16px;
    border-radius: 8px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}
.button-base:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.button-base:hover:not(:disabled) {
     transform: translateY(-1px);
}
.button-base:active:not(:disabled) {
    transform: translateY(0);
}
.button-primary {
    background-color: #4f46e5;
    color: white;
}
.button-primary:hover:not(:disabled) {
    background-color: #4338ca;
}
.button-secondary {
    background-color: #6b7280;
    color: white;
}
.button-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}
.link-button {
    display: block;
    background-color: #eff6ff;
    color: #1d4ed8;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.9rem;
}
.link-button:hover {
    background-color: #dbeafe;
    color: #1e40af;
}
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 10px auto;
    display: none;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}
#ai-results-section, #explanation-section, #stressed-text-section, #reference-section, #full-translation-section {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e5e7eb;
}
#google-translate-result, #selection-translate-result {
    margin-top: 10px;
    padding: 8px;
    background-color: #f0f4f8;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #333;
    border: 1px solid #d1e0ed;
}
.text-selection-popup {
    max-width: 320px;
    padding: 10px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: grab;
    position: absolute;
    z-index: 1001;
}
.text-selection-popup .button-secondary,
.text-selection-popup .button-primary {
    padding: 6px 10px;
    font-size: 0.8rem;
    width: 100%;
}
.close-button {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
}
.close-button:hover {
    color: #374151;
}
.tts-controls {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    background-color: #f9fafb;
}
#tts-progress-container {
    width: 100%;
    background-color: #e5e7eb;
    border-radius: 9999px;
    cursor: pointer;
    height: 10px;
}
#tts-progress-bar {
    height: 100%;
    background-color: #4f46e5;
    border-radius: 9999px;
    width: 0%;
    transition: width 0.1s linear;
}
#reference-section ul {
    list-style-type: disc;
    padding-left: 20px;
}
#reference-section li {
    margin-bottom: 0.5rem;
}
#reference-section a {
    color: #3b82f6;
    text-decoration: underline;
}
#reference-section a:hover {
    color: #1d4ed8;
}
#full-translation-content {
    max-height: 500px;
    overflow-y: auto;
}