/* ===== CSS Variables & Design System ===== */
:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-glass: rgba(15, 23, 42, 0.7);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --accent-gradient: linear-gradient(135deg, #3b82f6, #0ea5e9);

    --cyan-accent: #22d3ee;
    --pink-accent: #f472b6;
    --green-accent: #34d399;
    --amber-accent: #fbbf24;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(59, 130, 246, 0.45);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== App Container ===== */
.app-container {
    max-width: 1200px; /* Increased for 4-column layout */
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
}

/* ===== Ambient Background Blobs ===== */
.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    pointer-events: none;
    z-index: 0;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-primary);
    top: -150px;
    right: -100px;
    animation: blobFloat 20s ease-in-out infinite;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--cyan-accent);
    bottom: -100px;
    left: -150px;
    animation: blobFloat 25s ease-in-out infinite reverse;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: var(--pink-accent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: blobFloat 18s ease-in-out infinite 5s;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -40px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 35px) scale(1.02); }
}

/* ===== Header ===== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 20px;
    position: relative;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
    transition: transform var(--transition-base);
}

.logo:active {
    transform: scale(0.98);
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--accent-secondary);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo h1 {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.history-toggle {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
}

.history-toggle svg {
    width: 20px;
    height: 20px;
}

.history-toggle:hover {
    color: var(--accent-secondary);
    border-color: var(--border-active);
    background: var(--bg-card);
    transform: scale(1.05);
}

.history-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--accent-gradient);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition-base);
}

.history-badge.visible {
    opacity: 1;
    transform: scale(1);
}

/* ===== Search Section ===== */
.search-section {
    padding: 20px 0 10px;
    position: relative;
    z-index: 10;
}

.search-wrapper {
    position: relative;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 6px 8px 6px 22px;
    transition: all var(--transition-base);
    position: relative;
}

.search-box:focus-within {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow), 0 0 0 4px rgba(59, 130, 246, 0.08);
    background: var(--bg-card-hover);
}

.search-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--text-muted);
    transition: color var(--transition-base);
}

.search-box:focus-within .search-icon {
    color: var(--accent-secondary);
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-primary);
    padding: 14px 0;
    letter-spacing: 0.01em;
}

#search-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.clear-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    opacity: 0;
    pointer-events: none;
    flex-shrink: 0;
}

.clear-btn svg {
    width: 16px;
    height: 16px;
}

.clear-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.search-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 14px;
    font-weight: 300;
    transition: opacity var(--transition-base);
}

.search-hint kbd {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 2px 7px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== Auto-suggest Dropdown ===== */
.suggestions-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--border-active);
    border-radius: var(--radius-lg);
    overflow: hidden;
    z-index: 50;
    box-shadow: var(--shadow-md), 0 0 30px rgba(59, 130, 246, 0.1);
    backdrop-filter: blur(20px);
    opacity: 0;
    transform: translateY(-8px) scaleY(0.96);
    transform-origin: top center;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 320px;
}

.suggestions-dropdown.active {
    opacity: 1;
    transform: translateY(0) scaleY(1);
    pointer-events: auto;
}

.suggestions-list {
    list-style: none;
    padding: 6px;
    overflow-y: auto;
    max-height: 320px;
}

.suggestions-list::-webkit-scrollbar {
    width: 4px;
}

.suggestions-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: rgba(59, 130, 246, 0.1);
}

.suggestion-item.active {
    background: rgba(59, 130, 246, 0.15);
}

.suggestion-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.suggestion-item-icon.word-icon {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-secondary);
}

.suggestion-item-icon.history-icon {
    background: rgba(34, 211, 238, 0.1);
    color: var(--cyan-accent);
}

.suggestion-item-text {
    flex: 1;
    min-width: 0;
}

.suggestion-item-word {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
}

.suggestion-item-word mark {
    background: transparent;
    color: var(--accent-secondary);
    font-weight: 700;
}

.suggestion-item-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.suggestion-item-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.suggestion-item:hover .suggestion-item-arrow,
.suggestion-item.active .suggestion-item-arrow {
    opacity: 1;
    transform: translateX(0);
}

.suggestions-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 12px;
}

/* ===== Loader ===== */
.loader {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 60px 0;
    position: relative;
    z-index: 5;
}

.loader.active {
    display: flex;
}

.loader-ring {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    animation: spin 0.8s linear infinite;
}

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

.loader p {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 300;
}

/* ===== Error State ===== */
.error-state {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 50px 20px;
    position: relative;
    z-index: 5;
}

.error-state.active {
    display: flex;
    animation: fadeInUp 0.4s ease;
}

.error-icon {
    width: 80px;
    height: 80px;
    color: var(--pink-accent);
    margin-bottom: 20px;
    opacity: 0.6;
}

.error-state h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.error-state p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
    max-width: 360px;
}

.error-search-link {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color var(--transition-base);
}

.error-search-link:hover {
    color: var(--accent-secondary);
}

.near-words-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    display: none; /* Hidden by default */
}

.near-words-section.active {
    display: block;
    animation: fadeInUp 0.4s ease forwards;
}

.near-words-label {
    font-size: 0.82rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.near-words-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

/* ===== Results Section ===== */
.results-section {
    display: none;
    padding: 10px 0 60px;
    position: relative;
    z-index: 5;
}

.results-section.active {
    display: block;
    animation: fadeInUp 0.5s ease;
}

/* ===== Bible Verse Card ===== */
.bible-verse-card {
    display: none; /* Hidden until loaded */
    max-width: 850px;
    margin: 40px auto 20px;
    padding: 32px 40px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    animation: fadeInUp 0.8s ease backwards;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.bible-verse-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
}

.bible-verse-card:hover {
    border-color: var(--border-active);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 0 30px rgba(59, 130, 246, 0.1);
}

.bible-verse-content {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.bible-icon {
    width: 44px;
    height: 44px;
    color: var(--accent-secondary);
    flex-shrink: 0;
    margin-top: 6px;
}

.bible-verse-text-group {
    flex: 1;
}

/* ===== Date & Time Widget ===== */
.date-time-widget {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-active);
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: var(--shadow-md), 0 0 20px rgba(59, 130, 246, 0.05);
    animation: fadeInDown 0.8s ease;
}

.date-time-separator {
    width: 2px;
    height: 20px;
    background: var(--border-color);
}

.current-date {
    letter-spacing: 0.01em;
}

.current-time {
    color: var(--accent-primary);
    font-family: var(--font-sans);
    font-weight: 800;
    min-width: 130px;
    text-align: right;
    font-size: 1.25rem;
}

.bible-verse-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-secondary);
    margin-bottom: 12px;
    opacity: 0.9;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bible-verse-text {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    line-height: 1.5;
    color: var(--text-primary);
    font-style: italic;
    margin-bottom: 16px;
    text-wrap: balance;
}

.bible-verse-ref {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: right;
}

@media (max-width: 640px) {
    .bible-verse-card {
        margin: 24px 0;
        padding: 24px;
        max-width: 100%;
    }
    .bible-verse-text {
        font-size: 1.25rem;
    }
    .bible-icon {
        width: 32px;
        height: 32px;
    }
}

/* ===== Meanings Container Grid ===== */
.meanings-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    align-items: start;
    margin-top: 10px;
}

@media (max-width: 1024px) {
    .meanings-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .meanings-container {
        grid-template-columns: 1fr;
    }
}

/* ===== Source Column ===== */
.source-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.source-header {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(10px);
}

.source-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-secondary);
}

.source-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

.source-column .meaning-block {
    margin-bottom: 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.source-column .meaning-block:hover {
    border-color: var(--border-active);
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
}

.source-error {
    padding: 20px;
    border: 1.5px dashed var(--border-color);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--text-muted);
}

.source-error p {
    font-size: 0.82rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Word Header */
.word-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.word-title {
    font-family: var(--font-serif);
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.word-phonetic {
    color: var(--accent-secondary);
    font-size: 1.1rem;
    font-weight: 400;
    margin-top: 4px;
    letter-spacing: 0.02em;
}

.audio-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--accent-gradient);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-base);
    box-shadow: 0 4px 20px var(--accent-glow);
}

.audio-btn svg {
    width: 24px;
    height: 24px;
}

.audio-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(59, 130, 246, 0.4);
}

.audio-btn:active {
    transform: scale(0.95);
}

/* ===== Meaning Block ===== */
.meaning-block {
    animation: fadeInUp 0.5s ease backwards;
}

.meaning-block:nth-child(1) { animation-delay: 0.05s; }
.meaning-block:nth-child(2) { animation-delay: 0.12s; }
.meaning-block:nth-child(3) { animation-delay: 0.19s; }
.meaning-block:nth-child(4) { animation-delay: 0.26s; }

.part-of-speech {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.part-of-speech h3 {
    font-size: 1.15rem;
    font-weight: 600;
    font-style: italic;
    color: var(--text-primary);
    white-space: nowrap;
}

.part-of-speech::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border-color), transparent);
}

.meaning-label {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.definition-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.definition-item {
    position: relative;
    padding-left: 22px;
}

.definition-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-glow);
}

.definition-text {
    font-size: 0.98rem;
    line-height: 1.7;
    color: var(--text-primary);
    font-weight: 400;
}

.definition-example {
    margin-top: 8px;
    padding-left: 14px;
    border-left: 2px solid var(--border-active);
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.6;
}

/* Synonyms & Antonyms */
.word-chips-section {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.chips-label {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-right: 4px;
}

.word-chip {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.word-chip.synonym {
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent-secondary);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.word-chip.synonym:hover {
    background: rgba(59, 130, 246, 0.25);
    transform: translateY(-1px);
}

.word-chip.antonym {
    background: rgba(244, 114, 182, 0.12);
    color: var(--pink-accent);
    border: 1px solid rgba(244, 114, 182, 0.2);
}

.word-chip.antonym:hover {
    background: rgba(244, 114, 182, 0.25);
    transform: translateY(-1px);
}

/* Source Section */
.source-section {
    display: none; /* Hidden by default, JS will show if needed */
    align-items: center;
    gap: 10px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

.source-label {
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.source-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    word-break: break-all;
    transition: color var(--transition-fast);
}

.source-link:hover {
    color: var(--accent-secondary);
}

/* ===== History Panel ===== */
.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base);
}

.history-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.history-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 100;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel.active {
    transform: translateX(0);
}

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

.history-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.clear-history-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.clear-history-btn svg {
    width: 14px;
    height: 14px;
}

.clear-history-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.history-empty svg {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
}

.history-empty p {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.history-empty span {
    font-size: 0.82rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    animation: fadeInUp 0.3s ease backwards;
}

.history-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    transform: translateX(-3px);
}

.history-item-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.history-item-word {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.history-item-pos {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 12px;
}

.history-item-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 8px;
    transition: all var(--transition-fast);
    opacity: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.history-item-delete svg {
    width: 14px;
    height: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .app-container {
        padding: 0 16px;
    }

    .word-title {
        font-size: 2rem;
    }

    .audio-btn {
        width: 48px;
        height: 48px;
    }

    .audio-btn svg {
        width: 20px;
        height: 20px;
    }

    .history-panel {
        width: 100%;
    }
}

/* ===== Word Links (Clickable meaning words) ===== */
.word-link {
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0 1px;
    border-radius: 2px;
    color: inherit; /* Keep natural text color */
}

.word-link:hover {
    color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
    text-decoration: underline dotted;
    transform: translateY(-1px);
}

.definition-text:hover .word-link {
    /* Optional: can fade out non-hovered words slightly if desired, 
       but keeping it simple for now */
}

/* ===== Selection ===== */
::selection {
    background: rgba(59, 130, 246, 0.3);
    color: var(--text-primary);
}

/* ===== Focus Visible ===== */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}
