:root {
    --primary: #2c3e8f;
    --primary-light: #3b5a9e;
    --primary-dark: #1a2a5e;
    --secondary: #e8edf5;
    --accent: #e67e22;
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-light: #8888aa;
    --bg-body: #f5f7fb;
    --bg-white: #ffffff;
    --border-color: #e2e6ef;
    --shadow: 0 4px 20px rgba(44, 62, 143, 0.08);
    --shadow-hover: 0 8px 35px rgba(44, 62, 143, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, "Microsoft JhengHei", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font: 17px/1.7 var(--font-family);
    color: var(--text-primary);
    background: var(--bg-body);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
    text-decoration: none;
}

img, video, iframe, table, pre, svg {
    max-width: 100%;
    height: auto;
}

.container-custom {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.navbar-custom {
    background: var(--bg-white) !important;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    position: relative;
    z-index: 100;
}

.navbar-custom .navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--primary) !important;
    letter-spacing: 1px;
}

.navbar-custom .navbar-brand:hover {
    color: var(--accent) !important;
}

.navbar-custom .nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar-custom .nav-link:hover {
    color: var(--primary) !important;
    background: var(--secondary);
}

.navbar-custom .navbar-toggler {
    border: none;
    padding: 8px 12px;
}

.navbar-custom .navbar-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(44, 62, 143, 0.15);
}

.navbar-custom .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(26, 26, 46, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.nav-link-custom {
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.nav-link-custom:hover {
    color: var(--primary) !important;
    background: var(--secondary);
}

.page-header {
    padding: 20px 0 16px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1,
.page-header h5 {
    font-weight: 700;
    color: var(--text-primary);
}

.page-header h1 {
    font-size: 2rem;
}

.page-header h5 {
    font-size: 1.4rem;
}

.page-header .text-muted {
    color: var(--text-light) !important;
    font-weight: 400;
    font-size: 0.9rem;
}

.search-form {
    background: var(--bg-white);
    padding: 24px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    position: relative;
    z-index: 10;
}

.search-form label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.search-form .form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    height: auto;
    font-size: 1rem;
    transition: var(--transition);
    min-width: 220px;
}

.search-form .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(44, 62, 143, 0.1);
    outline: none;
}

.search-form .btn-success {
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 32px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    color: #fff;
}

.search-form .btn-success:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(44, 62, 143, 0.3);
    color: #fff;
}

.main-content {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 24px 28px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.article-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.article-list li {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    transition: var(--transition);
}

.article-list li:last-child {
    border-bottom: none;
}

.article-list li:hover {
    padding-left: 12px;
}

.article-list .t {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.article-list .t a {
    color: var(--text-primary);
}

.article-list .t a:hover {
    color: var(--primary);
}

.article-list .r {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 4px;
    word-break: break-word;
}

.article-single h1,
.article-single h9 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    margin-bottom: 12px;
    line-height: 1.3;
}

.article-single p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
}

.article-single .content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
}

.article-single .content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

.sidebar-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px 0;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.sidebar-card .card-header {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px 12px;
    border-bottom: 2px solid var(--border-color);
    background: transparent;
}

.sidebar-card .card-body {
    padding: 12px 20px 8px;
}

.sidebar-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-card ul li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f7;
}

.sidebar-card ul li:last-child {
    border-bottom: none;
}

.sidebar-card ul li a {
    color: var(--text-secondary);
    font-size: 0.92rem;
    transition: var(--transition);
    display: block;
    position: relative;
    z-index: 2;
    pointer-events: auto;
}

.sidebar-card ul li a:hover {
    color: var(--primary);
    padding-left: 6px;
}

.sidebar-card ul li a .badge-hot {
    background: var(--accent);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 8px;
    border-radius: 20px;
    margin-left: 6px;
}

.ad-placeholder {
    background: var(--secondary);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 16px 0;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 0;
}

.adsbygoogle,
ins.adsbygoogle,
.google-auto-placed {
    position: relative !important;
    z-index: 0 !important;
    pointer-events: auto;
}

.sidebar-card .adsbygoogle,
.sidebar-card ins.adsbygoogle {
    position: relative !important;
    z-index: 0 !important;
}

.footer-custom {
    border-top: 1px solid var(--border-color);
    padding: 40px 0 30px;
    margin-top: 40px;
    background: var(--bg-white);
}

.footer-custom .foot {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-custom .foot a {
    color: var(--text-secondary);
    padding: 0 12px;
}

.footer-custom .foot a:hover {
    color: var(--primary);
}

.breadcrumb-custom {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 8px 0 16px;
}

.breadcrumb-custom a {
    color: var(--text-secondary);
}

.breadcrumb-custom a:hover {
    color: var(--primary);
}

.article-meta {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.article-meta span {
    margin-right: 16px;
}

.article-meta a {
    color: var(--primary);
    font-weight: 500;
}

.article-meta a:hover {
    color: var(--accent);
}

.dict-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.dict-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.dict-card .card-title small {
    color: var(--text-light);
    font-weight: 400;
    font-size: 0.85rem;
}

.dict-card p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
}

.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-group a {
    background: var(--secondary);
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
    z-index: 1;
}

.tag-group a:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 62, 143, 0.25);
}

.tag-group-sm a {
    background: #f0f2f7;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.tag-group-sm a:hover {
    background: var(--primary);
    color: #fff;
}

.word-detail h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.word-detail .word-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.word-detail .word-meta span {
    margin-right: 20px;
}

.word-detail .content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.9;
}

.word-detail .content h7 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    padding: 12px 0 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 12px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
    margin-bottom: 20px;
}

.hero-desc strong {
    color: var(--primary);
}

.home-section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    font-size: 1.1rem;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.tag-group a.home-tag {
    background: var(--secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: var(--transition);
    border: 1px solid transparent;
    display: inline-block;
    margin: 4px 4px 4px 0;
}

.tag-group a.home-tag:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 62, 143, 0.25);
}

.index-app {
    position: relative;
    margin: 0.5rem 0 0.5rem;
    border: 1px solid #f8f9fa;
}

.index-app h6 {
    line-height: 1.8;
}

.index-app:hover {
    background-color: #eff9ff;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.5s ease forwards;
}

.main-content,
.sidebar-card,
.article-single .content,
.article-list .r,
.dict-card,
.word-detail .content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 32px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary, #2c3e8f);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(44, 62, 143, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s, background 0.2s;
    z-index: 999;
    padding: 0;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--primary-dark, #1f2c6b);
    transform: translateY(-3px);
}

.card-header {
    padding: 0.25rem;
}

.card-body {
    padding: 0.25rem;
}

.card-footer {
    padding: 0.25rem;
}

h1 small {
    font-size: 50%;
    margin-left: 10px;
}

a.mp3 {
    display: inline-block;
    width: 18px;
    height: 18px;
    background: transparent url(/image/audio.gif) no-repeat;
    margin: 0 0 0 2px;
    vertical-align: text-bottom;
}

.jumbotron {
    padding: 1rem 1rem;
}

@media (max-width: 992px) {
    .main-content {
        padding: 20px;
    }
    .page-header h1 {
        font-size: 1.6rem;
    }
    .article-single h1,
    .article-single h9 {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }
    .container-custom {
        padding: 0 12px;
    }
    .main-content {
        padding: 16px;
        border-radius: var(--radius-sm);
    }
    .search-form {
        padding: 16px;
    }
    .search-form .form-control {
        min-width: 0;
        width: 100%;
    }
    .search-form .btn-success {
        width: 100%;
        margin-top: 8px;
    }
    .page-header h1 {
        font-size: 1.4rem;
    }
    .page-header h5 {
        font-size: 1.2rem;
    }
    .article-list .t {
        font-size: 1rem;
        white-space: normal;
    }
    .article-single h1,
    .article-single h9 {
        font-size: 1.3rem;
    }
    .sidebar-card {
        margin-top: 20px;
    }
    .navbar-custom .navbar-brand {
        font-size: 1.1rem;
    }
    .navbar-custom .navbar-toggler {
        padding: 6px 8px;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
    }
    .home-tag {
        font-size: 0.82rem !important;
        padding: 4px 10px !important;
    }
    .col-md-5,
    .col-md-2 {
        margin-bottom: 8px;
    }
    .navbar-custom,
    .navbar-custom > .container-fluid {
        padding-left: 0;
        padding-right: 0;
    }
    .row {
        margin-left: -8px;
        margin-right: -8px;
    }
    .row > [class*="col-"] {
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 12px;
    }
    .page-header {
        padding: 12px 0;
    }
    .page-header h1 {
        font-size: 1.2rem;
    }
    .article-list li {
        padding: 14px 0;
    }
    .footer-custom {
        padding: 24px 0 20px;
    }
    .footer-custom .foot a {
        display: inline-block;
        padding: 4px 8px;
    }
    .back-to-top {
        right: 14px;
        bottom: 18px;
        width: 42px;
        height: 42px;
    }
}