* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #f5f7fb;
    color: #222;
    line-height: 1.7;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========== Header ========== */

.site-header {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: #fff;
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-decoration: none;
}

.main-nav {
    display: flex;
    gap: 16px;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.main-nav a:hover {
    background: rgba(255, 255, 255, 0.18);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

/* ========== Flash ========== */

.flash-area {
    background: #fff8e1;
    border-bottom: 1px solid #ffe082;
}

.flash-message {
    padding: 12px 16px;
    color: #6d4c00;
}

/* ========== Main ========== */

.main {
    padding: 24px 16px 40px;
}

/* ========== Hero ========== */

.hero {
    background: linear-gradient(135deg, #e0f7fa, #c5e1a5);
    padding: 40px 24px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

.hero p {
    color: #455a64;
}

/* ========== Section ========== */

.section {
    margin-bottom: 32px;
}

.section h2 {
    margin-bottom: 16px;
    font-size: 22px;
    border-left: 6px solid #2a5298;
    padding-left: 10px;
}

.section-desc {
    color: #546e7a;
    margin-bottom: 16px;
}

/* ========== Grid ========== */

.grid {
    display: grid;
    gap: 16px;
}

.grade-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.poem-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ========== Card ========== */

.card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.1);
}

.card h3 {
    color: #1e3c72;
    margin-bottom: 8px;
}

.card p {
    color: #455a64;
    font-size: 14px;
}

.card-footer {
    margin-top: auto;
    padding-top: 12px;
    color: #2a5298;
    font-weight: bold;
}

.poem-meta {
    font-size: 13px;
    color: #78909c;
    margin-bottom: 8px;
}

.poem-excerpt {
    color: #37474f;
}

/* ========== Tag ========== */

.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-group.inline {
    margin-top: 10px;
}

.tag {
    background: #e3f2fd;
    color: #1565c0;
    padding: 4px 12px;
    border-radius: 999px;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid #bbdefb;
}

.tag:hover {
    background: #bbdefb;
}

.tag.active {
    background: #1565c0;
    color: #fff;
}

.tag.small {
    font-size: 12px;
    padding: 2px 10px;
}

/* ========== Toolbar ========== */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 8px;
}

.search-form input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    font-size: 15px;
}

.search-form button,
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #eceff1;
    color: #37474f;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
}

.btn:hover {
    background: #cfd8dc;
}

.btn.primary {
    background: #1e3c72;
    color: #fff;
}

.btn.primary:hover {
    background: #2a5298;
}

.btn.small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn.danger {
    background: #ef5350;
    color: #fff;
}

.btn.danger:hover {
    background: #e53935;
}

/* ========== Breadcrumb ========== */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    color: #78909c;
    margin-bottom: 16px;
}

.breadcrumb a {
    color: #1565c0;
    text-decoration: none;
}

/* ========== Poem Detail ========== */
.poem-detail {
    max-width: 820px;
    margin: 0 auto;
}

.poem-header {
    text-align: center;
    margin-bottom: 24px;
}

.poem-header h1 {
    font-size: 32px;
    color: #1e3c72;
}

.poem-subtitle {
    color: #546e7a;
    margin-top: 6px;
}

.author-intro {
    background: #fff8e1;
    border-left: 4px solid #ffa726;
    padding: 10px 14px;
    margin-top: 14px;
    border-radius: 8px;
    font-size: 14px;
    text-align: left;
}

.poem-content-card {
    background: #fff;
    padding: 24px;
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.poem-content-card h2 {
    font-size: 20px;
    margin-bottom: 14px;
    color: #1e3c72;
    border-left: 5px solid #2a5298;
    padding-left: 10px;
}

.poem-line {
    font-size: 22px;
    text-align: center;
    margin: 10px 0;
    color: #263238;
    letter-spacing: 2px;
}

.poem-pinyin {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #b0bec5;
    color: #78909c;
}

.poem-pinyin p {
    text-align: center;
    margin: 8px 0;
}

/* ========== Form ========== */
.admin-form {
    background: #fff;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.admin-form.inline-form {
    margin-bottom: 32px;
}

.form-row {
    margin-bottom: 14px;
}

.form-row label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #37474f;
}

.form-row.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

input,
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd8dc;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

.action-row {
    display: flex;
    gap: 10px;
}

/* ========== Table ========== */

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.admin-table th,
.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #eceff1;
    text-align: left;
    font-size: 14px;
}

.admin-table th {
    background: #1e3c72;
    color: #fff;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table a {
    color: #1565c0;
    text-decoration: none;
}

.action-col {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-col form {
    display: inline;
}

/* ========== Login ========== */

.login-box {
    max-width: 400px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #1e3c72;
}

.login-tip {
    margin-top: 14px;
    font-size: 13px;
    color: #78909c;
    text-align: center;
}

/* ========== Footer ========== */

.site-footer {
    background: #1e3c72;
    color: #fff;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 24px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #1e3c72;
}

.stat-label {
    font-size: 14px;
    color: #455a64;
    margin-top: 4px;
}

.hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.required-badge {
    background: #ff5722;
    color: #fff;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    margin-left: 8px;
    vertical-align: middle;
}

.favorite-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    color: #ffb300;
    font-size: 20px;
}

.card {
    position: relative;
}

.poem-card {
    display: flex;
    flex-direction: column;
}

.poem-card-link {
    text-decoration: none;
    color: inherit;
    flex: 1;
}

.card-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.card-actions form {
    display: inline;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.page-info {
    color: #455a64;
}

.poem-header-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.poem-header-actions form {
    display: inline;
}

.search-form.large {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-form.large input {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
}

.search-form.large button {
    padding: 12px 20px;
}

.search-result-tip {
    color: #455a64;
    margin-bottom: 16px;
}

.random-header {
    text-align: center;
    margin-bottom: 24px;
}

.random-header h1 {
    color: #1e3c72;
}

.progress-bar-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 200;
}

.progress-bar-inner {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #66bb6a, #43a047);
    transition: width 0.3s;
}

/* ========== 登录注册卡片 ========== */

.login-box {
    max-width: 420px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #1e3c72;
}

.login-tip {
    margin-top: 14px;
    font-size: 13px;
    color: #78909c;
    text-align: center;
}

/* ========== 个人中心 ========== */

.profile-card {
    background: #fff;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.profile-info h2 {
    color: #1e3c72;
    margin-bottom: 8px;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

/* ========== 日历 ========== */

.calendar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.calendar-day {
    background: #eceff1;
    color: #455a64;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.calendar-day.active {
    background: #43a047;
    color: #fff;
}

/* ========== 练习卡片 ========== */

.practice-list {
    display: grid;
    gap: 16px;
}

.practice-card {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.practice-line {
    font-size: 18px;
    margin: 8px 0;
}

.poem-practice-pinyin {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #b0bec5;
    color: #78909c;
}

/* ========== Tip ========== */

.tip {
    background: #fff8e1;
    border-left: 4px solid #ffa726;
    padding: 10px 14px;
    border-radius: 8px;
    color: #6d4c00;
    margin-bottom: 16px;
}

/* ========== API 调试提示 ========== */

.api-info {
    background: #e8f5e9;
    border-left: 4px solid #43a047;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/*===== 新增导航局部样式（追加到文件末尾，原有样式不动）=====*/
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-nav {
    display: flex;
    align-items: center;
    gap:24px;
    flex: 1;
    margin-left: 30px;
}
.nav-left {
    display:flex;
    align-items:center;
    gap:16px;
}
.nav-right {
    display:flex;
    align-items:center;
    gap:14px;
    margin-left: auto; /* 将右侧区域推到最右边 */
}

.welcome-text {
    color:#ffffff;
    white-space: nowrap;
}

/*导航搜索框*/
.nav-search {
    display:flex;
    align-items:center;
}
.nav-search input {
    border:none;
    outline:none;
    padding:5px 12px;
    border-radius:20px 0 0 20px;
    font-size:14px;
    width:140px;
}
.nav-search button {
    border:none;
    background:#e8edf7;
    color:#1e3c72;
    border-radius:0 20px 20px 0;
    padding:5px 10px;
    cursor:pointer;
}

/*后台管理下拉菜单 PC悬浮展开*/
.dropdown {
    position: relative;
}
.dropdown-toggle {
    display: inline-block;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background:#1e3c72;
    min-width:160px;
    box-shadow:0 4px 14px rgba(0,0,0,0.2);
    border-radius:8px;
    z-index:999;
    padding:8px 0;
}
.dropdown-menu a {
    display:block;
    color:#fff;
    padding:10px 16px;
    text-decoration:none;
}
.dropdown-menu a:hover {
    background:rgba(255,255,255,0.18);
}
.dropdown:hover .dropdown-menu {
    display:block;
}

/* ===== AI 助手 ===== */
.ai-page {
    max-width: 860px;
    margin: 0 auto;
}

.ai-header {
    text-align: center;
    margin-bottom: 20px;
}

.ai-chat {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    min-height: 320px;
    max-height: 560px;
    overflow-y: auto;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    margin-bottom: 14px;
}

.ai-msg {
    display: flex;
    margin-bottom: 16px;
}

.ai-msg-user {
    justify-content: flex-end;
}

.ai-bubble {
    max-width: 78%;
    padding: 12px 16px;
    border-radius: 12px;
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 15px;
}

.ai-msg-bot .ai-bubble {
    background: #f1f5fb;
    color: #263238;
    border-top-left-radius: 4px;
}

.ai-msg-user .ai-bubble {
    background: #1e3c72;
    color: #fff;
    border-top-right-radius: 4px;
}

.ai-poem-card {
    background: #fffdf5;
    border: 1px solid #ffe082;
    border-radius: 10px;
    padding: 14px;
    margin-top: 10px;
}

.ai-poem-card h4 {
    color: #1e3c72;
    margin-bottom: 6px;
}

.ai-poem-card .meta {
    font-size: 13px;
    color: #78909c;
    margin-bottom: 8px;
}

.ai-poem-card .body {
    font-size: 15px;
    color: #37474f;
    white-space: pre-wrap;
}

.ai-poem-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ai-input-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.ai-input-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #cfd8dc;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
}

.ai-input-bar input:focus {
    border-color: #2a5298;
}

.ai-tip {
    color: #78909c;
    font-size: 13px;
    text-align: center;
}

.ai-loading {
    color: #78909c;
    font-size: 14px;
    padding: 8px 0;
}

/* 返回首页按钮样式，和你现有btn统一风格 */
.btn.primary {
    background-color: #2a5298;
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}
.btn.primary:hover {
    background-color: #1e3c72;
}

/* 标签折叠容器 */
.tag-collapse-wrap {
    margin-top:10px;
}
.tag-group.collapse-box {
    margin-top:10px;
    display: none; /* 默认收起 */
    flex-wrap: wrap;
    gap: 8px;
}
.tag-group.collapse-box.open {
    display: flex;
}
.tag {
    padding: 5px 10px;
    border:1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color:#333;
}
.tag.active {
    background:#2a5298;
    color:#fff;
    border-color:#2a5298;
}
.btn.default {
    padding:6px 12px;
    border-radius:6px;
    border:1px solid #bbb;
    background:#fff;
    cursor:pointer;
}

@media (max-width: 640px) {
    .ai-bubble { max-width: 88%; }
    .ai-chat { padding: 14px; }
}

/* ========== Responsive ========== */

@media (max-width: 900px) {

    .form-row.two-col {
        grid-template-columns: 2fr;
    }

    .poem-header h1 {
        font-size: 26px;
    }

    .poem-line {
        font-size: 19px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: auto;
        flex: none;
        flex-direction: column;
        align-items: stretch;
        background: #2a5298;
        padding: 12px 16px 16px;
        border-radius:0 0 12px 12px;
        margin: 0; /* 清除桌面端的 margin-left */
        box-shadow: 0 12px 24px rgba(0,0,0,0.25);
        z-index: 150;
    }

    .main-nav.open {
        display: flex;
    }

    /* header 内部保持一行，不换行 */
    .header-inner {
        flex-wrap: nowrap;
    }

    .hero h1 {
        font-size: 24px;
    }

    .card {
        padding: 16px;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px;
        font-size: 13px;
    }

    /* 下拉层内部纵向排布 */
    .nav-left,.nav-right {
        flex-direction:column;
        align-items:stretch;
        width:100%;
        margin-left:0;
        gap:8px;
    }
    .nav-search {
        width:100%;
    }

    .nav-search input {
        flex:1;
        width:auto;
    }

    /* 触屏设备没有 hover，改为点击展开 */
    .dropdown-menu {
        position:static;
        display: none;
        box-shadow:none;
        background:rgba(255, 255, 255, 0.08);
        border-radius: 8px;
    }
    .dropdown:hover .dropdown-menu {
        display:none;
    }
    .dropdown.open .dropdown-menu {
        display:block;
    }

    .dropdown.open:hover .dropdown-menu {
        display:block;
    }
}







