/* =====================================================================
   课程表系统 — Apple Liquid Glass 设计系统 v3
   精致玻璃质感 · 流畅动画 · 全设备响应式适配
   ===================================================================== */

/* ---------- 设计变量 ---------- */
:root {
    /* 品牌渐变色 */
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #43e97b 100%);
    --bg-gradient-2: linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #a18cd1 100%);

    /* 玻璃材质 — 更精致 */
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-bg-strong: rgba(255, 255, 255, 0.72);
    --glass-bg-soft: rgba(255, 255, 255, 0.35);
    --glass-bg-faint: rgba(255, 255, 255, 0.18);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-border-inner: rgba(255, 255, 255, 0.85);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.12), 0 2px 8px rgba(31,38,135,0.06);
    --glass-shadow-strong: 0 24px 60px rgba(31, 38, 135, 0.22), 0 8px 24px rgba(31,38,135,0.10);
    --glass-shadow-hover: 0 32px 80px rgba(31, 38, 135, 0.28), 0 12px 32px rgba(31,38,135,0.14);
    --glass-blur: 30px;

    /* 文字色 */
    --text-primary: #1a1a2e;
    --text-secondary: rgba(26, 26, 46, 0.62);
    --text-tertiary: rgba(26, 26, 46, 0.4);

    /* 功能色 */
    --accent: #007aff;
    --accent-grad: linear-gradient(135deg, #007aff, #5856d6);
    --accent-soft: rgba(0, 122, 255, 0.12);
    --success: #34c759;
    --success-grad: linear-gradient(135deg, #34c759, #30d158);
    --danger: #ff3b30;
    --danger-grad: linear-gradient(135deg, #ff3b30, #ff6b6b);
    --warning: #ff9500;
    --warning-grad: linear-gradient(135deg, #ff9500, #ffcc00);

    /* 圆角 */
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 18px;
    --r-lg: 24px;
    --r-xl: 32px;
    --r-2xl: 40px;

    /* 课程卡片色板（按星期） */
    --c1: linear-gradient(135deg, #ff9a9e, #fad0c4);
    --c2: linear-gradient(135deg, #a18cd1, #fbc2eb);
    --c3: linear-gradient(135deg, #84fab0, #8fd3f4);
    --c4: linear-gradient(135deg, #ffecd2, #fcb69f);
    --c5: linear-gradient(135deg, #c2e9fb, #a1c4fd);
    --c6: linear-gradient(135deg, #fbc2eb, #a6c1ee);
    --c7: linear-gradient(135deg, #fdcbf1, #e6dee9);

    /* 动画曲线 */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* 安全区 */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* ---------- Reset & 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC',
                 'Helvetica Neue', 'Segoe UI', 'Microsoft YaHei', sans-serif;
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-gradient);
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: bgShift 25s ease infinite;
    text-rendering: optimizeLegibility;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

@keyframes bgShift {
    0%, 100% { background-position: 0% 50%; }
    25%      { background-position: 50% 100%; }
    50%      { background-position: 100% 50%; }
    75%      { background-position: 50% 0%; }
}

/* 浮动光斑装饰 — 增强景深 */
body::before, body::after {
    content: '';
    position: fixed;
    width: 480px; height: 480px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    z-index: 0;
    pointer-events: none;
    animation: orbFloat 18s ease-in-out infinite;
}
body::before {
    background: radial-gradient(circle, rgba(255,255,255,0.8), transparent 70%);
    top: -180px; left: -180px;
}
body::after {
    background: radial-gradient(circle, rgba(160, 200, 255, 0.6), transparent 70%);
    bottom: -180px; right: -180px;
    animation-delay: -9s;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(80px, 60px) scale(1.1); }
    66%      { transform: translate(-50px, 30px) scale(0.95); }
}

/* 所有内容置于装饰之上 */
#app, .admin-layout, .share-container { position: relative; z-index: 1; }

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.4);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.65); background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.4) transparent; }

/* 选中文本 */
::selection { background: rgba(0,122,255,0.25); color: var(--text-primary); }

/* ---------- 玻璃材质通用类 ---------- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-border-inner);
}

.glass-strong {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(40px) saturate(200%);
    -webkit-backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow-strong), inset 0 1px 0 var(--glass-border-inner);
}

.glass-soft {
    background: var(--glass-bg-soft);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.4);
}

/* ---------- 入场动画 ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; } to { opacity: 1; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.fade-in-up { animation: fadeInUp 0.6s var(--ease-out) both; }
.fade-in { animation: fadeIn 0.5s ease both; }
.scale-in { animation: scaleIn 0.4s var(--ease-spring) both; }

/* 列表项依次入场 */
.stagger > * { animation: fadeInUp 0.5s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.10s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.20s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.30s; }
.stagger > *:nth-child(7) { animation-delay: 0.35s; }
.stagger > *:nth-child(8) { animation-delay: 0.40s; }
.stagger > *:nth-child(9) { animation-delay: 0.45s; }
.stagger > *:nth-child(10) { animation-delay: 0.50s; }
.stagger > *:nth-child(n+11) { animation-delay: 0.55s; }

/* =====================================================================
   管理后台
   ===================================================================== */
.admin-body { min-height: 100vh; min-height: 100dvh; }

/* ---------- 登录页 ---------- */
.login-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
}
.login-card {
    width: 100%; max-width: 400px;
    padding: 44px 36px;
    border-radius: var(--r-2xl);
    animation: scaleIn 0.6s var(--ease-spring) both;
}
.login-logo {
    width: 72px; height: 72px;
    margin: 0 auto 20px;
    border-radius: 22px;
    background: var(--accent-grad);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px;
    box-shadow: 0 12px 32px rgba(0,122,255,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
    animation: logoPulse 3s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}
.login-title {
    text-align: center;
    font-size: 26px; font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
}
.login-sub {
    text-align: center;
    font-size: 14px; color: var(--text-secondary);
    margin-bottom: 30px;
}

/* ---------- 表单元素 ---------- */
.field { margin-bottom: 18px; }
.field-label {
    display: block;
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px; padding-left: 4px;
}
.input, .select, .textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 15px;
    color: var(--text-primary);
    transition: all .25s var(--ease-out);
    outline: none;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.85);
    box-shadow: 0 0 0 4px rgba(0,122,255,0.12);
    transform: translateY(-1px);
}
.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }
.textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.select {
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%231a1a2e' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

/* 按钮系 — 加涟漪效果 */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 7px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--r-sm);
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s ease;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    overflow: hidden;
    font-family: inherit;
    -webkit-appearance: none; appearance: none;
    touch-action: manipulation;
}
.btn::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at var(--rx, 50%) var(--ry, 50%), rgba(255,255,255,0.4), transparent 50%);
    opacity: 0;
    transition: opacity .6s ease;
    pointer-events: none;
}
.btn:active::after { opacity: 1; transition: opacity 0s; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: 0 6px 20px rgba(0,122,255,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0,122,255,0.38), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-primary:active { transform: translateY(0) scale(0.97); }

.btn-success {
    background: var(--success-grad);
    color: #fff;
    box-shadow: 0 6px 20px rgba(52,199,89,0.25), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(52,199,89,0.35), inset 0 1px 0 rgba(255,255,255,0.25); }

.btn-danger { background: var(--danger-grad); color: #fff; box-shadow: 0 6px 20px rgba(255,59,48,0.22); }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(255,59,48,0.32); }

.btn-ghost {
    background: rgba(255,255,255,0.4);
    border: 1.5px solid rgba(255,255,255,0.5);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.65); transform: translateY(-1px); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ---------- 管理后台布局 ---------- */
.admin-layout { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.admin-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px;
    padding-top: calc(14px + var(--safe-top));
    position: sticky; top: 0; z-index: 100;
    border-radius: 0;
    border-bottom: 1px solid var(--glass-border);
    animation: fadeInDown 0.5s var(--ease-out) both;
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.admin-brand {
    display: flex; align-items: center; gap: 12px;
    font-size: 18px; font-weight: 700;
    letter-spacing: -0.3px;
}
.admin-brand-icon {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: var(--accent-grad);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 14px rgba(0,122,255,0.25), inset 0 1px 0 rgba(255,255,255,0.3);
}
.admin-user {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; color: var(--text-secondary);
    flex-wrap: wrap; justify-content: flex-end;
}
.admin-user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--text-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 600;
}
.btn-logout {
    background: rgba(255,255,255,0.4);
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all .2s var(--ease-out);
    font-family: inherit;
}
.btn-logout:hover {
    background: var(--danger-grad);
    color: #fff;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,59,48,0.25);
}

.admin-body-content {
    flex: 1;
    padding: 28px;
    padding-bottom: calc(28px + var(--safe-bottom));
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    animation: fadeInUp 0.5s var(--ease-out) both;
    animation-delay: 0.1s;
}

/* ---------- Tab 导航 ---------- */
.tabs {
    display: flex; gap: 6px;
    padding: 5px;
    border-radius: var(--r-sm);
    margin-bottom: 24px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    flex: 1; min-width: max-content;
    text-align: center;
    padding: 10px 20px;
    font-size: 14px; font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    transition: all .25s var(--ease-out);
    border: none;
    background: transparent;
    font-family: inherit;
    white-space: nowrap;
}
.tab.active {
    background: rgba(255,255,255,0.85);
    color: var(--text-primary);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

/* ---------- 卡片网格 ---------- */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}
.schedule-card {
    padding: 24px;
    border-radius: var(--r-lg);
    transition: all .35s var(--ease-out);
    animation: fadeInUp 0.5s var(--ease-out) both;
}
.schedule-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-shadow-hover);
}
.schedule-card-title {
    font-size: 18px; font-weight: 700;
    margin-bottom: 4px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    letter-spacing: -0.3px;
}
.schedule-card-meta {
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 16px; line-height: 1.7;
}
.schedule-card-stats { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.5);
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}
.schedule-card-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    animation: scaleIn 0.5s var(--ease-spring) both;
}
.empty-icon { font-size: 64px; margin-bottom: 16px; opacity: .5; animation: floatBob 3s ease-in-out infinite; }
@keyframes floatBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}
.empty-text { font-size: 16px; }

/* ---------- 模态框 ---------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.28);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 20px;
    padding-top: calc(40px + var(--safe-top));
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.25s ease both;
}
.modal {
    width: 100%;
    max-width: 560px;
    border-radius: var(--r-xl);
    padding: 32px;
    animation: modalIn 0.4s var(--ease-spring) both;
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px - var(--safe-top));
    overflow-y: auto;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.94) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
}
.modal-title {
    font-size: 22px; font-weight: 700;
    letter-spacing: -0.4px;
    flex: 1;
}
.modal-close {
    width: 32px; height: 32px;
    border: none; border-radius: 10px;
    background: rgba(0,0,0,0.06);
    cursor: pointer; font-size: 22px;
    color: var(--text-secondary);
    display: flex; align-items: center; justify-content: center;
    transition: all .2s var(--ease-out);
    flex-shrink: 0;
    line-height: 1;
}
.modal-close:hover { background: rgba(0,0,0,0.12); transform: rotate(90deg); }

/* ---------- 导入区 ---------- */
.import-tabs { display: flex; gap: 8px; margin-bottom: 22px; }
.import-tab {
    flex: 1; padding: 14px;
    border-radius: var(--r-sm);
    border: 1.5px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.35);
    cursor: pointer; text-align: center;
    font-size: 14px; font-weight: 600;
    color: var(--text-secondary);
    transition: all .25s var(--ease-out);
    font-family: inherit;
}
.import-tab.active {
    background: var(--accent-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 18px rgba(0,122,255,0.25);
    transform: translateY(-1px);
}
.dropzone {
    border: 2px dashed rgba(255,255,255,0.6);
    border-radius: var(--r-lg);
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    transition: all .3s var(--ease-out);
    background: rgba(255,255,255,0.2);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: rgba(0,122,255,0.1);
    transform: scale(1.01);
}
.dropzone-icon { font-size: 48px; margin-bottom: 12px; animation: floatBob 3s ease-in-out infinite; }
.dropzone-text { font-size: 15px; color: var(--text-secondary); font-weight: 500; }
.dropzone-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 6px; }

.ocr-progress { margin-top: 18px; }
.ocr-bar {
    height: 8px;
    border-radius: 4px;
    background: rgba(0,0,0,0.08);
    overflow: hidden;
}
.ocr-bar-fill {
    height: 100%;
    background: var(--accent-grad);
    transition: width .4s var(--ease-out);
    border-radius: 4px;
    background-size: 200% 100%;
    animation: barShimmer 1.5s linear infinite;
}
@keyframes barShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.ocr-status { font-size: 13px; color: var(--text-secondary); margin-top: 10px; text-align: center; }

/* ---------- 表格通用 ---------- */
.course-preview {
    margin-top: 22px;
    border-radius: var(--r-md);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}
.preview-table, .admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.preview-table th, .admin-table th {
    background: rgba(0,122,255,0.08);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    position: sticky; top: 0;
    backdrop-filter: blur(8px);
}
.preview-table td, .admin-table td {
    padding: 10px 12px;
    border-top: 1px solid rgba(0,0,0,0.05);
    vertical-align: top;
}
.preview-table tr, .admin-table tr {
    transition: background .2s ease;
}
.preview-table tr:hover td, .admin-table tr:hover td { background: rgba(0,122,255,0.04); }

.admin-table th { background: rgba(255,255,255,0.4); border-bottom: 1px solid var(--glass-border); }
.admin-table td { border-bottom: 1px solid rgba(0,0,0,0.05); }

/* 角色徽章 */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.role-super { background: rgba(0,122,255,0.14); color: var(--accent); }
.role-sub { background: rgba(52,199,89,0.14); color: var(--success); }

/* =====================================================================
   分享页
   ===================================================================== */
.share-body { min-height: 100vh; min-height: 100dvh; padding: 0; }
.share-container { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* 密码验证页 */
.share-password-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    padding-top: calc(20px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
}
.share-password-card {
    width: 100%; max-width: 380px;
    padding: 40px 32px;
    border-radius: var(--r-xl);
    text-align: center;
    animation: scaleIn 0.5s var(--ease-spring) both;
}
.lock-icon {
    width: 64px; height: 64px;
    margin: 0 auto 18px;
    border-radius: 18px;
    background: var(--warning-grad);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px;
    box-shadow: 0 8px 24px rgba(255,149,0,0.3);
    animation: lockShake 4s ease-in-out infinite;
}
@keyframes lockShake {
    0%, 90%, 100% { transform: rotate(0); }
    92%, 96%      { transform: rotate(-8deg); }
    94%           { transform: rotate(8deg); }
}

/* 分享页头部 */
.share-header {
    padding: 24px 28px;
    padding-top: calc(24px + var(--safe-top));
    border-radius: 0;
    border-bottom: 1px solid var(--glass-border);
    animation: fadeInDown 0.5s var(--ease-out) both;
}
.share-header-top {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.share-title {
    font-size: clamp(20px, 4vw, 26px); font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}
.share-sub {
    font-size: 14px; color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
}
.share-view-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.5);
    color: var(--text-secondary);
    backdrop-filter: blur(8px);
}

/* 视图切换 */
.view-switcher {
    display: inline-flex; gap: 4px;
    padding: 4px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.view-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 9px;
    font-size: 13px; font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all .25s var(--ease-out);
    background: transparent;
    font-family: inherit;
    white-space: nowrap;
    -webkit-appearance: none; appearance: none;
}
.view-btn.active {
    background: #fff;
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.view-btn:not(.active):hover { background: rgba(255,255,255,0.4); }

/* 周次切换器 */
.week-nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    border-radius: var(--r-md);
    margin: 20px;
    animation: fadeIn 0.4s ease both;
}
.week-nav-btn {
    width: 44px; height: 44px;
    border: none; border-radius: 12px;
    background: rgba(255,255,255,0.5);
    cursor: pointer; font-size: 22px;
    color: var(--text-primary);
    transition: all .2s var(--ease-out);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.week-nav-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.85);
    transform: scale(1.05);
}
.week-nav-btn:active:not(:disabled) { transform: scale(0.95); }
.week-nav-btn:disabled { opacity: .3; cursor: not-allowed; }

.week-info { flex: 1; text-align: center; min-width: 0; }
.week-label {
    font-size: 18px; font-weight: 700;
    letter-spacing: -0.3px;
}
.week-dates {
    font-size: 13px; color: var(--text-secondary);
    margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.week-current-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 16px;
    font-size: 11px; font-weight: 700;
    background: var(--accent); color: #fff;
    vertical-align: middle;
}

/* ---------- 课表网格 ---------- */
.schedule-wrap { padding: 0 20px 30px; padding-bottom: calc(30px + var(--safe-bottom)); }
.schedule-grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 5px;
    table-layout: fixed;
    animation: fadeIn 0.4s ease both;
}
.schedule-grid-table th {
    padding: 12px 6px;
    font-size: 13px; font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.4);
    white-space: nowrap;
    transition: all .3s var(--ease-out);
}
.schedule-grid-table th.today {
    background: var(--accent-grad);
    color: #fff;
    box-shadow: 0 4px 14px rgba(0,122,255,0.3);
    transform: scale(1.02);
}
.schedule-grid-table td { vertical-align: top; padding: 0; }
.period-cell {
    padding: 8px 4px;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.3);
    font-weight: 600;
}
.period-cell .period-num { font-size: 14px; color: var(--text-primary); display: block; font-weight: 700; }
.period-cell .period-time { font-size: 10px; opacity: .7; }

.course-cell {
    min-height: 64px;
    padding: 4px;
    border-radius: var(--r-sm);
    font-size: 12px;
    line-height: 1.45;
    transition: all .25s var(--ease-out);
    overflow: hidden;
}
.course-cell:hover { transform: scale(1.04); z-index: 10; box-shadow: 0 12px 32px rgba(0,0,0,0.14); }
.course-cell-empty { background: transparent; cursor: default; min-height: 60px; }
.course-cell-empty:hover { transform: none; box-shadow: none; }

.course-card-mini {
    padding: 7px 8px;
    border-radius: 9px;
    margin-bottom: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: all .2s var(--ease-out);
    cursor: pointer;
}
.course-card-mini:hover { transform: translateX(2px); }
.course-card-mini:last-child { margin-bottom: 0; }
.course-name {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    letter-spacing: -0.2px;
}
.course-info-line {
    font-size: 10px; opacity: .82;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 1px;
}

/* 体育课标签 */
.pe-tag {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 9px;
    background: rgba(0,0,0,0.22);
    color: #fff;
    margin-left: 4px;
    vertical-align: middle;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* 课程颜色（按星期） */
.day-color-1 .course-card-mini { background: var(--c1); }
.day-color-2 .course-card-mini { background: var(--c2); }
.day-color-3 .course-card-mini { background: var(--c3); }
.day-color-4 .course-card-mini { background: var(--c4); }
.day-color-5 .course-card-mini { background: var(--c5); }
.day-color-6 .course-card-mini { background: var(--c6); }
.day-color-7 .course-card-mini { background: var(--c7); }

/* ---------- 今日课程视图 ---------- */
.today-banner {
    padding: 24px 28px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    border-radius: var(--r-md);
    margin-bottom: 16px;
    animation: fadeInUp 0.4s var(--ease-out) both;
}
.today-date {
    font-size: clamp(18px, 4vw, 22px); font-weight: 800;
    letter-spacing: -0.4px;
}
.today-now {
    font-size: 14px; color: var(--text-secondary);
    font-family: 'SF Mono', 'Menlo', monospace;
    font-variant-numeric: tabular-nums;
}

.today-list {
    display: flex; flex-direction: column; gap: 12px;
}
.today-card {
    display: flex; align-items: stretch;
    padding: 18px 20px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all .25s var(--ease-out);
    border-left: 4px solid rgba(0,0,0,0.15);
    animation: slideInLeft 0.4s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 0.06s);
}
.today-card:hover { transform: translateX(3px); box-shadow: var(--glass-shadow-strong); }
.today-card.ongoing {
    border-left-color: var(--success);
    box-shadow: 0 0 0 3px rgba(52,199,89,0.18), var(--glass-shadow);
}
.today-card-time {
    flex: 0 0 80px;
    display: flex; flex-direction: column; justify-content: center;
    font-size: 14px;
    color: var(--text-primary);
    border-right: 1px solid rgba(0,0,0,0.08);
    padding-right: 14px;
    font-variant-numeric: tabular-nums;
}
.today-card-body { flex: 1; padding: 0 14px; min-width: 0; }
.today-card-body .course-name { font-size: 15px; white-space: normal; }
.today-card-status { display: flex; align-items: center; flex-shrink: 0; }
.badge-live {
    background: var(--success); color: #fff;
    padding: 4px 12px; border-radius: 14px;
    font-size: 11px; font-weight: 700;
    box-shadow: 0 0 0 3px rgba(52,199,89,0.2);
    animation: livePulse 1.6s ease infinite;
}
@keyframes livePulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgba(52,199,89,0.2); }
    50%      { opacity: 0.92; box-shadow: 0 0 0 8px rgba(52,199,89,0.08); }
}
.badge-soon {
    background: var(--warning); color: #fff;
    padding: 4px 12px; border-radius: 14px; font-size: 11px; font-weight: 700;
    box-shadow: 0 4px 12px rgba(255,149,0,0.3);
    animation: soonPulse 1.8s ease infinite;
}
@keyframes soonPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.05); }
}
.badge-future {
    background: rgba(0,0,0,0.06); color: var(--text-secondary);
    padding: 4px 12px; border-radius: 14px; font-size: 11px; font-weight: 600;
}

/* ---------- 整学期总览 ---------- */
.overview-wrap { padding: 20px; padding-bottom: calc(30px + var(--safe-bottom)); }
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.overview-week-card {
    padding: 18px;
    border-radius: var(--r-md);
    animation: fadeInUp 0.4s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 0.02s);
    transition: all .3s var(--ease-out);
}
.overview-week-card:hover { transform: translateY(-2px); box-shadow: var(--glass-shadow-strong); }
.overview-week-header {
    font-size: 15px; font-weight: 700;
    margin-bottom: 12px;
    display: flex; align-items: center; justify-content: space-between;
    letter-spacing: -0.2px;
}
.overview-current-tag {
    font-size: 11px; font-weight: 700;
    padding: 2px 10px; border-radius: 12px;
    background: var(--accent); color: #fff;
    box-shadow: 0 2px 8px rgba(0,122,255,0.3);
}
.overview-course-list { font-size: 12px; line-height: 1.9; }
.overview-course-item {
    display: flex; gap: 8px; align-items: center;
    padding: 3px 0;
}
.overview-course-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.4);
}
.overview-empty { font-size: 12px; color: var(--text-tertiary); text-align: center; padding: 16px 0; }

/* ---------- 课程详情弹窗 ---------- */
.course-detail {
    width: 100%; max-width: 420px;
    border-radius: var(--r-xl);
    overflow: hidden;
    animation: modalIn 0.4s var(--ease-spring) both;
}
.course-detail-banner {
    padding: 28px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.course-detail-banner::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.3), transparent 60%);
    pointer-events: none;
}
.course-detail-banner.bg1 { background: var(--c1); }
.course-detail-banner.bg2 { background: var(--c2); }
.course-detail-banner.bg3 { background: var(--c3); }
.course-detail-banner.bg4 { background: var(--c4); }
.course-detail-banner.bg5 { background: var(--c5); }
.course-detail-banner.bg6 { background: var(--c6); }
.course-detail-banner.bg7 { background: var(--c7); }
.course-detail-name {
    font-size: 22px; font-weight: 800;
    text-shadow: 0 1px 4px rgba(0,0,0,.12);
    letter-spacing: -0.4px;
    position: relative; z-index: 1;
}
.course-detail-body { padding: 24px 28px; }
.course-detail-row {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.course-detail-row:last-child { border-bottom: none; }
.course-detail-icon {
    font-size: 18px; width: 24px; text-align: center; flex-shrink: 0;
}
.course-detail-label { font-size: 12px; color: var(--text-tertiary); margin-bottom: 2px; }
.course-detail-value { font-size: 14px; font-weight: 600; line-height: 1.5; }

/* ---------- 公告列表 ---------- */
.ann-list { padding: 20px; padding-bottom: calc(30px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; }
.ann-card {
    padding: 22px 26px;
    border-radius: var(--r-md);
    transition: all .3s var(--ease-out);
    animation: fadeInUp 0.4s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 0.06s);
}
.ann-card:hover { transform: translateX(2px); box-shadow: var(--glass-shadow-strong); }
.ann-card.pinned { border-left: 4px solid var(--accent); order: -1; }
.ann-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.ann-type { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }
.ann-pin { font-size: 12px; color: var(--accent); font-weight: 600; }
.ann-title { font-size: 17px; font-weight: 700; flex: 1; min-width: 100%; letter-spacing: -0.3px; }
.ann-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}
.ann-time { font-size: 12px; color: var(--text-tertiary); margin-top: 14px; }

/* ---------- emoji 选择器 ---------- */
.emoji-picker {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.emoji-option {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.4);
    transition: all .15s var(--ease-out);
    user-select: none;
}
.emoji-option:hover { background: rgba(255,255,255,0.75); transform: scale(1.12); }
.emoji-option.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: scale(1.06);
    box-shadow: 0 4px 12px rgba(0,122,255,0.18);
}

/* ---------- 体育课自选弹窗 ---------- */
.pe-select-list { display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow: auto; -webkit-overflow-scrolling: touch; }
.pe-option {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.4);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .2s var(--ease-out);
}
.pe-option:hover { background: rgba(255,255,255,0.7); transform: translateY(-1px); }
.pe-option.checked {
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 4px 14px rgba(0,122,255,0.15);
}
.pe-option input[type=checkbox] {
    width: 22px; height: 22px;
    cursor: pointer; flex-shrink: 0;
    accent-color: var(--accent);
}
.pe-option-body { flex: 1; min-width: 0; }
.pe-option-body .course-name { font-size: 14px; margin-bottom: 3px; white-space: normal; }

/* ---------- Toast ---------- */
.toast-wrap {
    position: fixed;
    top: calc(24px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
    pointer-events: none;
    max-width: calc(100vw - 40px);
}
.toast {
    padding: 14px 24px;
    border-radius: var(--r-sm);
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    animation: toastIn .4s var(--ease-spring) both;
    pointer-events: auto;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    max-width: 100%;
    text-align: center;
}
.toast.success { background: rgba(52,199,89,0.95); color: #fff; }
.toast.error   { background: rgba(255,59,48,0.95); color: #fff; }
.toast.info    { background: rgba(255,255,255,0.95); }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(-30px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 加载骨架屏 ---------- */
.skeleton {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.3) 0%,
        rgba(255,255,255,0.6) 50%,
        rgba(255,255,255,0.3) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s linear infinite;
    border-radius: 8px;
}
@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ---------- 工具类 ---------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; } .mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; } .text-muted { color: var(--text-secondary); }
.hidden { display: none !important; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   响应式 — 全设备适配
   断点: 1024px (大屏) · 768px (平板) · 480px (手机) · 横屏
   ===================================================================== */

/* 大屏优化 (> 1024px) */
@media (min-width: 1280px) {
    .admin-body-content { max-width: 1320px; }
    .schedule-grid { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 24px; }
}

/* 平板 (768px - 1024px) */
@media (max-width: 1024px) {
    .admin-topbar { padding: 12px 20px; padding-top: calc(12px + var(--safe-top)); }
    .admin-body-content { padding: 20px; padding-bottom: calc(20px + var(--safe-bottom)); }
    .schedule-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
    .overview-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* 手机竖屏 (≤ 768px) */
@media (max-width: 768px) {
    /* 后台 */
    .admin-topbar {
        padding: 12px 16px;
        padding-top: calc(12px + var(--safe-top));
        flex-wrap: wrap;
        gap: 10px;
    }
    .admin-brand { font-size: 16px; }
    .admin-brand-icon { width: 34px; height: 34px; font-size: 18px; }
    .admin-user { gap: 6px; font-size: 13px; }
    .admin-user-avatar { width: 30px; height: 30px; font-size: 13px; }
    .admin-body-content { padding: 16px; padding-bottom: calc(20px + var(--safe-bottom)); }
    .schedule-grid { grid-template-columns: 1fr; gap: 14px; }
    .schedule-card { padding: 18px; }
    .schedule-card-title { font-size: 17px; }
    .schedule-card-actions { gap: 6px; }
    .schedule-card-actions .btn { flex: 1; min-width: 70px; }

    /* 模态框 */
    .modal-overlay { padding: 0; padding-top: var(--safe-top); align-items: stretch; }
    .modal {
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh; min-height: 100dvh;
        max-height: none;
        padding: 24px 20px;
        padding-top: calc(24px + var(--safe-top));
        padding-bottom: calc(24px + var(--safe-bottom));
    }
    .modal-title { font-size: 20px; }

    /* 表单 */
    .field { margin-bottom: 14px; }
    .input, .select, .textarea { padding: 12px 14px; font-size: 16px; /* 避免 iOS 缩放 */ }
    .btn { padding: 12px 20px; }

    /* 登录 */
    .login-card { padding: 32px 24px; border-radius: var(--r-xl); }

    /* 分享页 */
    .share-header { padding: 18px 16px; padding-top: calc(18px + var(--safe-top)); }
    .share-header-top { gap: 8px; }
    .share-sub { font-size: 13px; }
    .week-nav { margin: 12px; padding: 12px 14px; gap: 10px; }
    .week-nav-btn { width: 40px; height: 40px; font-size: 20px; }
    .week-label { font-size: 16px; }

    /* 课表网格 — 移动端优化 */
    .schedule-wrap { padding: 0 12px calc(20px + var(--safe-bottom)); }
    .schedule-grid-table { font-size: 10px; border-spacing: 3px; }
    .schedule-grid-table th { padding: 8px 2px; font-size: 10px; }
    .schedule-grid-table th div { font-size: 9px !important; }
    .period-cell { padding: 5px 2px; }
    .period-cell .period-num { font-size: 11px; }
    .period-cell .period-time { font-size: 8px; }
    .course-card-mini { padding: 4px 5px; border-radius: 6px; }
    .course-name { font-size: 10px; }
    .course-info-line { font-size: 8px; }

    /* 今日课程 */
    .today-banner { padding: 18px 20px; }
    .today-card {
        flex-direction: row;
        padding: 14px 16px;
    }
    .today-card-time { flex: 0 0 60px; font-size: 13px; padding-right: 10px; }
    .today-card-body { padding: 0 10px; }
    .today-card-body .course-name { font-size: 14px; }
    .badge-live, .badge-soon, .badge-future { font-size: 10px; padding: 3px 8px; }

    /* 总览 */
    .overview-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .overview-week-card { padding: 14px; }
    .overview-week-header { font-size: 14px; margin-bottom: 8px; }
    .overview-course-list { font-size: 11px; line-height: 1.7; }

    /* 公告 */
    .ann-list { padding: 14px; padding-bottom: calc(20px + var(--safe-bottom)); gap: 10px; }
    .ann-card { padding: 18px 20px; }
    .ann-title { font-size: 16px; }
    .ann-content { font-size: 13px; line-height: 1.7; }

    /* 课程详情 */
    .course-detail-banner { padding: 24px; }
    .course-detail-name { font-size: 20px; }
    .course-detail-body { padding: 20px 22px; }

    /* 导入 */
    .dropzone { padding: 32px 16px; }
    .dropzone-icon { font-size: 40px; }
    .preview-table, .admin-table { font-size: 12px; }
    .preview-table th, .preview-table td, .admin-table th, .admin-table td { padding: 8px 10px; }

    /* 体育自选 */
    .pe-select-list { max-height: 60vh; }
    .pe-option { padding: 12px; }
}

/* 小屏手机 (≤ 480px) */
@media (max-width: 480px) {
    .login-card { padding: 28px 20px; }
    .login-title { font-size: 22px; }
    .login-logo { width: 60px; height: 60px; font-size: 30px; }

    .admin-body-content { padding: 12px; padding-bottom: calc(16px + var(--safe-bottom)); }
    .schedule-card { padding: 16px; }
    .schedule-card-stats { gap: 6px; }
    .stat-pill { font-size: 11px; padding: 4px 10px; }

    /* 表格行级滚动横向 */
    .course-preview, .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .preview-table, .admin-table { min-width: 560px; }

    /* 总览单列 */
    .overview-grid { grid-template-columns: 1fr; }

    /* 模态框头部 */
    .modal { padding: 20px 16px; padding-top: calc(20px + var(--safe-top)); }
    .modal-title { font-size: 18px; }

    /* 双列表单改单列 */
    .modal form > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; gap: 0 !important; }

    /* 视图切换按钮缩小 */
    .view-btn { padding: 6px 12px; font-size: 12px; }
    .view-switcher { flex-wrap: wrap; }

    /* 分享头部紧凑 */
    .share-header-top { flex-direction: column; align-items: flex-start; }
    .share-view-badge { font-size: 11px; }
}

/* 横屏手机优化 */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    .login-wrap { padding: 12px; }
    .login-card { padding: 20px 24px; max-width: 480px; }
    .login-logo { width: 50px; height: 50px; font-size: 26px; margin-bottom: 12px; }
    .login-title { font-size: 20px; }
    .login-sub { margin-bottom: 16px; }

    .share-password-wrap { padding: 12px; }
    .share-password-card { padding: 24px 28px; max-width: 360px; }
    .lock-icon { width: 50px; height: 50px; font-size: 26px; margin-bottom: 12px; }

    /* 模态框横屏适配 */
    .modal-overlay { padding: 0 16px; align-items: center; padding-top: var(--safe-top); }
    .modal { max-height: 90vh; max-height: 90dvh; padding: 20px; overflow-y: auto; }

    /* 周次导航横屏紧凑 */
    .week-nav { margin: 10px; padding: 10px 14px; }
}

/* 暗色模式适配（系统级） */
@media (prefers-color-scheme: dark) {
    /* 这里保留亮色玻璃风格 — 但加强对比避免在深色背景下看不清 */
    body { background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #43e97b 100%); }
}

/* 减少动画偏好（无障碍） */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    body { animation: none; }
    body::before, body::after { animation: none; }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .schedule-card:hover { transform: none; }
    .course-cell:hover { transform: none; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
    .btn:hover { transform: none; }
    .btn:active { transform: scale(0.97); }
    .modal-close:hover { transform: none; }
}

/* 高 DPI 屏幕 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .glass, .glass-strong, .glass-soft { -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 1.2)) saturate(200%); }
}

/* 打印优化 */
@media print {
    body { background: white; color: black; }
    body::before, body::after { display: none; }
    .glass, .glass-strong, .glass-soft { background: white !important; backdrop-filter: none !important; box-shadow: none !important; border: 1px solid #ccc; }
    .admin-topbar, .share-header, .week-nav, .view-switcher { display: none; }
    .schedule-grid-table { width: 100%; }
}