/* ============================================================
   STUST Portal — 紙藝浮雕設計系統 (Paper Craft Design System)
   設計語言：手工紙張觸感 + 浮雕陰影 + 摺紙裝飾
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700;800;900&family=Source+Sans+3:wght@300;400;500;600;700;800;900&family=Noto+Sans+TC:wght@300;400;500;700;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ── 設計令牌 Design Tokens ── */
:root {
    /* 紙張色系 Paper Colors */
    --paper:          #F5F0E8;
    --paper-warm:     #EDE5D8;
    --paper-deep:     #D6CBBB;
    --paper-cream:    #FBF8F3;
    --paper-aged:     #E8DFD1;

    /* 墨水色系 Ink Colors */
    --ink:            #2C1810;
    --ink-light:      #5C4033;
    --ink-faint:      #8B7355;
    --ink-ghost:      #B8A89A;

    /* 主題色 Accent Colors */
    --rust:           #C4553A;
    --rust-light:     #D4725A;
    --rust-dark:      #A13D28;
    --rust-bg:        rgba(196, 85, 58, 0.08);
    --rust-border:    rgba(196, 85, 58, 0.25);

    --sage:           #5A7F60;
    --sage-light:     #7BA07F;
    --sage-bg:        rgba(90, 127, 96, 0.08);
    --sage-border:    rgba(90, 127, 96, 0.25);

    --amber:          #C4943A;
    --amber-light:    #D4A84A;
    --amber-bg:       rgba(196, 148, 58, 0.08);
    --amber-border:   rgba(196, 148, 58, 0.25);

    --indigo:         #4A5568;
    --indigo-light:   #6B7A8D;
    --indigo-bg:      rgba(74, 85, 104, 0.06);
    --indigo-border:  rgba(74, 85, 104, 0.2);

    --plum:           #7B5EA7;
    --plum-bg:        rgba(123, 94, 167, 0.08);
    --plum-border:    rgba(123, 94, 167, 0.25);

    --sky:            #4A8BA8;
    --sky-bg:         rgba(74, 139, 168, 0.08);
    --sky-border:     rgba(74, 139, 168, 0.25);

    /* 陰影系統 Shadow System */
    --shadow-1:       0 1px 2px rgba(44, 24, 16, 0.06);
    --shadow-2:       0 2px 4px rgba(44, 24, 16, 0.06), 0 4px 8px rgba(44, 24, 16, 0.04);
    --shadow-3:       0 2px 4px rgba(44, 24, 16, 0.06),
                      0 4px 8px rgba(44, 24, 16, 0.04),
                      0 8px 16px rgba(44, 24, 16, 0.03);
    --shadow-4:       0 2px 4px rgba(44, 24, 16, 0.08),
                      0 4px 8px rgba(44, 24, 16, 0.06),
                      0 8px 16px rgba(44, 24, 16, 0.04),
                      0 16px 32px rgba(44, 24, 16, 0.03);
    --shadow-emboss:  inset 0 1px 0 rgba(255, 255, 255, 0.5),
                      inset 0 -1px 0 rgba(44, 24, 16, 0.05);
    --shadow-inset:   inset 0 2px 4px rgba(44, 24, 16, 0.08);

    /* 字型 Typography */
    --font-display:   'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body:      'Source Sans 3', 'Noto Sans TC', 'Segoe UI', system-ui, sans-serif;
    --font-mono:      'JetBrains Mono', 'SF Mono', 'Cascadia Code', Consolas, monospace;

    /* 圓角 Border Radius */
    --radius-sm:      4px;
    --radius:         6px;
    --radius-lg:      8px;
    --radius-xl:      12px;

    /* 間距 Spacing */
    --space-1:        4px;
    --space-2:        8px;
    --space-3:        12px;
    --space-4:        16px;
    --space-5:        20px;
    --space-6:        24px;
    --space-8:        32px;
    --space-10:       40px;
    --space-12:       48px;
    --space-16:       64px;

    /* 過場 Transition */
    --ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce:    cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration:       0.3s;
    --duration-slow:  0.5s;
}

/* ── 動畫偏好 ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── 重置與基礎 ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background-color: var(--paper);
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E"),
        linear-gradient(180deg, var(--paper-cream) 0%, var(--paper) 30%, var(--paper-warm) 100%);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ── 捲軸 Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--paper-deep); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-ghost); }

/* ── 選取 Selection ── */
::selection { background: rgba(196, 85, 58, 0.15); color: var(--ink); }

/* ============================================================
   LAYOUT 佈局
   ============================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .container { padding: 0 var(--space-4); }
}

/* ── 面板 Panel ── */
.panel {
    background: var(--paper-cream);
    border: 1px solid var(--paper-deep);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3);
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.015'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.panel > * { position: relative; z-index: 1; }

.panel-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--paper-deep);
    background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.panel-body {
    padding: var(--space-6);
}

.panel-hoverable {
    transition: transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.panel-hoverable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-4);
}

/* ── 書脊陰影 Book Spine ── */
.book-spine {
    position: relative;
}

.book-spine::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(44, 24, 16, 0.04) 10%,
        rgba(44, 24, 16, 0.06) 50%,
        rgba(44, 24, 16, 0.04) 90%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 2;
}

/* ── 摺線分隔 Fold Line ── */
.fold-divider {
    border: none;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--paper-deep) 15%,
        rgba(44, 24, 16, 0.08) 50%,
        var(--paper-deep) 85%,
        transparent 100%
    );
    margin: var(--space-8) 0;
    position: relative;
}

.fold-divider::before,
.fold-divider::after {
    content: '';
    position: absolute;
    top: -1px;
    width: 6px;
    height: 4px;
    background: var(--paper-deep);
    border-radius: 50%;
}

.fold-divider::before { left: 14%; }
.fold-divider::after { right: 14%; }

/* ============================================================
   TYPOGRAPHY 字型
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
    letter-spacing: -0.01em;
}

h1 { font-size: 2.75rem; font-weight: 800; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; font-weight: 600; }

/* ── 凸版印刷效果 Embossed Text ── */
.text-embossed {
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6),
        0 -1px 0 rgba(44, 24, 16, 0.05);
}

.text-debossed {
    text-shadow:
        0 -1px 0 rgba(255, 255, 255, 0.4),
        0 1px 2px rgba(44, 24, 16, 0.1);
}

.text-display {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.text-mono {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 0.9em;
}

.text-muted { color: var(--ink-faint); }
.text-light { color: var(--ink-light); }
.text-rust  { color: var(--rust); }
.text-sage  { color: var(--sage); }
.text-amber { color: var(--amber); }

/* ── 標題裝飾 Heading Decorations ── */
.heading-decorated {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.heading-decorated::before {
    content: '';
    width: 4px;
    height: 1.2em;
    background: var(--rust);
    border-radius: 2px;
    flex-shrink: 0;
}

.heading-decorated::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--paper-deep), transparent);
}

/* ── 段落標籤 Eyebrow ── */
.eyebrow {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: var(--space-2);
}

/* ============================================================
   FORMS 表單
   ============================================================ */

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius);
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-emboss);
}

.input-field:focus {
    outline: none;
    border-color: var(--rust-light);
    box-shadow: var(--shadow-emboss), 0 0 0 3px var(--rust-bg);
}

.input-field::placeholder {
    color: var(--ink-ghost);
    font-weight: 400;
}

select.input-field {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238B7355' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
}

select.input-field option {
    background: var(--paper-cream);
    color: var(--ink);
}

.input-group {
    display: flex;
    gap: var(--space-3);
    align-items: end;
    flex-wrap: wrap;
}

.input-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--ink-ghost);
    margin-top: var(--space-1);
}

/* ============================================================
   BUTTONS 按鈕
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.7rem 1.4rem;
    border: 1.5px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    text-decoration: none;
    white-space: nowrap;
    box-shadow: var(--shadow-1);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15), transparent 50%);
    pointer-events: none;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

/* 主要按鈕 — 鐵鏽紅 */
.btn-primary {
    background: linear-gradient(180deg, var(--rust-light), var(--rust));
    color: #fff;
    border-color: var(--rust-dark);
    box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--rust), var(--rust-dark));
    box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

/* 次要按鈕 — 紙張色 */
.btn-secondary {
    background: var(--paper-warm);
    color: var(--ink-light);
    border-color: var(--paper-deep);
    box-shadow: var(--shadow-1), var(--shadow-emboss);
}

.btn-secondary:hover {
    background: var(--paper-deep);
    color: var(--ink);
    border-color: var(--ink-ghost);
}

/* 幽靈按鈕 */
.btn-ghost {
    background: transparent;
    color: var(--ink-faint);
    border-color: transparent;
    box-shadow: none;
}

.btn-ghost:hover {
    color: var(--ink);
    background: var(--paper-warm);
}

/* 成功按鈕 */
.btn-sage {
    background: linear-gradient(180deg, var(--sage-light), var(--sage));
    color: #fff;
    border-color: #4A6B4F;
    box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-sage:hover {
    box-shadow: var(--shadow-3);
    transform: translateY(-1px);
}

/* 小按鈕 */
.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.78rem;
}

/* ============================================================
   DATA TABLE 數據表格
   ============================================================ */

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table th {
    background: linear-gradient(180deg, var(--paper-warm), var(--paper-aged));
    color: var(--ink-light);
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1.5px solid var(--paper-deep);
    position: relative;
}

.data-table th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255,255,255,0.4);
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(214, 203, 187, 0.5);
    font-size: 0.88rem;
    color: var(--ink-light);
    transition: background var(--duration) var(--ease);
    background: var(--paper-cream);
}

.data-table tbody tr:hover td {
    background: var(--paper-warm);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* ── 印章徽章 Stamp Badge ── */
.badge-stamp {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.65rem;
    border: 2px solid;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    transform: rotate(-2deg);
    position: relative;
}

.badge-stamp::before {
    content: '';
    position: absolute;
    inset: -3px;
    border: 1px dashed;
    border-color: inherit;
    border-radius: 22px;
    opacity: 0.3;
}

.badge-rust   { color: var(--rust);  border-color: var(--rust-border);  background: var(--rust-bg); }
.badge-sage   { color: var(--sage);  border-color: var(--sage-border);  background: var(--sage-bg); }
.badge-amber  { color: var(--amber); border-color: var(--amber-border); background: var(--amber-bg); }
.badge-indigo { color: var(--indigo); border-color: var(--indigo-border); background: var(--indigo-bg); }
.badge-plum   { color: var(--plum);  border-color: var(--plum-border);  background: var(--plum-bg); }

.badge-strip {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* ── 通用徽章 ── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1.5px solid;
}

.badge-required {
    background: var(--rust-bg);
    color: var(--rust);
    border-color: var(--rust-border);
}

.badge-elective {
    background: var(--sky-bg);
    color: var(--sky);
    border-color: var(--sky-border);
}

/* ── form-row 課程查詢用 ── */
.form-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: end;
}

/* ============================================================
   STAT CARD 統計卡片
   ============================================================ */
.stat-card {
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    transition: transform var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-4);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1.5px solid;
    transition: transform var(--duration) var(--ease-bounce);
}

.stat-card:hover .stat-icon {
    transform: scale(1.1) rotate(-3deg);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

/* ============================================================
   MODAL 對話框
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration) var(--ease);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(44, 24, 16, 0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-content {
    position: relative;
    background: var(--paper-cream);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-4);
    width: 100%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--duration) var(--ease-bounce);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1.5px solid var(--paper-deep);
    background: linear-gradient(180deg, rgba(255,255,255,0.4), var(--paper-cream));
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1.5px solid var(--paper-deep);
    background: var(--paper-warm);
    flex-shrink: 0;
}

/* ── 對話框 Dialog ── */
.dialog-box {
    position: relative;
    background: var(--paper-cream);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-4);
    max-width: 400px;
    width: 100%;
    text-align: center;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform var(--duration) var(--ease-bounce);
}

.modal-overlay.active .dialog-box {
    transform: scale(1);
}

.dialog-body {
    padding: var(--space-10) var(--space-8) var(--space-6);
}

.dialog-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin: 0 auto var(--space-5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border: 2px solid;
}

.dialog-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: var(--space-3);
}

.dialog-msg {
    font-size: 0.88rem;
    color: var(--ink-light);
    line-height: 1.6;
    white-space: pre-line;
    max-height: 40vh;
    overflow-y: auto;
}

.dialog-actions {
    display: flex;
    border-top: 1.5px solid var(--paper-deep);
}

.dialog-actions button {
    flex: 1;
    padding: var(--space-4);
    border: none;
    background: none;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.dialog-actions button:hover {
    background: var(--paper-warm);
}

.dialog-actions .btn-confirm {
    color: var(--rust);
}

.dialog-actions .btn-confirm:hover {
    background: var(--rust-bg);
}

/* ============================================================
   LOADING 載入動畫
   ============================================================ */

.loading-screen {
    display: none;
    min-height: 60vh;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
}

.loading-screen.active {
    display: flex;
}

/* 摺紙飛翔動畫 */
.OrigamiLoader {
    width: 60px;
    height: 60px;
    position: relative;
}

.OrigamiLoader::before,
.OrigamiLoader::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
}

.OrigamiLoader::before {
    top: 5px;
    left: 10px;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 25px solid var(--rust);
    transform-origin: bottom center;
    animation: origami-flap 1.2s var(--ease) infinite;
}

.OrigamiLoader::after {
    top: 30px;
    left: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-top: 20px solid var(--rust-light);
    transform-origin: top center;
    animation: origami-flap 1.2s var(--ease) infinite reverse;
}

@keyframes origami-flap {
    0%, 100% { transform: rotateX(0deg); }
    50% { transform: rotateX(50deg); }
}

.loading-text {
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--ink-faint);
    letter-spacing: 0.1em;
}

.overlay-loading {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-4);
}

.overlay-loading.active {
    display: flex;
}

.overlay-loading .modal-backdrop {
    background: rgba(44, 24, 16, 0.2);
}

.overlay-loading .loading-text {
    color: var(--ink);
    font-weight: 600;
    background: var(--paper-cream);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
}

/* ── 旋轉器（備用）── */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--paper-deep);
    border-top-color: var(--rust);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   NAVIGATION 導航
   ============================================================ */

/* ── Header ── */
.site-header {
    background: rgba(245, 240, 232, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1.5px solid var(--paper-deep);
    position: sticky;
    top: 0;
    z-index: 50;
    padding: var(--space-3) 0;
    box-shadow: var(--shadow-1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--ink);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--rust-light), var(--rust));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: var(--shadow-2), inset 0 1px 0 rgba(255,255,255,0.2);
    border: 1.5px solid var(--rust-dark);
}

.logo-text h1 {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.logo-text h1 span {
    color: var(--rust);
}

.logo-text p {
    font-size: 0.65rem;
    color: var(--ink-ghost);
    letter-spacing: 0.08em;
    font-weight: 500;
}

.profile-bar {
    display: none;
    align-items: center;
    gap: var(--space-3);
}

.profile-bar.active {
    display: flex;
}

.profile-id {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--sage);
    background: var(--sage-bg);
    border: 1.5px solid var(--sage-border);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
}

/* ── Mobile Nav ── */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: none;
    background: rgba(245, 240, 232, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1.5px solid var(--paper-deep);
    box-shadow: 0 -2px 8px rgba(44, 24, 16, 0.06);
    padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
}

.mobile-nav-inner {
    display: flex;
    justify-content: space-around;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) var(--space-3);
    background: none;
    border: none;
    color: var(--ink-ghost);
    font-family: var(--font-body);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    position: relative;
    border-radius: var(--radius);
}

.nav-btn.active {
    color: var(--rust);
}

.nav-btn:hover {
    color: var(--ink-light);
    background: var(--paper-warm);
}

.nav-btn .nav-icon {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform var(--duration) var(--ease-bounce);
}

.nav-btn.active .nav-icon {
    transform: scale(1.15);
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--rust);
    border-radius: 50%;
    border: 2px solid var(--paper);
    box-shadow: 0 0 6px rgba(196, 85, 58, 0.4);
}

@media (min-width: 1024px) {
    .mobile-nav { display: none !important; }
}

@media (max-width: 1023px) {
    .mobile-nav { display: block !important; }
}

/* ============================================================
   CARDS 卡片元件
   ============================================================ */

/* ── 服務卡片 ── */
.service-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-8);
    background: var(--paper-cream);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-3);
    text-decoration: none;
    color: var(--ink);
    cursor: pointer;
    transition: all var(--duration-slow) var(--ease);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.service-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
}

.service-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-4);
    border-color: var(--ink-ghost);
}

.service-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.service-card.disabled:hover {
    transform: none;
    box-shadow: var(--shadow-3);
}

.service-card .card-stripe-rust::before    { background: var(--rust); }
.service-card .card-stripe-sky::before     { background: var(--sky); }
.service-card .card-stripe-sage::before    { background: var(--sage); }
.service-card .card-stripe-amber::before   { background: var(--amber); }
.service-card .card-stripe-plum::before    { background: var(--plum); }
.service-card .card-stripe-indigo::before  { background: var(--indigo); }

.service-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 1.5px solid;
    transition: transform var(--duration) var(--ease-bounce);
}

.service-card:hover .service-icon {
    transform: scale(1.08) rotate(-3deg);
}

.service-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
}

.service-desc {
    font-size: 0.88rem;
    color: var(--ink-light);
    line-height: 1.5;
    flex: 1;
}

.service-tags {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-top: var(--space-2);
}

.service-tag {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    border: 1.5px solid;
    letter-spacing: 0.03em;
}

/* ── 狀態指示點 ── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: absolute;
    top: var(--space-5);
    right: var(--space-5);
    box-shadow: 0 0 8px currentColor;
}

/* ============================================================
   PROGRESS BAR 進度條（尺規風格）
   ============================================================ */

.progress-track {
    width: 100%;
    height: 6px;
    background: var(--paper-deep);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-inset);
}

.progress-track::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 10%,
        rgba(44, 24, 16, 0.03) 10%,
        rgba(44, 24, 16, 0.03) 10.5%
    );
    z-index: 1;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s var(--ease);
    position: relative;
}

.progress-fill-rust  { background: linear-gradient(90deg, var(--rust-light), var(--rust)); }
.progress-fill-amber { background: linear-gradient(90deg, var(--amber-light), var(--amber)); }
.progress-fill-sage  { background: linear-gradient(90deg, var(--sage-light), var(--sage)); }
.progress-fill-indigo { background: linear-gradient(90deg, var(--indigo-light), var(--indigo)); }

/* ============================================================
   CHART 圖表
   ============================================================ */
.chart-container {
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-border {
    border: 1.5px dashed var(--paper-deep);
    border-radius: var(--radius);
    padding: var(--space-4);
    position: relative;
}

.chart-border::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 1px solid rgba(214, 203, 187, 0.3);
    border-radius: var(--radius-lg);
    pointer-events: none;
}

/* ============================================================
   CALENDAR 日曆（紙張格線風格）
   ============================================================ */

.fc {
    --fc-border-color: var(--paper-deep);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--paper-warm);
    --fc-list-event-hover-bg-color: var(--paper-aged);
    --fc-today-bg-color: var(--rust-bg);
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.fc-theme-standard td, .fc-theme-standard th {
    border-color: var(--paper-deep) !important;
}

.fc-col-header-cell-cushion {
    color: var(--ink-faint);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 4px !important;
}

.fc-daygrid-day-number {
    color: var(--ink-light);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 6px 8px !important;
}

.fc-day-today .fc-daygrid-day-number {
    color: var(--rust);
    font-weight: 800;
}

.fc-header-toolbar {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--space-5) !important;
}

.fc .fc-toolbar-title {
    font-family: var(--font-display) !important;
    font-size: 1.1rem !important;
    font-weight: 700;
    color: var(--ink);
}

.fc .fc-button-primary {
    background: var(--paper-warm) !important;
    border: 1.5px solid var(--paper-deep) !important;
    color: var(--ink-light) !important;
    border-radius: var(--radius) !important;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 14px !important;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-1);
    text-transform: capitalize;
}

.fc .fc-button-primary:hover {
    background: var(--paper-deep) !important;
    color: var(--ink) !important;
}

.fc .fc-button-primary:disabled {
    opacity: 0.5;
}

.fc .fc-button-active {
    background: var(--rust-bg) !important;
    border-color: var(--rust-border) !important;
    color: var(--rust) !important;
}

.fc-list-day-cushion {
    background: var(--paper-warm) !important;
    color: var(--ink) !important;
    font-weight: 700;
}

.fc-daygrid-event {
    border-radius: 3px !important;
    padding: 2px 5px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border: none !important;
}

/* ============================================================
   SCHEDULE GRID 課表時間格
   ============================================================ */

.schedule-day {
    background: var(--paper-cream);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    overflow: hidden;
    box-shadow: var(--shadow-2);
}

.schedule-day-header {
    padding: var(--space-3) var(--space-5);
    background: linear-gradient(180deg, var(--paper-warm), var(--paper-aged));
    border-bottom: 1.5px solid var(--paper-deep);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schedule-day-header h4 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--rust);
}

.schedule-periods {
    padding: var(--space-4);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-3);
}

@media (max-width: 640px) {
    .schedule-periods { grid-template-columns: 1fr; }
}

.period-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--paper);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-1);
}

.period-item:hover {
    border-color: var(--rust-border);
    background: var(--rust-bg);
    box-shadow: var(--shadow-2);
}

.period-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--paper-warm);
}

.period-item.disabled:hover {
    border-color: var(--paper-deep);
    background: var(--paper-warm);
    box-shadow: var(--shadow-1);
}

.period-item input[type="checkbox"] {
    accent-color: var(--rust);
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

.period-num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--ink-faint);
    background: var(--paper-warm);
    border: 1px solid var(--paper-deep);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.period-course {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    flex: 1;
    min-width: 0;
}

/* ============================================================
   LEGEND 圖例
   ============================================================ */

.legend {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-faint);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 4px currentColor;
}

/* ============================================================
   TIMETABLE 課表（課程查詢用）
   ============================================================ */

.timetable-wrap {
    overflow-x: auto;
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-lg);
    background: var(--paper);
}

.timetable {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.timetable th {
    background: linear-gradient(180deg, var(--paper-warm), var(--paper-aged));
    color: var(--ink-faint);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1.5px solid var(--paper-deep);
}

.timetable td {
    border-bottom: 1px solid rgba(214, 203, 187, 0.4);
    padding: 0.4rem;
    text-align: center;
    vertical-align: middle;
    min-height: 48px;
}

.timetable .period-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--ink-faint);
}

.timetable .period-time {
    font-size: 0.6rem;
    color: var(--ink-ghost);
}

.course-cell {
    background: var(--paper-cream);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-sm);
    padding: 0.3rem;
    box-shadow: var(--shadow-1);
}

.course-cell-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink);
    display: block;
}

.course-cell-teacher {
    font-size: 0.6rem;
    color: var(--ink-faint);
    display: block;
}

/* ============================================================
   TABS 標籤頁
   ============================================================ */

.tab-bar {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.tab-btn {
    padding: var(--space-2) var(--space-4);
    border: 1.5px solid var(--paper-deep);
    background: var(--paper-warm);
    color: var(--ink-faint);
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    box-shadow: var(--shadow-1);
}

.tab-btn.active {
    background: var(--paper-cream);
    color: var(--ink);
    border-color: var(--rust-border);
    box-shadow: var(--shadow-2);
}

.tab-btn:hover:not(.active) {
    background: var(--paper-deep);
    color: var(--ink-light);
}

.tab-panel {
    padding: var(--space-5);
    background: var(--paper);
    border: 1.5px solid var(--paper-deep);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-inset);
}

/* ============================================================
   CARD GRID 卡片網格
   ============================================================ */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-6);
}

@media (max-width: 768px) {
    .card-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   3D DECORATIONS 摺紙裝飾
   ============================================================ */

/* ── 摺紙鶴 ── */
.OrigamiDecor {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    opacity: 0.06;
}

.OrigamiDecor svg {
    filter: drop-shadow(0 2px 4px rgba(44, 24, 16, 0.1));
}

.OrigamiDecor.top-right {
    top: 80px;
    right: -20px;
    transform: rotate(15deg);
    animation: float-slow 8s ease-in-out infinite;
}

.OrigamiDecor.bottom-left {
    bottom: 100px;
    left: -20px;
    transform: rotate(-20deg);
    animation: float-slow 10s ease-in-out infinite reverse;
}

@keyframes float-slow {
    0%, 100% { transform: rotate(15deg) translateY(0px); }
    50% { transform: rotate(15deg) translateY(-12px); }
}

/* ── 迴紋針 ── */
.paperclip {
    position: absolute;
    width: 20px;
    height: 50px;
    border: 2px solid var(--ink-ghost);
    border-radius: 10px 10px 0 0;
    opacity: 0.15;
}

.paperclip::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 2px;
    right: 2px;
    height: 30px;
    border: 2px solid var(--ink-ghost);
    border-radius: 0 0 8px 8px;
    border-top: none;
}

/* ── 紙膠帶 ── */
.washi-tape {
    position: absolute;
    width: 80px;
    height: 24px;
    background: rgba(196, 85, 58, 0.12);
    border: 1px solid rgba(196, 85, 58, 0.08);
    transform: rotate(-5deg);
    opacity: 0.6;
}

.washi-tape::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 3px,
        rgba(196, 85, 58, 0.06) 3px,
        rgba(196, 85, 58, 0.06) 6px
    );
}

/* ============================================================
   ANIMATIONS 動畫
   ============================================================ */

.fade-in {
    animation: paper-fade-in 0.5s var(--ease) forwards;
    opacity: 0;
}

@keyframes paper-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-up {
    animation: paper-slide-up 0.5s var(--ease) forwards;
    opacity: 0;
}

@keyframes paper-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* ── 壓入效果（hover 模擬手指壓紙）── */
.press-in {
    transition: transform var(--duration) var(--ease),
                box-shadow var(--duration) var(--ease);
}

.press-in:hover {
    transform: translateY(1px);
    box-shadow: var(--shadow-1);
}

.press-in:active {
    transform: translateY(2px);
    box-shadow: none;
}

/* ============================================================
   INFO SECTION 資訊區塊
   ============================================================ */

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    padding-top: var(--space-8);
    border-top: 1.5px solid var(--paper-deep);
    margin-top: var(--space-8);
}

@media (max-width: 768px) {
    .info-grid { grid-template-columns: 1fr; gap: var(--space-6); }
}

.info-item {
    text-align: center;
}

.info-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1.5px solid;
}

.info-item h4 {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: var(--space-2);
}

.info-item p {
    font-size: 0.82rem;
    color: var(--ink-light);
    line-height: 1.5;
}

/* ============================================================
   UTILITY CLASSES 工具類別
   ============================================================ */

.hidden { display: none !important; }
.flex:not(.hidden) { display: flex !important; }
.grid:not(.hidden) { display: grid !important; }
.block:not(.hidden) { display: block !important; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }

.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }

.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

.relative { position: relative; }
.absolute { position: absolute; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.font-mono { font-family: var(--font-mono); }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 800; }

.text-xs { font-size: 0.72rem; }
.text-sm { font-size: 0.85rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.12rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.whitespace-nowrap { white-space: nowrap; }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }

.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

.z-10 { z-index: 10; }
.z-50 { z-index: 50; }

/* ── Grid System ── */
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr;
    }
}

/* ── Responsive Grid Layouts ── */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-6);
}

@media (max-width: 1023px) {
    .main-grid { grid-template-columns: 1fr; }
}

.task-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
}

@media (max-width: 768px) {
    .task-grid { grid-template-columns: 1fr; }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
}

@media (max-width: 1023px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── 課程頁面雙欄 ── */
.course-top-layout {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: var(--space-6);
    align-items: start;
}

.course-top-layout > .panel {
    display: flex;
    flex-direction: column;
}

.course-top-layout > .panel > .panel-body {
    display: flex;
    flex-direction: column;
}

.course-top-layout > .panel > .panel-body > .tab-bar {
    flex-shrink: 0;
}

.course-top-layout > .panel > .panel-body > .tab-panel {
    flex: 1;
}

@media (max-width: 1024px) {
    .course-top-layout {
        grid-template-columns: 1fr;
        align-items: start;
    }
}

/* ── 訊息列 ── */
.info-bar {
    font-size: 0.82rem;
    color: var(--ink-light);
    background: var(--sky-bg);
    border: 1.5px solid var(--sky-border);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* ── 顏色工具 ── */
.bg-rust   { background: var(--rust); }
.bg-sage   { background: var(--sage); }
.bg-amber  { background: var(--amber); }
.bg-indigo { background: var(--indigo); }
.bg-plum   { background: var(--plum); }
.bg-sky    { background: var(--sky); }

.bg-rust-light   { background: var(--rust-light); }
.bg-sage-light   { background: var(--sage-light); }
.bg-amber-light  { background: var(--amber-light); }
.bg-indigo-light { background: var(--indigo-light); }

.text-white { color: #fff; }
.text-paper { color: var(--paper-cream); }

/* ── 列印樣式 ── */
@media print {
    .site-header, .mobile-nav, .OrigamiDecor, .modal-overlay { display: none !important; }
    body { background: white; box-shadow: none; }
    .panel { box-shadow: none; border: 1px solid #ddd; }
}
