body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 20% 15%, #ffe8de 0%, #fff6f0 45%, #f8f5f3 100%);
    color: #3c2f2b;
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a {
    color: #c55b38;
    text-decoration: none;
}

a:hover {
    color: #a9482a;
    text-decoration: underline;
}

input,
select {
    box-sizing: border-box;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid #ead8ce;
    background: #fffdfa;
    color: #3c2f2b;
    font-size: 15px;
}

input:focus,
select:focus {
    outline: none;
    border-color: #d78f6d;
    box-shadow: 0 0 0 4px rgba(215, 143, 109, 0.16);
    background: #ffffff;
}

button {
    padding: 12px 20px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #e89169, #d86b45);
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

button:hover {
    filter: brightness(0.98);
    box-shadow: 0 8px 20px rgba(216, 107, 69, 0.25);
}

button:active {
    transform: translateY(1px);
}

.page-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px 28px;
}

.card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #f3ddd2;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(126, 80, 64, 0.12);
}

.subtitle {
    color: #7b5e54;
    line-height: 1.5;
}

.top-bar {
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #f3ddd2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

/* 统一导航栏 */
.unified-nav {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #f3ddd2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(6px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
}

.nav-brand a {
    color: #402f29;
}

.nav-brand a:hover {
    color: #c55b38;
    text-decoration: none;
}

.nav-sep {
    color: #c9b0a4;
    font-weight: 300;
}

.nav-user-link {
    font-weight: 700;
    color: #c55b38 !important;
}

.top-bar h2 {
    margin: 0;
    color: #402f29;
}

.top-links {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-links a {
    font-weight: 600;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stack-form label {
    font-size: 14px;
    color: #6f544a;
    margin-bottom: 6px;
    text-align: left;
    font-weight: 600;
}

.stack-form input {
    width: 100%;
    margin-bottom: 0;
}

.stack-form button {
    width: 100%;
    margin-top: 8px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 12px;
}

.card-links {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* 登录页 */
.landing-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    padding: 32px 28px;
}

.auth-card h1 {
    margin: 8px 0 10px;
    font-size: 32px;
    line-height: 1.15;
    color: #402f29;
}

.login-page .auth-form {
    margin-top: 14px;
}

.login-page .auth-form .form-field input {
    height: 44px;
}

.eyebrow {
    margin: 0;
    color: #b26b4a;
    font-size: 14px;
    font-weight: 600;
}

.hint {
    margin: 16px 0 0;
    font-size: 13px;
    color: #8a7168;
    text-align: center;
}

/* 创建页 */
.create-page .create-card {
    max-width: 560px;
    margin: 28px auto;
    padding: 28px 24px;
}

.create-page h1 {
    margin: 0 0 8px;
}

/* 话题页 */
.topic-list {
    max-width: 860px;
    margin: 16px auto;
    padding: 16px;
}

.topic-item {
    background: #fffdfa;
    border: 1px solid #f3ddd2;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.topic-item:last-child {
    margin-bottom: 0;
}

.topic-info h3 {
    margin: 0 0 6px 0;
    color: #a85f41;
}

.topic-info p {
    margin: 0;
    color: #8a7168;
    font-size: 13px;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.inline-form {
    margin: 0;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
}

.btn-edit {
    background: #f0b267;
    color: #3b2a24;
}

.btn-danger {
    background: #d86a5d;
}

.empty-text {
    text-align: center;
    color: #7b5e54;
}

/* 房间页弹幕：fixed 对齐视口最右侧，top 由脚本按轨道写入 */
#danmaku-container {
    position: relative;
    width: 100%;
    height: 66vh;
    background: #1f1a1a;
    overflow: hidden;
    border-bottom: 1px solid #5a4640;
}

.room-page .danmaku {
    position: fixed;
    left: auto;
    right: 0;
    z-index: 20;
    white-space: nowrap;
    color: #ffd36b;
    font-size: 22px;
    line-height: 1.35;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    margin: 0;
    /* 首字在视口最右侧：书写从右向左排布，句首贴齐 right:0 */
    direction: rtl;
    unicode-bidi: plaintext;
    /* 起点在 x 轴上再向右偏移整个视口宽度，多留一段飞行距离 */
    transform: translateY(-50%) translateX(100vw);
    will-change: transform;
    pointer-events: none;
}

@keyframes move {
    from {
        transform: translateY(-50%) translateX(100vw);
    }
    to {
        transform: translateY(-50%) translateX(calc(-100% - 200vw));
    }
}

.room-page .room-panel {
    margin-top: 16px;
    padding: 16px;
}

.input-area {
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-area input {
    flex: 1;
}

.action-buttons {
    margin-top: 12px;
    text-align: right;
}

.action-buttons a {
    display: inline-block;
    padding: 8px 14px;
    background: #b08876;
    color: #fff;
    border-radius: 8px;
}

.action-buttons a:hover {
    background: #9a7565;
    text-decoration: none;
}

@media (max-width: 768px) {
    .auth-card {
        padding: 26px 20px;
    }

    .auth-card h1 {
        font-size: 27px;
    }

    .subtitle {
        font-size: 14px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topic-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .input-area {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons {
        text-align: left;
    }
}

/* --- 论坛 --- */
.forum-page .forum-top a {
    color: inherit;
}

.forum-hero-title {
    margin: 0 0 8px;
    font-size: 28px;
    color: #402f29;
}

.card-pad {
    padding: 20px 22px;
}

.forum-section {
    margin-bottom: 20px;
}

.forum-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.forum-section-head h2 {
    margin: 0 0 6px;
}

.forum-board-desc {
    margin: 0 0 8px;
}

.forum-meta {
    margin: 0;
    font-size: 13px;
    color: #8a7168;
}

.forum-post-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.forum-post-card {
    border: 1px solid #f3ddd2;
    border-radius: 12px;
    overflow: hidden;
    background: #fffdfa;
}

.forum-post-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.forum-post-link:hover {
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(126, 80, 64, 0.12);
}

.forum-thumb-wrap {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #eee;
}

.forum-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.forum-post-card-body {
    padding: 12px 14px 14px;
}

.forum-post-card-body h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #a85f41;
}

.forum-snippet {
    margin: 0 0 8px;
    font-size: 13px;
    color: #5c4a44;
    line-height: 1.45;
}

.forum-empty {
    margin-top: 12px;
}

.forum-list-plain {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.forum-list-row {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    color: inherit;
    text-decoration: none;
}

.forum-list-row:hover h3 {
    text-decoration: underline;
}

.forum-list-thumb {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.forum-figure {
    margin: 16px 0;
    text-align: center;
}

.forum-figure img {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid #f3ddd2;
}

.forum-body-text p {
    margin: 0 0 10px;
    line-height: 1.65;
    white-space: pre-wrap;
}

.forum-rating-line {
    color: #7b5e54;
    margin: 8px 0 0;
}

.forum-side-block {
    margin-top: 16px;
}

.forum-side-block h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.forum-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-weight: 600;
    color: #6f544a;
}

.forum-comment-list {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    border-top: 1px solid #f3ddd2;
}

.forum-comment {
    padding: 14px 0;
    border-bottom: 1px solid #f3eee8;
}

.forum-comment-head {
    margin: 0 0 6px;
    font-size: 13px;
    color: #8a7168;
}

.forum-comment-body p {
    margin: 0 0 6px;
    line-height: 1.5;
}

.forum-error {
    color: #b23c2f;
    font-weight: 600;
}

code {
    font-size: 0.9em;
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 班级 Tab 切换栏 */
.class-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 20px;
}

.class-tab {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid #e0ccbf;
    background: rgba(255,255,255,0.8);
    color: #7b5e54;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.class-tab:hover {
    background: #fde8dc;
    color: #a85f41;
    text-decoration: none;
    border-color: #d78f6d;
}

.class-tab--active {
    background: linear-gradient(135deg, #e89169, #d86b45);
    color: #fff !important;
    border-color: transparent;
}

.class-tab--new {
    border-style: dashed;
    color: #b08876;
}

/* 班级标题区 */
.forum-class-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.forum-class-header .forum-hero-title {
    margin: 0 0 4px;
}

/* 管理页 */
.manage-block {
    margin-bottom: 16px;
}

.manage-block h2 {
    margin: 0 0 14px;
    font-size: 20px;
}

.manage-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.manage-section-head h2 {
    margin: 0;
}

.manage-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.manage-row input {
    flex: 1;
}

.manage-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.manage-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3eee8;
}

.manage-list-item:last-child {
    border-bottom: none;
}

.manage-danger-zone {
    border-color: #f3c4bc;
    background: #fff8f7;
}

.manage-danger-zone h2 {
    color: #b23c2f;
}

/* 无图占位 */
.forum-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0e8e2;
    color: #b08876;
    font-size: 13px;
}