/**
 * Islamic Scholarly CSS for Raeel
 * Respectful design for Islamic educational content
 */

/* Root Variables - Islamic Traditional Palette */
:root {
    /* Traditional Islamic Colors */
    --primary-color: #2c5530;
    /* Deep forest green */
    --primary-light: #3d6b41;
    --primary-dark: #1a3319;
    --secondary-color: #8b4513;
    /* Saddle brown */

    /* Accent Colors */
    --gold-color: #d4af37;
    --gold-light: #e6c55a;
    --gold-dark: #b8941f;

    /* Status Colors */
    --success-color: #2d5a3d;
    --warning-color: #8b6914;
    --info-color: #2c4a6b;
    --danger-color: #8b2635;

    /* Neutral Colors */
    --text-primary: #2c2c2c;
    --text-secondary: #4a4a4a;
    --text-muted: #6b6b6b;
    --text-light: #f5f5f5;

    /* Background Colors */
    --bg-primary: #faf8f3;
    /* Warm cream */
    --bg-secondary: #f0ece3;
    /* Light beige */
    --bg-card: #ffffff;
    --bg-accent: #f8f6f0;

    /* Border Colors */
    --border-color: #d4c4a0;
    --border-light: #e8dcc0;
    --border-dark: #b8a882;

    /* Layout */
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;

    /* Shadows - Subtle and respectful */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);

    /* Transitions */
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;

    /* Light Mode Colors */
    --footer-bg: var(--primary-color);
    --footer-text: rgba(255, 255, 255, 0.9);
    --footer-text-muted: rgba(255, 255, 255, 0.7);
    --footer-border: rgba(255, 255, 255, 0.1);
    --modal-bg: var(--bg-card);
    --modal-text: var(--text-primary);

    /* Dark Mode Colors */
    --dark-footer-bg: #1a1a1a;
    --dark-footer-text: #ffffff;
    --dark-footer-text-muted: rgba(255, 255, 255, 0.8);
    --dark-modal-bg: #2d2d2d;
    --dark-modal-text: #ffffff;
    --dark-card-bg: #2d2d2d;
    --dark-card-border: #3d3d3d;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Amiri', 'Scheherazade New', 'Times New Roman', serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(circle at 25% 25%, rgba(212, 175, 55, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(44, 85, 48, 0.05) 0%, transparent 50%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.8;
    color: var(--text-primary);
}

/* Typography - Islamic Style */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Amiri', 'Scheherazade New', serif;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.display-4 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 0.5rem;
    position: relative;
}

.display-4::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold-color), var(--gold-light));
    border-radius: 2px;
}

p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.lead {
    font-size: 1.25rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Header - Minimal Islamic Style */
.minimal-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.game-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Amiri', serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.game-brand:hover {
    color: var(--primary-light);
    transform: scale(1.02);
}

.game-brand i {
    color: var(--gold-color);
    margin-left: 0.5rem;
}

/* Cards - Traditional Islamic Design */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--gold-color), var(--primary-color));
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 2rem;
}

.card-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Game Mode Cards */
.game-mode-card {
    cursor: pointer;
    transition: var(--transition-slow);
    height: 100%;
}

.game-mode-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.game-mode-card .card-body {
    padding: 2rem;
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-mode-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.game-mode-card:hover i {
    transform: scale(1.1);
}

/* Mode-specific colors */
.game-mode-card.classic-mode i {
    color: var(--primary-color);
}

.game-mode-card.poem-mode i {
    color: var(--success-color);
}

.game-mode-card.hadith-mode i {
    color: var(--warning-color);
}

.game-mode-card.athar-mode i {
    color: var(--info-color);
}

/* Buttons - Traditional Islamic Style */
.btn {
    font-family: 'Amiri', serif;
    font-weight: 600;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    transition: var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
    border-color: var(--warning-color);
}

.btn-info {
    background: var(--info-color);
    color: white;
    border-color: var(--info-color);
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-outline-warning {
    background: transparent;
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.btn-outline-warning:hover {
    background: var(--warning-color);
    color: white;
}

/* Form Controls */
.form-control {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: 'Amiri', serif;
    transition: var(--transition);
    color: var(--text-primary);
}

.form-control:focus {
    background: var(--bg-card);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 85, 48, 0.1);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Content Text - Islamic Manuscript Style */
.content-text {
    background: var(--bg-accent);
    border: 1px solid var(--border-light);
    border-right: 4px solid var(--gold-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    margin: 1.5rem 0;
    font-size: 1.2rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-family: 'Amiri', serif;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.poem-verse,
.hadith-verse,
.athar-verse {
    font-size: 1.3rem;
    line-height: 2;
    color: var(--text-primary);
    padding: 1rem;
    background: rgba(212, 175, 55, 0.05);
    border-radius: var(--border-radius);
    margin: 1rem 0;
    font-weight: 500;
}

.poem-text {
    text-align: center;
    font-style: italic;
}

/* Statistics */
.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-number {
    font-family: 'Amiri', serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Progress Bars */
.progress {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--gold-color));
    border-radius: 3px;
}

/* Badges - Islamic Style */
.badge {
    font-family: 'Amiri', serif;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.badge.bg-success {
    background: var(--success-color) !important;
    color: white;
}

.badge.bg-info {
    background: var(--info-color) !important;
    color: white;
}

.badge.bg-warning {
    background: var(--warning-color) !important;
    color: white;
}

/* Alerts */
.alert {
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    color: var(--text-primary);
}

.alert-info {
    border-left: 4px solid var(--info-color);
    background: rgba(44, 74, 107, 0.05);
}

.alert-warning {
    border-left: 4px solid var(--warning-color);
    background: rgba(139, 105, 20, 0.05);
}

/* Enhanced Classic Mode Comparison Results */
.comparison-results {
    margin: 1.5rem 0;
    overflow-x: auto;
}

.comparison-header {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: #111814;
    border-bottom: none;
    color: #9db9a8;
    font-weight: bold;
    font-size: 0.875rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 900px;
}

.comparison-row {
    display: flex;
    gap: 0.5rem;
    padding: 0.25rem 1rem;
    border-bottom: none;
    align-items: center;
    transition: var(--transition);
    min-width: 900px;
}

/* Column sizing */
.comparison-header-character,
.comparison-character {
    flex: 2;
    min-width: 140px;
    padding: 0 0.5rem;
    text-align: right;
}

.comparison-header-cell {
    flex: 1;
    min-width: 85px;
    text-align: center;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-character {
    flex: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    min-height: 5rem;
}

.comparison-character .cell-content {
    background: #1c2e26;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    font-weight: bold;
    flex-direction: row !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 5rem;
    border-radius: 0.75rem;
    padding: 0.25rem;
}

.comparison-character .cell-value {
    font-size: clamp(0.75rem, 1.9vw, 0.9rem);
    /* Increased */
    line-height: 1.1;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: block;
    transform-origin: center;
    transition: transform 0.1s ease;
}

/* Quick report flag button — inline next to character name */
.report-flag-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.report-flag-btn .material-symbols-outlined {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.report-flag-btn:hover .material-symbols-outlined {
    color: rgba(239, 68, 68, 0.9);
}

.comparison-cell {
    flex: 1;
    min-width: 85px;
    padding: 0;
    min-height: 5rem;
    position: relative;
}

.cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 5rem;
    width: 100%;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
    position: relative;
    z-index: 2;
    padding: 0.25rem;
}

.cell-value {
    font-size: clamp(0.7rem, 1.7vw, 0.85rem);
    /* Increased */
    line-height: 1.1;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    display: block;
    transform-origin: center;
    transition: transform 0.1s ease;
    max-height: 100%;
    overflow: hidden;
}

/* Flexible text sizing for الأدوار (roles) - 5th column */
.comparison-cell:nth-child(6) .cell-value,
.comparison-header-cell:nth-child(6) {
    font-size: clamp(0.6rem, 1.4vw, 0.75rem);
    /* Smaller to fit more content */
    line-height: 1.0;
}

/* Very long text in roles column */
.comparison-cell:nth-child(6) .cell-value.very-long-text {
    font-size: clamp(0.5rem, 1.1vw, 0.6rem);
    line-height: 0.9;
    transform: scaleX(0.85);
    /* Horizontal compression for very long text */
}

/* Enhanced text scaling for all cells */
.cell-value.long-text {
    font-size: clamp(0.6rem, 1.3vw, 0.7rem);
    /* Increased */
    line-height: 1.0;
}

.cell-value.very-long-text {
    font-size: clamp(0.55rem, 1.1vw, 0.65rem);
    /* Increased */
    line-height: 0.95;
    transform: scaleX(0.9);
}

/* Hints Section Styling */
.hints-section {
    background: var(--bg-accent);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
}

.hint-item {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-primary);
    border-left: 4px solid var(--gold-color);
}

.hint-item:last-child {
    margin-bottom: 0;
}

.hint-item .hint-label {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.hint-item .hint-value {
    color: var(--text-secondary);
}

/* Header buttons styling */
.header-buttons {
    display: flex;
    align-items: center;
}

/* Remove old arrow styles */
.cell-arrow {
    display: none;
    /* Hide text arrows */
}

/* Arrow indicators using Material Symbols */
.comparison-cell.arrow-up .cell-content::after,
.comparison-cell.arrow-down .cell-content::after {
    font-family: 'Material Symbols Outlined';
    font-size: 1rem;
    margin-top: 0.25rem;
}

.comparison-cell.arrow-up .cell-content::after {
    content: 'arrow_upward';
}

.comparison-cell.arrow-down .cell-content::after {
    content: 'arrow_downward';
}

.comparison-cell.correct .cell-content {
    background: #11d462;
    color: #000;
}

.comparison-cell.partial .cell-content {
    background: #f59e0b;
    color: #000;
}

.comparison-cell.incorrect .cell-content {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
}

/* Grey for non-comparable cases */
.comparison-cell.unequal .cell-content {
    background: #3f3f46;
    border: 1px solid #71717a;
    color: #9ca3af;
}

/* Dash indicator for non-comparable */
.comparison-cell.arrow-dash::before {
    content: "–";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    color: #6c757d;
    font-size: 16px;
}

/* Comparison table always uses desktop layout (scrolls horizontally on mobile) */

/* Updated Poem Mode Guess Cards - Vertical stack */
.poem-guesses {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    /* Stack vertically instead of row */
    gap: 0.5rem;
    align-items: center;
    /* Center the cards */
}

.poem-guess-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    /* Make it wider and shorter for better text display */
    width: 280px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Space between name and icon */
    text-align: left;
}

.poem-guess-card.correct {
    border-left: 4px solid var(--success-color);
    background: rgba(45, 90, 61, 0.05);
}

.poem-guess-card.incorrect {
    border-left: 4px solid #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.poem-guess-card .guess-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.poem-guess-card .character-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    /* Allow text to take most of the space */
    flex: 1;
    margin-right: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poem-guess-card.correct .character-name {
    color: var(--success-color);
}

.poem-guess-card.incorrect .character-name {
    color: #dc3545;
}

.poem-guess-card .guess-icon {
    font-size: 1.5rem;
    opacity: 0.9;
    flex-shrink: 0;
    /* Don't shrink the icon */
    width: 24px;
    text-align: center;
}

.poem-guess-card.correct .guess-icon {
    color: var(--success-color);
}

.poem-guess-card.incorrect .guess-icon {
    color: #dc3545;
}

.poem-guess-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Responsive design for poem cards */
@media (max-width: 768px) {
    .poem-guess-card {
        width: 250px;
        height: 55px;
    }

    .poem-guess-card .character-name {
        font-size: 0.9rem;
    }

    .poem-guess-card .guess-icon {
        font-size: 1.3rem;
    }
}

/* Enhanced bonus athar dropdown positioning - removed fixed positioning in favor of absolute */

.bonus-athar .suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    background: white;
    color: #495057;
}

.bonus-athar .suggestion-item:hover {
    background-color: #f8f9fa;
}

.bonus-athar .suggestion-item:last-child {
    border-bottom: none;
}

/* Comparison 576px breakpoint removed — table uses fixed min-width for consistent desktop layout */

/* Suggestions Dropdown */
.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: var(--shadow);
}

.suggestion-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}

.suggestion-item:hover {
    background: var(--bg-secondary);
}

.suggestion-name {
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Golden shine effects */
.golden-shine {
    background: linear-gradient(45deg, #ffd700, #ffed4e, #ffd700, #ffed4e, #ffd700);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldenShine 2s ease-in-out infinite;
    font-weight: 700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.golden-shine-dark {
    background: linear-gradient(45deg, #b8941f, #d4af37, #b8941f, #d4af37, #b8941f);
    background-size: 300% 300%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: goldenShine 2s ease-in-out infinite;
    font-weight: 600;
    text-shadow: 0 0 15px rgba(180, 148, 31, 0.4);
}

@keyframes goldenShine {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Fallback for browsers that don't support background-clip: text */
@supports not (-webkit-background-clip: text) {
    .golden-shine {
        background: none;
        -webkit-text-fill-color: initial;
        color: #ffd700;
        text-shadow:
            0 0 10px rgba(255, 215, 0, 0.8),
            0 0 20px rgba(255, 215, 0, 0.6),
            0 0 30px rgba(255, 215, 0, 0.4);
        animation: goldenGlow 2s ease-in-out infinite;
    }

    .golden-shine-dark {
        background: none;
        -webkit-text-fill-color: initial;
        color: #d4af37;
        text-shadow:
            0 0 8px rgba(212, 175, 55, 0.8),
            0 0 16px rgba(212, 175, 55, 0.6),
            0 0 24px rgba(212, 175, 55, 0.4);
        animation: goldenGlow 2s ease-in-out infinite;
    }
}

@keyframes goldenGlow {

    0%,
    100% {
        text-shadow:
            0 0 10px rgba(255, 215, 0, 0.8),
            0 0 20px rgba(255, 215, 0, 0.6),
            0 0 30px rgba(255, 215, 0, 0.4);
    }

    50% {
        text-shadow:
            0 0 15px rgba(255, 215, 0, 1),
            0 0 30px rgba(255, 215, 0, 0.8),
            0 0 45px rgba(255, 215, 0, 0.6);
    }
}

/* Enhanced Victory Panel */
.victory-panel {
    background: linear-gradient(135deg, var(--success-color), var(--primary-color));
    color: white;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
    text-align: center;
    margin: 2rem 0;
    margin-top: 3rem;
    /* Extra top margin to account for header */
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}


.victory-panel::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 215, 0, 0.1), transparent);
    animation: victoryShimmer 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes victoryShimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    50% {
        transform: translateX(0%) translateY(0%) rotate(45deg);
    }

    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.victory-character {
    position: relative;
    z-index: 2;
    margin-bottom: 1.5rem;
}

.victory-character h3 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.victory-character h4 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.victory-character p {
    font-size: 1.2rem;
    opacity: 0.9;
}


/* Loading States */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Islamic Decorative Elements */
.islamic-decoration {
    position: relative;
}

.islamic-decoration::before,
.islamic-decoration::after {
    content: '◊';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold-color);
    font-size: 0.8rem;
}

.islamic-decoration::before {
    left: -15px;
}

.islamic-decoration::after {
    right: -15px;
}

.poem-verse {
    text-align: center;
    line-height: 2;
}

/* Print Styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    .card {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }

    .minimal-header {
        display: none !important;
    }
}

/* Modal Styles */
.modal-content {
    background: var(--modal-bg);
    color: var(--modal-text);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
}

.modal-title {
    color: var(--modal-text);
}

/* Dark Mode Styles */
body.dark-mode {
    background: #1a1a1a;
    color: #ffffff;
}

body.dark-mode .card {
    background: var(--dark-card-bg);
    border-color: var(--dark-card-border);
    color: #ffffff;
}

body.dark-mode .card-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom-color: var(--dark-card-border);
}

body.dark-mode .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

body.dark-mode .modal-content {
    background: var(--dark-modal-bg);
    color: var(--dark-modal-text);
    border-color: var(--dark-card-border);
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: var(--dark-card-border);
}

body.dark-mode .form-control {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--dark-card-border);
    color: #ffffff;
}

body.dark-mode .form-control:focus {
    background: rgba(255, 255, 255, 0.15);
}

body.dark-mode .form-control::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Modal Animation */
.modal.fade .modal-dialog {
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
}

.modal.show .modal-dialog {
    transform: scale(1);
}

/* Improved Button Styles */
.btn-close {
    opacity: 0.8;
    transition: opacity 0.2s;
}

.btn-close:hover {
    opacity: 1;
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Improved Form Styles */
.form-control {
    transition: all 0.2s ease;
}

.form-control:focus {
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
}

/* Stats and Progress Bars in Dark Mode */
body.dark-mode .stat-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--dark-card-border);
}

body.dark-mode .progress {
    background: rgba(255, 255, 255, 0.1);
}

/* Game Mode Cards in Dark Mode */
body.dark-mode .game-mode-card {
    background: var(--dark-card-bg);
}

body.dark-mode .game-mode-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Content Text in Dark Mode */
body.dark-mode .content-text {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

/* Suggestions Dropdown in Dark Mode */
body.dark-mode .suggestions-dropdown {
    background: var(--dark-card-bg);
    border-color: var(--dark-card-border);
}

body.dark-mode .suggestion-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .suggestion-name {
    color: #ffffff;
}

body.dark-mode .suggestion-details {
    color: rgba(255, 255, 255, 0.6);
}

/* Alert Styles in Dark Mode */
body.dark-mode .alert {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--dark-card-border);
}

/* Badge Styles in Dark Mode */
body.dark-mode .badge {
    border: none;
}

.streak-display,
.mega-streak-display {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
}

.streak-display .bi-fire {
    color: #ff4d4d;
}

.mega-streak-display .bi-crown {
    color: #ffd700;
}

.streak-count,
.mega-streak-count {
    font-weight: bold;
}

/* Dark mode adjustments */
body.dark-mode .comparison-character {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--dark-card-border);
    color: #ffffff;
}

/* Animation classes */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-in-out forwards;
}

.slide-in {
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn 0.4s ease-out forwards;
}

.cell-animate {
    opacity: 0;
    transform: scale(0.8);
    animation: cellReveal 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cellReveal {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Ensure proper positioning for loaded guesses */
.comparison-results .comparison-row {
    position: relative;
    z-index: 1;
}

.comparison-results .comparison-header {
    position: relative;
    z-index: 2;
    margin-bottom: 0.5rem;
}

/* Fix bonus suggestions dropdown positioning */
.bonus-athar .suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    max-height: 240px;
    /* Increased to ensure at least 3 suggestions are visible */
    overflow-y: auto;
    z-index: 1050;
    /* Higher than modal z-index */
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.bonus-athar .suggestion-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    background: white;
    color: #495057;
}

.bonus-athar .suggestion-item:hover {
    background-color: #f8f9fa;
}

.bonus-athar .suggestion-item:last-child {
    border-bottom: none;
}

/* Ensure bonus athar container doesn't clip suggestions */
.bonus-athar {
    overflow: visible;
    position: relative;
}

.bonus-athar .position-relative {
    z-index: 1051;
    /* Even higher to ensure suggestions appear above everything */
}

/* Updated Poem Mode Guess Cards - 3x bigger and fixed layout */
.poem-guesses {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.poem-guess-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    /* Increased padding */
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    /* 3x bigger size */
    width: 840px;
    /* 280px * 3 */
    height: 180px;
    /* 60px * 3 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.poem-guess-card.correct {
    border-left: 8px solid var(--success-color);
    /* Thicker border */
    background: rgba(45, 90, 61, 0.05);
}

.poem-guess-card.incorrect {
    border-left: 8px solid #dc3545;
    /* Thicker border */
    background: rgba(220, 53, 69, 0.05);
}

.poem-guess-card .guess-content {
    display: flex;
    flex-direction: column;
    /* Stack vertically to prevent overlap */
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-align: center;
    gap: 1rem;
    /* Space between name and icon */
}

.poem-guess-card .character-name {
    font-size: 2rem;
    /* Much larger text */
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    /* Allow full width */
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.poem-guess-card.correct .character-name {
    color: var(--success-color);
}

.poem-guess-card.incorrect .character-name {
    color: #dc3545;
}

.poem-guess-card .guess-icon {
    font-size: 3rem;
    /* Much larger icon */
    opacity: 0.9;
    flex-shrink: 0;
    text-align: center;
    margin: 0;
}

.poem-guess-card.correct .guess-icon {
    color: var(--success-color);
}

.poem-guess-card.incorrect .guess-icon {
    color: #dc3545;
}

.poem-guess-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

/* Responsive design for poem cards */
@media (max-width: 1200px) {
    .poem-guess-card {
        width: 600px;
        /* Smaller on medium screens */
        height: 150px;
    }

    .poem-guess-card .character-name {
        font-size: 1.5rem;
    }

    .poem-guess-card .guess-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .poem-guess-card {
        width: 90%;
        /* Responsive width */
        max-width: 400px;
        height: 120px;
    }

    .poem-guess-card .character-name {
        font-size: 1.2rem;
    }

    .poem-guess-card .guess-icon {
        font-size: 2rem;
    }
}

/* Legacy Hint Buttons Styling removed - see theme.css */

/* Distinct styling for the main guess input */
#guess-input {
    background: #ffffff;
    border: 2px solid #ced4da;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

#guess-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.15);
}

/* Dark mode visibility for guess input */
body.dark-mode #guess-input {
    background: #2b2b2b;
    color: #ffffff;
    border: 2px solid #555;
}

body.dark-mode #guess-input:focus {
    border-color: var(--gold-color);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}