:root {
  --front-canvas: #f2f3f1;
  --front-paper: #fdfdfb;
  --front-paper-soft: #e7e9e6;
  --front-ink: #191b1a;
  --front-muted: #666b68;
  --front-red: #8c0000;
  --front-red-deep: #620000;
  --work-red: var(--front-red);
  --work-red-deep: var(--front-red-deep);
  --front-cinnabar: #a33a32;
  --front-cloud: #aeb2ae;
  --front-green: #3f5550;
  --front-shadow: 0 12px 34px rgba(25, 27, 26, 0.07);
  --front-shell-max: 1600px;
  --front-shell: min(var(--front-shell-max), calc(100% - 96px));
  --front-soft: #fff6f4;
  --front-tint: #f7eeee;
  --front-wash: #fffaf8;
  --sticky-paper: #f7f6f3;
  --sticky-paper-deep: #f1efea;
  --sticky-border: rgba(90, 92, 88, 0.16);
  --sticky-ink: #2a2c2a;
  --sticky-muted: #6d716c;
  --pin-core: var(--front-red);
  --pin-rim: var(--front-red-deep);
  --entry-tone-red-bg: linear-gradient(180deg, var(--front-wash), var(--front-soft));
  --entry-tone-red-border: color-mix(in srgb, var(--front-red) 22%, transparent);
  --entry-tone-amber-bg: linear-gradient(180deg, #faf8f3, #f3eee4);
  --entry-tone-amber-border: rgba(150, 120, 60, 0.2);
  --entry-tone-green-bg: linear-gradient(180deg, #f5f8f5, #eaf1eb);
  --entry-tone-green-border: rgba(70, 120, 80, 0.2);
  --entry-tone-blue-bg: linear-gradient(180deg, #f4f7fb, #e8eef6);
  --entry-tone-blue-border: rgba(70, 100, 150, 0.2);
  --entry-tone-violet-bg: linear-gradient(180deg, #f7f5fa, #eee8f4);
  --entry-tone-violet-border: rgba(110, 80, 140, 0.2);
}

/* Browser 100% should match the old 125% look. No CSS zoom — it clips left/right. */
html:has(body[data-page="home"]),
html:has(body[data-page="module"]),
html:has(body[data-page="article"]),
html:has(body[data-page="submission"]) {
  font-size: 20px;
}

html:has(body[data-page="home"]),
body[data-page="home"] {
  overflow-x: clip;
}

body[data-auth-required="true"]:not([data-auth-state="ready"]) > * {
  visibility: hidden;
}

body[data-auth-required="true"]:not([data-auth-state="ready"]) .topbar,
body[data-auth-required="true"]:not([data-auth-state="ready"]) .reader-header {
  visibility: visible;
}

body[data-page="home"][data-auth-required="true"]:not([data-auth-state="ready"]) > * {
  visibility: visible;
}

body[data-page="home"] {
  --module-accent: var(--front-red);
  background: #f6f6f4;
  color: var(--front-ink);
}

body[data-page="module"],
body[data-page="submission"] {
  --module-accent: var(--front-red);
  background:
    linear-gradient(90deg, rgba(25, 27, 26, 0.025) 1px, transparent 1px) 0 0 / 86px 100%,
    var(--front-canvas);
  color: var(--front-ink);
}

body[data-page="module"][data-module="note"] {
  --module-accent: var(--front-cinnabar);
}

body[data-page="module"][data-module="qa"] {
  --module-accent: var(--front-red);
}

body[data-page="home"]::before,
body[data-page="module"]::before,
body[data-page="submission"]::before {
  display: none;
}

body[data-page="home"] .site-shell,
body[data-page="module"] .site-shell,
body[data-page="submission"] .site-shell {
  width: var(--front-shell);
}

body[data-page="home"] .topbar,
body[data-page="module"] .topbar,
body[data-page="submission"] .topbar {
  min-height: 84px;
  padding: 12px 0 10px;
  background: rgba(253, 253, 251, 0.94);
  box-shadow:
    0 1px 0 rgba(25, 27, 26, 0.07),
    0 0 0 100vmax rgba(253, 253, 251, 0.94);
  clip-path: inset(0 -100vmax);
  backdrop-filter: blur(18px);
  align-items: center;
}

body[data-page="home"] .topbar::before,
body[data-page="module"] .topbar::before,
body[data-page="submission"] .topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: calc(50% - 50vw);
  width: 100vw;
  height: 3px;
  background: linear-gradient(90deg, var(--front-red) 0 34%, var(--front-ink) 34% 42%, #c8cbc8 42% 100%);
}

body[data-page="home"] .brand,
body[data-page="module"] .brand,
body[data-page="submission"] .brand {
  gap: 0;
}

body[data-page="home"] .logo-plate,
body[data-page="module"] .logo-plate {
  width: 238px;
  height: 58px;
  padding: 0;
  border: 0;
  background: transparent;
}

body[data-page="home"] .brand-copy,
body[data-page="module"] .brand-copy {
  display: none;
}

body[data-page="home"] .topnav,
body[data-page="module"] .topnav {
  gap: 22px;
  padding: 0;
  background: transparent;
}

.site-title {
  position: static;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: none;
  height: 78px;
  flex: 0 0 auto;
  margin: 0;
  padding-left: 0;
  border-left: 0;
  overflow: visible;
  transform: none;
  color: var(--front-ink);
  text-decoration: none;
  white-space: nowrap;
}

.versabase-copy {
  width: auto;
  max-width: none;
  display: grid;
  flex: 0 0 auto;
  justify-items: start;
  align-content: center;
  gap: 1px;
}

.site-title .versabase-cn {
  display: block;
  width: auto;
  height: 42px;
  max-width: none;
  object-fit: contain;
  object-position: left center;
  transform: none;
}

.site-title .versabase-en {
  display: block;
  width: auto;
  height: 14px;
  max-width: none;
  margin-top: 0;
  object-fit: contain;
  object-position: left center;
}

.versabase-copy small {
  display: none;
  padding-left: 1px;
  margin-top: 0;
  color: var(--front-red, #8c0000);
  font-family: "Times New Roman", Times, Georgia, serif;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.04em;
  transform: none;
}

.site-title .versabase-mark {
  display: block !important;
  width: auto;
  height: 50px;
  max-width: 78px;
  flex: 0 0 auto;
  margin-left: 0;
  margin: 0;
  align-self: center;
  object-fit: contain;
  object-position: center;
}

/* 院校主题品牌图着色由 appearance.js 用 mask + --front-red 完成 */

body[data-page="home"] .topnav a,
body[data-page="home"] .topnav .topnav-install-link,
body[data-page="module"] .topnav a,
body[data-page="module"] .topnav .topnav-install-link,
body[data-page="submission"] .topnav a,
body[data-page="submission"] .topnav .topnav-install-link,
.reader-header nav a,
.reader-header nav .topnav-install-link {
  position: relative;
  min-height: 42px;
  padding: 0 2px;
  border: 0;
  outline: none;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
  color: #4d524f;
  font: inherit;
  font-weight: 700;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

body[data-page="home"] .topnav a::after,
body[data-page="home"] .topnav .topnav-install-link::after,
body[data-page="module"] .topnav a::after,
body[data-page="module"] .topnav .topnav-install-link::after,
body[data-page="submission"] .topnav a::after,
body[data-page="submission"] .topnav .topnav-install-link::after,
.reader-header nav a::after,
.reader-header nav .topnav-install-link::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: 4px;
  left: 50%;
  height: 2px;
  background: var(--front-red);
  transition: right 160ms ease, left 160ms ease;
}

body[data-page="home"] .topnav a:hover,
body[data-page="home"] .topnav a.active,
body[data-page="home"] .topnav .topnav-install-link:hover,
body[data-page="module"] .topnav a:hover,
body[data-page="module"] .topnav a.active,
body[data-page="module"] .topnav .topnav-install-link:hover,
body[data-page="submission"] .topnav a:hover,
body[data-page="submission"] .topnav a.active,
body[data-page="submission"] .topnav .topnav-install-link:hover,
.reader-header nav a:hover,
.reader-header nav .topnav-install-link:hover {
  background: transparent;
  color: var(--front-red-deep);
}

body[data-page="home"] .topnav a:hover::after,
body[data-page="home"] .topnav a.active::after,
body[data-page="home"] .topnav .topnav-install-link:hover::after,
body[data-page="module"] .topnav a:hover::after,
body[data-page="module"] .topnav a.active::after,
body[data-page="module"] .topnav .topnav-install-link:hover::after,
body[data-page="submission"] .topnav a:hover::after,
body[data-page="submission"] .topnav a.active::after,
body[data-page="submission"] .topnav .topnav-install-link:hover::after,
.reader-header nav a:hover::after,
.reader-header nav .topnav-install-link:hover::after {
  right: 0;
  left: 0;
}

body[data-page="home"] .front-hero {
  min-height: 0;
  align-items: stretch;
  margin-top: 0;
  padding-top: 20px;
  padding-bottom: 28px;
  background: none;
}

body[data-page="module"] .module-page-hero {
  min-height: 244px;
  align-items: center;
  margin-top: 0;
  padding-top: 38px;
  padding-bottom: 34px;
  background:
    radial-gradient(ellipse at 92% 0%, rgba(174, 178, 174, 0.18), transparent 34%),
    linear-gradient(108deg, #fdfdfb 0%, #f8f9f7 66%, #eceeec 100%);
}

body[data-page="home"] .front-hero::before,
body[data-page="module"] .module-page-hero::before,
body[data-page="module"][data-module="note"] .module-page-hero::before,
body[data-page="module"][data-module="qa"] .module-page-hero::before,
body[data-page="module"][data-module="talk"] .module-page-hero::before {
  display: none;
}

body[data-page="home"] .cloud-motif-one,
body[data-page="module"] .cloud-motif-one {
  display: none;
}

body[data-page="home"] .front-hero::after {
  display: none;
}

body[data-page="module"] .module-page-hero::after {
  z-index: 0;
  right: max(-96px, calc((100vw - 1440px) / 2 - 28px));
  top: -78px;
  width: 440px;
  height: 270px;
  background: url("./assets/cloud-gray-top.png") right center / contain no-repeat;
  filter: grayscale(1) contrast(0.86);
  opacity: 0.13;
}

body[data-page="home"] .front-hero-copy,
body[data-page="module"] .module-page-hero > div {
  width: min(760px, 64vw);
}

body[data-page="module"][data-module="announcement"] .module-page-hero > .announcement-hero-copy {
  width: auto;
  max-width: 560px;
}

#increment-compose {
  display: inline-flex;
  margin-top: 16px;
}

body[data-page="home"] .notice-strip {
  gap: 0;
  margin-bottom: 19px;
  color: var(--front-muted);
}

body[data-page="home"] .notice-strip span {
  min-height: auto;
  padding: 0 13px;
  border: 0;
  border-radius: 0;
  background: transparent !important;
  color: var(--front-muted) !important;
  font-size: 0.84rem;
  font-weight: 700;
}

body[data-page="home"] .notice-strip span:first-child {
  padding-left: 0;
  color: var(--front-red) !important;
}

body[data-page="home"] .notice-strip span + span {
  border-left: 1px solid #c9ccca;
}

body[data-page="home"] .front-hero h1,
body[data-page="module"] .module-page-hero h1 {
  max-width: 710px;
  margin-bottom: 14px;
  color: var(--front-ink);
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-weight: 800;
  text-wrap: balance;
}

body[data-page="home"] .front-hero h1 {
  font-size: 2.7rem;
  line-height: 1.28;
}

body[data-page="module"] .module-page-hero h1 {
  margin-top: 6px;
  font-size: 2.65rem;
}

body[data-page="home"] .front-hero p,
body[data-page="module"] .module-page-hero p {
  color: #555b58;
  font-size: 1.05rem;
  line-height: 1.72;
}

body[data-page="home"] .eyebrow,
body[data-page="module"] .eyebrow {
  color: var(--module-accent);
  font-size: 0.72rem;
  font-weight: 800;
}

body[data-page="home"] .module-entry-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 28px;
}

body[data-page="home"] .module-entry {
  --entry-accent: var(--front-red);
  position: relative;
  min-height: 166px;
  justify-content: flex-start;
  gap: 7px;
  padding: 23px 24px 21px;
  border: 0;
  border-radius: 6px;
  background: var(--front-paper);
  box-shadow: var(--front-shadow);
  isolation: isolate;
}

body[data-page="home"] .module-entry::before {
  display: none;
}

body[data-page="home"] .module-entry::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -38px;
  bottom: -64px;
  width: 230px;
  height: 140px;
  background: url("./assets/cloud-gray-top.png") center / contain no-repeat;
  filter: grayscale(1);
  opacity: 0.16;
}

body[data-page="home"] .module-entry:hover {
  box-shadow: 0 18px 38px rgba(25, 27, 26, 0.11);
  transform: translateY(-3px);
}

body[data-page="home"] .module-entry span {
  color: var(--entry-accent);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

body[data-page="home"] .module-entry strong {
  margin-top: 14px;
  color: var(--front-ink);
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 1.65rem;
}

body[data-page="home"] .module-entry p {
  max-width: 82%;
  margin-top: 4px;
  color: var(--front-muted);
  font-size: 0.9rem;
}

body[data-page="home"] .module-entry svg {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 18px;
  height: 18px;
  color: #8c918e;
  transition: color 160ms ease, transform 160ms ease;
}

body[data-page="home"] .module-entry:hover svg {
  color: var(--entry-accent);
  transform: translate(2px, -2px);
}

body[data-page="home"] .home-latest,
body[data-page="module"] .module-board {
  margin-bottom: 32px;
  padding: 24px 0 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="home"] .section-heading,
body[data-page="module"] .content-tools {
  padding: 0 2px;
}

body[data-page="home"] .section-heading h2,
body[data-page="module"] .section-heading h2 {
  color: var(--front-ink);
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
}

body[data-page="home"] .section-heading a,
body[data-page="module"] .source-link,
body[data-page="module"] .read-more {
  color: var(--module-accent);
}

body[data-page="home"] .list-item {
  min-height: 112px;
  padding: 19px 22px;
  border: 0;
  border-radius: 6px;
  background: var(--front-paper);
  box-shadow: 0 7px 24px rgba(25, 27, 26, 0.05);
}

body[data-page="home"] .list-item h3,
body[data-page="module"] .content-card h3 {
  color: var(--front-ink);
}

body[data-page="home"] .list-item p,
body[data-page="module"] .content-card p {
  color: var(--front-muted);
}

body[data-page="home"] .date-badge,
body[data-page="module"] .date-badge {
  min-width: 64px;
  align-self: center;
  padding: 8px 0;
  background: transparent;
  color: var(--front-red);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

body[data-page="home"] .chip,
body[data-page="module"] .chip {
  min-height: 25px;
  padding: 3px 8px;
  border: 0;
  border-radius: 4px;
  background: #f0e4e5;
  color: var(--front-red-deep);
  font-size: 0.72rem;
  font-weight: 750;
}

body[data-page="home"] .chip.teal,
body[data-page="module"] .chip.teal {
  background: #e2e9e6;
  color: var(--front-green);
}

body[data-page="home"] .chip.gold,
body[data-page="module"] .chip.gold {
  background: #eee3dc;
  color: #754435;
}

body[data-page="home"] .chip.blue,
body[data-page="module"] .chip.blue {
  background: #e3e7ea;
  color: #46545d;
}

body[data-page="home"] .chip.muted,
body[data-page="module"] .chip.muted {
  background: #e7e9e6;
  color: #5e6461;
}

body[data-page="module"] .module-board {
  margin-top: 0;
}

body[data-page="module"] .control-panel {
  align-items: end;
  margin: 0 0 14px;
  padding: 17px 18px;
  border-radius: 6px;
  background: var(--front-paper-soft);
}

body[data-page="module"] .control-panel-single {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="module"] .announcement-tabs {
  min-width: 292px;
}

body[data-page="module"] .search-line label,
body[data-page="module"] .course-filters label {
  color: #535956;
}

body[data-page="module"] input,
body[data-page="module"] select {
  border: 0;
  border-radius: 5px;
  background: var(--front-paper);
  box-shadow: none;
}

body[data-page="module"] input:focus,
body[data-page="module"] select:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--module-accent) 15%, transparent);
}

body[data-page="module"] .segmented {
  border: 0;
  border-radius: 5px;
  background: #daddda;
}

body[data-page="module"] .segmented button {
  border-radius: 4px;
}

body[data-page="module"] .segmented button.active {
  background: var(--front-paper);
  color: var(--module-accent);
  box-shadow: 0 3px 10px rgba(25, 27, 26, 0.08);
}

body[data-page="module"] .course-filters {
  margin: 0 0 15px;
  padding: 14px 18px;
  border-radius: 6px;
  background: rgba(231, 233, 230, 0.68);
}

body[data-page="module"] .course-filters select {
  background: var(--front-paper);
}

body[data-page="module"] .content-tools {
  margin: 18px 0 12px;
}

.collection-filter-bar {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 17px;
  margin: 2px 0 18px;
  padding: 0 0 12px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(25, 27, 26, 0.09);
  scrollbar-width: thin;
}

.collection-filter-label {
  flex: 0 0 auto;
  color: #929792;
  font-size: 0.72rem;
  font-weight: 700;
}

.collection-filter-bar button,
.collection-filter-bar a {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 4px 0 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #666d68;
  font-size: 0.78rem;
  text-decoration: none;
  white-space: nowrap;
}

.collection-filter-bar button::after,
.collection-filter-bar a::after {
  content: "";
  position: absolute;
  right: 50%;
  bottom: 0;
  left: 50%;
  height: 2px;
  background: var(--module-accent);
  transition: left 150ms ease, right 150ms ease;
}

.collection-filter-bar button:hover,
.collection-filter-bar button.active,
.collection-filter-bar a:hover,
.collection-filter-bar a.active {
  color: var(--module-accent);
}

.collection-filter-bar button.active::after,
.collection-filter-bar a.active::after {
  right: 0;
  left: 0;
}

.collection-filter-bar button small,
.collection-filter-bar a small {
  color: #a0a5a0;
  font-size: 0.62rem;
}

body[data-page="module"] .content-tools p,
body[data-page="module"] .content-tools select {
  color: var(--front-muted);
}

.meta-line {
  align-items: center;
  gap: 6px;
}

.topic-chip,
.verification-chip,
.reader-detail {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 0;
  border-radius: 3px;
  background: #eceeeb;
  color: #5e6661;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.reader-detail::before {
  content: "·";
  margin: 0 7px;
  color: #b0b4b0;
  font-weight: 400;
}

.topic-chip:hover,
.topic-chip:focus-visible {
  color: var(--module-accent, var(--front-red));
  background: #f1e4e4;
  text-decoration: none;
}

.verification-chip {
  color: #879087;
  font-weight: 500;
}

body[data-page="module"] .card-grid {
  gap: 16px;
}

body[data-page="module"] .content-card {
  position: relative;
  min-height: 218px;
  padding: 21px 22px;
  border: 0;
  border-radius: 6px;
  background: var(--front-paper);
  box-shadow: var(--front-shadow);
  overflow: hidden;
}

body[data-page="module"] .content-card::before {
  width: 46px;
  height: 4px;
  margin-bottom: 15px;
  border-radius: 0;
  background: var(--module-accent);
}

body[data-page="module"] .content-card::after {
  content: "";
  position: absolute;
  top: -38px;
  right: -72px;
  width: 240px;
  height: 145px;
  background: url("./assets/cloud-gray-top.png") center / contain no-repeat;
  filter: grayscale(1);
  opacity: 0.055;
  pointer-events: none;
}

body[data-page="module"] .qa-card::before {
  display: none;
}

body[data-page="module"] .qa-card {
  min-height: 204px;
}

.qa-card-heading {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.qa-heading-copy {
  min-width: 0;
}

.qa-program {
  width: auto;
  min-width: 50px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0 9px;
  border-radius: 3px;
  color: #fff;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(98, 0, 0, 0.1);
}

.qa-program-external {
  background: var(--front-red, #8c0000);
}

.qa-program-internal {
  background: var(--front-red-deep, #620000);
}

.qa-program-both {
  background: var(--front-ink);
}

.qa-keywords {
  margin: 9px 0 0;
}

body[data-page="module"] .qa-keywords .chip.gold {
  background: #f2e5e3;
  color: #7c2020;
}

.qa-card > .card-top > .card-excerpt {
  margin-top: 3px;
}

body[data-page="module"] .content-card .card-footer {
  margin-top: auto;
  padding-top: 18px;
  border: 0;
}

body[data-page="module"] .content-card .card-footer small {
  color: #777d79;
}

body[data-page="module"] .submission-entry {
  border-radius: 5px;
  background: var(--front-red);
  box-shadow: 0 7px 18px rgba(101, 0, 14, 0.18);
}

body[data-page="module"] .submission-entry:hover {
  background: var(--front-red-deep);
}

body[data-page="home"] .empty-state,
body[data-page="module"] .empty-state {
  border: 0;
  border-radius: 6px;
  background: var(--front-paper);
  box-shadow: inset 0 0 0 1px rgba(25, 27, 26, 0.04);
}

.reader-body {
  color: var(--front-ink);
  background:
    linear-gradient(90deg, rgba(25, 27, 26, 0.025) 1px, transparent 1px) 0 0 / 86px 100%,
    var(--front-canvas);
}

.reader-header {
  position: relative;
  z-index: 2000;
  overflow: visible;
  max-width: none;
  min-height: 84px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px max(24px, calc((100vw - var(--front-shell-max, 1600px)) / 2));
  background: rgba(253, 253, 251, 0.94);
  box-shadow: 0 1px 0 rgba(25, 27, 26, 0.07);
}

.reader-title-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.reader-title-row .reader-title {
  margin: 0;
}

.reader-title-row .qa-program {
  min-width: 58px;
  height: 32px;
  padding: 0 11px;
  font-size: 0.82rem;
}

.reader-brand {
  width: 238px;
  height: 58px;
  flex: 0 0 238px;
  display: inline-flex;
  align-items: center;
}

.reader-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: left center;
}

.reader-header nav {
  overflow: visible;
  color: #4d524f;
  font-size: 0.9rem;
  font-weight: 700;
}

.reader-header nav a:hover,
.reader-back,
.reader-source a,
.reader-attachment a {
  color: var(--front-red);
}

.reader-main {
  width: min(1025px, calc(100% - 48px));
  margin-top: 44px;
}

.reader-main.qa-reader-main {
  width: min(1400px, calc(100% - 48px));
}

.qa-reader-main .reader-content {
  padding-top: 20px;
  font-size: max(17px, var(--article-size));
}

.qa-reader-main .reader-title {
  font-size: 34px;
}

.reader-meta {
  color: #737a76;
}

.reader-meta .topic-chip,
.reader-meta .verification-chip,
.reader-meta .reader-detail {
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 3px;
}

.reader-meta .reader-detail {
  padding-right: 0;
  padding-left: 0;
  background: transparent;
}

.reader-title {
  color: var(--front-red-deep);
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-weight: 800;
}

@media (max-width: 920px) {
  body[data-page="home"] .module-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="home"] .brand,
  body[data-page="module"] .brand,
  body[data-page="submission"] .brand,
  .reader-brand {
    display: none;
  }

  .site-title {
    display: inline-flex;
    width: auto;
    max-width: calc(100vw - 28px);
    height: auto;
    min-height: 52px;
    flex: 0 0 auto;
    flex-basis: auto;
    margin: 0;
    padding-left: 0;
    gap: 8px;
    order: -1;
    overflow: visible;
    align-items: center;
  }

  .versabase-copy {
    width: auto;
    max-width: min(220px, calc(100vw - 100px));
    flex: 0 1 auto;
    flex-basis: auto;
    gap: 1px;
  }

  .site-title .versabase-cn {
    width: auto;
    max-width: min(220px, calc(100vw - 100px));
    height: 36px;
    transform: none;
    object-fit: contain;
    object-position: left center;
  }

  .site-title .versabase-en {
    width: auto;
    max-width: min(168px, calc(100vw - 140px));
    height: 12px;
  }

  .versabase-copy small {
    display: none;
    font-size: 0.6rem;
    transform: none;
    margin-top: 1px;
  }

  .site-title .versabase-mark {
    display: block !important;
    width: auto;
    height: 42px;
    max-width: 66px;
    flex: 0 0 auto;
    margin: 0;
    align-self: center;
  }

  body[data-page="home"] .front-hero-copy,
  body[data-page="module"] .module-page-hero > div {
    width: min(650px, 70vw);
  }
  body[data-page="module"][data-module="announcement"] .module-page-hero > .announcement-hero-copy {
    width: 100%;
    max-width: none;
  }

  body[data-page="home"] .front-hero::before,
  body[data-page="module"] .module-page-hero::before {
    display: none;
  }

  body[data-page="home"] .front-hero::after {
    display: none;
  }
  body[data-page="module"] .module-page-hero::after {
    right: -100px;
    top: -70px;
    width: 390px;
    opacity: 0.11;
  }
}

@media (max-width: 760px) {
  body[data-page="home"] .site-shell,
  body[data-page="module"] .site-shell {
    width: min(100% - 40px, var(--front-shell-max));
  }

  body[data-page="home"] .topbar,
  body[data-page="module"] .topbar,
  body[data-page="submission"] .topbar {
    min-height: 0;
    height: auto;
    gap: 4px;
    padding: 8px 0 4px;
    justify-content: flex-start;
    align-items: center;
  }

  body[data-page="home"] .brand,
  body[data-page="module"] .brand {
    display: none;
  }

  .site-title {
    width: auto;
    max-width: 100%;
    height: auto;
    min-height: 52px;
    align-self: center;
    align-items: center;
    gap: 6px;
  }

  .versabase-copy {
    width: auto;
    max-width: min(200px, calc(100vw - 96px));
    gap: 1px;
    align-content: center;
  }

  .site-title .versabase-cn {
    width: auto;
    max-width: min(200px, calc(100vw - 96px));
    height: 32px;
    margin: 0;
    object-fit: contain;
    object-position: left center;
  }

  .site-title .versabase-en {
    width: auto;
    max-width: min(150px, calc(100vw - 120px));
    height: 11px;
  }

  .versabase-copy small {
    display: none;
    font-size: 0.6rem;
    line-height: 1;
    margin-top: 1px;
  }

  .site-title .versabase-mark {
    display: block !important;
    width: auto;
    height: 40px;
    max-width: 62px;
    flex: 0 0 auto;
    margin: 0;
    align-self: center;
  }

  body[data-page="home"] .topnav,
  body[data-page="module"] .topnav {
    width: 100%;
    justify-content: flex-start;
    gap: 18px;
    overflow: visible;
    min-height: 0;
    padding: 0;
  }

  body[data-page="home"] .topnav a,
  body[data-page="module"] .topnav a {
    min-height: 28px;
  }

  body[data-page="home"] .front-hero,
  body[data-page="module"] .module-page-hero {
    min-height: 236px;
    padding: 28px 18px 25px;
    background: linear-gradient(135deg, rgba(253, 253, 251, 0.98), rgba(231, 233, 230, 0.94));
  }

  body[data-page="home"] .front-hero-copy,
  body[data-page="module"] .module-page-hero > div {
    width: 100%;
  }

  body[data-page="home"] .front-hero::before,
  body[data-page="module"] .module-page-hero::before {
    display: block;
    top: auto;
    bottom: 0;
    width: 38%;
    height: 5px;
    background: var(--module-accent);
  }

  body[data-page="home"] .front-hero::after {
    display: none;
  }
  body[data-page="module"] .module-page-hero::after {
    right: -68px;
    top: -18px;
    width: 220px;
    height: 132px;
    background-image: url("./assets/cloud-gray-top.png");
    opacity: 0.1;
  }

  body[data-page="home"] .front-hero h1 {
    font-size: 2.05rem;
  }

  body[data-page="module"] .module-page-hero h1 {
    font-size: 2.2rem;
  }

  body[data-page="home"] .notice-strip {
    row-gap: 8px;
  }

  body[data-page="home"] .notice-strip span {
    padding: 0 9px;
    font-size: 0.7rem;
  }

  body[data-page="home"] .notice-strip span:first-child {
    padding-left: 0;
  }

  body[data-page="home"] .module-entry-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 14px 0 24px;
  }

  body[data-page="home"] .module-entry {
    min-height: 126px;
    padding: 18px 20px;
  }

  body[data-page="home"] .module-entry strong {
    margin-top: 6px;
    font-size: 1.4rem;
  }

  body[data-page="home"] .module-entry p {
    margin-bottom: 0;
  }

  body[data-page="home"] .section-heading {
    flex-direction: row;
    align-items: flex-end;
  }

  body[data-page="home"] .list-item {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    min-height: 0;
    padding: 17px 18px;
  }

  body[data-page="home"] .list-item > div {
    min-width: 0;
  }

  body[data-page="home"] .list-item .excerpt-summary {
    -webkit-line-clamp: 2;
  }

  body[data-page="home"] .list-item .date-badge {
    align-self: start;
    min-width: 48px;
    padding: 2px 0 0 8px;
  }

  body[data-page="home"] .home-latest,
  body[data-page="module"] .module-board {
    padding-top: 18px;
  }

  body[data-page="module"] .control-panel,
  body[data-page="module"] .course-filters {
    padding: 14px;
  }

  body[data-page="module"] .search-line {
    text-align: left;
  }

  body[data-page="module"] .content-card {
    padding: 19px;
  }
  body[data-page="module"] .content-card.note-tile {
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .notes-title-row {
    gap: 14px;
  }

  .submission-entry {
    padding: 9px 11px;
  }

  .reader-header {
    min-height: 0;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 16px 4px;
  }

  .reader-brand img {
    width: 100%;
  }

  .reader-brand { display: none; }

  .reader-header nav {
    width: 100%;
    justify-content: center;
  }

  .reader-main {
    margin-top: 26px;
  }
}

/* Single-screen student workspace */
body[data-page="home"] .site-shell {
  width: var(--front-shell);
}

body[data-page="home"] main#top {
  min-height: 0;
}

body[data-page="home"] .front-hero {
  grid-template-columns: minmax(280px, max-content) minmax(340px, 1fr);
  gap: 26px;
  min-height: 0;
  align-items: stretch;
  justify-content: center;
  padding: 24px 0 18px;
}

body[data-page="home"] .front-hero-copy {
  width: min(720px, 100%);
  max-width: 720px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: center;
  padding-inline: 8px 0;
}

body[data-page="home"] .front-hero h1 {
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  font-size: 2.7rem;
  line-height: 1.28;
  text-align: center;
}

body[data-page="home"] .front-hero .hero-english {
  max-width: 34em;
  margin-left: auto;
  margin-right: auto;
}

body[data-page="home"] .hero-live-time {
  margin: 10px auto 6px;
  padding: 32px 0 30px;
  justify-content: center;
}

body[data-page="home"] .hero-live-time strong {
  font-size: 3.35rem;
}

body[data-page="home"] .front-hero-copy .module-entry-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 720px);
  margin: 22px auto 0;
  text-align: left;
}

body[data-page="home"] .home-utility-links {
  align-self: center;
  justify-content: center;
  text-align: center;
}

body[data-page="home"] .home-schedule {
  max-height: none;
}

@media (max-width: 1360px) {
  body[data-page="home"] .front-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  body[data-page="home"] .home-schedule { width: 100%; max-height: none; }
}

@media (max-width: 620px) {
  body[data-page="home"] .front-hero-copy .module-entry-grid { grid-template-columns: 1fr; }
}

/* Home schedule workspace */
body[data-page="home"] .topbar,
body[data-page="module"] .topbar {
  z-index: 2000;
  overflow: visible;
}

body[data-page="home"] .topnav,
body[data-page="module"] .topnav {
  overflow: visible;
}

.reader-header {
  gap: 14px;
}

@media (min-width: 761px) {
  body[data-page="home"] .topbar,
  body[data-page="module"] .topbar {
    gap: 14px;
    align-items: center;
  }

  body[data-page="home"] .logo-plate,
  body[data-page="module"] .logo-plate {
    width: 200px;
    height: 58px;
    padding: 0;
  }

  .reader-brand {
    width: 200px;
    height: 58px;
    flex-basis: 200px;
  }

  .site-title {
    width: auto;
    max-width: none;
    height: 78px;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: 0;
    padding-left: 10px;
    overflow: visible;
    align-items: center;
  }

  .versabase-copy {
    width: auto;
    flex-basis: auto;
    gap: 1px;
  }

  .site-title .versabase-cn {
    width: auto;
    height: 42px;
    transform: none;
    object-fit: contain;
    object-position: left center;
  }

  .site-title .versabase-en {
    width: auto;
    height: 14px;
  }

  .versabase-copy small {
    display: none;
    color: var(--front-red, #8c0000);
    font-size: 0.7rem;
    margin-top: 0;
    transform: none;
  }

  .site-title .versabase-mark {
    display: block !important;
    width: auto;
    height: 50px;
    max-width: 78px;
    flex: 0 0 auto;
    margin: 0;
    align-self: center;
  }
}

body[data-page="home"] .front-hero {
  display: grid;
  grid-template-columns: minmax(280px, max-content) minmax(340px, 1fr);
  gap: 26px;
  min-height: 0;
  align-items: stretch;
  justify-content: center;
  padding-top: 24px;
  padding-bottom: 18px;
}

body[data-page="home"] .front-hero-copy {
  width: min(720px, 100%);
  max-width: 720px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: center;
  padding-inline: 8px 0;
}

.home-schedule {
  position: relative;
  z-index: 2;
  min-width: 0;
  align-self: stretch;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  height: auto;
  min-height: 100%;
  overflow: visible;
  padding: 20px 22px 18px;
  border: 1px solid #e1e4e0;
  border-radius: 6px;
  background: rgba(255, 255, 253, 0.96);
  box-shadow: 0 16px 42px rgba(28, 32, 29, 0.1);
}

.hero-live-time {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 18px;
  margin: 8px 0 4px;
  padding: 28px 0 26px;
  border-top: 1px solid #dfe2de;
}

.hero-live-time strong {
  color: var(--front-red-deep);
  font: 700 3.25rem/1 "Noto Serif SC", "Source Serif 4", "Songti SC", "Times New Roman", Georgia, serif;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: 0.04em;
}

.hero-live-time span {
  color: #5f6662;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 1.18rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-life-add {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-left: 2px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--front-red, #8c0000) 22%, transparent);
  border-radius: 999px;
  background: #fff;
  color: var(--front-red, #8c0000);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--front-red, #8c0000) 8%, transparent);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.hero-life-add:hover {
  background: var(--front-red, #8c0000);
  border-color: var(--front-red, #8c0000);
  color: #fff;
  transform: scale(1.05);
}

.hero-life-add svg {
  width: 16px;
  height: 16px;
}

.schedule-head,
.schedule-day-heading,
.schedule-countdown,
.schedule-life-zone,
.schedule-diary,
.schedule-entry,
.schedule-date-nav,
.schedule-form-grid {
  display: flex;
  align-items: center;
}

.schedule-head {
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid #e7e9e6;
}

.schedule-head > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.schedule-panel-title {
  display: grid !important;
  gap: 3px !important;
}

.schedule-panel-title strong {
  color: #252b27;
  font: 800 1.2rem/1.2 "Noto Serif SC", "Songti SC", serif;
}

.schedule-head span {
  color: #646b67;
  font-size: 0.82rem;
  font-weight: 700;
}

.schedule-head strong {
  color: #1e2420;
  font: 700 1.34rem/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

.schedule-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
}

.schedule-actions .schedule-action-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  gap: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #e0e3df;
  border-radius: 5px;
  background: #f8f9f7;
  color: #3f4641;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: width 160ms ease, min-width 160ms ease, padding 160ms ease, gap 160ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.schedule-actions .schedule-action-btn span {
  max-width: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: max-width 160ms ease, opacity 120ms ease, margin 160ms ease;
}

.schedule-actions .schedule-action-btn:hover,
.schedule-actions .schedule-action-btn:focus-visible,
.schedule-actions .schedule-action-btn[aria-expanded="true"] {
  width: auto;
  min-width: 34px;
  padding: 0 10px;
  gap: 6px;
}

.schedule-actions .schedule-action-btn:hover span,
.schedule-actions .schedule-action-btn:focus-visible span,
.schedule-actions .schedule-action-btn[aria-expanded="true"] span {
  max-width: 4.5em;
  opacity: 1;
}

.schedule-actions .schedule-action-btn[aria-expanded="true"] {
  border-color: #c9b0ad;
  background: color-mix(in srgb, var(--front-red) 8%, #fff);
  color: #7f1d16;
}

.schedule-actions .schedule-action-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.schedule-actions button,
.schedule-date-nav > button,
.schedule-entry-actions button,
.schedule-dialog header button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #e0e3df;
  border-radius: 5px;
  background: #f8f9f7;
  color: #555d58;
  cursor: pointer;
}

.schedule-actions svg,
.schedule-date-nav > button svg,
.schedule-entry-actions svg,
.schedule-dialog header button svg {
  width: 16px;
  height: 16px;
}

.schedule-date-nav {
  align-items: stretch;
  gap: 8px;
  padding: 14px 2px 12px;
  perspective: 920px;
}

.schedule-date-nav > button {
  position: relative;
  z-index: 2;
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  height: auto;
  min-height: 4.6rem;
  border: 1px solid #e4e7e3;
  border-radius: 10px;
  background: #f8f9f7;
  box-shadow: 3px 4px 0 rgba(40, 44, 40, 0.06);
}

.schedule-days {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  padding: 4px 2px 8px;
  transform-style: preserve-3d;
}

.schedule-day-cell {
  position: relative;
  z-index: 1;
  display: block;
  min-width: 0;
  transform-style: preserve-3d;
}

.schedule-day-cell.is-active { z-index: 5; }

.schedule-day-cell:hover,
.schedule-day-cell:focus-within {
  z-index: 20;
}

.schedule-day-add {
  position: absolute;
  top: 50%;
  left: calc(100% - 8px);
  z-index: 30;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  border-radius: 999px;
  background: #fff;
  color: var(--front-red, #8c0000);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--front-red, #8c0000) 18%, transparent);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateZ(80px);
  transition: opacity 120ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.schedule-day-add::before {
  content: "";
  position: absolute;
  inset: -10px -8px -10px -14px;
}

.schedule-day-cell:hover .schedule-day-add,
.schedule-day-cell:focus-within .schedule-day-add {
  opacity: 1;
  pointer-events: auto;
}

.schedule-day-add:hover {
  background: var(--front-red, #8c0000);
  color: #fff;
  transform: translateY(-50%) translateZ(80px) scale(1.06);
}

.schedule-day-add svg { width: 13px; height: 13px; }

.schedule-day-cell:last-child .schedule-day-add {
  left: auto;
  right: calc(100% - 8px);
}
.schedule-day-cell:last-child .schedule-day-add::before {
  inset: -10px -14px -10px -8px;
}

.schedule-days .schedule-day-cell > button[data-schedule-date] {
  width: 100%;
}

.schedule-days button[data-schedule-date] {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 5.6rem;
  height: auto;
  display: grid;
  justify-items: center;
  align-content: center;
  grid-template-rows: auto auto 1.25em;
  gap: 3px;
  padding: 8px 3px 8px;
  border: 1px solid rgba(55, 62, 56, 0.08);
  border-radius: 12px;
  background:
    linear-gradient(145deg, #fbfbfa 0%, #eef0ed 55%, #e6e8e4 100%);
  color: #5f6662;
  cursor: pointer;
  transform: rotateY(-12deg) rotateX(6deg) translateZ(0);
  transform-style: preserve-3d;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset -1px -1px 0 rgba(40, 44, 40, 0.04),
    5px 7px 0 rgba(55, 62, 56, 0.08),
    8px 12px 18px rgba(25, 27, 26, 0.1);
  transition:
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 180ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
  will-change: transform;
}

.schedule-days button[data-schedule-date]:hover {
  z-index: 4;
  background: linear-gradient(145deg, #ffffff, #f3f5f2);
  transform: rotateY(-6deg) rotateX(4deg) translateZ(28px) scale(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    7px 10px 0 rgba(55, 62, 56, 0.1),
    12px 18px 28px rgba(25, 27, 26, 0.16);
}

.schedule-days button[data-schedule-date].holiday:not(.active) {
  background: linear-gradient(145deg, #fbf6ec, #f0e4d2);
  color: #6a5340;
}

.schedule-days button[data-schedule-date].makeup:not(.active) {
  background: linear-gradient(145deg, #f2f8f4, #e2eee6);
  color: #3f5550;
}

.schedule-days button[data-schedule-date].active {
  z-index: 3;
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 35%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--front-red) 82%, white), var(--front-red, #8c0000) 48%, var(--front-red-deep, #8c0000));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    5px 7px 0 rgba(90, 0, 0, 0.18),
    8px 14px 22px color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
}

.schedule-days button[data-schedule-date].active:hover {
  transform: rotateY(-6deg) rotateX(4deg) translateZ(30px) scale(1.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    7px 10px 0 rgba(90, 0, 0, 0.2),
    14px 20px 30px color-mix(in srgb, var(--front-red, #8c0000) 34%, transparent);
}

.schedule-days button[data-schedule-date][aria-current="date"]:not(.active) {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    5px 7px 0 rgba(55, 62, 56, 0.08),
    0 0 0 2px color-mix(in srgb, var(--front-red, #8c0000) 16%, transparent),
    0 0 18px color-mix(in srgb, var(--front-red, #8c0000) 42%, transparent),
    0 0 34px color-mix(in srgb, var(--front-red, #8c0000) 18%, transparent);
}

.schedule-days button[data-schedule-date][aria-current="date"].active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    5px 7px 0 rgba(90, 0, 0, 0.18),
    0 0 0 2px rgba(255, 220, 200, 0.35),
    0 0 22px color-mix(in srgb, var(--front-red, #8c0000) 55%, transparent),
    0 0 40px color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
}

.schedule-days span {
  color: inherit;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

.schedule-days strong {
  font: 750 1.2rem/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

.schedule-days em {
  display: block;
  min-width: 0;
  max-width: 100%;
  min-height: 1.15em;
  overflow: hidden;
  color: #8a7564;
  font: 650 0.62rem/1.15 "Noto Serif SC", "Songti SC", serif;
  font-style: normal;
  letter-spacing: 0;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.schedule-days button.has-term em {
  color: #8c3d32;
  font-weight: 750;
}

.schedule-days button.is-wide em,
.schedule-month-grid button.is-wide em,
.schedule-month-grid button.is-wide span {
  font-size: 0.52rem;
  letter-spacing: -0.04em;
}

.schedule-days button.active span {
  opacity: 0.84;
}

.schedule-days button.active em {
  color: #f3d2c4;
}

.schedule-days small {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d9dfda;
  color: #555c57;
  font-size: 0.5rem;
  font-weight: 700;
}

.schedule-days button.active small {
  background: #fff;
  color: var(--front-red, #8c0000);
}

.schedule-days button.has-class::after {
  content: "";
  position: absolute;
  bottom: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--front-red, #8c0000);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.schedule-days button.active.has-class::after {
  background: #fff;
}

.schedule-life-zone {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding: 8px 0 6px;
  border-top: 1px solid #eceeea;
}

.schedule-life-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 78px;
  width: 5.1em;
  margin: 0;
  padding: 8px;
  border: 1px dashed rgba(25, 27, 26, 0.16);
  border-radius: 10px;
  background: #f8f9f7;
  color: #8a908b;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.schedule-life-empty[hidden] {
  display: none;
}

.schedule-life-empty:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  color: var(--front-red, #8c0000);
  background: #fff;
}

.schedule-countdown {
  display: none;
}

.schedule-countdown-head {
  display: none;
}

.schedule-countdown-empty {
  display: none;
}

.schedule-day-flag:empty {
  display: block;
  height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  visibility: hidden;
}

.schedule-day-flag {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.schedule-agenda-label {
  margin: 0 0 6px;
  color: var(--front-red, #8c0000);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.schedule-day-heading {
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-top: 2px;
  padding: 10px 0 8px;
  border-top: 1px solid #eceeea;
}

.schedule-day-heading > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.schedule-day-heading > div > span:first-child {
  width: 100%;
  color: var(--front-red, #8c0000);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.schedule-day-heading strong {
  color: #1f2522;
  font: 800 1.14rem/1.3 "Noto Serif SC", "Songti SC", serif;
}

.schedule-day-heading [data-schedule-cal-toggle] {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #555d58;
  cursor: pointer;
}

.schedule-day-heading [data-schedule-cal-toggle][aria-expanded="true"] {
  background: #f7f0e6;
  color: var(--front-red, #8c0000);
}

.schedule-day-heading [data-schedule-cal-toggle] svg {
  width: 18px;
  height: 18px;
}

.schedule-life-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 8px;
  margin: 0;
  min-height: 0;
  flex: 0 0 auto;
}
.schedule-life-chips[hidden] { display: none; }
.life-chip {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  align-self: flex-start;
  gap: 6px;
  width: 5.1em;
  min-width: 78px;
  max-width: 5.6em;
  height: auto;
  min-height: 0;
  margin: 10px 4px 6px;
  padding: 16px 8px 12px;
  border: 1px solid var(--sticky-border);
  border-radius: 3px 3px 4px 4px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sticky-paper) 92%, white), var(--sticky-paper-deep));
  color: var(--sticky-ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 10px 18px rgba(40, 42, 40, 0.08),
    0 2px 4px rgba(40, 42, 40, 0.05);
  transform: rotate(-1.6deg);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}
.life-chip:nth-child(2n) {
  transform: rotate(1.4deg);
}
.life-chip:nth-child(3n) {
  transform: rotate(-0.7deg);
}
.life-chip::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  z-index: 2;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f4c4b8 0 28%, transparent 30%),
    radial-gradient(circle at 50% 48%, var(--front-red, #8c0000) 0 42%, #5a0000 58%, var(--front-red-deep, #3a0000) 72%, transparent 74%);
  box-shadow:
    0 1px 2px rgba(40, 20, 12, 0.35),
    0 0 0 1px rgba(90, 20, 10, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
}
.life-chip::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 50%;
  z-index: 1;
  width: 3px;
  height: 8px;
  border-radius: 1px;
  background: linear-gradient(180deg, #6a6e72, #3d4246);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
  pointer-events: none;
}
.life-chip:hover {
  border-color: rgba(140, 90, 70, 0.28);
  background: linear-gradient(180deg, #fffdf9, #fff3e8);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 14px 24px rgba(60, 40, 28, 0.16),
    0 3px 6px rgba(60, 40, 28, 0.1);
  transform: rotate(0deg) translateY(-2px);
}
.life-chip.is-pinned {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 12px 22px rgba(60, 40, 28, 0.16),
    0 2px 4px rgba(60, 40, 28, 0.1);
}
.life-chip.is-pinned::before {
  background:
    radial-gradient(circle at 35% 30%, #ffd2c4 0 28%, transparent 30%),
    radial-gradient(circle at 50% 48%, var(--front-red, #a01010) 0 42%, var(--front-red-deep, #6f0000) 58%, var(--front-red-deep, #3a0000) 72%, transparent 74%);
}
.life-chip svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: var(--front-red, #8c0000);
}
.life-chip-days {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  color: #8a6558;
  font-style: normal;
  line-height: 1;
}
.life-chip-num {
  color: #6a3d32;
  font-family: "Noto Serif SC", "Source Serif 4", "Songti SC", "Times New Roman", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.02em;
  line-height: 0.95;
}
.life-chip-prefix,
.life-chip-unit {
  color: #9a6f60;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
}
.life-chip-prefix {
  margin-right: 1px;
  font-size: 0.68rem;
}
.life-chip-label {
  color: #2f2723;
  font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.02em;
  word-break: break-all;
}
.life-chip.tone-today,
.life-chip.tone-soon {
  border-color: #e2b6ae;
  background: linear-gradient(180deg, #fff7f4, #ffefea);
}
.life-chip.tone-overdue {
  border-color: #d8c3bf;
  background: #f4eeec;
  color: #7a5550;
}
.life-chip.tone-countup {
  border-color: #e6d3c0;
  background: linear-gradient(180deg, #fffaf3, #fff4e8);
}
.life-chip.tone-countup svg { color: #b06b45; }
.life-chip.tone-countup .life-chip-num { color: #a45d38; }
.life-chip.tone-countup .life-chip-prefix,
.life-chip.tone-countup .life-chip-unit { color: #b07a55; }
.life-chip.tone-memo {
  border-color: #e4d7c4;
  background: #fbf7f0;
}
.life-chip.tone-memo svg { color: #9a7340; }
.life-chip.tone-memo .life-chip-num { color: #8a6436; }
.life-chip.tone-memo .life-chip-prefix,
.life-chip.tone-memo .life-chip-unit { color: #9a7340; }

.life-mark-kinds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 14px;
}
.life-mark-kinds button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid #e4ddd6;
  border-radius: 6px;
  background: #faf8f5;
  color: #5c5852;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.life-mark-kinds button svg { width: 15px; height: 15px; }
.life-mark-kinds button[aria-pressed="true"] {
  border-color: #ead4d1;
  background: #f7eeec;
  color: var(--front-red, #8c0000);
}
.life-mark-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.life-mark-icons button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #e6e2db;
  border-radius: 6px;
  background: #fff;
  color: #6d6760;
  cursor: pointer;
}
.life-mark-icons button svg { width: 16px; height: 16px; }
.life-mark-icons button[aria-pressed="true"] {
  border-color: #ead4d1;
  background: #f7eeec;
  color: var(--front-red, #8c0000);
}
.life-mark-pin {
  display: block !important;
  position: relative;
  cursor: pointer;
  user-select: none;
}
.life-mark-pin > input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}
.life-mark-pin-ui {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #e6e2db;
  border-radius: 6px;
  background: #faf8f5;
  color: #5c5852;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.life-mark-pin-ui > svg,
.life-mark-pin-ui > i {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: #9a7340;
}
.life-mark-pin-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.life-mark-pin-copy strong {
  color: inherit;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
}
.life-mark-pin-copy small {
  color: #8a8378;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
}
.life-mark-pin:hover .life-mark-pin-ui {
  border-color: #d7b4ac;
  background: #fff4ef;
}
.life-mark-pin > input:focus-visible + .life-mark-pin-ui {
  outline: 2px solid #a54b4344;
  outline-offset: 2px;
}
.life-mark-pin > input:checked + .life-mark-pin-ui {
  border-color: #ead4d1;
  background: #f7eeec;
  color: var(--front-red, #8c0000);
}
.life-mark-pin > input:checked + .life-mark-pin-ui > svg,
.life-mark-pin > input:checked + .life-mark-pin-ui > i {
  color: var(--front-red, #8c0000);
}
.life-mark-pin > input:checked + .life-mark-pin-ui .life-mark-pin-copy small {
  color: #a56a62;
}
.life-mark-dialog footer .danger {
  margin-right: auto;
  border: 0;
  background: transparent;
  color: var(--front-red, #8c0000);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.schedule-month-grid button.has-memo span {
  color: #9a7340;
  font-weight: 700;
}

.schedule-day-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: visible;
  padding-right: 0;
}
.schedule-agenda {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: none;
  flex: 0 0 auto;
  padding: 0;
  overflow: visible;
}

.schedule-entry {
  position: relative;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 14px 12px 14px 14px;
  border: 1px solid var(--entry-tone-amber-border);
  border-radius: 2px;
  background: var(--entry-tone-amber-bg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 10px 18px rgba(40, 42, 40, 0.08),
    0 2px 4px rgba(40, 42, 40, 0.05);
  transform: rotate(-0.55deg);
  font-family: "KingHwa_OldSong", "Noto Serif SC", "Songti SC", STSong, serif;
}

.schedule-entry.tone-red {
  border-color: var(--entry-tone-red-border);
  background: var(--entry-tone-red-bg);
}
.schedule-entry.tone-amber {
  border-color: var(--entry-tone-amber-border);
  background: var(--entry-tone-amber-bg);
}
.schedule-entry.tone-green {
  border-color: var(--entry-tone-green-border);
  background: var(--entry-tone-green-bg);
}
.schedule-entry.tone-blue {
  border-color: var(--entry-tone-blue-border);
  background: var(--entry-tone-blue-bg);
}
.schedule-entry.tone-violet {
  border-color: var(--entry-tone-violet-border);
  background: var(--entry-tone-violet-bg);
}

.schedule-entry:nth-child(2n) {
  transform: rotate(0.45deg);
}

.schedule-entry:nth-child(3n) {
  transform: rotate(-0.2deg);
}

.schedule-entry::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 18px;
  z-index: 2;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--front-red) 35%, white) 0 28%, transparent 30%),
    radial-gradient(circle at 50% 55%, var(--pin-core) 0 52%, var(--pin-rim) 68%, #2a1010 100%);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--front-red) 28%, transparent);
}

.schedule-entry > time {
  width: 52px;
  flex: 0 0 52px;
  padding-right: 10px;
  border-right: 1px solid color-mix(in srgb, var(--front-red) 28%, transparent);
  color: var(--front-red);
  font: 700 0.84rem/1.15 "KingHwa_OldSong", "Noto Serif SC", serif;
  font-variant-numeric: tabular-nums;
}

.schedule-entry > time span {
  display: block;
  margin-top: 2px;
  color: var(--sticky-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.schedule-entry > div:nth-child(2) {
  min-width: 0;
  flex: 1;
  padding-top: 0;
}

.schedule-entry strong,
.schedule-entry small,
.schedule-entry p {
  display: block;
}

.schedule-entry strong {
  color: var(--sticky-ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.02em;
}

.schedule-entry small {
  margin-top: 4px;
  color: var(--sticky-muted);
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.35;
}

.schedule-entry small svg {
  width: 13px;
  height: 13px;
  margin-right: 5px;
  vertical-align: -2px;
}

.schedule-entry-note {
  margin-top: 6px;
  min-width: 0;
  max-width: 100%;
}

.schedule-entry-note-view {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6d624c;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
  text-align: left;
  cursor: default;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  pointer-events: none;
  user-select: text;
}

.schedule-entry-note-view.markdown-article > :first-child { margin-top: 0; }
.schedule-entry-note-view.markdown-article > :last-child { margin-bottom: 0; }
.schedule-entry-note-view.markdown-article p,
.schedule-entry-note-view.markdown-article li {
  margin: 0.2em 0;
  font-size: inherit;
  line-height: 1.45;
  color: inherit;
}
.schedule-entry-note-view.markdown-article ul,
.schedule-entry-note-view.markdown-article ol {
  margin: 0.15em 0;
  padding-left: 1.2em;
}
.schedule-entry-note-view.markdown-article strong {
  display: inline;
  font-size: inherit;
  font-weight: 700;
  color: #4a4030;
}
.schedule-entry-note-view.markdown-article h1,
.schedule-entry-note-view.markdown-article h2,
.schedule-entry-note-view.markdown-article h3 {
  margin: 0.3em 0 0.15em;
  font-size: 0.88em;
  font-weight: 700;
  color: var(--front-red, #8c0000);
}

.schedule-entry p {
  margin: 4px 0 0;
  color: #7a6f58;
  font-size: 0.8rem;
  line-height: 1.45;
}

.schedule-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-left: auto;
}

.schedule-entry-actions .schedule-entry-tool {
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.schedule-entry:hover .schedule-entry-tool,
.schedule-entry:focus-within .schedule-entry-tool {
  opacity: 1;
  transform: none;
}

.schedule-entry-actions button {
  width: 26px;
  height: 26px;
  border: 0;
  background: transparent;
}

.schedule-entry-actions .schedule-note-start {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid #dfc5c1;
  border-radius: 4px;
  background: var(--community-soft, color-mix(in srgb, var(--front-red) 6%, #fff));
  color: var(--front-red, #8c0000);
  text-decoration: none;
}

.schedule-entry-actions .schedule-note-start:hover {
  border-color: var(--front-red, #8c0000);
  background: var(--front-red, #8c0000);
  color: #fff;
}

.schedule-entry-actions .schedule-note-start svg {
  width: 16px;
  height: 16px;
}

.schedule-empty {
  min-height: 88px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 22px 16px;
  border: 1px dashed #d7dcd7;
  border-radius: 7px;
  background: #f7f8f5;
  color: #6d746f;
  text-align: center;
}

.schedule-empty svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  color: var(--front-red, #8c0000);
}

.schedule-empty strong {
  color: #2a302c;
  font-size: 0.95rem;
  font-weight: 750;
}

.schedule-empty span {
  max-width: 16em;
  color: #7a817c;
  font-size: 0.78rem;
  line-height: 1.55;
}

.schedule-empty button {
  margin-top: 6px;
  padding: 6px 12px;
  border: 1px solid #ddc4c0;
  border-radius: 4px;
  background: #fff;
  color: var(--front-red, #8c0000);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.schedule-empty button:hover {
  border-color: var(--front-red, #8c0000);
  background: var(--front-red, #8c0000);
  color: #fff;
}

.schedule-diary {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  align-items: stretch;
  gap: 6px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid #e7e9e6;
}

.diary-sticky {
  position: fixed;
  right: 12px;
  top: max(100px, 16vh);
  bottom: auto;
  z-index: 1400;
  width: 46px;
  transform: none;
  transform-origin: 100% 0%;
  transition:
    width 280ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 220ms ease;
  filter: drop-shadow(0 10px 18px rgba(60, 40, 20, 0.16));
  pointer-events: auto;
}

.diary-sticky.is-open,
.diary-sticky.is-pinned,
.diary-sticky[data-diary-mode="edit"],
.diary-sticky:focus-within {
  width: min(300px, calc(100vw - 28px));
  transform: none;
  filter: drop-shadow(0 16px 28px rgba(40, 42, 40, 0.18));
}

.diary-sticky.is-pinned {
  z-index: 1500;
}

/* Collapsed: vertical spine with 今日小结 */
.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .diary-sticky-sheet {
  min-height: 228px;
  padding: 20px 7px 16px;
  justify-items: center;
  align-content: start;
  gap: 0;
  cursor: pointer;
}

.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .schedule-diary-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  gap: 0;
}

.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .schedule-diary-head strong {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.28em;
  font-size: 1.02rem;
  line-height: 1.15;
  padding-top: 4px;
}

.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .schedule-diary-tools,
.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .schedule-diary-status,
.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .schedule-diary-view,
.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .schedule-diary-editor,
.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .diary-sticky-handle,
.diary-sticky:not(.is-open):not(.is-pinned):not(.is-floating):not([data-diary-mode="edit"]):not(:focus-within) .diary-sticky-sheet::before {
  display: none !important;
}

.diary-sticky .schedule-diary-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.diary-sticky .schedule-diary-tools button,
.diary-sticky .schedule-diary-tools a {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--sticky-muted);
  text-decoration: none;
  cursor: pointer;
}

.diary-sticky .schedule-diary-tools button:hover,
.diary-sticky .schedule-diary-tools a:hover,
.diary-sticky .schedule-diary-tools button.is-active {
  border-color: color-mix(in srgb, var(--front-red) 28%, transparent);
  background: color-mix(in srgb, var(--front-red) 8%, transparent);
  color: var(--front-red);
}

.diary-sticky .schedule-diary-tools svg {
  width: 14px;
  height: 14px;
}

.diary-sticky .schedule-diary-head strong {
  color: var(--sticky-ink);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.diary-sticky-sheet {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 168px;
  padding: 16px 14px 14px;
  border: 1px solid var(--sticky-border);
  border-radius: 2px 2px 4px 4px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--sticky-paper) 94%, white), var(--sticky-paper-deep));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 2px 4px rgba(40, 42, 40, 0.05);
  font-family: "KingHwa_OldSong", "Noto Serif SC", "Songti SC", STSong, serif;
}

.life-chip.has-note::before {
  box-shadow:
    0 1px 2px rgba(40, 20, 12, 0.35),
    0 0 0 1px rgba(90, 20, 10, 0.18),
    0 0 0 3px color-mix(in srgb, var(--front-red) 12%, transparent);
}

.life-chip-popover {
  position: fixed;
  z-index: 2600;
  max-width: min(260px, calc(100vw - 24px));
  padding: 10px 12px;
  border: 1px solid var(--sticky-border, #e6e0d6);
  border-radius: 8px;
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(40, 32, 24, 0.14);
  color: var(--sticky-ink, #2a2c2a);
  pointer-events: auto;
}

.life-chip-popover[hidden] {
  display: none !important;
}

.life-chip-popover strong {
  display: block;
  margin-bottom: 4px;
  color: var(--front-red, #8c0000);
  font-size: 0.78rem;
  font-weight: 750;
}

.life-chip-popover p {
  margin: 0;
  color: #4a4338;
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diary-sticky-handle {
  position: absolute;
  top: -12px;
  right: 20px;
  z-index: 4;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--front-red) 35%, white) 0 28%, transparent 30%),
    radial-gradient(circle at 50% 55%, var(--pin-core) 0 52%, var(--pin-rim) 68%, #2a1010 100%);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--front-red) 28%, transparent);
  cursor: grab;
  touch-action: none;
}

.diary-sticky-handle::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 50%;
  width: 3px;
  height: 10px;
  border-radius: 1px;
  background: linear-gradient(180deg, #6a6e72, #3d4246);
  transform: translateX(-50%);
  pointer-events: none;
}

.diary-sticky-handle:hover,
.diary-sticky-handle.is-active {
  transform: scale(1.06);
}

.diary-sticky-handle:active,
.diary-sticky.is-dragging .diary-sticky-handle {
  cursor: grabbing;
}

.diary-sticky.is-floating,
.diary-sticky.is-dragging {
  right: auto;
  bottom: auto;
  top: auto;
  width: min(300px, calc(100vw - 28px));
  transform: none;
  transition: none;
  z-index: 1600;
}

.diary-sticky.is-dragging {
  opacity: 0.96;
  filter: drop-shadow(0 18px 30px rgba(40, 42, 40, 0.22));
  user-select: none;
}

.diary-sticky-sheet::before {
  content: none;
  display: none;
}

.diary-sticky[data-diary-mode="empty"] .diary-sticky-sheet::before {
  content: "";
  display: block;
  position: absolute;
  top: -7px;
  right: 28px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--front-red) 35%, white) 0 28%, transparent 30%),
    radial-gradient(circle at 50% 55%, var(--pin-core) 0 52%, var(--pin-rim) 68%, #2a1010 100%);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--front-red) 28%, transparent);
  pointer-events: none;
}

.diary-sticky .schedule-diary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.diary-sticky .schedule-diary-head strong {
  color: #2c261c;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.diary-sticky .schedule-diary-status {
  color: #9a8a68;
  font-size: 0.62rem;
  font-weight: 600;
  white-space: nowrap;
}

.diary-sticky .schedule-diary-prompt,
.diary-sticky .schedule-diary-view {
  display: block;
  width: 100%;
  min-height: 110px;
  margin: 0;
  padding: 10px 11px;
  border: 1px dashed rgba(140, 110, 50, 0.28);
  border-radius: 3px;
  background: rgba(255, 252, 245, 0.72);
  color: #8a7a5a;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
}

.diary-sticky .schedule-diary-prompt:hover,
.diary-sticky .schedule-diary-view:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  background: #fffdf6;
  color: #5c4e36;
}

.diary-sticky .schedule-diary-view {
  border-style: solid;
  border-color: rgba(176, 140, 70, 0.22);
  color: #2c261c;
  cursor: text;
  overflow: auto;
  max-height: 220px;
}

.diary-sticky .schedule-diary-view.markdown-article {
  font-size: 0.84rem;
}

.diary-sticky .schedule-diary-view.markdown-article > :first-child {
  margin-top: 0;
}

.diary-sticky .schedule-diary-view.markdown-article > :last-child {
  margin-bottom: 0;
}

.diary-sticky .schedule-diary-view.markdown-article p,
.diary-sticky .schedule-diary-view.markdown-article li {
  margin: 0.35em 0;
  line-height: 1.55;
}

.diary-sticky .schedule-diary-view.markdown-article h1,
.diary-sticky .schedule-diary-view.markdown-article h2,
.diary-sticky .schedule-diary-view.markdown-article h3 {
  margin: 0.45em 0 0.25em;
  font-size: 1em;
  font-weight: 700;
  color: var(--front-red, #8c0000);
}

.diary-sticky .schedule-diary-editor textarea {
  min-height: 140px;
  width: 100%;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid rgba(176, 140, 70, 0.35);
  border-radius: 3px;
  background: #fffdf8;
  color: #2c261c;
  font: inherit;
  font-size: 0.84rem;
  line-height: 1.55;
}

.diary-sticky .schedule-diary-editor textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--front-red, #8c0000) 14%, transparent);
  border-color: #c9a3a0;
}

.diary-sticky .schedule-diary-prompt[hidden],
.diary-sticky .schedule-diary-view[hidden],
.diary-sticky .schedule-diary-editor[hidden] {
  display: none;
}

html[data-theme="dark"] .diary-sticky-sheet {
  border-color: rgba(212, 170, 90, 0.28);
  background: linear-gradient(180deg, #2a261c, #231f16);
  color: #f0e7d2;
}

html[data-theme="dark"] .diary-sticky .schedule-diary-head strong,
html[data-theme="dark"] .diary-sticky .schedule-diary-view {
  color: #f5edd8;
}

html[data-theme="dark"] .diary-sticky .schedule-diary-prompt,
html[data-theme="dark"] .diary-sticky .schedule-diary-editor textarea {
  background: #1f1b14;
  border-color: rgba(212, 170, 90, 0.28);
  color: #d8c9a8;
}

@media (max-width: 720px) {
  .diary-sticky {
    right: 8px;
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: 42px;
    transform: none;
  }
  .diary-sticky.is-open,
  .diary-sticky.is-pinned,
  .diary-sticky[data-diary-mode="edit"],
  .diary-sticky:focus-within {
    width: min(280px, calc(100vw - 20px));
  }
  body.has-mobile-tabbar .diary-sticky {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
  }
}

.schedule-diary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.schedule-diary-head strong,
.schedule-diary label {
  flex: 0 0 auto;
  color: #3f4541;
  font-size: 0.78rem;
  font-weight: 800;
}

.schedule-diary-head small,
.schedule-diary-hint,
.schedule-diary-status {
  color: #8a908b;
  font-size: 0.66rem;
  font-weight: 600;
}

.schedule-diary-prompt,
.schedule-diary-view {
  display: block;
  width: 100%;
  min-height: 56px;
  margin: 0;
  padding: 10px 11px;
  border: 1px dashed rgba(25, 27, 26, 0.14);
  border-radius: 6px;
  background: #f8f9f7;
  color: #8a908b;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
}

.schedule-diary-prompt:hover,
.schedule-diary-view:hover {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 28%, transparent);
  background: #fff;
  color: #5f6662;
}

.schedule-diary-view {
  border-style: solid;
  border-color: #e2e5e1;
  background: #fffcf9;
  color: #383e3a;
  white-space: pre-wrap;
  word-break: break-word;
}

.schedule-diary-prompt[hidden],
.schedule-diary-view[hidden],
.schedule-diary-editor[hidden] {
  display: none;
}

.schedule-diary-editor textarea,
.schedule-diary textarea {
  min-width: 0;
  min-height: 72px;
  width: 100%;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid #e2e5e1;
  border-radius: 4px;
  background: #fff;
  color: #383e3a;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.55;
}

.schedule-diary-editor textarea:focus,
.schedule-diary textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--front-red, #8c0000) 16%, transparent);
  border-color: #c9a3a0;
  background: #fff;
}

.schedule-diary-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.schedule-diary button.schedule-diary-prompt,
.schedule-diary button.schedule-diary-view {
  width: 100%;
}

.schedule-diary button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.schedule-diary button svg {
  width: 14px;
  height: 14px;
}

.schedule-diary button span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
}

.schedule-dialog {
  width: min(560px, calc(100% - 28px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #292e2b;
  box-shadow: 0 28px 80px rgba(17, 20, 18, 0.24);
}

.schedule-dialog::backdrop {
  background: rgba(27, 31, 28, 0.54);
  backdrop-filter: blur(3px);
}

.schedule-dialog form {
  padding: 24px 26px 22px;
}

.schedule-history-shell {
  padding: 24px 26px 22px;
}

.schedule-history-dialog,
.schedule-notes-dialog {
  width: min(720px, calc(100% - 28px));
}

.schedule-dialog header,
.schedule-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.schedule-dialog header {
  padding-bottom: 17px;
  border-bottom: 1px solid #e8eae7;
}

.schedule-dialog header span {
  color: var(--front-red, #8c0000);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.schedule-dialog h2 {
  margin: 4px 0 0;
  font: 800 1.5rem/1.25 "Noto Serif SC", "Songti SC", serif;
}

.schedule-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-top: 20px;
}

.schedule-dialog label {
  display: grid;
  gap: 6px;
  color: #656d68;
  font-size: 0.72rem;
  font-weight: 700;
}

.schedule-dialog label.wide {
  grid-column: 1 / -1;
}

.schedule-dialog input,
.schedule-dialog textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #dfe3de;
  border-radius: 4px;
  background: #fafbf9;
  color: #252b27;
  font: inherit;
  font-size: 0.82rem;
}

.schedule-dialog textarea {
  resize: vertical;
  line-height: 1.65;
}

.schedule-dialog-status {
  min-height: 20px;
  margin: 13px 0 0;
  color: #68716b;
  font-size: 0.72rem;
}

.schedule-dialog-status[data-state="error"],
.schedule-import-preview[data-state="error"] {
  color: #9b1c12;
}

.schedule-dialog footer {
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid #eceeeb;
}
.life-mark-dialog footer .danger {
  margin-right: auto;
  border-color: transparent;
  background: transparent;
  color: var(--front-red, #8c0000);
}

.schedule-dialog footer button {
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid #dfe2de;
  border-radius: 4px;
  background: #f7f8f6;
  color: #505753;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.schedule-dialog footer .primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-color: var(--front-red, #8c0000);
  background: var(--front-red, #8c0000);
  color: #fff;
}

.schedule-dialog footer svg {
  width: 15px;
  height: 15px;
}

.import-guide {
  margin: 18px 0 9px;
  color: #69716c;
  font-size: 0.78rem;
  line-height: 1.7;
}

.import-dialog code {
  display: block;
  margin-bottom: 16px;
  padding: 10px 12px;
  border-left:  solid var(--front-red, #8c0000);
  background: #f4f5f2;
  color: #4f5752;
  font-size: 0.68rem;
  line-height: 1.75;
  white-space: normal;
}

.schedule-import-tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 14px;
  padding: 4px;
  border-radius: 6px;
  background: #f2f3f0;
}

.schedule-import-tabs button {
  flex: 1;
  width: auto !important;
  height: 34px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border: 0 !important;
  border-radius: 4px;
  background: transparent;
  color: #667069;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.schedule-import-tabs button.is-active {
  background: #fff;
  color: #7f1d16;
  box-shadow: 0 1px 3px rgba(28, 32, 29, 0.08);
}

.schedule-import-pane[hidden] { display: none !important; }

.schedule-single-add {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.schedule-rule-actions {
  display: inline-flex;
  gap: 6px;
}

.schedule-rule-actions button,
.schedule-history-item .schedule-history-actions button {
  width: auto;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.66rem;
  font-weight: 700;
}

.schedule-history-item .schedule-history-actions {
  display: inline-flex;
  gap: 6px;
}

.schedule-color-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.schedule-color-picks button {
  width: 28px !important;
  height: 28px !important;
  border-radius: 999px !important;
  border: 2px solid transparent !important;
  cursor: pointer;
}

.schedule-color-picks button[data-color="red"] { background: #e8cfcb !important; }
.schedule-color-picks button[data-color="amber"] { background: #e8dfc4 !important; }
.schedule-color-picks button[data-color="green"] { background: #cfe0d2 !important; }
.schedule-color-picks button[data-color="blue"] { background: #cfdced !important; }
.schedule-color-picks button[data-color="violet"] { background: #d9cee6 !important; }
.schedule-color-picks button.is-active {
  border-color: var(--front-red) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--front-red) 20%, transparent);
}

.diary-archive-main {
  display: grid;
  gap: 20px;
  padding: 28px 0 56px;
}

.diary-archive-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
  padding: 14px 16px;
  border: 1px solid var(--front-paper-soft, #e8e4dc);
  border-radius: 8px;
  background: color-mix(in srgb, var(--front-wash, #faf8f5) 88%, white);
}

.diary-archive-range {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 12px;
}

.diary-archive-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--front-muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.diary-archive-toolbar input[type="date"] {
  min-width: 10.5rem;
  padding: 8px 10px;
  border: 1px solid var(--front-paper-soft);
  border-radius: 5px;
  background: var(--front-paper, #fff);
  color: var(--front-ink);
}

.diary-archive-presets {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diary-archive-presets button {
  padding: 7px 12px;
  border: 1px solid var(--front-paper-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--front-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}

.diary-archive-presets button.is-active,
.diary-archive-presets button:hover {
  border-color: color-mix(in srgb, var(--front-red) 35%, transparent);
  background: color-mix(in srgb, var(--front-red) 8%, white);
  color: var(--front-red);
}

.diary-archive-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
  min-height: 420px;
}

.diary-archive-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.diary-archive-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--front-muted);
  font-size: 0.78rem;
}

.diary-archive-meta strong {
  color: var(--front-ink);
  font-size: 0.86rem;
}

.diary-archive-list {
  display: grid;
  gap: 10px;
  max-height: min(68vh, 760px);
  overflow: auto;
  padding-right: 4px;
}

.diary-archive-card {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--sticky-border, #e6e0d6);
  border-radius: 8px;
  background: var(--sticky-paper, #fffdf9);
  color: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.diary-archive-card:hover {
  border-color: color-mix(in srgb, var(--front-red) 28%, transparent);
}

.diary-archive-card.is-selected {
  border-color: color-mix(in srgb, var(--front-red) 45%, transparent);
  background: color-mix(in srgb, var(--front-soft, #fff6f4) 70%, white);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--front-red) 12%, transparent);
}

.diary-archive-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.diary-archive-card time,
.diary-archive-detail-head time {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  color: var(--front-red);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.2;
}

.diary-archive-card time small,
.diary-archive-detail-head time small {
  color: var(--front-muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.diary-archive-pin {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--front-red) 12%, transparent);
  color: var(--front-red);
  font: 700 0.66rem/1.2 inherit;
  font-style: normal;
}

.diary-archive-card strong {
  color: var(--front-ink);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.diary-archive-card p {
  margin: 0;
  color: var(--front-muted);
  font-size: 0.82rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.diary-archive-detail {
  position: sticky;
  top: 18px;
  min-height: 320px;
  padding: 22px 24px 28px;
  border: 1px solid var(--sticky-border, #e6e0d6);
  border-radius: 10px;
  background: var(--front-paper, #fff);
  box-shadow: 0 12px 28px rgba(40, 32, 24, 0.04);
}

.diary-archive-detail-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 280px;
  color: var(--front-muted);
  text-align: center;
}

.diary-archive-detail-empty svg {
  width: 28px;
  height: 28px;
  opacity: 0.55;
}

.diary-archive-detail-empty p {
  margin: 0;
  font-size: 0.88rem;
}

.diary-archive-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--front-paper-soft, #ebe6de);
}

.diary-archive-detail-head time {
  font-size: 1.05rem;
}

.diary-archive-body {
  color: var(--front-ink);
  font-size: 0.95rem;
  line-height: 1.75;
}

.diary-archive-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 42px 20px;
  border: 1px dashed var(--front-paper-soft);
  border-radius: 8px;
  color: var(--front-muted);
  text-align: center;
}

.diary-archive-empty svg {
  width: 28px;
  height: 28px;
  opacity: 0.55;
}

.diary-archive-empty strong {
  color: var(--front-ink);
  font-size: 0.95rem;
}

.diary-archive-empty p {
  margin: 0;
  max-width: 18em;
  font-size: 0.84rem;
  line-height: 1.55;
}

.diary-archive-empty .button {
  margin-top: 6px;
}

@media (max-width: 900px) {
  .diary-archive-layout {
    grid-template-columns: 1fr;
  }

  .diary-archive-list {
    max-height: none;
  }

  .diary-archive-detail {
    position: static;
  }
}

.appearance-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appearance-swatch {
  min-width: 72px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--front-paper-soft);
  border-radius: 999px;
  background: var(--front-paper);
  color: var(--front-ink);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.appearance-swatch i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--swatch, var(--front-red));
}

.appearance-swatch.is-active {
  border-color: var(--front-red);
  color: var(--front-red);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--front-red) 25%, transparent);
}

.schedule-import-preview[data-state="ready"] {
  color: #25623f;
}

.history-guide {
  margin: 16px 0 10px;
  color: #737b76;
  font-size: 0.75rem;
  line-height: 1.7;
}

.schedule-rule-heading,
.schedule-record-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.schedule-rule-heading {
  margin-top: 17px;
}

.schedule-rule-heading > div,
.schedule-record-heading {
  color: #717974;
  font-size: 0.7rem;
}

.schedule-rule-heading strong,
.schedule-record-heading strong {
  display: block;
  color: #303632;
  font-size: 0.82rem;
}

.schedule-rule-heading span,
.schedule-record-heading span {
  margin-top: 3px;
}

.schedule-rule-heading > button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid #e2c9c5;
  border-radius: 4px;
  background: var(--community-soft, color-mix(in srgb, var(--front-red) 6%, #fff));
  color: var(--front-red, #8c2119);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 750;
  cursor: pointer;
}

.schedule-rule-heading > button svg {
  width: 15px;
}

.schedule-rule-list {
  max-height: min(25vh, 220px);
  margin-top: 10px;
  overflow: auto;
  border-top: 1px solid #e8eae7;
}

.schedule-rule-item {
  min-height: 62px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 2px;
  border-bottom: 1px solid #eceeeb;
}

.schedule-rule-item > div {
  min-width: 0;
}

.schedule-rule-item strong,
.schedule-rule-item span {
  display: block;
}

.schedule-rule-item strong {
  overflow: hidden;
  color: #2b312d;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-rule-item > div span {
  margin-top: 4px;
  color: #8c948f;
  font-size: 0.66rem;
}

.schedule-rule-item > div small {
  display: block;
  margin-top: 4px;
  color: #9aa19b;
  font-size: 0.62rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.schedule-rule-item > button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  color: var(--front-red, #8c2119);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.schedule-rule-item > button svg {
  width: 14px;
}

.schedule-record-heading {
  margin: 20px 0 8px;
  padding-top: 16px;
  border-top: 1px solid #e8eae7;
}

.schedule-history-list {
  max-height: min(56vh, 480px);
  overflow: auto;
  border-top: 1px solid #e8eae7;
}

.schedule-history-item {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 10px 2px;
  border-bottom: 1px solid #eceeeb;
}

.schedule-history-item time,
.schedule-history-item > div {
  min-width: 0;
}

.schedule-history-item time strong,
.schedule-history-item time span,
.schedule-history-item > div strong,
.schedule-history-item > div small {
  display: block;
}

.schedule-history-item time strong {
  color: #525a55;
  font: 700 0.72rem/1.4 Arial, sans-serif;
}

.schedule-history-item time span,
.schedule-history-item > div small {
  margin-top: 3px;
  color: #969c98;
  font-size: 0.65rem;
}

.schedule-history-item > div strong {
  overflow: hidden;
  color: #292f2b;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-history-item > button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #eadedc;
  border-radius: 4px;
  background: #faf5f4;
  color: var(--front-red, #8c2119);
  cursor: pointer;
}

.schedule-history-item > button svg {
  width: 15px;
  height: 15px;
}

.schedule-history-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: #8c938e;
  font-size: 0.75rem;
}

.schedule-history-empty.compact {
  min-height: 76px;
}

.schedule-notes-list {
  max-height: min(60vh, 520px);
  overflow: auto;
  border-top: 1px solid #e8eae7;
}

.schedule-note-item {
  min-height: 88px;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 2px;
  border-bottom: 1px solid #eceeeb;
}

.schedule-note-state {
  display: grid;
  justify-items: start;
  gap: 4px;
  color: #7b827d;
  font-size: 0.66rem;
  font-weight: 700;
}

.schedule-note-state svg {
  width: 16px;
  color: var(--front-red, #8c0000);
}

.schedule-note-item > div:nth-child(2) {
  min-width: 0;
}

.schedule-note-item > div:nth-child(2) strong {
  color: #29302b;
  font-size: 0.82rem;
}

.schedule-note-item p {
  overflow: hidden;
  margin: 5px 0 4px;
  color: #6e7671;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-note-item small {
  color: #9a9f9b;
  font-size: 0.64rem;
}

.schedule-note-actions {
  display: flex;
  gap: 3px;
}

.schedule-note-actions a,
.schedule-note-actions button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #69716c;
  cursor: pointer;
}

.schedule-note-actions a:hover,
.schedule-note-actions button:hover {
  background: #f2f3f0;
  color: var(--front-red, #8c0000);
}

.schedule-note-actions svg {
  width: 15px;
}

.schedule-cal {
  position: relative;
  z-index: 6;
}

.schedule-month {
  position: absolute;
  left: -6px;
  right: -6px;
  top: calc(100% - 2px);
  z-index: 24;
  max-height: min(78vh, 680px);
  overflow: auto;
  padding: 14px 14px 12px;
  border: 1px solid #e6e9e4;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 253, 0.98), rgba(246, 247, 244, 0.98));
  box-shadow: 0 22px 48px rgba(25, 27, 26, 0.14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transform-origin: top center;
  transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 220ms cubic-bezier(0.22, 1, 0.36, 1), visibility 180ms;
}

.schedule-cal.is-open .schedule-month {
  position: fixed;
  top: 14px;
  right: max(12px, calc((100vw - 520px - 20px - (100svh - 140px) * 0.8) / 2));
  bottom: auto;
  left: auto;
  z-index: 30;
  width: min(calc((100svh - 140px) * 0.8), calc(100vw - 24px));
  max-height: calc(100svh - 28px);
  overflow: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.schedule-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
}

.schedule-month-head strong {
  color: #1f2522;
  font: 700 0.92rem/1.2 "Noto Serif SC", "Songti SC", serif;
  letter-spacing: 0.02em;
}

.schedule-month-head button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #6a716c;
  cursor: pointer;
}

.schedule-month-head button:hover {
  background: #f3f4f2;
  color: #1f2522;
}

.schedule-month-head button svg {
  width: 18px;
  height: 18px;
}

.schedule-month-weekdays,
.schedule-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.schedule-month-weekdays {
  margin-bottom: 6px;
}

.schedule-month-weekdays span {
  color: #8a908b;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.8;
  text-align: center;
}

.schedule-month-grid {
  align-items: stretch;
}

.schedule-month-grid button {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1.05em 1.15em;
  align-content: start;
  justify-items: center;
  gap: 0;
  padding: 4px 1px 3px;
  border: 1px solid rgba(55, 62, 56, 0.08);
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfbfa, #f3f4f1);
  color: #252b27;
  cursor: pointer;
  opacity: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: background 140ms ease, box-shadow 140ms ease;
}

.schedule-month-grid button b {
  font: 650 0.92rem/1 Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

.schedule-month-grid button em,
.schedule-month-grid button span {
  display: block;
  width: 100%;
  min-height: 1.05em;
  max-width: 100%;
  padding: 0 1px;
  overflow: hidden;
  font-style: normal;
  letter-spacing: 0;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.schedule-month-grid button em {
  color: #7d6a58;
  font: 650 0.62rem/1.05 "Noto Serif SC", "Songti SC", serif;
}

.schedule-month-grid button span {
  color: transparent;
  font: 750 0.6rem/1.15 "Noto Serif SC", "Songti SC", serif;
}

.schedule-month-grid button.has-term span {
  color: #8c3d32;
}

.schedule-month-grid button.has-class::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--front-red, #8c0000);
  transform: translateX(-50%);
}

.schedule-month-grid button small {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: color-mix(in srgb, var(--front-red, #8c0000) 8%, transparent);
  color: var(--front-red, #8c0000);
  font-size: 0.54rem;
  font-weight: 800;
}

.schedule-month-grid button.muted {
  color: #c0c4bf;
  background: linear-gradient(145deg, #f6f6f4, #ecece8);
  opacity: 0.55;
}

.schedule-month-grid button.muted em {
  color: #b7b3ad;
}

.schedule-month-grid button.muted.has-term span {
  color: #a56a62;
}

.schedule-month-grid button.holiday {
  background: linear-gradient(145deg, #fbf6ec, #efe4d2);
}

.schedule-month-grid button.makeup {
  background: linear-gradient(145deg, #f1f7f3, #e0ebe4);
}

.schedule-month-grid button:hover:not(.active) {
  z-index: 3;
  background: #fff;
  box-shadow: 0 6px 16px rgba(25, 27, 26, 0.08);
}

.schedule-month-grid button.holiday:hover:not(.active) {
  background: linear-gradient(145deg, #fff8ee, #eee6d8);
}

.schedule-month-grid button.makeup:hover:not(.active) {
  background: linear-gradient(145deg, #f4faf6, #dce8df);
}

.schedule-month-grid button[aria-current="date"]:not(.active) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    3px 4px 0 rgba(55, 62, 56, 0.07),
    0 0 0 2px color-mix(in srgb, var(--front-red, #8c0000) 16%, transparent),
    0 0 16px color-mix(in srgb, var(--front-red, #8c0000) 38%, transparent);
}

.schedule-month-grid button.active {
  z-index: 2;
  background: linear-gradient(145deg, color-mix(in srgb, var(--front-red) 82%, white), var(--front-red, #8c0000) 50%, var(--front-red-deep, #8c0000));
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    3px 4px 0 rgba(90, 0, 0, 0.16),
    0 0 18px color-mix(in srgb, var(--front-red, #8c0000) 35%, transparent);
}

.schedule-month-grid button.active em,
.schedule-month-grid button.active span,
.schedule-month-grid button.active.has-term span {
  color: #f3d2c8;
}

.schedule-month-grid button.active small {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.schedule-month-grid button.active.has-class::after {
  background: #fff;
}

.schedule-month-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eceeea;
  color: #6b726d;
  font-size: 0.64rem;
}

.schedule-month-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 2px;
  vertical-align: 0;
}

.schedule-month-legend .dot-holiday { background: #cbb896; }
.schedule-month-legend .dot-makeup { background: #7ea58a; }

.schedule-term-note,
.schedule-day-note,
.schedule-adjust {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 700;
}

#schedule-day-flag,
.schedule-term-note {
  font-style: normal;
}

.schedule-term-note {
  background: transparent;
  padding: 0;
  color: #6a5340;
  font-size: 0.8rem;
}

.schedule-day-note {
  background: #f3eee6;
  color: #7a5a28;
}

.schedule-adjust {
  background: #e7efe9;
  color: #2f5c3f;
}

.schedule-day-heading .schedule-term-note,
.schedule-day-heading .schedule-day-note,
.schedule-day-heading .schedule-adjust {
  margin-left: 0;
}

@media (max-width: 1100px) {
  body[data-page="home"] .front-hero {
    grid-template-columns: minmax(280px, 480px) minmax(480px, 560px);
    column-gap: 16px;
  }
}

@media (max-width: 980px) {
  body[data-page="home"] .front-hero {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
    align-items: start;
  }

  body[data-page="home"] .front-hero-copy,
  body[data-page="home"] .home-schedule {
    width: min(680px, 100%);
    max-width: 680px;
  }

  body[data-page="home"] .home-schedule {
    height: auto;
    max-height: none;
    min-height: 0;
    grid-template-rows: auto auto auto 1fr;
    overflow: visible;
  }

  body[data-page="home"] .home-life-dock {
    /* stacked layout: chips sit above schedule, never beside it */
    width: 100%;
    margin-top: 16px;
  }
}

@media (max-width: 760px) {
  body[data-page="home"] .front-hero {
    display: grid;
    min-height: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .home-schedule {
    width: 100%;
    padding: 16px 12px 14px;
  }

  .schedule-head > div:first-child {
    display: grid;
    gap: 3px;
  }

  .hero-live-time {
    margin: 8px 0 4px;
    padding: 22px 0 20px;
  }

  .hero-live-time strong {
    font-size: 2.7rem;
  }

  .schedule-head strong {
    font-size: 1.12rem;
  }

  .schedule-date-nav {
    gap: 3px;
  }

  .schedule-date-nav > button {
    flex-basis: 30px;
    width: 30px;
    min-width: 30px;
    min-height: 4.1rem;
  }

  .schedule-days {
    gap: 4px;
  }

  .schedule-days button {
    min-height: 5.1rem;
    padding: 6px 2px 7px;
  }

  .schedule-diary {
    display: grid;
  }

  .schedule-form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-dialog label.wide {
    grid-column: auto;
  }

  .schedule-rule-heading,
  .schedule-record-heading {
    align-items: flex-start;
  }

  .schedule-rule-heading > div span,
  .schedule-record-heading span {
    display: none;
  }

  .schedule-rule-heading > button {
    font-size: 0;
  }

  .schedule-rule-heading > button svg {
    width: 16px;
  }

  .schedule-note-item {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-page="home"] .topnav a::after,
  body[data-page="module"] .topnav a::after,
  body[data-page="home"] .module-entry svg {
    transition: none;
  }
}

/* Home workspace: clean canvas, 24px edge, compact schedule rows, paper cards */
body[data-page="home"] .site-shell {
  width: 100%;
  max-width: none;
  min-height: 100svh;
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 56px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
body[data-page="home"] main#top { flex: 1 1 auto; display: flex; min-height: 0; }
body[data-page="home"] .front-hero {
  flex: 1 1 auto;
  width: min(1160px, 100%);
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(460px, 620px);
  justify-content: center;
  justify-items: stretch;
  column-gap: 28px;
  row-gap: 20px;
  min-height: calc(100svh - 96px);
  height: auto;
  align-items: stretch;
  align-content: stretch;
  padding: 8px 0 20px;
  background: none;
}
body[data-page="home"] .front-hero-copy {
  width: 100%;
  max-width: none;
  min-width: 0;
  align-self: stretch;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  padding: 0;
  overflow: visible;
  z-index: 1;
}
body[data-page="home"] .front-hero-copy > h1,
body[data-page="home"] .front-hero-copy > .hero-english,
body[data-page="home"] .front-hero-copy > .hero-live-time {
  width: min(100%, 560px);
}
body[data-page="home"] .front-hero h1 {
  max-width: none;
  margin-bottom: 8px;
  margin-left: auto;
  margin-right: auto;
  font-size: 2.35rem;
  line-height: 1.22;
  text-align: center;
}
body[data-page="home"] .front-hero p { font-size: 0.92rem; line-height: 1.55; }
body[data-page="home"] .notice-strip { margin-bottom: 14px; }
body[data-page="home"] .hero-live-time {
  margin: 6px auto 2px;
  padding: 18px 0 16px;
  justify-content: center;
  gap: 14px;
}
body[data-page="home"] .hero-live-time strong { font-size: 2.7rem; }
body[data-page="home"] .hero-life-add {
  width: 32px;
  height: 32px;
  align-self: center;
}
html[data-theme="dark"] .hero-life-add {
  background: #241a1a;
  border-color: rgba(212, 90, 82, 0.4);
  color: #ef8a82;
}
html[data-theme="dark"] .hero-life-add:hover {
  background: #d45a52;
  border-color: #d45a52;
  color: #fff;
}
body[data-page="home"] .front-hero-copy .module-entry-grid {
  display: grid;
  flex: 0 0 auto;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto;
  gap: 10px;
  width: min(100%, 420px);
  margin: 16px auto 0;
  text-align: left;
}
body[data-page="home"] .front-hero-copy .module-entry {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  height: auto;
  min-height: 0;
  padding: 14px 14px 12px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #e4e6e2;
  border-radius: 8px;
  background: #fffcf9;
  box-shadow: 0 10px 28px rgba(28, 32, 29, 0.06);
}
body[data-page="home"] .front-hero-copy .module-entry::after {
  display: block;
  right: -28px;
  bottom: -52px;
  width: 180px;
  height: 110px;
  opacity: 0.18;
}
body[data-page="home"] .front-hero-copy .module-entry > span { position: static; padding-top: 0; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em; }
body[data-page="home"] .front-hero-copy .module-entry > svg { position: absolute; top: 14px; right: 14px; width: 15px; height: 15px; }
body[data-page="home"] .front-hero-copy .module-entry strong { margin: 8px 0 0; font-size: 1.05rem; line-height: 1.2; font-family: "Noto Serif SC", "Songti SC", STSong, Georgia, serif; }
body[data-page="home"] .front-hero-copy .module-entry p { max-width: 100%; margin: 5px 0 0; font-size: 0.72rem; line-height: 1.45; }
body[data-page="home"] .home-utility-links {
  position: static;
  left: auto;
  bottom: auto;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  padding-top: 0;
  text-align: center;
}
body[data-page="home"] .home-utility-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid #e4e6e2;
  border-radius: 6px;
  background: #fffcf9;
  box-shadow: 0 6px 16px rgba(28, 32, 29, 0.04);
  color: #69706c;
  font-size: .72rem;
  font-weight: 700;
  text-decoration: none;
}
body[data-page="home"] .home-utility-links a:hover { border-color: color-mix(in srgb, var(--front-red, #8c0000) 34%, transparent); color: var(--front-red); }
body[data-page="home"] .home-utility-links svg { width: 16px; height: 16px; }
body[data-page="home"] .home-life-dock {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 18px 0 0;
  min-height: 0;
  align-self: stretch;
  box-sizing: border-box;
  overflow: visible;
}
body[data-page="home"] .home-life-dock .schedule-life-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 10px;
  margin: 0;
  max-width: 100%;
}
body[data-page="home"] .home-life-dock .life-chip {
  /* keep rotated chips inside the left column so they never cover the schedule */
  margin: 10px 2px 6px;
}
body[data-page="home"] .home-life-dock .schedule-life-empty {
  min-width: 72px;
  min-height: 72px;
  margin: 8px 4px 0;
}
body[data-page="home"] .front-hero-copy {
  position: relative;
  padding: 0;
  align-items: center;
  justify-content: center;
}
body[data-page="home"] .home-schedule {
  align-self: stretch;
  width: 100%;
  max-width: none;
  min-width: 0;
  height: auto;
  min-height: 0;
  max-height: none;
  justify-self: stretch;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  padding: 18px 20px 16px;
  border: 1px solid var(--front-paper-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--front-paper) 92%, var(--front-soft));
  box-shadow: 0 14px 36px rgba(28, 32, 29, 0.08);
  z-index: 2;
  isolation: isolate;
  overflow: visible;
}
body[data-page="home"] .schedule-day-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: auto;
  overflow: visible;
  align-content: start;
}
body[data-page="home"] .schedule-agenda {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
  align-content: start;
}
@media (max-width: 1360px) {
  body[data-page="home"] .site-shell { min-height: 100svh; }
  body[data-page="home"] main#top { flex: 1 1 auto; display: flex; min-height: 0; }
  body[data-page="home"] .front-hero {
    flex: 1 1 auto;
    width: min(1080px, 100%);
    max-width: 1080px;
    margin-inline: auto;
    grid-template-columns: minmax(240px, 1fr) minmax(420px, 560px);
    justify-content: center;
    column-gap: 20px;
    min-height: calc(100svh - 92px);
    height: auto;
    align-items: stretch;
    padding-bottom: 20px;
  }
  body[data-page="home"] .front-hero-copy {
    align-self: stretch;
    width: 100%;
    max-width: none;
    justify-content: center;
    align-items: center;
    min-height: 0;
    padding: 0;
  }
  body[data-page="home"] .front-hero-copy .module-entry-grid { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
  body[data-page="home"] .front-hero-copy .module-entry { min-height: 0; }
  body[data-page="home"] .home-utility-links {
    position: static;
    margin-top: 16px;
    padding-top: 0;
  }
  body[data-page="home"] .home-life-dock {
    width: 100%;
    margin-top: 16px;
    min-height: 0;
  }
  body[data-page="home"] .front-hero-copy { padding: 0; }
  body[data-page="home"] .home-schedule {
    width: 100%;
    max-width: none;
    height: auto;
    min-height: 0;
    max-height: none;
    grid-template-rows: auto auto auto 1fr;
    overflow: visible;
  }
}
@media (max-width: 620px) {
  body[data-page="home"] .site-shell { margin: 0 16px; }
  body[data-page="home"] .front-hero-copy .module-entry-grid { grid-template-columns: 1fr; }
}

/* Appearance: dark mode */
html[data-theme="dark"] {
  color-scheme: dark;
  --sticky-paper: #232624;
  --sticky-paper-deep: #1d201e;
  --sticky-border: rgba(255, 255, 255, 0.1);
  --sticky-ink: #e8ebe7;
  --sticky-muted: #a4aaa4;
  --entry-tone-red-bg: linear-gradient(180deg, #2c2222, #261c1c);
  --entry-tone-red-border: rgba(220, 140, 140, 0.22);
  --entry-tone-amber-bg: linear-gradient(180deg, #2a2620, #231f1a);
  --entry-tone-amber-border: rgba(210, 180, 110, 0.2);
  --entry-tone-green-bg: linear-gradient(180deg, #202622, #1a211c);
  --entry-tone-green-border: rgba(130, 190, 150, 0.2);
  --entry-tone-blue-bg: linear-gradient(180deg, #1f242b, #1a1f26);
  --entry-tone-blue-border: rgba(130, 170, 220, 0.2);
  --entry-tone-violet-bg: linear-gradient(180deg, #25222a, #1f1c24);
  --entry-tone-violet-border: rgba(180, 150, 220, 0.2);
}

html[data-theme="dark"] body[data-page="home"],
html[data-theme="dark"] body[data-page="module"],
html[data-theme="dark"] body[data-page="submission"],
html[data-theme="dark"] body[data-page="article"] {
  --front-canvas: #141616;
  --front-paper: #1c1f1e;
  --front-paper-soft: #262a28;
  --front-ink: #eceee9;
  --front-muted: #9aa19a;
  --front-cloud: #6a706c;
  --front-green: #8fb0a6;
  --front-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --community-ink: #eceee9;
  --community-muted: #9aa19a;
  --community-paper: #1c1f1e;
  background: #121414;
  color: var(--front-ink);
}

html[data-theme="dark"] body[data-page="home"] .topbar,
html[data-theme="dark"] body[data-page="module"] .topbar,
html[data-theme="dark"] body[data-page="submission"] .topbar,
html[data-theme="dark"] body[data-page="article"] .reader-header {
  background: rgba(28, 31, 30, 0.94);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 100vmax rgba(28, 31, 30, 0.94);
}

html[data-theme="dark"] body[data-page="home"] .home-schedule,
html[data-theme="dark"] body[data-page="home"] .front-hero-copy .module-entry,
html[data-theme="dark"] body[data-page="home"] .home-utility-links a {
  border-color: rgba(255, 255, 255, 0.08);
  background: #1c1f1e;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
  color: var(--front-ink);
}

html[data-theme="dark"] .schedule-panel-title strong,
html[data-theme="dark"] .hero-live-time strong,
html[data-theme="dark"] body[data-page="home"] .front-hero h1 {
  color: #f3f4f1;
}

html[data-theme="dark"] .hero-live-time span,
html[data-theme="dark"] .schedule-head span,
html[data-theme="dark"] body[data-page="home"] .front-hero p {
  color: #a3aaa4;
}

html[data-theme="dark"] .schedule-days button[data-schedule-date] {
  background: linear-gradient(145deg, #2a2e2c, #1f2321);
  border-color: rgba(255, 255, 255, 0.08);
  color: #b7beb8;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    5px 7px 0 rgba(0, 0, 0, 0.28),
    8px 12px 18px rgba(0, 0, 0, 0.32);
}

html[data-theme="dark"] .schedule-days button[data-schedule-date].active {
  background: linear-gradient(145deg, color-mix(in srgb, var(--front-red) 78%, white), var(--front-red, #8c0000) 48%, var(--front-red-deep, #8c0000));
  color: #fff;
}
html[data-theme="dark"] .schedule-days em { color: #cbb8a6; }
html[data-theme="dark"] .schedule-days button.has-term em { color: #f0c2b4; }
html[data-theme="dark"] .schedule-month-grid button em { color: #cbb8a6; }
html[data-theme="dark"] .schedule-month-grid button.has-term span { color: #f0c2b4; }

html[data-theme="dark"] .schedule-day-add {
  background: #241a1a;
  border-color: rgba(212, 90, 82, 0.45);
  color: #ef8a82;
}

html[data-theme="dark"] .schedule-entry {
  color: var(--sticky-ink);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .schedule-entry strong { color: var(--sticky-ink); }
html[data-theme="dark"] .schedule-entry small,
html[data-theme="dark"] .schedule-entry p,
html[data-theme="dark"] .schedule-entry-note-view { color: var(--sticky-muted); }
html[data-theme="dark"] .schedule-entry > time { color: var(--front-cinnabar); border-right-color: var(--sticky-border); }

html[data-theme="dark"] .schedule-actions button,
html[data-theme="dark"] .schedule-date-nav > button,
html[data-theme="dark"] .schedule-actions .schedule-action-btn {
  border-color: rgba(255, 255, 255, 0.1);
  background: #262a28;
  color: #c5cbc5;
}

html[data-theme="dark"] .life-chip {
  border-color: var(--sticky-border);
  background: linear-gradient(180deg, var(--sticky-paper), var(--sticky-paper-deep));
  color: var(--sticky-ink);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
}
  color: #e8d7c4;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.28);
html[data-theme="dark"] .schedule-empty,
html[data-theme="dark"] .profile-panel,
html[data-theme="dark"] .points-panel,
html[data-theme="dark"] .auth-panel {
  border-color: rgba(255, 255, 255, 0.08);
  background: #1c1f1e;
  color: var(--front-ink);
}

html[data-theme="dark"] .profile-form input,
html[data-theme="dark"] .auth-form input,
html[data-theme="dark"] .auth-form textarea,
html[data-theme="dark"] .schedule-diary textarea {
  background: #262a28;
  color: var(--front-ink);
  border-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .appearance-choice {
  border-color: rgba(255, 255, 255, 0.1);
  background: #262a28;
  color: #c5cbc5;
}

html[data-theme="dark"] .appearance-choice.is-active {
  border-color: color-mix(in srgb, var(--front-red, #ef8a82) 50%, transparent);
  background: color-mix(in srgb, var(--front-red, #ef8a82) 18%, #1c1f1d);
  color: color-mix(in srgb, var(--front-red, #ef8a82) 72%, #fff);
}

.appearance-settings {
  display: grid;
  gap: 22px;
  margin-top: 16px;
}

.appearance-row {
  display: grid;
  gap: 10px;
}

.appearance-row > span {
  color: var(--front-muted, #666b68);
  font-size: 0.74rem;
  font-weight: 700;
}

.appearance-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appearance-choice {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #e0e3df;
  border-radius: 6px;
  background: #f8f9f7;
  color: #555d58;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.appearance-choice.is-active {
  border-color: color-mix(in srgb, var(--front-red, #8c0000) 35%, transparent);
  background: var(--front-soft, #fbf4f3);
  color: var(--front-red, #8c0000);
}

.appearance-hint {
  color: var(--front-muted, #666b68);
  font-size: 0.72rem;
  line-height: 1.5;
}

