
:root {
    --primary-color: #8B5A3C;
    --primary-light: #A2704E;
    --primary-dark: #6F442A;
    --primary-soft: rgba(139, 90, 60, 0.08);
    --background-color: #FFFFFF;
    --surface-color: #F8F6F2;
    --surface-elevated: #FFFFFF;
    --border-color: #EBE3DA;
    --border-light: #F0EAE3;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.03), 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 12px 28px -8px rgba(100, 70, 40, 0.12);
    --text-primary: #2C241A;
    --text-secondary: #6B5A4A;
    --text-tertiary: #9B8B7A;
    --transition-default: all 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}


.hero {
    position: relative;
    overflow: hidden;
    min-height: 650px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #FCF9F5 0%, #F5EFE8 100%);

}

.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('./cymraq.svg');
    background-size: 50%;
    background-position: 50% 10%;
    background-repeat: no-repeat;
    opacity: 0.15;
    pointer-events: none;
}


.state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 32px 20px 20px;
    position: relative;
    z-index: 2;
    flex-wrap: wrap;
}

.state .counter {
    background: var(--surface-elevated);
    padding: 20px 45px;
    border-radius: 10px;
    text-align: center;
    min-width: 200px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-default);
}

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

.state .CountName {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 8px;
}

.state #wordCount,
.state #articleCount {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}


.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 20px 24px 32px;
}

.hero h1 {
    font-size: clamp(32px, 6vw, 48px);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.hero h2 {
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 32px;
}


.search-box {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 600px;
    margin: 0 auto;
}

.search-box input[type="text"] {
    flex: 1;
    min-width: 260px;
    padding: 14px 20px;
    font-size: 15px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-family: inherit;
    background: var(--background-color);
    color: var(--text-primary);
    transition: var(--transition-default);
}

.search-box input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-box input[type="text"]::placeholder {
    color: var(--text-tertiary);
}

#searchButton {
    background: var(--primary-color);
    border: none;
    border-radius: 12px;
    padding: 12.2px 12.2px;
    cursor: pointer;
    transition: var(--transition-default);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#searchButton:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

#searchButton svg {
    width: 22px;
    height: 22px;
}

#searchButton svg path {
    fill: white;
}

.settings-btn {
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    padding: 12.2px 12.2px;
    cursor: pointer;
    transition: var(--transition-default);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: var(--primary-soft);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.settings-btn svg path {
    fill: var(--primary-color);
}


.search-results {
    position: relative;
    z-index: 2;
    padding: 20px 24px 40px;
}

.search-results.searched {
    background: transparent;
}


.featured-words {
    max-width: 1280px;
    margin: 0 auto;
}

.featured-words h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-right: 8px;
    border-right: 3px solid var(--primary-color);
}


.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.word-item {
    background: var(--surface-elevated);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-default);
    position: relative;
    overflow: hidden;
}

.word-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.word-item h3 {
    font-size: 20px;
    font-weight: 650;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.word-item h3 a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-default);
}

.word-item h3 a:hover {
    color: var(--primary-light);
}

.word-item p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}


.word-item::before {
    content: '';
    position: absolute;
    bottom: -20px;
    left: -20px;
    width: 80px;
    height: 80px;
    background-image: url("./iran.svg");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.06;
    pointer-events: none;
}

.word-item::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background-image: url("./iran.svg");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.06;
    pointer-events: none;
}


mark {
    background-color: #FDEBD0;
    color: var(--primary-dark);
    border-radius: 4px;
    padding: 0 2px;
}


.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
    font-size: 16px;
}


.loading-indicator {
    display: flex;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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


.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    z-index: 1300;
    align-items: center;
    justify-content: center;
}


.modal.show {
    display: flex !important;
}

.modal-content {
    background: var(--surface-elevated);
    width: calc(100% - 32px);
    max-width: 520px;
    margin: 0 auto;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
    overflow: hidden;
    position: relative;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-16px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-elevated);
}

.modal-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.3px;
}

.modal-header .close-btn {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-default);
    line-height: 1;
}

.modal-header .close-btn:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
    transform: rotate(90deg);
}

.modal-body {
    padding: 28px 24px;
    background: var(--surface-elevated);
}

.setting-group {
    margin-bottom: 24px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.setting-group select {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9rem;
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    background: var(--background-color);
    color: var(--text-primary);
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-default);
}

.setting-group select:hover {
    border-color: var(--primary-light);
}

.setting-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);
}


.setting-group select option {
    padding: 12px;
    background: var(--surface-elevated);
}

.modal-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--surface-elevated);
}

.save-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 44px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-default);
    letter-spacing: 0.3px;
}

.save-btn:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 90, 60, 0.3);
}

.save-btn:active {
    transform: translateY(0);
}


@media (max-width: 600px) {
    .modal-content {
        width: calc(100% - 24px);
        max-width: none;
        border-radius: 24px;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 16px 20px 20px;
    }

    .setting-group {
        margin-bottom: 20px;
    }

    .setting-group select {
        padding: 10px 14px;
    }

    .save-btn {
        padding: 10px 24px;
    }
}


@media (max-width: 380px) {
    .modal-content {
        width: calc(100% - 16px);
        border-radius: 20px;
    }

    .modal-body {
        padding: 16px;
    }

    .setting-group label {
        font-size: 0.85rem;
    }

    .setting-group select {
        font-size: 0.85rem;
        padding: 10px 12px;
    }
}

@media (max-width: 768px) {
    .hero {
        min-height: auto;
    }
    
    .hero::before {
        background-size: 70%;
        background-position: 50% 10%;
        opacity: 0.1;
    }
    
    .state {
        gap: 16px;
        padding: 20px 16px 12px;
    }
    
    .state .counter {
        padding: 14px 20px;
        min-width: 130px;
    }
    
    .state #wordCount,
    .state #articleCount {
        font-size: 28px;
    }
    
    .hero-content {
        padding: 16px 20px 24px;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .hero h2 {
        font-size: 16px;
        margin-bottom: 24px;
    }
    
    .search-box {
        gap: 8px;
    }
    
    .search-box input[type="text"] {
        min-width: 200px;
        padding: 12px 18px;
        font-size: 14px;
    }
    
    .word-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .search-results {
        padding: 16px;
    }
    
    .modal-content {
        width: 95%;
        margin: auto;
    }
}

@media (max-width: 480px) {
    .state .counter {
        padding: 12px 16px;
        min-width: 110px;
    }
    
    .state #wordCount,
    .state #articleCount {
        font-size: 24px;
    }
    
    .word-item {
        padding: 16px;
    }
    
    .word-item h3 {
        font-size: 18px;
    }
}