:root {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  --surface: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.45);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-glow: rgba(79, 70, 229, 0.22);
  --accent: #38bdf8;
  --success: #10b981;
  --danger: #ef4444;
  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --input-bg: #fff;
  --input-border: #cbd5e1;
  --focus-ring: rgba(79, 70, 229, 0.2);
  --chip-bg: rgba(79, 70, 229, 0.08);
  --chip-bg-danger: rgba(239, 68, 68, 0.08);
}

body.dark-mode {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --surface: rgba(30, 41, 59, 0.82);
  --glass-border: rgba(255, 255, 255, 0.06);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.22);
  --card-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.55);
  --input-bg: #0f172a;
  --input-border: #334155;
  --focus-ring: rgba(99, 102, 241, 0.25);
  --chip-bg: rgba(99, 102, 241, 0.15);
  --chip-bg-danger: rgba(239, 68, 68, 0.15);
}

/* Dictionary Specific Styles */

.page-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
    background: none !important;
    text-align: left !important;
    padding: 0 !important;
    color: inherit !important;
}

.page-hero div h1 {
    font-size: 2.3rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-main) !important;
    background: none !important;
    -webkit-text-fill-color: initial !important;
    line-height: 1.15;
    margin-bottom: 6px;
}

.page-hero div p {
    color: var(--text-muted) !important;
    opacity: 1 !important;
    margin: 0 !important;
    max-width: none !important;
    font-size: 0.97rem;
    font-weight: 400;
}

/* Theme Toggle */
.theme-toggle {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    box-shadow: var(--card-shadow);
    transition: all 0.25s;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* Search Bar */
.searchbar {
    position: sticky;
    top: 20px;
    z-index: 10;
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 12px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 12px 12px 12px 20px;
    box-shadow: var(--card-shadow);
    align-items: center;
    transition: box-shadow 0.3s, border-color 0.3s;
}

.search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.search-form input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.1rem;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
}

.search-form input::placeholder {
    color: var(--text-muted);
}

.search-form .btn-search {
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--primary-glow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.search-form .btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.helper {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.kbd {
    border: 1px solid var(--glass-border);
    padding: 2px 6px;
    border-radius: 6px;
    font-family: monospace;
    background: var(--surface);
    color: var(--text-main);
}

/* Results Cards */
.card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 24px;
}

.titleRow {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 16px;
}

.word-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-main);
}

.phonetic {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.2rem;
    font-family: monospace;
}

.audioBtn {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--primary);
    background: var(--chip-bg);
    color: var(--primary);
    padding: 10px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.audioBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.audioBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--glass-border);
    color: var(--text-muted);
    background: transparent;
}

/* Meanings Layout */
.defSection {
    margin-bottom: 24px;
}

.posRow {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.pos-pill {
    background: var(--text-main);
    color: var(--bg-gradient);
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.dark-mode .pos-pill {
    background: #f8fafc;
    color: #0f172a;
}

.def-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.def-box {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

body.dark-mode .def-box {
    background: rgba(0, 0, 0, 0.15);
}

.def-text {
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--text-main);
}

.def-index {
    font-weight: 800;
    color: var(--primary);
    margin-right: 8px;
}

.example {
    margin-top: 10px;
    font-style: italic;
    color: var(--text-muted);
    padding-left: 14px;
    border-left: 3px solid var(--primary);
}

.syn-ant-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin: 12px 0 6px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    background: var(--chip-bg);
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.chip.antonym {
    border-color: var(--danger);
    background: var(--chip-bg-danger);
    color: var(--danger);
}

.chip.antonym:hover {
    background: var(--danger);
    color: white;
}

/* Extras Grid */
.extras-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, 1fr);
    margin-top: 24px;
}

.extra-card {
    padding: 16px;
    border-radius: 14px;
    border: 1px dashed var(--glass-border);
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .extra-card {
    background: rgba(0, 0, 0, 0.1);
}

.extra-card strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 8px;
    color: var(--text-main);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.05em;
}

.extra-content {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.source {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.source a {
    text-decoration: none;
    color: var(--accent);
    background: var(--chip-bg);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--glass-border);
    transition: all 0.2s;
}

.source a:hover {
    border-color: var(--accent);
}

/* States */
.empty,
.error,
.loading-state {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 20px;
    font-size: 1.1rem;
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--card-shadow);
}

.error {
    color: var(--danger);
    font-weight: 600;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Skeletons */
.skeleton {
    height: 20px;
    border-radius: 10px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, rgba(128, 128, 128, 0.1), rgba(128, 128, 128, 0.2), rgba(128, 128, 128, 0.1));
    background-size: 200% 100%;
    animation: skeleton-load 1.5s infinite linear;
}

body.dark-mode .skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    background-size: 200% 100%;
}

@keyframes skeleton-load {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Definition Card */
.definitions-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 35px;
    box-shadow: var(--card-shadow);
    margin-top: 40px;
}

.definitions-card h2 {
    margin: 0 0 6px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.definitions-card .card-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 24px;
    line-height: 1.6;
}

.def-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.def-item {
    display: flex;
    gap: 16px;
    align-items: stretch;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 20px;
    transition: transform 0.2s ease;
}

body.dark-mode .def-item {
    background: rgba(30, 41, 59, 0.4);
}

.def-item:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}

.def-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: 800;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
}

body.dark-mode .def-badge {
    background: rgba(99, 102, 241, 0.25);
    color: #818cf8;
}

.def-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.def-text strong {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.def-text span {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

@media (max-width: 768px) {
    .page-hero {
        flex-direction: column;
    }

    .searchbar {
        position: relative;
        top: 0;
    }

    .extras-grid {
        grid-template-columns: 1fr;
    }

    .definitions-card {
        padding: 20px;
        border-radius: 16px;
    }

    .def-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .def-badge {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .titleRow {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .audioBtn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}
