:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-alt: #eef1ed;
  --ink: #17232b;
  --muted: #667179;
  --line: #d9ded9;
  --green: #1d4f4a;
  --green-soft: #e5efeb;
  --red: #a43e36;
  --red-soft: #f6e9e6;
  --blue: #315f7d;
  --blue-soft: #e6eef3;
  --yellow: #8a6719;
  --yellow-soft: #f5eed8;
  --danger: #a12f2f;
  --shadow: 0 8px 24px rgba(28, 44, 46, 0.08);
  --page: 1080px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
a { color: inherit; }
svg { width: 19px; height: 19px; stroke-width: 1.9; }
[hidden] { display: none !important; }

.page-width { width: min(calc(100% - 32px), var(--page)); margin: 0 auto; }
.narrow-page { width: min(calc(100% - 32px), 760px); }
.app-main { min-height: calc(100vh - 66px); padding-bottom: 30px; }
.app-view { display: none; padding: 34px 0 60px; }
.app-view.is-active { display: block; }

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.96);
}
.header-inner { display: flex; width: min(calc(100% - 32px), var(--page)); height: 66px; margin: 0 auto; align-items: center; gap: 26px; }
.brand { display: inline-flex; flex: none; padding: 0; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.brand-mark, .status-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 6px; color: #fff; background: var(--green); font-weight: 900; }
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 15px; }
.brand-copy small { color: var(--muted); font-size: 10px; }
.header-search { display: flex; width: min(470px, 100%); height: 40px; margin-left: auto; padding-left: 12px; align-items: center; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.header-search:focus-within { border-color: var(--green); background: #fff; }
.header-search input { min-width: 0; flex: 1; padding: 0 10px; border: 0; outline: 0; background: transparent; font-size: 13px; }
.header-search button { height: 100%; padding: 0 15px; border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button, .avatar-button { position: relative; display: grid; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.icon-button:hover, .avatar-button:hover { border-color: #9ca8a3; }
.avatar-button { overflow: hidden; }
.avatar-button img { width: 100%; height: 100%; object-fit: cover; }
.notice-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border: 1px solid #fff; border-radius: 50%; background: var(--red); }
.admin-button { display: inline-flex; height: 38px; padding: 0 12px; align-items: center; gap: 7px; border: 1px solid #b9cac5; border-radius: 6px; color: var(--green); background: var(--green-soft); cursor: pointer; font-size: 12px; font-weight: 800; }

.readonly-banner { display: flex; min-height: 38px; padding: 8px 16px; align-items: center; justify-content: center; gap: 8px; color: #6f5716; background: var(--yellow-soft); font-size: 12px; }
.readonly-banner svg { width: 15px; height: 15px; }

.home-layout { display: grid; gap: 28px; }
.home-cover {
  position: relative;
  display: grid;
  min-height: 460px;
  overflow: hidden;
  align-items: end;
  background-image: url("xmu-campus-visual.png");
  background-position: center 31%;
  background-size: cover;
}
.home-cover-shade { position: absolute; inset: 0; background: rgba(15, 40, 50, 0.28); }
.cover-content { position: relative; z-index: 1; display: grid; padding-bottom: 48px; gap: 16px; }
.cover-label { margin: 0 0 8px; color: #fff; font-size: 13px; font-weight: 900; text-shadow: 0 1px 5px rgba(0,0,0,.28); }
.home-content { padding-top: 28px; }
.home-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.kicker, .section-label { margin: 0 0 5px; color: var(--green); font-size: 11px; font-weight: 900; }
.home-intro h1, .page-heading h1, .form-heading h1 { margin: 0; font-size: 31px; line-height: 1.2; }
.home-cover .home-intro h1 { max-width: 680px; color: #fff; font-size: 38px; text-shadow: 0 2px 8px rgba(0,0,0,.32); }
.campus-select { display: inline-flex; min-height: 38px; padding: 0 11px; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }
.home-cover .campus-select { border-color: rgba(255,255,255,.68); background: rgba(255,255,255,.94); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.campus-select svg { width: 15px; height: 15px; }
.main-search { display: flex; height: 58px; padding-left: 18px; align-items: center; border: 2px solid var(--green); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.main-search input { min-width: 0; flex: 1; height: 100%; padding: 0 14px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.main-search button { height: calc(100% - 8px); margin-right: 4px; padding: 0 24px; border: 0; border-radius: 5px; color: #fff; background: var(--green); cursor: pointer; font-weight: 800; }
.search-hints { display: flex; flex-wrap: wrap; gap: 7px; }
.search-hints button { padding: 5px 9px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; }
.home-cover .search-hints button { color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.42); }

.home-section { padding-top: 22px; border-top: 1px solid var(--line); }
.section-head, .page-heading, .split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.section-head { margin-bottom: 14px; }
.section-head h2, .freshman-strip h2 { margin: 0; font-size: 20px; }
.link-button { display: inline-flex; padding: 6px 0; align-items: center; gap: 3px; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.link-button svg { width: 15px; height: 15px; }

.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tool-grid.compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tool-card { display: grid; min-height: 148px; padding: 16px; align-content: start; gap: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; }
.tool-card:hover { border-color: #a9b6b0; box-shadow: 0 5px 14px rgba(24, 44, 43, 0.07); transform: translateY(-1px); }
.tool-grid.compact .tool-card { min-height: 120px; padding: 13px; }
.tool-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 6px; color: var(--green); background: var(--green-soft); }
.tool-card:nth-child(4n+2) .tool-icon { color: var(--blue); background: var(--blue-soft); }
.tool-card:nth-child(4n+3) .tool-icon { color: var(--red); background: var(--red-soft); }
.tool-card:nth-child(4n+4) .tool-icon { color: var(--yellow); background: var(--yellow-soft); }
.tool-card strong { font-size: 14px; line-height: 1.35; }
.tool-card small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.tool-source { display: inline-flex; margin-top: auto; align-items: center; gap: 4px; color: #667b74; font-size: 10px; }
.tool-source svg { width: 12px; height: 12px; }

.freshman-strip { display: flex; padding: 24px; align-items: center; justify-content: space-between; gap: 24px; border-left: 4px solid var(--red); background: #fff; }
.freshman-strip p:not(.section-label) { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.freshman-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.freshman-actions button { min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); cursor: pointer; font-size: 12px; font-weight: 800; }

.page-heading { margin-bottom: 24px; }
.page-heading p, .form-heading p { max-width: 650px; margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.filter-row { display: flex; margin-bottom: 18px; overflow-x: auto; gap: 8px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-row button { flex: none; min-height: 34px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }
.filter-row button.is-active { border-color: var(--green); color: #fff; background: var(--green); }

.question-list { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); }
.question-item { display: grid; padding: 15px 17px; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; border: 0; background: #fff; cursor: pointer; text-align: left; }
.question-item:hover { background: #fafbf9; }
.question-item h3 { margin: 0; font-size: 15px; line-height: 1.5; }
.question-item p { display: -webkit-box; margin: 5px 0 0; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.question-meta { display: flex; margin-top: 9px; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 10px; }
.question-meta span { display: inline-flex; align-items: center; gap: 4px; }
.question-meta svg { width: 12px; height: 12px; }
.question-rank { min-width: 54px; padding-top: 2px; color: var(--red); font-size: 11px; font-weight: 900; text-align: right; }
.roomy .question-item { padding-block: 18px; }
.tag { display: inline-flex; min-height: 21px; padding: 0 7px; align-items: center; border-radius: 4px; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 800; }
.tag.best { color: #6f5411; background: var(--yellow-soft); }
.tag.verified { color: var(--blue); background: var(--blue-soft); }
.tag.pending { color: #745f26; background: var(--yellow-soft); }
.tag.danger { color: var(--danger); background: var(--red-soft); }

.primary-button, .secondary-button, .danger-button { display: inline-flex; min-height: 40px; padding: 0 15px; align-items: center; justify-content: center; gap: 7px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 900; }
.primary-button { border: 1px solid var(--green); color: #fff; background: var(--green); }
.secondary-button { border: 1px solid var(--line); background: #fff; }
.danger-button { border: 1px solid #e2b6b2; color: var(--danger); background: var(--red-soft); }
.full-button { width: 100%; }
.back-button { display: inline-flex; margin-bottom: 20px; padding: 0; align-items: center; gap: 6px; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 12px; font-weight: 900; }
.back-button svg { width: 16px; height: 16px; }

.question-article { display: grid; gap: 18px; }
.question-header { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.question-header h1 { margin: 10px 0 8px; font-size: 25px; line-height: 1.4; }
.question-header > p { margin: 0; color: #3f4a50; font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
.author-row { display: flex; margin-top: 18px; align-items: center; gap: 10px; }
.author-row img, .answer-author img, .profile-avatar { width: 38px; height: 38px; flex: none; border-radius: 6px; object-fit: cover; background: var(--surface-alt); }
.author-row strong, .answer-author strong { display: block; font-size: 12px; }
.author-row small, .answer-author small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.question-actions, .answer-actions { display: flex; margin-top: 16px; flex-wrap: wrap; gap: 8px; }
.text-action { display: inline-flex; min-height: 32px; padding: 0 9px; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; cursor: pointer; font-size: 11px; font-weight: 800; }
.text-action.is-active { border-color: #abc1b9; color: var(--green); background: var(--green-soft); }
.text-action svg { width: 14px; height: 14px; }
.answer-section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.answer-section-title h2 { margin: 0; font-size: 18px; }
.answer-list { display: grid; gap: 12px; }
.answer-card { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.answer-card.is-best { border-color: #d6c17e; box-shadow: inset 4px 0 0 #b28a22; }
.answer-flags { display: flex; margin-bottom: 12px; flex-wrap: wrap; gap: 6px; }
.answer-author { display: flex; align-items: center; gap: 9px; }
.answer-text { margin: 14px 0 0; color: #28343a; font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.answer-source { display: inline-flex; margin-top: 12px; align-items: center; gap: 5px; color: var(--blue); font-size: 11px; }
.answer-source svg { width: 14px; height: 14px; }
.answer-form { display: grid; padding: 18px; gap: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.answer-form textarea { width: 100%; min-height: 130px; padding: 12px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; outline: 0; line-height: 1.7; }
.answer-form textarea:focus { border-color: var(--green); }
.answer-form .source-field { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.answer-form input { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; }

.form-page { width: min(calc(100% - 32px), 680px); }
.form-heading { margin-bottom: 22px; }
.editor-form { display: grid; padding: 22px; gap: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.editor-form label { display: grid; gap: 7px; font-size: 12px; font-weight: 800; }
.editor-form label > span { display: flex; justify-content: space-between; gap: 10px; }
.editor-form small { color: var(--muted); font-weight: 500; }
.editor-form input, .editor-form textarea, .editor-form select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; background: #fff; line-height: 1.6; }
.editor-form textarea { resize: vertical; }
.editor-form input:focus, .editor-form textarea:focus, .editor-form select:focus { border-color: var(--green); }
.form-notice { display: flex; padding: 11px; align-items: flex-start; gap: 8px; color: #5c666b; background: var(--surface-alt); font-size: 11px; line-height: 1.6; }
.form-notice svg { width: 15px; height: 15px; flex: none; }

.empty-state { padding: 48px 20px; border: 1px dashed #bfc8c3; text-align: center; }
.empty-state svg { width: 34px; height: 34px; color: var(--muted); }
.empty-state h2 { margin: 10px 0; font-size: 17px; }
.empty-state button { border: 0; color: var(--green); background: transparent; cursor: pointer; font-weight: 800; }

.notification-list { display: grid; gap: 1px; border: 1px solid var(--line); background: var(--line); }
.notification-item { display: grid; padding: 15px; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; background: #fff; }
.notification-item.unread { background: #f5faf7; }
.notification-icon { display: grid; width: 34px; height: 34px; place-items: center; color: var(--green); background: var(--green-soft); }
.notification-item h3 { margin: 0; font-size: 13px; }
.notification-item p { margin: 4px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.notification-item time { color: #889197; font-size: 9px; }

.profile-page { display: grid; gap: 18px; }
.profile-header { display: flex; padding: 22px; align-items: center; gap: 16px; border: 1px solid var(--line); background: #fff; }
.profile-avatar { width: 72px; height: 72px; }
.profile-identity { min-width: 0; flex: 1; }
.profile-identity h1 { margin: 0; overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.profile-identity p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.profile-id { display: inline-block; margin-top: 6px; color: #84908b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); background: #fff; }
.stat-grid div { padding: 16px 8px; border-right: 1px solid var(--line); text-align: center; }
.stat-grid div:last-child { border-right: 0; }
.stat-grid strong { display: block; font-size: 20px; }
.stat-grid span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.profile-columns { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .7fr); gap: 16px; }
.profile-panel { border: 1px solid var(--line); background: #fff; }
.panel-head { display: flex; min-height: 48px; padding: 0 15px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 14px; }
.profile-list { display: grid; }
.profile-list button, .profile-row { display: flex; min-height: 48px; padding: 10px 15px; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.profile-list button { cursor: pointer; }
.profile-list button:last-child, .profile-row:last-child { border-bottom: 0; }
.profile-list strong { font-size: 12px; }
.profile-list small { color: var(--muted); font-size: 10px; }
.reward-balance { padding: 18px; }
.reward-balance strong { display: block; font-size: 26px; }
.reward-balance p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }

.app-dialog { width: min(620px, calc(100% - 24px)); max-height: min(86vh, 760px); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(20, 31, 34, 0.46); }
.dialog-shell { display: grid; max-height: min(86vh, 760px); grid-template-rows: auto minmax(0, 1fr); background: #fff; }
.dialog-head { display: flex; min-height: 58px; padding: 0 16px; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-head p { margin: 2px 0 0; color: var(--muted); font-size: 10px; }
.dialog-body { padding: 18px; overflow-y: auto; }
.dialog-section { padding: 15px 0; border-bottom: 1px solid var(--line); }
.dialog-section:first-child { padding-top: 0; }
.dialog-section:last-child { padding-bottom: 0; border-bottom: 0; }
.dialog-section h3 { margin: 0 0 9px; font-size: 14px; }
.dialog-section p { margin: 0; color: #465159; font-size: 12px; line-height: 1.75; white-space: pre-wrap; }
.step-list { display: grid; margin: 0; padding: 0; gap: 8px; list-style: none; counter-reset: step; }
.step-list li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 9px; color: #354149; font-size: 12px; line-height: 1.65; counter-increment: step; }
.step-list li::before { content: counter(step); display: grid; width: 22px; height: 22px; place-items: center; color: var(--green); background: var(--green-soft); font-size: 10px; font-weight: 900; }
.dialog-actions { display: flex; margin-top: 16px; flex-wrap: wrap; gap: 8px; }
.campus-options, .avatar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.campus-options button { min-height: 46px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }
.avatar-option { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; border: 2px solid transparent; border-radius: 6px; background: var(--surface-alt); cursor: pointer; }
.avatar-option.is-active { border-color: var(--green); }
.avatar-option img { width: 100%; height: 100%; object-fit: cover; }
.search-results { display: grid; gap: 18px; }
.result-group h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; }
.result-list { display: grid; border: 1px solid var(--line); }
.result-list button, .result-link { display: flex; min-height: 48px; padding: 10px 12px; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; }
.result-list > :last-child { border-bottom: 0; }
.result-list strong { display: block; font-size: 12px; }
.result-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.major-result { padding: 14px; border: 1px solid var(--line); background: #fff; }
.major-result h3 { margin: 0 0 5px; font-size: 14px; }
.major-result p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }

.admin-page { width: min(calc(100% - 32px), 1200px); }
.admin-login { width: min(100%, 420px); margin: 60px auto; padding: 24px; border: 1px solid var(--line); background: #fff; }
.admin-login h1 { margin: 0 0 6px; font-size: 22px; }
.admin-login p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.admin-login form { display: grid; gap: 10px; }
.admin-login input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; outline: 0; }
.admin-toolbar { display: flex; margin-bottom: 18px; align-items: flex-end; justify-content: space-between; gap: 14px; }
.admin-toolbar h1 { margin: 0; font-size: 26px; }
.admin-toolbar p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.admin-toolbar-actions { display: flex; gap: 8px; }
.admin-tabs { display: flex; margin-bottom: 14px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.admin-tabs button { flex: none; min-height: 42px; padding: 0 13px; border: 0; border-bottom: 3px solid transparent; background: transparent; cursor: pointer; font-size: 12px; font-weight: 800; }
.admin-tabs button.is-active { border-bottom-color: var(--green); color: var(--green); }
.admin-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.admin-summary div { padding: 15px; border: 1px solid var(--line); background: #fff; }
.admin-summary strong { display: block; font-size: 22px; }
.admin-summary span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.admin-panel { border: 1px solid var(--line); background: #fff; }
.admin-panel.wide { grid-column: 1 / -1; }
.admin-panel-body { padding: 15px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.admin-table th, .admin-table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.admin-table th { color: var(--muted); font-weight: 800; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.mini-button { min-height: 27px; padding: 0 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; font-size: 10px; font-weight: 800; }
.mini-button.approve { border-color: #a8c4ba; color: var(--green); background: var(--green-soft); }
.mini-button.reject { border-color: #dfb5b0; color: var(--danger); background: var(--red-soft); }
.mode-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-option { display: grid; min-height: 92px; padding: 13px; align-content: start; gap: 5px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; }
.mode-option.is-active { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.mode-option strong { font-size: 13px; }
.mode-option small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.settings-form { display: grid; gap: 13px; }
.settings-form label { display: grid; gap: 6px; font-size: 11px; font-weight: 800; }
.settings-form input, .settings-form textarea { padding: 10px; border: 1px solid var(--line); border-radius: 6px; outline: 0; }
.manual { display: grid; gap: 18px; }
.manual section { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.manual h2 { margin: 0 0 8px; font-size: 15px; }
.manual p, .manual li { color: #465159; font-size: 12px; line-height: 1.75; }
.manual ol, .manual ul { margin: 0; padding-left: 20px; }
.muted-box { padding: 12px; color: var(--muted); background: var(--surface-alt); font-size: 11px; line-height: 1.7; }
.commercial-archive { display: grid; gap: 8px; }
.commercial-item { padding: 13px; border: 1px solid var(--line); }
.commercial-item h3 { margin: 0 0 5px; font-size: 13px; }
.commercial-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; white-space: pre-wrap; }

.site-status-view { display: grid; min-height: 100vh; padding: 24px; place-items: center; background: var(--bg); }
.status-box { width: min(100%, 440px); padding: 30px; border-top: 4px solid var(--green); background: #fff; text-align: center; }
.status-box .status-mark { margin: 0 auto 16px; }
.status-box h1 { margin: 0; font-size: 26px; }
.status-box > p:not(.kicker):not(.status-time) { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.status-time { margin: 14px 0 0; color: #89918e; font-size: 10px; }

.bottom-nav { display: none; }
.toast { position: fixed; z-index: 100; right: 20px; bottom: 24px; max-width: min(360px, calc(100% - 32px)); padding: 11px 14px; opacity: 0; transform: translateY(8px); pointer-events: none; border-radius: 6px; color: #fff; background: #1c292e; font-size: 12px; transition: .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-grid div:nth-child(3) { border-right: 0; }
  .stat-grid div:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .profile-columns { grid-template-columns: 1fr; }
  .admin-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 720px) {
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .page-width, .narrow-page, .form-page, .admin-page { width: min(calc(100% - 24px), var(--page)); }
  .app-main { min-height: calc(100vh - 58px); padding-bottom: 12px; }
  .app-view { padding: 22px 0 34px; }
  .header-inner { width: calc(100% - 24px); height: 58px; gap: 10px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-copy small, .header-search { display: none; }
  .brand-copy strong { font-size: 14px; }
  .header-actions { margin-left: auto; }
  .admin-button span { display: none; }
  .admin-button { width: 38px; padding: 0; justify-content: center; }
  #homeView { padding-top: 0; }
  .home-layout { gap: 22px; }
  .home-cover { min-height: 430px; background-position: 54% 25%; }
  .cover-content { min-height: 430px; padding-top: 28px; padding-bottom: 30px; align-content: end; gap: 13px; }
  .home-intro { align-items: center; }
  .home-cover .home-intro { display: block; }
  .home-intro h1, .page-heading h1, .form-heading h1 { font-size: 25px; }
  .home-cover .home-intro h1 { max-width: 245px; font-size: 29px; line-height: 1.3; }
  .home-cover .campus-select { margin-top: 12px; }
  .cover-label { font-size: 12px; }
  .campus-select { max-width: 130px; }
  .campus-select span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main-search { height: 52px; padding-left: 13px; }
  .main-search input { padding-inline: 10px; font-size: 14px; }
  .main-search button { padding-inline: 17px; font-size: 12px; }
  .search-hints { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .search-hints button { flex: none; }
  .tool-grid, .tool-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .tool-card, .tool-grid.compact .tool-card { min-height: 99px; padding: 10px 7px; justify-items: center; gap: 6px; text-align: center; }
  .tool-icon { width: 32px; height: 32px; }
  .tool-card strong { font-size: 11px; }
  .tool-card small, .tool-source { display: none; }
  .freshman-strip { display: block; padding: 18px; }
  .freshman-actions { margin-top: 14px; justify-content: flex-start; }
  .freshman-actions button { flex: 1 1 calc(33.333% - 6px); padding: 0 7px; font-size: 10px; }
  .split-heading { align-items: center; }
  .desktop-ask { display: none; }
  .question-item { padding: 13px; }
  .question-item h3 { font-size: 14px; }
  .question-rank { min-width: 38px; }
  .question-header { padding: 17px; }
  .question-header h1 { font-size: 21px; }
  .answer-card, .answer-form { padding: 15px; }
  .editor-form { padding: 17px; }
  .profile-header { padding: 17px; align-items: flex-start; }
  .profile-avatar { width: 60px; height: 60px; }
  .profile-header .secondary-button { padding: 0 10px; }
  .stat-grid strong { font-size: 17px; }
  .stat-grid div { padding: 13px 5px; }
  .app-dialog { width: 100%; max-width: none; max-height: 100vh; height: 100vh; margin: 0; border: 0; border-radius: 0; }
  .dialog-shell { max-height: 100vh; height: 100vh; }
  .dialog-body { padding: 16px; }
  .campus-options { grid-template-columns: repeat(2, 1fr); }
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .bottom-nav { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: grid; height: calc(62px + env(safe-area-inset-bottom)); padding: 5px 10px env(safe-area-inset-bottom); grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: rgba(255,255,255,0.98); }
  .bottom-nav button { display: grid; min-width: 0; padding: 3px; place-items: center; gap: 2px; border: 0; color: #687279; background: transparent; cursor: pointer; font-size: 9px; }
  .bottom-nav button.is-active { color: var(--green); }
  .bottom-nav svg { width: 20px; height: 20px; }
  .bottom-nav .ask-nav { width: 44px; height: 44px; margin: -15px auto 0; align-self: center; border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 5px 14px rgba(29,79,74,.24); }
  .bottom-nav .ask-nav svg { width: 24px; height: 24px; }
  .admin-toolbar { display: block; }
  .admin-toolbar-actions { margin-top: 12px; }
  .admin-summary { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-panel.wide { grid-column: auto; }
  .admin-table { min-width: 660px; }
  .admin-panel-body.table-scroll { overflow-x: auto; }
  .mode-options { grid-template-columns: 1fr; }
  .toast { right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .tool-grid, .tool-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .freshman-actions button { flex-basis: 100%; }
  .question-item { grid-template-columns: 1fr; }
  .question-rank { text-align: left; }
  .profile-identity h1 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
