/* 所有布局与交互样式均可独立使用。 */
:root {
  color-scheme: light;
  --canvas: #F2F7FB;
  --surface: #FFFFFF;
  --ink: #1E293B;
  --secondary: #64748B;
  --icon-ink: #475569;
  --icon-surface: #EDF2F7;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 2px 8px rgba(30, 64, 110, 0.04);
  --gutter: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body.sheet-open { position: fixed; inset-inline: 0; width: 100%; overflow: hidden; }
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
input { min-width: 0; }

:focus-visible {
  outline: 2px solid #475569;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell {
  width: 100%;
  margin-inline: auto;
  padding: 0 var(--gutter);
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.hero-banner {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #96D4F6 0%, #BEE7FB 58%, #DFF3FD 100%);
  padding-top: calc(26px + env(safe-area-inset-top));
  padding-bottom: 44px;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 1040px;
  margin-inline: auto;
  pointer-events: none;
  display: block;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.hero-title {
  font-size: 27px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #1E293B;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.92), 0 6px 16px rgba(30, 64, 110, 0.10);
}

.hero-subtitle {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.92);
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(30, 64, 110, 0.06);
}

.content-sheet {
  position: relative;
  z-index: 2;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  margin-top: -22px;
  border-radius: 28px 28px 0 0;
  background: #FAFBFD;
  box-shadow: 0 -4px 20px rgba(30, 64, 110, 0.06);
}

.icon-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--icon-surface);
  color: var(--icon-ink);
  font-size: 19px;
  line-height: 1;
}

.icon-badge svg { width: 19px; height: 19px; }

.search-band {
  position: sticky;
  top: 0;
  top: env(safe-area-inset-top);
  z-index: 20;
  padding: 14px 0 10px;
  border-radius: 28px 28px 0 0;
  background: rgba(250, 251, 253, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 4px 0 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.search-field:focus-within { border-color: #629BC3; }
.search-icon { display: grid; place-items: center; flex: 0 0 auto; color: var(--secondary); }
.search-icon svg { width: 19px; height: 19px; }

.search-field input {
  flex: 1;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.search-field input::placeholder { color: var(--secondary); opacity: 1; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-key { display: none; }

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--secondary);
  font-size: 24px;
  line-height: 1;
}

.press {
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 180ms ease,
    border-color 180ms ease, background-color 180ms ease;
}

.press:active { transform: scale(0.94); }
.press:disabled:active { transform: none; }

.main-content { flex: 1 0 auto; padding-top: 13px; padding-bottom: 38px; }
.main-content h2 { font-size: 17px; line-height: 1.4; font-weight: 720; letter-spacing: -0.015em; }

.recent-section { margin-bottom: 22px; }

.recent-placeholder {
  padding: 9px 12px;
  border-radius: 14px;
  background: #F1F6FA;
  border: 1px solid rgba(15, 23, 42, 0.05);
  color: #64748B;
  font-size: 11.5px;
  line-height: 1.5;
}

.recent-placeholder strong { color: var(--icon-ink); font-weight: 600; }
.recent-heading, .search-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recent-heading { margin-bottom: 8px; }
.recent-heading h2 { font-size: 13px; }
.recent-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.recent-chip {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 6px 8px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 2px 6px rgba(30, 64, 110, 0.035);
  font-size: 12px;
  font-weight: 600;
  color: #1F2937;
  text-align: left;
  cursor: pointer;
}

.recent-mini-tile {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.recent-mini-tile svg { width: 22px; height: 22px; display: block; }
.recent-arrow { display: none; flex: 0 0 auto; color: #8893A4; }
.recent-arrow svg { display: block; width: 13px; height: 13px; }

.text-button {
  min-height: 36px;
  padding: 4px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 600;
}

.recent-heading .text-button, .search-status .text-button { margin-right: -8px; }
.search-status { margin: -4px 0 10px; color: var(--secondary); font-size: 13px; }

.category-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  overflow-x: auto;
  margin-top: 10px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: 14px;
  background: #EEF3F8;
  -webkit-overflow-scrolling: touch;
}

.hide-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

.category-tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #64748B;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.category-tab[aria-selected="true"] {
  background: #FFFFFF;
  color: #1E293B;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.category-tab:focus-visible { outline-offset: -3px; }
#category-tabs[hidden] + #campus-panel { margin-top: 11px; }
.campus-grid, .benefits-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.app-card {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 12px 6px 11px;
  border-radius: 20px;
  background: #FFFFFF;
  border: 1px solid rgba(15, 23, 42, 0.055);
  box-shadow: var(--shadow);
  text-align: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.app-card:disabled { cursor: default; }
.card-tile-wrap { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; }

.mascot-tile {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  background-color: #EDF2F7;
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.8), 0 4px 10px rgba(30, 58, 95, 0.06);
}

.mascot-tile svg { width: 54px; height: 54px; display: block; }
.mascot-tile.sheet-mascot { width: 56px; height: 56px; border-radius: 18px; }
.sheet-mascot svg { width: 46px; height: 46px; }
.emoji-icon { font-size: 30px; line-height: 1; display: inline-block; }
.recent-mini-tile .emoji-icon { font-size: 16px; }

.tone-sky { background-color: #E3F2FD; }
.tone-mint { background-color: #E2F6EC; }
.tone-lavender { background-color: #EFEAFF; }
.tone-periwinkle { background-color: #E6EEFF; }
.tone-butter { background-color: #FFF5D4; }
.tone-peach { background-color: #FFECE2; }
.tone-teal { background-color: #E0F5F4; }
.tone-sand { background-color: #FBF0DF; }
.tone-rose { background-color: #FDEBF1; }
.tone-pistachio { background-color: #ECF7DF; }
.tone-cream { background-color: #FFF3E4; }
.tone-cloud { background-color: #EDF2F7; }

.card-badges {
  position: absolute;
  top: -5px;
  right: -2px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  max-width: 100%;
  pointer-events: none;
}

.campus-badge, .card-cat-badge {
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 9.5px;
  line-height: 1.35;
  font-weight: 600;
  white-space: nowrap;
}

.campus-badge {
  background: rgba(255, 255, 255, 0.94);
  color: #475569;
  border: 1px solid rgba(15, 23, 42, 0.09);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.06);
}

.card-cat-badge {
  background: rgba(239, 246, 255, 0.95);
  color: #0284C7;
  border: 1px solid rgba(2, 132, 199, 0.16);
}

.truncate {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title { margin-top: 8px; font-size: 13px; line-height: 1.35; font-weight: 700; color: #1F2937; }
.card-desc { margin-top: 2px; font-size: 11px; line-height: 1.35; color: #8893A4; }

.benefits-section { margin-top: 31px; padding-top: 21px; border-top: 1px solid var(--border); }
.campus-section[hidden] + .benefits-section { margin-top: 0; padding-top: 0; border-top: 0; }
.section-subtitle { margin-top: 3px; color: var(--secondary); font-size: 12px; }
.benefits-section .card-grid { margin-top: 13px; }

.notice, .empty-state { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); }
.notice { padding: 14px; color: var(--secondary); }
.empty-state { display: grid; justify-items: center; gap: 10px; padding: 26px 16px 18px; text-align: center; }
.empty-state p { color: var(--icon-ink); overflow-wrap: anywhere; }

.site-footer {
  padding-top: 15px;
  padding-bottom: 22px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 12px;
}

.feedback-link { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; color: var(--icon-ink); font-weight: 600; }
.feedback-link svg { width: 13px; height: 13px; }
.site-footer p { max-width: 680px; line-height: 1.65; }

.footer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 8px; }
.cache-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.cache-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #CBD5E1;
  flex: 0 0 auto;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.cache-dot.is-active { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18); }

.sheet-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  background: rgba(17, 24, 39, 0.36);
  transition: opacity 200ms ease, visibility 0s linear 240ms;
}

.sheet-overlay.is-open { visibility: visible; opacity: 1; transition-delay: 0s; }

.sheet {
  position: relative;
  width: 100%;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 26px 19px 22px;
  padding-left: max(19px, env(safe-area-inset-left));
  padding-right: max(19px, env(safe-area-inset-right));
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: 0 12px 45px rgba(15, 23, 42, 0.17);
  transform: translateY(100%);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.is-open .sheet { transform: none; }
.sheet-handle { position: absolute; top: 9px; left: 50%; width: 34px; height: 4px; border-radius: 4px; background: #CBD5E1; transform: translateX(-50%); }
.sheet-close { position: absolute; top: 15px; right: 9px; right: max(9px, env(safe-area-inset-right)); }
.sheet-heading { display: flex; align-items: center; gap: 10px; padding-right: 39px; }
.sheet-heading h2 { font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }

.kouling-box {
  margin: 16px 0 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--canvas);
  color: var(--icon-ink);
  font: 13px/1.6 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  -webkit-user-select: all;
  user-select: all;
}

.copy-button, .sheet-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  font-size: 14px;
  font-weight: 650;
}

.copy-button { background: var(--ink); color: #fff; }
.copy-button:disabled { opacity: 0.55; }
.copy-button svg, .sheet-link svg { width: 16px; height: 16px; }
.sheet-link { margin-top: 8px; background: var(--surface); color: var(--icon-ink); }
.usage-tip { margin-top: 11px; color: var(--secondary); font-size: 12px; line-height: 1.65; }
.sheet-heading-text { min-width: 0; }

.cache-toggle-row {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #F4F8FB;
  border: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cache-toggle-copy { display: grid; gap: 3px; min-width: 0; }
.cache-toggle-label { font-size: 14px; font-weight: 650; }
.cache-toggle-hint { font-size: 12px; color: var(--secondary); }

.cache-switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  flex: 0 0 auto;
  width: 50px;
  height: 28px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: #CBD5E1;
  font-size: 0;
  color: transparent;
  overflow: hidden;
  transition: background-color 200ms ease, transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cache-switch::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22);
  transform: translateX(0);
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cache-switch[aria-checked="true"] { background: #10B981; }
.cache-switch[aria-checked="true"]::after { transform: translateX(22px); }

.cache-meta-list {
  margin-top: 12px;
  padding: 2px 14px;
  border-radius: 16px;
  background: #F8FAFC;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.cache-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.055);
  font-size: 13px;
}

.cache-meta-row:last-child { border-bottom: 0; }
.cache-meta-label { color: #64748B; }
.cache-meta-value { color: #1E293B; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.cache-clear-button {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: #FFF5F5;
  color: #DC2626;
  font-size: 14px;
  font-weight: 650;
}

.copy-fallback {
  position: fixed;
  top: 0;
  left: -4000px;
  opacity: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  font-size: 16px;
}

.toast {
  position: fixed;
  z-index: 60;
  top: 14px;
  top: calc(14px + env(safe-area-inset-top));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 28px);
  padding: 8px 13px;
  border-radius: 20px;
  background: var(--ink);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.15);
  color: #fff;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (hover: hover) {
  .search-key {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-right: 7px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--canvas);
    color: var(--secondary);
    font-size: 12px;
  }

  .app-card:not(:disabled):hover:not(:active), .recent-chip:hover:not(:active) {
    transform: translateY(-2px);
    border-color: rgba(30, 64, 110, 0.13);
    box-shadow: 0 5px 14px rgba(30, 64, 110, 0.09);
  }

  .icon-button:hover, .text-button:hover, .sheet-link:hover { background: var(--icon-surface); color: var(--ink); }
  .category-tab:not([aria-selected="true"]):hover { background: rgba(255, 255, 255, 0.55); color: var(--ink); }
  .copy-button:not(:disabled):hover { background: #293141; }
  .feedback-link:hover { text-decoration: underline; }
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .hero-banner { padding-top: calc(36px + env(safe-area-inset-top)); padding-bottom: 52px; }
  .hero-title { font-size: 34px; }
  .main-content { padding-top: 16px; padding-bottom: 44px; }
  .recent-arrow { display: inline-flex; margin-left: auto; }
  .campus-grid, .benefits-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .app-card { padding: 14px 10px 13px; }
  .mascot-tile:not(.sheet-mascot) { width: 72px; height: 72px; border-radius: 22px; }
  .mascot-tile:not(.sheet-mascot) svg { width: 60px; height: 60px; }
  .card-title { font-size: 14px; }
  .card-desc { font-size: 12px; }
  .sheet-overlay { align-items: center; padding: 22px; }
  .sheet { max-width: 448px; padding: 27px 23px 23px; border-radius: 24px; transform: translateY(12px); }
  .sheet-close { top: 14px; right: 12px; }
}

@media (min-width: 768px) {
  .content-sheet {
    width: 100%;
    max-width: 960px;
    margin-inline: auto;
    margin-bottom: 28px;
    border-radius: 28px;
    box-shadow: 0 10px 32px rgba(30, 64, 110, 0.07);
  }
}

@media (min-width: 1024px) {
  .hero-art { mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
  .campus-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
}

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