:root {
  color-scheme: light;
  --ink: #243034;
  --muted: #68777d;
  --line: #d9e1e4;
  --paper: #ffffff;
  --soft: #f4f7f6;
  --brand: #1f6f8b;
  --brand-dark: #144d61;
  --warm: #b85c38;
  --green: #3f7c53;
  --gold: #c6922e;
  --blue-soft: #e7f2f5;
  --warm-soft: #fff1ea;
  --green-soft: #edf6ef;
  --gold-soft: #fff7df;
  --danger: #9f3232;
  --glass: rgba(255, 255, 255, .88);
  --glass-strong: rgba(255, 255, 255, .94);
  --shadow: 0 18px 48px rgba(18, 56, 40, .18);
  --photo-overlay: linear-gradient(90deg, rgba(10, 44, 31, .78), rgba(22, 76, 57, .44) 42%, rgba(246, 250, 244, .72));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  line-height: 1.65;
}

body:has(.app-shell) {
  overflow: hidden;
  background:
    var(--photo-overlay),
    url("/static/campus-bg-web.jpg") center / cover fixed no-repeat;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(115deg, rgba(9, 58, 39, .9), rgba(36, 96, 61, .5)),
    url("/static/campus-bg-web.jpg") center / cover fixed no-repeat;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: 0; margin-top: 0; }
h1 { color: var(--brand-dark); font-size: clamp(30px, 4vw, 44px); line-height: 1.15; margin-bottom: 8px; }
h2 { color: var(--brand-dark); font-size: 22px; margin-bottom: 12px; }
h3 { color: var(--ink); font-size: 18px; margin-bottom: 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  background: linear-gradient(90deg, rgba(6, 45, 29, .1), rgba(255, 255, 255, .14));
}

.side-nav {
  background: linear-gradient(180deg, rgba(8, 69, 43, .94), rgba(13, 82, 54, .86));
  color: #fff;
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 16px 0 36px rgba(10, 39, 26, .16);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 900;
  margin-bottom: 30px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .1);
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 900;
  overflow: hidden;
  position: relative;
  flex: 0 0 auto;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 2px;
}
.brand-mark img:not([hidden]) + span {
  display: none;
}

.side-nav a {
  display: flex;
  align-items: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 9px 12px;
  color: #e6f3e9;
  margin-bottom: 7px;
  border: 1px solid transparent;
}

.side-nav a.active,
.side-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .2);
  text-decoration: none;
}

.main-area {
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: linear-gradient(180deg, rgba(250, 253, 248, .16), rgba(250, 253, 248, .68));
}

.public-topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.public-info-bar {
  min-height: 36px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 6px 20px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.activity-marquee {
  overflow: hidden;
  border-bottom: 1px solid #cfe1e7;
  background: var(--gold-soft);
  color: #654719;
}

.marquee-track {
  width: max-content;
  min-width: 100%;
  padding: 8px 20px;
  white-space: nowrap;
  font-weight: 800;
  animation: marquee 22s linear infinite;
}

@keyframes marquee {
  from { transform: translateX(100%); }
  to { transform: translateX(-100%); }
}

.public-nav {
  max-width: 1120px;
  margin: 0 auto;
  min-height: 70px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.public-nav .brand { color: var(--brand-dark); margin: 0; }
.public-nav .brand-mark { background: var(--brand); color: #fff; }

.nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-links a {
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
}
.nav-links a.active { background: var(--blue-soft); color: var(--brand-dark); }

.public-contact {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 28px;
  text-align: center;
}

.article-share-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 1px solid #cfe1e7;
  border-radius: 8px;
  background: var(--blue-soft);
  padding: 16px;
  margin-top: 20px;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 24px 64px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
}

.page > .page-head:first-child {
  min-height: 190px;
  align-items: flex-end;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .44);
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(9, 58, 39, .88), rgba(36, 96, 61, .58) 48%, rgba(255, 255, 255, .3)),
    url("/static/campus-bg-web.jpg") center 42% / cover no-repeat;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.page > .page-head:first-child h1 {
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, .24);
}
.page > .page-head:first-child .muted {
  max-width: 660px;
  color: rgba(255, 255, 255, .88);
}
.page > .page-head:first-child .primary {
  background: #f0d832;
  border-color: #f0d832;
  color: #173d2b;
  box-shadow: 0 12px 28px rgba(18, 56, 40, .22);
}

.notice {
  border: 1px solid #cfe1e7;
  background: var(--blue-soft);
  color: var(--brand-dark);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(100%, 430px);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 8px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card .brand {
  color: var(--brand-dark);
  background: rgba(31, 111, 139, .1);
}

.login-form {
  display: grid;
  gap: 14px;
  margin: 22px 0 14px;
}

.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid.two { grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-row { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; margin-top: 22px; align-items: start; }

.panel,
.metric,
.list-card,
.source-card,
.article-shell,
.war-room-card {
  background: var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(18, 56, 40, .08);
  backdrop-filter: blur(8px);
}

.panel { padding: 20px; }

.metric {
  padding: 18px;
  min-height: 112px;
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--brand);
}
.metric strong { display: block; margin-top: 8px; color: var(--brand-dark); font-size: 42px; line-height: 1; }
.metric.warm { background: rgba(255, 241, 234, .94); }
.metric.warm::before { background: var(--warm); }
.metric.green { background: rgba(237, 246, 239, .94); }
.metric.green::before { background: var(--green); }
.metric.gold { background: rgba(255, 247, 223, .94); }
.metric.gold::before { background: var(--gold); }

.list { display: grid; gap: 12px; }
.list-card,
.source-card {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: transform .16s ease, box-shadow .16s ease;
}
.list-card:hover,
.source-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(18, 56, 40, .13);
}
.source-card.compact { align-items: flex-start; }
.list-card p, .source-card p { color: var(--muted); margin-bottom: 0; }
.list-main { min-width: 0; }
.list-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 13px;
  background: var(--blue-soft);
  color: var(--brand-dark);
}
.tag.warm { background: var(--warm-soft); color: var(--warm); }
.status.draft { background: var(--warm-soft); color: var(--warm); }
.status.published { background: var(--green-soft); color: var(--green); }
.status.archived { background: #eceff1; color: #59656a; }

.button,
button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.button.primary, button.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 800; }
.button.ghost, button.ghost { background: #fff; }
.button.danger, button.danger { border-color: #efc4c4; color: var(--danger); background: #fff7f7; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

.empty { border: 1px dashed #c8d2d6; border-radius: 8px; padding: 18px; color: var(--muted); background: #fff; }

.review-top {
  background: var(--warm-soft);
  border: 1px solid #ffd6c3;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 18px;
}
.review-note {
  background: var(--warm-soft);
  border: 1px solid #ffd6c3;
  border-radius: 8px;
  padding: 12px;
  color: #744022;
  margin-bottom: 14px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
label { color: var(--brand-dark); font-size: 14px; font-weight: 800; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}
textarea { min-height: 92px; resize: vertical; }
textarea.body { min-height: 300px; }
textarea.post { min-height: 126px; }
textarea.panel-text { min-height: 90px; }

.share-block { display: grid; gap: 12px; }
.share-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.public-page {
  background:
    linear-gradient(180deg, rgba(250, 253, 248, .92), rgba(250, 253, 248, .82)),
    url("/static/campus-bg-web.jpg") center / cover fixed no-repeat;
  min-height: 100vh;
}
.article-layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 42px 20px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: start;
}
.article-shell { padding: 38px 42px; background: rgba(255, 255, 255, .94); }
.article-body { font-size: 17px; }
.article-body h2 { margin-top: 28px; }
.article-body ul { padding-left: 22px; }
.source-box {
  background: var(--warm-soft);
  border: 1px solid #ffd6c3;
  border-radius: 8px;
  padding: 14px;
  margin: 24px 0;
}
.reader-side { position: sticky; top: 92px; display: grid; gap: 14px; }
.reader-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.extension-section {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  padding-top: 26px;
}
.section-title { display: flex; justify-content: space-between; gap: 14px; align-items: start; }
.comic-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.comic-panel-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.comic-panel-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}
.comic-panel-card figcaption {
  min-height: 118px;
  padding: 14px 16px 16px;
}
.comic-panel-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand);
}
.comic-panel-card p { margin: 0; color: var(--ink); }
.comic-custom {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.comic-custom img {
  display: block;
  width: 100%;
  max-height: 880px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.comic-caption-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.comic-caption-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.comic-caption-list strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
}
.comic-caption-list span { color: var(--ink); }
.admin-comic-preview { margin-bottom: 18px; }
.joke-box {
  margin-top: 14px;
  background: var(--gold-soft);
  border: 1px solid #efd58e;
  border-radius: 8px;
  padding: 16px;
}

.footer { padding: 22px 20px; text-align: center; border-top: 1px solid var(--line); background: #fff; color: var(--muted); }

.annotation-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.annotation-widget button,
.annotation-widget textarea,
.annotation-widget input,
.annotation-widget aside,
.annotation-widget form {
  pointer-events: auto;
}
.annotation-toggle,
.annotation-list-toggle {
  box-shadow: 0 10px 26px rgba(20, 77, 97, .18);
}
.annotation-toggle.is-active {
  background: var(--warm);
  border-color: var(--warm);
  color: #fff;
  font-weight: 900;
}
.annotation-composer,
.annotation-drawer {
  width: min(380px, calc(100vw - 36px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(36, 48, 52, .22);
  padding: 16px;
}
.annotation-composer {
  position: absolute;
  right: 0;
  bottom: 50px;
}
.annotation-drawer {
  position: absolute;
  right: 0;
  bottom: 50px;
}
.annotation-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.annotation-items { display: grid; gap: 10px; }
.annotation-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.annotation-item p { margin-bottom: 8px; }
.annotation-item .muted { font-size: 13px; }
body.annotation-mode * {
  cursor: crosshair;
}
body.annotation-mode [data-annotation-widget],
body.annotation-mode [data-annotation-widget] * {
  cursor: auto;
}
.annotation-hover {
  outline: 3px solid rgba(184, 92, 56, .85);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .annotation-widget {
    left: 12px;
    right: 12px;
    bottom: 12px;
    flex-wrap: wrap;
  }
  .annotation-composer,
  .annotation-drawer {
    width: calc(100vw - 24px);
    right: 0;
    bottom: 92px;
  }
}

@media (max-width: 960px) {
  body:has(.app-shell) { overflow: hidden; }
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .side-nav { position: static; height: auto; max-height: 36vh; display: block; }
  .main-area { height: auto; min-height: 0; overflow-y: auto; }
  .side-nav a { display: inline-flex; margin-right: 6px; }
  .grid, .grid.two, .grid.three, .section-row, .form-grid, .article-layout, .comic-strip, .comic-caption-list { grid-template-columns: 1fr; }
  .page-head, .list-card, .source-card { align-items: flex-start; flex-direction: column; }
  .public-info-bar { display: block; text-align: center; }
  .public-info-bar span { display: block; }
  .article-share-strip { display: block; }
  .article-share-strip .primary { margin-top: 10px; }
  .article-shell { padding: 24px 18px; }
  .reader-side { position: static; }
}
