/* === Base & Typography === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    direction: rtl;
    font-family: 'Amiri', 'Traditional Arabic', 'Arial', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    background: #f8f6f3;
    color: #2c2c2c;
    min-height: 100vh;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* === Header === */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #d4c5a9;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.header-links {
    display: flex;
    gap: 0.5rem;
}

.header-link {
    color: #6b7c8a;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid #d4c5a9;
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    transition: all 0.2s;
}

.header-link:hover {
    background: #f0ebe4;
    color: #1a3a4a;
}

/* Usage Indicator */
.usage-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: auto;
}

.usage-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-size: 0.8rem;
    color: #6b7c8a;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #f0ebe4;
    transition: all 0.2s;
}

.usage-compact:hover {
    background: #f0ebe4;
    border-color: #d4c5a9;
}

.usage-label-mini {
    color: #1a3a4a;
    font-weight: 700;
}

.usage-bar-mini {
    width: 50px;
    height: 6px;
    background: #f0ebe4;
    border-radius: 3px;
    overflow: hidden;
    display: inline-block;
}

.usage-fill-mini {
    height: 100%;
    border-radius: 3px;
    display: block;
    transition: width 0.3s ease;
}

.usage-count-mini {
    font-weight: 700;
    font-size: 0.78rem;
}

.usage-warning-mini {
    font-size: 0.75rem;
    color: #f39c12;
    font-weight: 700;
}

.usage-expired {
    font-size: 0.8rem;
    color: #e74c3c;
    font-weight: 700;
    text-decoration: none;
}

.usage-expired:hover {
    text-decoration: underline;
}

.logout-btn {
    background: transparent;
    color: #6b7c8a;
    border: 1px solid #d4c5a9;
    border-radius: 6px;
    padding: 0.3rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #f0ebe4;
    color: #1a3a4a;
}

.header h1 {
    font-size: 2.2rem;
    color: #1a3a4a;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.subtitle {
    color: #6b7c8a;
    font-size: 1.1rem;
}

/* === Mode Selector === */
.mode-selector {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #1a3a4a;
    width: fit-content;
}

.mode-btn {
    padding: 0.6rem 1.5rem;
    border: none;
    background: #fff;
    color: #1a3a4a;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn.active {
    background: #1a3a4a;
    color: #fff;
}

.mode-btn:hover:not(.active) {
    background: #e8e2d8;
}

/* === Dialect Settings === */
.dialect-settings {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    background: #f0ebe4;
    border-radius: 8px;
    font-size: 0.95rem;
}

.dialect-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dialect-selector label {
    font-weight: 700;
    color: #1a3a4a;
}

.dialect-selector select {
    padding: 0.4rem 0.8rem;
    border: 1px solid #d4c5a9;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: #2c2c2c;
    cursor: pointer;
}

.settings-toggles {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    color: #4a5a6a;
    white-space: nowrap;
}

.toggle-label input[type="checkbox"] {
    accent-color: #1a3a4a;
    width: 16px;
    height: 16px;
}

/* === Input Section === */
.input-section {
    margin-bottom: 2rem;
}

.textarea-wrapper {
    position: relative;
}

#poem-input {
    width: 100%;
    padding: 1.2rem;
    border: 2px solid #d4c5a9;
    border-radius: 8px;
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 1.2rem;
    line-height: 2;
    direction: rtl;
    resize: vertical;
    background: #fff;
    color: #2c2c2c;
    transition: border-color 0.2s;
}

#poem-input:focus {
    outline: none;
    border-color: #1a3a4a;
    box-shadow: 0 0 0 3px rgba(26, 58, 74, 0.1);
}

#poem-input::placeholder {
    color: #aaa;
    font-size: 1rem;
}

.char-hint {
    margin-top: 0.5rem;
    min-height: 1.5rem;
}

.hint-warning {
    color: #e67e22;
    font-size: 0.9rem;
}

/* === Actions === */
.actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1rem;
}

.primary-btn {
    padding: 0.8rem 2.5rem;
    background: #1a3a4a;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #2a5a6a;
}

.primary-btn:disabled {
    background: #999;
    cursor: not-allowed;
}

.secondary-btn {
    padding: 0.8rem 1.5rem;
    background: #fff;
    color: #1a3a4a;
    border: 2px solid #d4c5a9;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: #f0ebe4;
}

/* === Loading === */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7c8a;
}

.spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #d4c5a9;
    border-top-color: #1a3a4a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Results === */
.results-section {
    margin-top: 2rem;
}

/* Meter Banner */
.meter-banner {
    background: linear-gradient(135deg, #1a3a4a, #2a6a7a);
    color: #fff;
    padding: 1.5rem 2rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.meter-info {
    text-align: center;
    margin-bottom: 0.8rem;
}

.meter-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

.meter-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-right: 0.5rem;
}

.confidence-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    height: 24px;
    position: relative;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, #e74c3c, #f39c12, #27ae60);
    transition: width 0.5s ease;
}

.confidence-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.85rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Taf3ilat Display */
.taf3ilat-display {
    text-align: center;
    font-size: 1.3rem;
    color: #1a3a4a;
    padding: 0.8rem;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e0d8cf;
    margin-bottom: 1rem;
    letter-spacing: 3px;
}

/* Message */
.message {
    text-align: center;
    padding: 0.5rem;
    color: #6b7c8a;
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-color {
    display: inline-block;
    width: 30px;
    height: 4px;
    border-radius: 2px;
}

.legend-color.correct {
    background: #27ae60;
}

.legend-color.weak {
    background: #f39c12;
}

.legend-color.broken {
    background: #e74c3c;
}

.legend-color.heavy {
    background: #8e44ad;
}

/* === Method Badge === */
.method-badge {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: #fff;
    display: inline-block;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    background: #7f8c8d;
}

.method-badge.prosodic {
    background: #27ae60;
}

.method-badge.viterbi {
    background: #e67e22;
}

.method-badge-wrapper {
    text-align: center;
    margin-bottom: 1rem;
}

/* === Hint Info === */
.hint-info {
    color: #3498db;
    font-size: 0.9rem;
}

/* === Poem Display === */
.poem-display {
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 10px;
    border: 1px solid #e0d8cf;
}

.verse {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 2rem;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0ebe4;
    position: relative;
}

.verse:last-child {
    border-bottom: none;
}

.verse-number {
    position: absolute;
    right: -2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: #bbb;
    width: 1.5rem;
    text-align: center;
}

.hemistich {
    flex: 1;
    text-align: center;
    font-size: 1.3rem;
    line-height: 2.2;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: default;
    position: relative;
    transition: background 0.2s;
}

.hemistich:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Hemistich status styles */
.hemistich.correct {
    border-bottom: 3px solid #27ae60;
}

.hemistich.weak {
    border-bottom: 3px solid #f39c12;
    background: #fffbf0;
}

.hemistich.broken {
    border-bottom: 3px wavy #e74c3c;
    background: #fff5f5;
}

.hemistich.heavy {
    border-bottom: 3px dotted #8e44ad;
    background: #faf5ff;
}

/* Verse separator */
.verse-separator {
    color: #d4c5a9;
    font-size: 1.5rem;
    user-select: none;
}

/* Tooltip */
.hemistich-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 50%;
    transform: translateX(50%);
    background: #1a3a4a;
    color: #ecf0f1;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    direction: ltr;
    text-align: center;
    line-height: 1.6;
}

.hemistich-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 50%;
    transform: translateX(50%);
    border: 6px solid transparent;
    border-top-color: #1a3a4a;
}

.hemistich:hover .hemistich-tooltip {
    display: block !important;
}

/* Mobile: show tooltip on tap via JS .show class */
.hemistich-tooltip.show {
    display: block !important;
}

/* === Details Panel === */
.details-toggle {
    display: block;
    margin: 1.5rem auto 0;
}

.details-panel {
    margin-top: 1rem;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e0d8cf;
    padding: 1.5rem;
}

.detail-verse {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f0ebe4;
}

.detail-verse:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.detail-verse-header {
    font-weight: 700;
    color: #1a3a4a;
    margin-bottom: 0.5rem;
}

.detail-hemistich {
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: #faf8f5;
    border-radius: 6px;
}

.detail-label {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.2rem;
}

.detail-value {
    font-size: 1rem;
    direction: ltr;
    text-align: left;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.detail-value.arabic {
    direction: rtl;
    text-align: right;
    font-family: 'Amiri', serif;
    letter-spacing: 0;
}

.detail-taf3ilat {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    direction: rtl;
}

.taf3ila-chip {
    background: #e8f4f8;
    color: #1a3a4a;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.detail-status {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
}

.detail-status.correct {
    color: #27ae60;
    background: #e8f8ef;
}

.detail-status.weak {
    color: #f39c12;
    background: #fef9e7;
}

.detail-status.broken {
    color: #e74c3c;
    background: #fdedec;
}

.detail-status.heavy {
    color: #8e44ad;
    background: #f4ecf7;
}

/* === AI Suggestion === */

.suggest-fix-section {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #ddd;
}

.suggest-fix-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.1s;
}

.suggest-fix-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.suggest-fix-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.suggestion-result {
    margin-top: 0.6rem;
}

.suggestion-loading {
    color: #764ba2;
    font-size: 0.9rem;
    padding: 0.5rem;
    animation: pulse 1.5s infinite;
}

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

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    background: #f8f4ff;
    border: 1px solid #e0d4f5;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.4rem;
    direction: rtl;
}

.suggestion-text {
    flex: 1;
    font-size: 1rem;
    color: #2c3e50;
}

.suggestion-copy-btn {
    background: #764ba2;
    color: #fff;
    border: none;
    padding: 0.25rem 0.7rem;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.2s;
}

.suggestion-copy-btn:hover {
    background: #5a3780;
}

.suggestion-empty,
.suggestion-error {
    font-size: 0.85rem;
    padding: 0.5rem;
    border-radius: 6px;
}

.suggestion-empty {
    color: #999;
}

.suggestion-error {
    color: #e74c3c;
    background: #fdedec;
}

/* === PDF Upload Section === */
.pdf-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #d4c5a9;
}

.pdf-header {
    margin-bottom: 1rem;
}

.pdf-title {
    font-size: 1.3rem;
    color: #1a3a4a;
    font-weight: 700;
}

.pdf-dropzone {
    border: 2px dashed #d4c5a9;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    margin-bottom: 1rem;
}

.pdf-dropzone:hover,
.pdf-dropzone.dragover {
    border-color: #1a3a4a;
    background: #f0ebe4;
}

.dropzone-icon {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #1a3a4a;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}

.dropzone-content p {
    color: #6b7c8a;
    font-size: 1rem;
}

.pdf-file-list {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.pdf-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: #e8f4f8;
    color: #1a3a4a;
    border-radius: 20px;
    font-size: 0.9rem;
}

.pdf-file-remove {
    cursor: pointer;
    color: #e74c3c;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
}

.pdf-file-remove:hover {
    color: #c0392b;
}

/* === PDF Summary === */
.pdf-summary {
    background: linear-gradient(135deg, #1a3a4a, #2a6a7a);
    color: #fff;
    padding: 1.2rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    text-align: center;
}

/* === Ranking Table === */
.ranking-table-wrapper {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e0d8cf;
    font-size: 0.95rem;
}

.ranking-table thead {
    background: #1a3a4a;
    color: #fff;
}

.ranking-table th {
    padding: 0.8rem 0.6rem;
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
}

.ranking-table td {
    padding: 0.7rem 0.6rem;
    text-align: center;
    border-bottom: 1px solid #f0ebe4;
}

.ranking-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.ranking-table tbody tr:hover {
    background: #f0ebe4;
}

.ranking-table tbody tr:last-child td {
    border-bottom: none;
}

/* Score bar in table */
.score-bar {
    display: inline-block;
    width: 60px;
    height: 8px;
    border-radius: 4px;
    background: #eee;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.score-bar-fill.high {
    background: #27ae60;
}

.score-bar-fill.medium {
    background: #f39c12;
}

.score-bar-fill.low {
    background: #e74c3c;
}

.score-text {
    font-weight: 700;
}

.score-text.high {
    color: #27ae60;
}

.score-text.medium {
    color: #f39c12;
}

.score-text.low {
    color: #e74c3c;
}

.rank-badge {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    background: #1a3a4a;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    text-align: center;
}

.rank-badge.gold {
    background: #f1c40f;
    color: #333;
}

.rank-badge.silver {
    background: #bdc3c7;
    color: #333;
}

.rank-badge.bronze {
    background: #cd7f32;
    color: #fff;
}

/* === Footer === */
.footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0d8cf;
    color: #999;
    font-size: 0.9rem;
}

/* === Margin Poetry Quotes === */
.margin-quotes {
    display: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 180px;
    z-index: 1;
}

.margin-quotes-right {
    right: 20px;
}

.margin-quotes-left {
    left: 20px;
}

.quote-card {
    background: rgba(248, 246, 243, 0.9);
    border: 1px solid #e0d8cf;
    border-radius: 8px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    opacity: 0.45;
    transition: opacity 0.3s, transform 0.3s;
    cursor: default;
}

.quote-card:hover {
    opacity: 0.85;
    transform: scale(1.03);
}

.quote-text {
    font-size: 0.82rem;
    color: #1a3a4a;
    line-height: 1.7;
    margin-bottom: 0.3rem;
    direction: rtl;
    text-align: right;
}

.quote-poet {
    font-size: 0.72rem;
    color: #8a7a6a;
    text-align: left;
    direction: rtl;
}

/* Show quotes only on wide screens */
@media (min-width: 1200px) {
    .margin-quotes {
        display: block;
    }
}

/* === Responsive === */

/* Tablet landscape (≤1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.9rem;
    }

    .meter-banner {
        padding: 1.2rem 1.5rem;
    }
}

/* Tablet portrait (≤768px) */
@media (max-width: 768px) {
    .dialect-settings {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }

    .settings-toggles {
        justify-content: center;
    }

    .primary-btn,
    .secondary-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .ranking-table {
        font-size: 0.85rem;
    }

    .ranking-table th,
    .ranking-table td {
        padding: 0.5rem 0.4rem;
    }

    .score-bar {
        width: 40px;
    }

    .legend {
        gap: 1rem;
        font-size: 0.9rem;
    }

    .suggestion-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
    }

    .suggestion-copy-btn {
        align-self: flex-start;
    }
}

/* Mobile (≤600px) */
@media (max-width: 600px) {
    .container {
        padding: 1rem 0.8rem;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .verse {
        flex-direction: column;
        gap: 0.3rem;
    }

    .verse-separator {
        display: none;
    }

    .hemistich {
        font-size: 1.1rem;
    }

    .actions {
        flex-wrap: wrap;
    }

    .primary-btn {
        flex: 1;
        min-width: 120px;
    }

    .meter-name {
        font-size: 1.4rem;
    }

    .meter-banner {
        padding: 1rem 1rem;
        border-radius: 8px;
    }

    .poem-display {
        padding: 1rem;
    }

    .legend {
        gap: 0.8rem;
        font-size: 0.85rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .pdf-dropzone {
        padding: 1.2rem;
    }

    .mode-selector {
        width: 100%;
    }

    .mode-btn {
        flex: 1;
        text-align: center;
    }

    .taf3ilat-display {
        font-size: 1.1rem;
        letter-spacing: 1px;
    }

    .detail-taf3ilat {
        gap: 0.5rem;
    }

    .taf3ila-chip {
        font-size: 0.8rem;
        padding: 0.15rem 0.6rem;
    }
}

/* Small mobile (≤480px) */
@media (max-width: 480px) {
    body {
        font-size: 1rem;
    }

    .container {
        padding: 0.8rem 0.5rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    #poem-input {
        font-size: 1rem;
        padding: 0.8rem;
    }

    .hemistich {
        font-size: 1rem;
        line-height: 2;
    }

    .meter-name {
        font-size: 1.2rem;
    }

    .confidence-bar {
        height: 20px;
    }

    .confidence-text {
        font-size: 0.75rem;
    }

    .settings-toggles {
        flex-direction: column;
        gap: 0.5rem;
    }

    .suggest-fix-btn {
        width: 100%;
        padding: 0.5rem;
    }

    .detail-hemistich {
        padding: 0.4rem;
    }

    .pdf-title {
        font-size: 1.1rem;
    }
}

/* ════════════════════════════════════════════════════════════════
   Wave 1 — قافية ذكية / إكمال الشطر / كشف البلاغة
   ════════════════════════════════════════════════════════════════ */
.wave1-panel {
  margin-top: 32px;
  border: 1px solid #e0d8c8;
  border-radius: 14px;
  background: linear-gradient(180deg, #fefcf7 0%, #faf6ee 100%);
  overflow: hidden;
}
.wave1-tabs {
  display: flex;
  background: #f3eddf;
  border-bottom: 1px solid #e0d8c8;
}
.wave1-tab {
  flex: 1;
  padding: 14px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  color: #8a7d63;
  font-family: inherit;
  transition: all 0.18s;
  border-bottom: 3px solid transparent;
}
.wave1-tab:hover { background: rgba(255,255,255,0.5); color: #6b5e44; }
.wave1-tab.active {
  background: #fff;
  color: #1a3a4a;
  border-bottom-color: #d4af37;
}
.wave1-body { padding: 22px 24px; }
.wave1-tab-content { display: none; }
.wave1-tab-content.active { display: block; }

.wave1-hint {
  color: #6b5e44;
  font-size: 14px;
  margin-bottom: 14px;
  line-height: 1.7;
}
.wave1-subheading {
  font-weight: 700;
  font-size: 15px;
  color: #1a3a4a;
  margin: 18px 0 10px;
}
.wave1-divider {
  border-top: 1px dashed #d4c5a9;
  margin: 22px 0 8px;
}
.wave1-input-full {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d4c5a9;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  background: #fff;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.wave1-input-full:focus { outline: none; border-color: #d4af37; }
.wave1-action-btn {
  padding: 11px 22px;
  background: #1a3a4a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s;
}
.wave1-action-btn:hover:not(:disabled) { background: #2a4a5a; }
.wave1-action-btn:disabled { background: #aaa; cursor: not-allowed; }
.wave1-note { color: #8a7d63; font-size: 12px; margin: 8px 0; }
.wave1-error {
  background: #fff5f5;
  border: 1px solid #f8b4b4;
  color: #c62828;
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 10px;
}
.wave1-result { margin-top: 14px; }

/* ── قافية ── */
.rhyme-summary {
  background: #fff;
  padding: 14px 16px;
  border-radius: 8px;
  border-right: 4px solid #d4af37;
  margin-bottom: 14px;
  line-height: 1.9;
}
.rhyme-rowy { font-size: 18px; }
.rhyme-verdict { margin-top: 8px; color: #6b5e44; font-style: italic; }
.rhyme-defects-title { font-weight: 700; margin: 14px 0 8px; color: #1a3a4a; }
.rhyme-defect {
  background: #fff;
  border-right: 4px solid;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 8px;
}
.rhyme-defect-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.rhyme-defect-sev {
  color: #fff;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.rhyme-defect-desc { color: #555; font-size: 13.5px; line-height: 1.7; }
.rhyme-no-defects {
  background: #f0f9f4;
  border: 1px solid #b6dac3;
  color: #2e7d32;
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 600;
}
.rhyme-verses-details { margin-top: 14px; }
.rhyme-verses-details summary { cursor: pointer; color: #8a7d63; font-weight: 600; }
.rhyme-verses-list { margin: 10px 0 0; padding-right: 22px; line-height: 1.9; color: #555; }
.rhyme-verses-list li { font-size: 13.5px; }

.rhyme-gen-form { display: grid; grid-template-columns: 100px 110px 1fr auto; gap: 10px; align-items: center; }
.rhyme-gen-form input, .rhyme-gen-form select {
  padding: 9px 12px;
  border: 1px solid #d4c5a9;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}
.rhyme-words-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.rhyme-word-card {
  background: #fff;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #e8dfcb;
  text-align: center;
}
.rhyme-word { font-size: 18px; font-weight: 700; color: #1a3a4a; }
.rhyme-word-meaning { font-size: 12px; color: #6b5e44; margin: 4px 0 6px; line-height: 1.5; }
.rhyme-word-strength { color: #d4af37; font-size: 14px; letter-spacing: 2px; }

/* ── إكمال الشطر ── */
.completions-list { display: flex; flex-direction: column; gap: 12px; }
.completion-card {
  display: flex;
  gap: 14px;
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e0d8c8;
}
.completion-card.validated { border-right: 4px solid #2e7d32; }
.completion-card.unvalidated { border-right: 4px solid #ef6c00; }
.completion-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: #d4af37; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.completion-body { flex: 1; }
.completion-bayt { font-size: 17px; line-height: 2; color: #1a3a4a; }
.bayt-sep { color: #d4af37; margin: 0 14px; font-weight: 700; }
.completion-meaning { color: #6b5e44; font-size: 13px; margin-top: 6px; font-style: italic; }
.comp-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11.5px; font-weight: 700; margin-top: 6px;
}
.comp-badge.ok { background: #e8f5e9; color: #2e7d32; }
.comp-badge.warn { background: #fff3e0; color: #ef6c00; }

/* ── بلاغة ── */
.rhetoric-overall {
  background: #fff;
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 14px;
}
.rhetoric-overall-label { font-size: 15px; color: #1a3a4a; margin-bottom: 8px; }
.rhetoric-bar { height: 10px; background: #f0e7d0; border-radius: 5px; overflow: hidden; }
.rhetoric-bar-fill { height: 100%; transition: width 0.6s ease; }
.rhetoric-summary { margin-top: 10px; color: #555; font-style: italic; line-height: 1.7; }
.rhetoric-empty { color: #8a7d63; padding: 12px; text-align: center; background: #fff; border-radius: 8px; }
.rhetoric-figures { display: flex; flex-direction: column; gap: 18px; }
.rhetoric-group { background: #fff; border-radius: 10px; padding: 14px 16px; border: 1px solid #e8dfcb; }
.rhetoric-group-title {
  font-weight: 700; color: #1a3a4a; font-size: 15px;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px dashed #e0d8c8;
}
.rhetoric-count { color: #d4af37; background: #fef6e0; padding: 2px 9px; border-radius: 11px; font-size: 11.5px; margin-right: 6px; }
.rhetoric-figure { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #f0e7d0; }
.rhetoric-figure:first-child { padding-top: 0; border-top: none; }
.rhetoric-figure-head { display: flex; justify-content: space-between; font-size: 12px; color: #8a7d63; }
.rhetoric-strength { font-weight: 700; }
.rhetoric-excerpt { font-size: 16px; color: #1a3a4a; line-height: 1.9; margin: 6px 0; font-weight: 600; }
.rhetoric-explanation { color: #6b5e44; font-size: 13.5px; line-height: 1.7; }

@media (max-width: 640px) {
  .rhyme-gen-form { grid-template-columns: 1fr; }
  .wave1-tab { font-size: 13px; padding: 12px 6px; }
}

.complete-dialect-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.complete-dialect-row label { color: #6b5e44; font-weight: 600; font-size: 14px; }
.complete-dialect-row select {
  padding: 8px 12px; border: 1px solid #d4c5a9; border-radius: 7px;
  font-family: inherit; font-size: 14px; background: #fff; cursor: pointer;
}
.complete-dialect-row select:focus { outline: none; border-color: #d4af37; }

/* ─── Wave 2 styles ─── */
.extend-controls { display: flex; gap: 16px; align-items: center; margin: 6px 0 10px; flex-wrap: wrap; }
.extend-controls label { color: #6b5e44; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.extend-controls input, .extend-controls select {
  padding: 7px 10px; border: 1px solid #d4c5a9; border-radius: 7px;
  font-family: inherit; font-size: 14px; background: #fff;
}
.extend-num { width: 70px; }

.extend-header { background: #fff; padding: 12px 14px; border-radius: 8px; border-right: 4px solid #d4af37; margin-bottom: 12px; line-height: 1.8; }
.extend-msg { color: #6b5e44; font-style: italic; margin-top: 6px; }
.extend-verses { display: flex; flex-direction: column; gap: 12px; }
.extend-verse-card {
  display: flex; gap: 14px;
  background: #fff; border-radius: 10px; padding: 14px 16px;
  border: 1px solid #e0d8c8;
}
.extend-verse-card.validated { border-right: 4px solid #2e7d32; }
.extend-verse-card.unvalidated { border-right: 4px solid #ef6c00; }
.extend-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.rhyme-defect-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.repair-btn {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: #8a6914; border-radius: 6px;
  padding: 5px 11px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.repair-btn:hover:not(:disabled) { background: rgba(212, 175, 55, 0.28); }
.repair-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.rhyme-defect-repair-result { margin-top: 10px; }
.repair-header { background: rgba(212, 175, 55, 0.08); padding: 10px 12px; border-radius: 7px; line-height: 1.7; font-size: 13px; }
.repair-original { color: #6b5e44; margin-top: 6px; }
.repair-msg { color: #555; margin-top: 4px; font-size: 12.5px; }
.repair-suggestions { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.repair-card {
  display: flex; gap: 12px;
  background: #fff; border-radius: 9px; padding: 12px 14px;
  border: 1px solid #e0d8c8;
}
.repair-card.validated { border-right: 4px solid #2e7d32; }
.repair-card.unvalidated { border-right: 4px solid #ef6c00; }
.repair-reasoning { color: #6b5e44; font-size: 12.5px; margin-top: 6px; font-style: italic; }

/* Tafilah analysis result rendering */
.tafilah-lines { display: flex; flex-direction: column; gap: 6px; }
.tafilah-line {
  display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 14px; background: #fff; border-radius: 7px;
  border-right: 3px solid transparent;
}
.tafilah-line.fits { border-right-color: #2e7d32; }
.tafilah-line.broken { border-right-color: #ef6c00; }
.tafilah-line-num { color: #8a7d63; font-weight: 700; font-size: 13px; }
.tafilah-line-text { font-size: 16px; line-height: 1.7; color: #1a3a4a; }
.tafilah-line-feet { color: #6b5e44; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tafilah-line-mark.ok { color: #2e7d32; font-weight: 700; }
.tafilah-line-mark.bad { color: #ef6c00; font-weight: 700; cursor: help; }
.tafilah-deviation { padding: 4px 14px 8px; color: #ef6c00; font-size: 12.5px; font-style: italic; }
.tafilah-fixes-title { font-weight: 700; color: #1a3a4a; margin: 14px 0 6px; }
.tafilah-fixes { padding-right: 22px; color: #6b5e44; line-height: 1.8; font-size: 13.5px; }
.message-ok { background: #e8f5e9; color: #2e7d32; padding: 12px 16px; border-radius: 8px; }
.message-warn { background: #fff3e0; color: #ef6c00; padding: 12px 16px; border-radius: 8px; }
.message-bad { background: #ffebee; color: #c62828; padding: 12px 16px; border-radius: 8px; }

/* ─── Wave 3 styles ─── */
.header-btn { background:transparent; border:1px solid rgba(255,255,255,0.2); padding:6px 12px; cursor:pointer; font-family:inherit; }

.diac-header { color:#6b5e44; margin-bottom:6px; }
.diac-output {
  background:#fff; padding:14px; border-radius:8px; border:1px solid #e0d8c8;
  font-family:'Amiri',serif; font-size:18px; line-height:2.2; white-space:pre-wrap; direction:rtl;
}

.emotion-overall { background:#fff; padding:12px 14px; border-radius:8px; border-right:4px solid #d4af37; margin-bottom:12px; }
.emotion-block { background:#fff; padding:12px 14px; border-radius:8px; }
.emotion-block-title { font-weight:700; margin-bottom:10px; color:#1a3a4a; }
.emotion-bars { display:flex; flex-direction:column; gap:8px; }
.emotion-bar { display:grid; grid-template-columns:80px 1fr 50px; gap:10px; align-items:center; }
.emotion-name { color:#1a3a4a; font-weight:600; font-size:13.5px; }
.emotion-track { background:#f0e7d0; height:10px; border-radius:5px; overflow:hidden; }
.emotion-fill { height:100%; background:linear-gradient(90deg,#d4af37,#a38538); }
.emotion-pct { color:#6b5e44; font-size:12px; font-weight:700; }
.emotion-suggest { margin-top:12px; background:#fff; padding:10px 14px; border-radius:7px; }
.meter-chip { display:inline-block; background:#fef6e0; color:#8a6914; padding:3px 10px; border-radius:11px; margin:2px 4px; font-size:12px; font-weight:600; }

.poets-fingerprint { background:#fff; padding:12px 14px; border-radius:8px; border-right:4px solid #d4af37; margin-bottom:12px; line-height:1.8; }
.poets-matches-title { font-weight:700; color:#1a3a4a; margin:10px 0; }
.poet-match { display:grid; grid-template-columns:32px 1fr 200px; gap:12px; align-items:center; background:#fff; padding:10px 14px; border-radius:8px; margin-bottom:8px; }
.poet-rank { background:#d4af37; color:#fff; border-radius:50%; width:28px; height:28px; display:flex; align-items:center; justify-content:center; font-weight:700; }
.poet-name { font-weight:700; color:#1a3a4a; }
.poet-reasons { color:#6b5e44; font-size:12.5px; margin-top:3px; }
.poet-pct { display:flex; align-items:center; gap:8px; }
.poet-pct-bar { flex:1; background:#f0e7d0; height:8px; border-radius:4px; overflow:hidden; }
.poet-pct-fill { height:100%; background:#a38538; }
.poets-strengths, .poets-improvements { background:#fff; padding:10px 14px; border-radius:8px; margin-top:10px; }
.poets-strengths ul, .poets-improvements ul { padding-right:22px; line-height:1.9; color:#555; font-size:13.5px; }

/* ── Modals ── */
.mz-modal {
  position:fixed; inset:0; background:rgba(20,20,20,0.6);
  display:none; align-items:center; justify-content:center; z-index:1000;
}
.mz-modal-content {
  background:#faf6ee; border-radius:14px; width:95%; max-width:900px;
  max-height:90vh; overflow:hidden; display:flex; flex-direction:column;
  box-shadow:0 10px 50px rgba(0,0,0,0.4);
}
.mz-modal-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 24px; border-bottom:1px solid #e0d8c8;
  background:linear-gradient(180deg,#f3eddf,transparent);
}
.mz-modal-head h2 { margin:0; color:#1a3a4a; font-size:22px; }
.mz-modal-close {
  background:transparent; border:none; font-size:22px; cursor:pointer;
  color:#8a7d63; padding:0 6px;
}
.mz-modal-tabs { display:flex; border-bottom:1px solid #e0d8c8; }
.mz-mtab { flex:1; padding:12px; background:transparent; border:none; cursor:pointer; font-family:inherit; font-weight:700; color:#8a7d63; border-bottom:3px solid transparent; }
.mz-mtab.active { color:#1a3a4a; border-bottom-color:#d4af37; background:#fff; }
.mz-modal-body { padding:18px 24px; overflow-y:auto; }
.mz-mtab-content { display:none; }
.mz-mtab-content.active { display:block; }

/* Library */
.lib-list { display:flex; flex-direction:column; gap:12px; }
.lib-card { background:#fff; padding:12px 14px; border-radius:8px; border:1px solid #e0d8c8; }
.lib-card-head { display:flex; align-items:center; gap:10px; }
.lib-title { flex:1; font-weight:700; color:#1a3a4a; font-size:15px; }
.lib-score { background:#e8f5e9; color:#2e7d32; padding:3px 10px; border-radius:11px; font-size:12px; font-weight:700; }
.lib-load, .lib-delete { background:transparent; border:1px solid #d4c5a9; border-radius:6px; padding:4px 10px; cursor:pointer; font-family:inherit; font-size:12px; }
.lib-delete { color:#c62828; border-color:#f8b4b4; }
.lib-meta { color:#8a7d63; font-size:11.5px; margin:6px 0; }
.lib-preview { background:#faf6ee; padding:8px; border-radius:6px; font-family:'Amiri',serif; font-size:14px; line-height:1.9; max-height:80px; overflow:hidden; white-space:pre-wrap; color:#555; }

.stats-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; margin-bottom:14px; }
.stat-card { background:#fff; padding:14px; border-radius:8px; text-align:center; border:1px solid #e0d8c8; }
.stat-label { color:#8a7d63; font-size:12px; margin-bottom:6px; }
.stat-value { color:#1a3a4a; font-size:24px; font-weight:700; }
.stats-section { background:#fff; padding:10px 14px; border-radius:8px; margin-bottom:10px; line-height:2; }
.timeline-list { padding-right:22px; color:#555; }

.challenge-card { background:#fff; padding:14px 18px; border-radius:10px; border-right:4px solid #d4af37; }
.challenge-title { font-weight:700; color:#1a3a4a; font-size:17px; margin-bottom:8px; }
.challenge-instr { color:#1a3a4a; line-height:1.9; margin-bottom:10px; }
.challenge-meta { display:flex; flex-wrap:wrap; gap:12px; color:#6b5e44; font-size:13px; }
.challenge-prev { margin-top:10px; padding:10px 14px; background:#fef6e0; border-radius:7px; color:#8a6914; }

/* ─── Wave 4 styles ─── */

/* Live preview bar */
.live-preview-bar {
  margin-top: 8px; padding: 10px 14px;
  background: #faf6ee; border: 1px solid #e8dfcb; border-radius: 8px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
}
.live-toggle { display: flex; align-items: center; gap: 6px; cursor: pointer; color: #6b5e44; font-weight: 600; font-size: 13.5px; }
.live-toggle input { accent-color: #d4af37; }
.live-preview-result { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.lp-pill {
  background: #fff; border: 1px solid #e0d8c8; border-radius: 12px;
  padding: 3px 11px; font-size: 12px; color: #6b5e44;
}
.lp-pill b { color: #1a3a4a; }
.lp-meter { background: #fef6e0; border-color: #d4af37; }
.lp-ok { color: #2e7d32; }
.lp-weak { color: #ef6c00; }
.lp-broken { color: #c62828; }
.lp-error { background: #fff5f5; color: #c62828; border-color: #f8b4b4; }

/* Plagiarism results */
.plag-summary { color: #6b5e44; margin: 12px 0 8px; font-size: 13.5px; }
.plag-matches { display: flex; flex-direction: column; gap: 10px; }
.plag-match {
  background: #fff; border: 1px solid #e0d8c8; border-right: 4px solid;
  border-radius: 8px; padding: 12px 14px;
}
.plag-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.plag-verse { color: #1a3a4a; font-weight: 700; font-size: 13px; }
.plag-sim {
  color: #fff; padding: 3px 10px; border-radius: 12px;
  font-size: 11.5px; font-weight: 700;
}
.plag-original { color: #1a3a4a; font-size: 14px; line-height: 1.9; margin-bottom: 4px; }
.plag-suspected { color: #6b5e44; font-size: 14px; line-height: 1.9; font-style: italic; }
.plag-explain { color: #8a7d63; font-size: 12.5px; margin-top: 6px; }

/* Library card extra buttons */
.lib-share, .lib-export-txt, .lib-export-docx {
  background: transparent; border: 1px solid #d4c5a9; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-family: inherit; font-size: 12px;
  color: #6b5e44;
}
.lib-share:hover, .lib-export-txt:hover, .lib-export-docx:hover {
  background: #fef6e0; border-color: #d4af37;
}

/* ─── Wave 5 styles ─── */

/* Library toolbar (search/filter row) */
.lib-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 0; margin-bottom: 12px;
  border-bottom: 1px dashed #e0d8c8;
}
.lib-toolbar select {
  padding: 7px 10px; border: 1px solid #d4c5a9; border-radius: 7px;
  font-family: inherit; font-size: 13px; background: #fff; min-width: 140px;
}

/* Tag chips inside library cards */
.lib-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.lib-tag {
  background: #fef6e0; color: #8a6914; padding: 2px 9px;
  border-radius: 10px; font-size: 11.5px; font-weight: 600;
  cursor: pointer; user-select: none;
}
.lib-tag:hover { background: #d4af37; color: #fff; }

/* New action buttons in library cards (read/edit) */
.lib-read, .lib-edit {
  background: transparent; border: 1px solid #d4c5a9; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-family: inherit; font-size: 12px;
  color: #6b5e44;
}
.lib-read:hover, .lib-edit:hover {
  background: #fef6e0; border-color: #d4af37;
}
.lib-load { font-size: 12px; }   /* keep wave3 button compact */

/* Read modal (diwan-style display) */
.read-meta { color: #8a7d63; font-size: 13px; text-align: center; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e8dfcb; }
.read-body { font-family: 'Amiri', serif; line-height: 2.4; text-align: center; color: #1a3a4a; }
.read-line { font-size: 19px; margin: 4px 0; }
.read-spacer { height: 14px; }

/* PDF import */
.import-list { background: #fff; padding: 12px 16px; border-radius: 8px; margin-top: 12px; }
.import-list ul { padding-right: 22px; line-height: 1.9; color: #555; }

/* Draft restore banner */
.draft-banner {
  display: flex; align-items: center; gap: 12px;
  background: #fef6e0; border: 1px solid #d4af37;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 12px;
  color: #8a6914; font-size: 13.5px;
}
.draft-banner button {
  background: #1a3a4a; color: #fff; border: none;
  border-radius: 6px; padding: 5px 12px; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 700;
}
.draft-banner button:last-child {
  background: transparent; color: #8a6914;
  border: 1px solid #d4af37;
}
.draft-banner button:hover { opacity: 0.88; }

/* ─── Wave 6 styles ─── */

/* Meaning explainer */
.explain-theme { background:#fef6e0; padding:10px 14px; border-radius:7px; margin-bottom:12px; color:#8a6914; line-height:1.8; }
.explain-verse { background:#fff; padding:12px 14px; border-radius:8px; margin-bottom:10px; border-right:4px solid #d4af37; }
.explain-verse-num { color:#8a7d63; font-size:12px; font-weight:700; margin-bottom:4px; }
.explain-original { font-family:'Amiri',serif; font-size:16px; color:#1a3a4a; line-height:2; margin-bottom:6px; }
.explain-meaning { color:#1a3a4a; line-height:1.9; padding:8px 12px; background:#faf6ee; border-radius:6px; }
.explain-imagery { color:#5a4528; font-size:13px; margin-top:8px; font-style:italic; }
.explain-words { color:#6b5e44; font-size:12.5px; margin-top:8px; line-height:1.9; }
.word-pop { display:inline-block; background:#fff; padding:3px 9px; margin:2px 4px; border-radius:11px; border:1px solid #e8dfcb; }
.explain-note { background:#f3eddf; padding:10px 14px; border-radius:7px; margin-top:12px; color:#6b5e44; font-style:italic; }

/* Words alternatives */
.words-original { font-size:15px; color:#1a3a4a; margin-bottom:8px; }
.words-tip { background:#fef6e0; padding:8px 12px; border-radius:6px; color:#8a6914; margin-bottom:10px; font-size:13px; }
.words-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(170px,1fr)); gap:8px; }
.word-card { background:#fff; padding:10px; border-radius:8px; border:1px solid #e0d8c8; text-align:center; }
.word-w { font-size:18px; font-weight:700; }
.word-m { font-size:11.5px; color:#6b5e44; margin:4px 0 6px; line-height:1.5; }
.word-meta { font-size:11px; }
.word-fits-ok { color:#2e7d32; font-weight:600; }
.word-fits-warn { color:#ef6c00; font-weight:600; }
.word-mood { color:#8a7d63; }

/* Holistic review */
.holistic-overall { background:#fff; padding:18px; border-radius:10px; text-align:center; margin-bottom:14px; border:1px solid #e0d8c8; }
.holistic-score { font-size:54px; font-weight:700; line-height:1; }
.holistic-score span { font-size:18px; color:#8a7d63; }
.holistic-grade { font-size:20px; font-weight:700; margin-top:4px; }
.holistic-summary { color:#6b5e44; margin-top:12px; line-height:1.8; }
.holistic-axes { display:flex; flex-direction:column; gap:8px; }
.holistic-axis { background:#fff; padding:10px 14px; border-radius:8px; border-right:3px solid #d4c5a9; }
.holistic-axis.axis-high { border-right-color:#2e7d32; }
.holistic-axis.axis-mid  { border-right-color:#ef6c00; }
.holistic-axis.axis-low  { border-right-color:#c62828; }
.axis-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:6px; }
.axis-label { color:#1a3a4a; font-weight:700; font-size:14px; }
.axis-score { color:#6b5e44; font-weight:700; font-size:13px; }
.axis-bar { background:#f0e7d0; height:6px; border-radius:3px; overflow:hidden; }
.axis-fill { height:100%; background:linear-gradient(90deg,#d4af37,#a38538); }
.axis-comment { color:#6b5e44; font-size:12px; margin-top:6px; font-style:italic; }
.holistic-section { background:#fff; padding:10px 14px; border-radius:8px; margin-top:10px; }
.holistic-section ul { padding-right:22px; line-height:1.9; color:#555; font-size:13.5px; }
.holistic-strengths { border-right:3px solid #2e7d32; }
.holistic-weaknesses { border-right:3px solid #ef6c00; }
.holistic-recs { border-right:3px solid #d4af37; }

/* Title modal */
.title-list { display:flex; flex-direction:column; gap:10px; }
.title-card { display:flex; gap:10px; background:#fff; padding:12px; border-radius:8px; border:1px solid #e0d8c8; align-items:center; }
.title-num { background:#d4af37; color:#fff; border-radius:50%; width:30px; height:30px; display:flex; align-items:center; justify-content:center; font-weight:700; flex-shrink:0; }
.title-body { flex:1; }
.title-text { font-family:'Amiri',serif; font-size:18px; font-weight:700; color:#1a3a4a; }
.title-meta { color:#8a7d63; font-size:12px; margin-top:4px; }
.title-style { background:#fef6e0; color:#8a6914; padding:1px 8px; border-radius:9px; font-weight:600; }
.title-copy { background:transparent; border:1px solid #d4c5a9; border-radius:6px; padding:5px 10px; cursor:pointer; font-family:inherit; font-size:12px; }
.title-copy:hover { background:#fef6e0; }

/* Plagiarism attribution box */
.plag-attribution {
  background: linear-gradient(135deg, #ffebee, #ffe0b2);
  border: 2px solid #c62828; border-radius: 10px;
  padding: 14px 18px; margin-bottom: 12px; text-align: center;
}
.plag-attr-label { color: #c62828; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.plag-attr-poet { font-family: 'Amiri', serif; font-size: 24px; font-weight: 700; color: #5a4528; }
.plag-attr-work { color: #8a7d63; font-size: 13px; margin-top: 4px; font-style: italic; }

/* Enhanced footer */
.footer-links {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
  padding: 14px 0 10px; font-size: 13.5px;
}
.footer-links a {
  color: #5a4528; text-decoration: none; font-weight: 600;
  padding: 4px 10px; border-radius: 6px; transition: background 0.15s;
}
.footer-links a:hover { background: #fef6e0; }
.footer-sep { color: #d4c5a9; }
.footer p { text-align: center; color: #8a7d63; font-size: 12.5px; padding: 6px 0; }
.footer p a { color: #8a6914; text-decoration: none; }
.footer p a:hover { text-decoration: underline; }

/* Wave 7: Profile tab */
.profile-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.profile-row > span { color: #6b5e44; font-weight: 600; font-size: 13.5px; }
.profile-row input[type=text], .profile-row textarea {
  padding: 9px 12px; border: 1px solid #d4c5a9; border-radius: 7px;
  font-family: inherit; font-size: 14px; background: #fff;
}
.profile-row input:focus, .profile-row textarea:focus { outline: none; border-color: #d4af37; }
.profile-toggle { flex-direction: row; align-items: center; gap: 10px; }
.profile-toggle input { accent-color: #d4af37; width: 18px; height: 18px; }
.profile-toggle span { font-weight: 600; color: #1a3a4a; font-size: 14px; }

/* Public toggle button in library cards */
.lib-pub {
  background: transparent; border: 1px solid #d4c5a9; border-radius: 6px;
  padding: 4px 9px; cursor: pointer; font-size: 14px; font-family: inherit;
}
.lib-pub.active { background: #fef6e0; border-color: #d4af37; }
.lib-pub:hover:not(:disabled) { background: #faf6ee; }
