:root {
  color-scheme: light;
  --ink: #242b2b;
  --ink-soft: #586363;
  --muted: #7d8889;
  --paper: rgba(255, 255, 252, 0.82);
  --paper-strong: rgba(255, 255, 253, 0.94);
  --line: rgba(67, 87, 88, 0.14);
  --vermilion: #b85245;
  --indigo: #315f86;
  --moss: #657e67;
  --summer: #426d84;
  --gold: #a88b53;
  --shadow: 0 14px 38px rgba(65, 91, 94, 0.09);
  --radius-lg: 24px;
  --radius-md: 16px;
  --page-max: 1180px;
  --season-art: url("./assets/seasons/summer.webp");
  --season-base: #e8f1f2;
  --season-top: rgba(218, 237, 245, 0.8);
  --season-middle: rgba(247, 244, 235, 0.88);
  --season-bottom: rgba(238, 241, 234, 0.9);
  --season-glow: rgba(255, 255, 255, 0.74);
  --season-wash-top: rgba(230, 244, 249, 0.14);
  --season-wash-bottom: rgba(255, 252, 244, 0.38);
  --season-accent: #426d84;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-synthesis: none;
}

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

html {
  min-width: 0;
  min-height: 100%;
  background: var(--season-base);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, var(--season-top), var(--season-middle) 58%, var(--season-bottom));
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--season-art) center top / cover no-repeat;
  content: "";
  opacity: 0.72;
  pointer-events: none;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 78% 10%, var(--season-glow), transparent 28%),
    linear-gradient(180deg, var(--season-wash-top), var(--season-wash-bottom) 72%);
  content: "";
  pointer-events: none;
}

html[data-season="spring"] {
  --season-art: url("./assets/seasons/spring.webp");
  --season-base: #f4e8e4;
  --season-top: rgba(250, 232, 230, 0.8);
  --season-middle: rgba(251, 246, 238, 0.9);
  --season-bottom: rgba(242, 240, 228, 0.92);
  --season-glow: rgba(255, 251, 250, 0.78);
  --season-wash-top: rgba(252, 222, 224, 0.16);
  --season-wash-bottom: rgba(255, 252, 244, 0.42);
  --season-accent: #a76c73;
}

html[data-season="summer"] {
  --season-art: url("./assets/seasons/summer.webp");
  --season-base: #e8f1f2;
  --season-top: rgba(218, 237, 245, 0.8);
  --season-middle: rgba(247, 244, 235, 0.88);
  --season-bottom: rgba(238, 241, 234, 0.9);
  --season-glow: rgba(255, 255, 255, 0.74);
  --season-wash-top: rgba(230, 244, 249, 0.14);
  --season-wash-bottom: rgba(255, 252, 244, 0.38);
  --season-accent: #426d84;
}

html[data-season="autumn"] {
  --season-art: url("./assets/seasons/autumn.webp");
  --season-base: #f4ebd8;
  --season-top: rgba(251, 236, 203, 0.78);
  --season-middle: rgba(250, 246, 232, 0.9);
  --season-bottom: rgba(239, 235, 219, 0.94);
  --season-glow: rgba(255, 249, 235, 0.76);
  --season-wash-top: rgba(251, 211, 157, 0.14);
  --season-wash-bottom: rgba(255, 251, 240, 0.44);
  --season-accent: #a67144;
}

html[data-season="winter"] {
  --season-art: url("./assets/seasons/winter.webp");
  --season-base: #edf1f1;
  --season-top: rgba(230, 238, 241, 0.84);
  --season-middle: rgba(249, 249, 246, 0.92);
  --season-bottom: rgba(229, 233, 232, 0.92);
  --season-glow: rgba(255, 255, 255, 0.78);
  --season-wash-top: rgba(218, 230, 236, 0.18);
  --season-wash-bottom: rgba(255, 255, 255, 0.42);
  --season-accent: #617c91;
}

button { font: inherit; }
button, [tabindex] { -webkit-tap-highlight-color: transparent; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(49,95,134,.42); outline-offset: 3px; }
ruby { ruby-align: center; }
rt { color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif; font-size: .54em; font-weight: 500; letter-spacing: .02em; }
html.setting-hide-ruby rt { display: none; }

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

.app-shell {
  width: min(100%, var(--page-max));
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.app-header {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  min-height: 68px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 8px;
}

.app-name {
  margin: 0;
  color: rgba(36,43,43,.7);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: .85rem;
  letter-spacing: .18em;
  text-align: center;
}

.icon-button, .month-arrow {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.35);
  color: var(--ink-soft);
  cursor: pointer;
}

.icon-button svg, .month-arrow svg, .nav-item svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.today-button {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(75,102,107,.12);
  border-radius: 999px;
  background: rgba(255,255,255,.58);
  box-shadow: 0 4px 14px rgba(66,91,94,.06);
  color: var(--ink);
  cursor: pointer;
}

.today-view { min-width: 0; }
.tab-view { min-width: 0; padding: 12px 0 34px; }
.app-credit { display: grid; justify-items: center; gap: 5px; padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); color: rgba(70,84,83,.58); font-size: .6rem; letter-spacing: .08em; text-align: center; }
.app-credit a { color: inherit; text-decoration-color: rgba(70,84,83,.24); text-underline-offset: 3px; }
.app-credit a:focus-visible { outline: 2px solid rgba(49,95,134,.42); outline-offset: 3px; }
.tab-heading { max-width: 620px; margin: 0 auto; padding: 24px 28px 20px; text-align: center; }
.tab-heading h1 { margin: 4px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.65rem; font-weight: 500; letter-spacing: .1em; }
.tab-heading > p:last-child { margin: 10px 0 0; color: var(--ink-soft); font-size: .78rem; line-height: 1.7; }
.calendar-view .calendar-section { padding-top: 0; }
.words-view, .year-view { max-width: 960px; margin-inline: auto; }
.words-feature {
  position: relative;
  margin: 8px 24px 0;
  padding: 34px 28px 30px;
  overflow: hidden;
  border: 1px solid rgba(151,130,84,.14);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255,253,244,.92), rgba(238,244,237,.82));
  box-shadow: var(--shadow);
}
.words-feature::after { position: absolute; right: -42px; bottom: -48px; width: 156px; height: 156px; border: 1px solid rgba(95,130,105,.14); border-radius: 50%; content: ""; }
.words-feature blockquote { position: relative; z-index: 1; margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1rem; line-height: 2.15; white-space: pre-line; }
.words-feature p { position: relative; z-index: 1; margin: 24px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .76rem; line-height: 1.8; }
.words-moon { display: block; width: 28px; height: 28px; margin-bottom: 18px; background: var(--gold); -webkit-mask: url("./assets/icons/moon.svg") center / contain no-repeat; mask: url("./assets/icons/moon.svg") center / contain no-repeat; }
.tab-primary-link { margin-top: 18px; }
.year-toolbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; max-width: 360px; margin: 2px auto 0; text-align: center; }
.year-toolbar h2 { margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.1rem; font-weight: 500; letter-spacing: .08em; }
.year-actions { display: flex; justify-content: center; gap: 12px; margin: 10px 20px 18px; }
.print-button { min-height: 34px; padding: 0 13px; border: 1px solid rgba(49,95,134,.22); border-radius: 999px; background: rgba(232,241,244,.78); color: var(--indigo); font: inherit; font-size: .7rem; font-weight: 600; cursor: pointer; }
.year-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 14px 28px; }
.year-month { min-width: 0; padding: 10px 7px 8px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,252,.76); box-shadow: 0 5px 16px rgba(62,76,74,.035); }
.year-month h3 { margin: 0 0 7px; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .77rem; font-weight: 500; text-align: center; }
.year-month h3 small { color: var(--muted); font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif; font-size: .52rem; font-weight: 500; }
.year-weekdays, .year-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.year-weekdays span { color: var(--muted); font-size: .48rem; line-height: 1.5; text-align: center; }
.year-weekdays span:first-child, .year-day.is-sunday { color: var(--vermilion); }
.year-weekdays span:last-child, .year-day.is-saturday { color: var(--indigo); }
.year-day { display: grid; min-width: 0; aspect-ratio: 1; padding: 0; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font: inherit; font-size: .54rem; cursor: pointer; }
.year-day:hover { background: rgba(84,119,124,.1); }
.year-day.is-today { background: var(--season-accent); color: #fff; font-weight: 700; }
.year-day:focus-visible { outline-width: 2px; outline-offset: 1px; }

.season-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px;
  gap: 12px 14px;
  padding: 24px 24px 22px;
  text-align: center;
}

.hero-date-copy { grid-column: 1 / -1; padding-inline: 28px; }
.era-line { margin: 0 0 9px; color: var(--ink-soft); font-size: .78rem; letter-spacing: .09em; }
.hero-date-copy h1 {
  margin: 0;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: clamp(1.65rem, 7vw, 2.2rem);
  font-weight: 500;
  letter-spacing: .07em;
}
.full-date { margin: 10px 0 0; font-size: .9rem; letter-spacing: .05em; }

.moon-figure {
  position: absolute;
  top: 42px;
  right: 16px;
  width: 82px;
  height: 82px;
  margin: 0;
  filter: drop-shadow(0 6px 8px rgba(34,44,45,.13));
  opacity: .94;
}
.moon-figure canvas { display: block; width: 100%; height: 100%; }

.term-flow { grid-column: 1 / -1; margin-top: 10px; }
.term-labels { display: flex; justify-content: space-between; color: var(--ink); font-size: .72rem; }
.term-track { position: relative; height: 14px; margin: 3px 4px 0; }
.term-track::before {
  position: absolute;
  top: 6px;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(61,86,92,.16), rgba(61,86,92,.34), rgba(61,86,92,.16));
  content: "";
}
.term-track span { position: absolute; top: 5px; left: 0; width: 0; height: 3px; border-radius: 2px; background: var(--season-accent); }
.term-track i {
  position: absolute;
  top: 1px;
  left: 0;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,.8);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 5px rgba(21,35,37,.2);
  transform: translateX(-50%);
}
.term-caption { margin: 1px 0 0; color: var(--muted); font-size: .67rem; }

.season-sentence { grid-column: 1 / -1; margin: 1px 0 3px; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .84rem; letter-spacing: .04em; }

.moon-summary {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-self: center;
  gap: 10px;
  min-width: 176px;
  padding: 8px 16px 8px 10px;
  border: 1px solid rgba(80,100,101,.12);
  border-radius: 13px;
  background: rgba(255,255,255,.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
}
.moon-summary canvas { width: 34px; height: 34px; filter: drop-shadow(0 2px 4px rgba(37,45,45,.12)); }
.moon-summary p { margin: 0; }
.moon-summary p:first-child { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .92rem; }
.moon-summary p:last-child { margin-top: 2px; color: var(--ink-soft); font-size: .67rem; }
.precision-label { margin-left: 5px; color: var(--muted); font-family: -apple-system, sans-serif; font-size: .58rem; }

.calendar-section { min-width: 0; padding-block: 4px 12px; }
.calendar-toolbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  margin: 0 22px 10px;
  text-align: center;
}
.calendar-toolbar h2 { margin: 1px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.1rem; font-weight: 600; letter-spacing: .08em; }
.section-kicker { margin: 0; color: var(--muted); font-size: .62rem; letter-spacing: .16em; text-transform: uppercase; }
.month-arrow { background: transparent; }

.month-viewport { min-width: 0; overflow: hidden; }
.month-track {
  display: flex;
  gap: 12px;
  min-width: 0;
  padding: 0 28px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 28px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
}
.month-track::-webkit-scrollbar { display: none; }
.month-track.is-dragging { cursor: grabbing; scroll-snap-type: none; user-select: none; }

.month-card {
  flex: 0 0 100%;
  min-width: 0;
  padding: 15px 13px 14px;
  scroll-snap-align: center;
  border: 1px solid rgba(86,103,102,.12);
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.month-card.is-loading { display: grid; min-height: 300px; place-items: center; color: var(--muted); }
.month-card-header { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 0 4px 10px; }
.month-card-header h3 { margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.08rem; font-weight: 600; }
.month-card-header p { margin: 0; color: var(--muted); font-size: .72rem; letter-spacing: .12em; }

.weekday-row, .days-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.weekday { padding: 4px 0; color: var(--ink-soft); font-size: .68rem; text-align: center; }
.weekday.is-sunday { color: var(--vermilion); }
.weekday.is-saturday { color: var(--indigo); }

.day-button {
  position: relative;
  display: grid;
  grid-template-rows: 23px 14px;
  min-width: 0;
  min-height: 42px;
  padding: 3px 1px 1px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.day-button:hover { background: rgba(70,101,111,.06); }
.day-number {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.day-note {
  display: block;
  max-width: 100%;
  overflow: hidden;
  color: var(--moss);
  font-size: .5rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-button.is-sunday, .day-button.is-holiday { color: var(--vermilion); }
.day-button.is-saturday { color: var(--indigo); }
.day-button.is-outside { opacity: .34; }
.day-button.is-today .day-number { background: var(--season-accent); box-shadow: 0 4px 9px rgba(75,95,94,.22); color: #fff; font-weight: 700; }
.day-button.has-seasonal-event .day-note { color: var(--gold); }
.day-button.is-selected { background: rgba(49,95,134,.08); }
.day-button.has-moon .day-note::before { display: inline-block; width: 5px; height: 5px; margin-right: 2px; border-radius: 50%; background: currentColor; content: ""; vertical-align: 1px; }

.calendar-hint { margin: 4px 0 0; color: var(--muted); font-size: .64rem; text-align: center; }

.daily-letter {
  margin: 6px 28px 24px;
  padding: 18px 18px 20px;
  border: 1px solid rgba(78,95,89,.11);
  border-radius: var(--radius-md);
  background: rgba(255,255,252,.65);
  box-shadow: 0 9px 26px rgba(70,91,87,.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.letter-heading { display: flex; align-items: center; gap: 8px; }
.letter-heading h2 { margin: 0; font-size: .85rem; font-weight: 600; letter-spacing: .05em; }
.leaf-mark { width: 13px; height: 8px; border-radius: 100% 0 100% 0; background: #79a276; transform: rotate(-28deg); }
.daily-letter > p { margin: 11px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .82rem; line-height: 1.9; }
.letter-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.text-link {
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--indigo);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
}
.text-link::after { margin-left: 5px; content: "›"; }

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-height: calc(68px + env(safe-area-inset-bottom));
  padding: 5px max(8px, calc((100vw - 480px) / 2)) env(safe-area-inset-bottom);
  border-top: 1px solid rgba(64,82,82,.12);
  background: rgba(252,252,248,.88);
  box-shadow: 0 -8px 26px rgba(57,77,76,.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.nav-item {
  display: grid;
  min-width: 0;
  min-height: 58px;
  padding: 5px 2px 3px;
  place-items: center;
  gap: 0;
  border: 0;
  background: transparent;
  color: #727b7c;
  cursor: pointer;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item span { font-size: .61rem; }
.nav-item.is-active { color: var(--indigo); }

.menu-dialog {
  width: min(100% - 24px, 420px);
  margin: auto auto 10px;
  padding: 8px 20px calc(22px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255,255,252,.96);
  color: var(--ink);
  box-shadow: 0 20px 80px rgba(21,35,36,.22);
  max-height: calc(100dvh - 20px);
  overflow-y: auto;
}
.menu-dialog::backdrop { background: rgba(32,44,45,.28); backdrop-filter: blur(3px); }
.dialog-handle { width: 38px; height: 4px; margin: 0 auto 12px; border-radius: 4px; background: #d4d9d7; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; }
.dialog-header h2 { margin: 2px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; }
.menu-dialog > p { margin: 18px 0 4px; color: var(--ink-soft); font-size: .84rem; line-height: 1.8; }
.menu-list { margin-top: 14px; }
.menu-list button {
  display: grid;
  width: 100%;
  min-height: 62px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(244,248,244,.76);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.menu-list small { margin-top: 3px; color: var(--muted); }
.settings-list { display: grid; gap: 0; margin: 18px 0 0; padding: 0; border: 0; }
.settings-list legend { width: 100%; padding: 0 0 8px; color: var(--muted); font-size: .66rem; letter-spacing: .1em; }
.settings-list label { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 46px; align-items: center; min-height: 60px; padding: 9px 2px; border-top: 1px solid var(--line); cursor: pointer; }
.settings-list strong, .settings-list small { display: block; }
.settings-list strong { font-size: .8rem; font-weight: 600; }
.settings-list small { margin-top: 3px; color: var(--muted); font-size: .61rem; }
.settings-list input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.settings-list i { position: relative; width: 42px; height: 25px; border-radius: 999px; background: #d8dcda; box-shadow: inset 0 0 0 1px rgba(45,59,58,.06); transition: background .2s; }
.settings-list i::after { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(35,48,48,.18); content: ""; transition: transform .2s; }
.settings-list input:checked + i { background: var(--indigo); }
.settings-list input:checked + i::after { transform: translateX(17px); }
.settings-list input:focus-visible + i { outline: 3px solid rgba(49,95,134,.3); outline-offset: 2px; }
.settings-note { margin-top: 10px !important; font-size: .68rem !important; }

html.setting-hide-moon .moon-figure,
html.setting-hide-moon .moon-summary,
html.setting-hide-moon .detail-moon,
html.setting-hide-moon .info-card.is-moon { display: none; }
html.setting-hide-calendar .term-flow,
html.setting-hide-calendar .season-sentence,
html.setting-hide-calendar .info-card.is-season,
html.setting-hide-calendar .info-card.is-event { display: none; }
html.setting-hide-eto #yearGanzi,
html.setting-hide-eto .detail-eto { display: none; }
html.setting-hide-eto .detail-eto-note { display: none; }

html.has-overlay, html.has-overlay body { overflow: hidden; }

.detail-dialog {
  width: min(100%, 440px);
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #fbfbf7;
  color: var(--ink);
}
.detail-dialog::backdrop { background: rgba(30,39,40,.34); backdrop-filter: blur(4px); }
.detail-sheet { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.detail-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 82px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
  border-bottom: 1px solid rgba(65,81,80,.08);
  background: rgba(251,251,247,.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
}
.detail-header h2 { margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.32rem; font-weight: 500; letter-spacing: .06em; }
.detail-header p { margin: 3px 0 0; color: var(--muted); font-size: .65rem; }
.detail-header .icon-button { background: transparent; }
.detail-moon { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 20px; padding: 28px 30px 22px; }
.detail-moon canvas { width: 92px; height: 92px; filter: drop-shadow(0 7px 9px rgba(32,39,39,.15)); }
.detail-moon h3 { margin: 0 0 4px; color: var(--muted); font-size: .68rem; font-weight: 500; }
.detail-moon p { margin: 0; }
.detail-moon-age { font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1.2rem; }
.detail-moon-age + p { margin-top: 5px; color: var(--ink-soft); font-size: .76rem; }
.precision-note { display: inline-block; margin-top: 6px; color: var(--muted); font-size: .58rem; }
.detail-eto { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 24px; padding: 15px 0; border-block: 1px solid var(--line); }
.detail-eto div { text-align: center; }
.detail-eto div + div { border-left: 1px solid var(--line); }
.detail-eto dt { color: var(--muted); font-size: .62rem; }
.detail-eto dd { margin: 6px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .92rem; }
.detail-definition { margin: 9px 26px 2px; color: var(--ink-soft); font-size: .68rem; line-height: 1.7; }
.detail-list { margin: 0 24px; }
.detail-list > div { display: grid; grid-template-columns: 94px minmax(0, 1fr); gap: 12px; align-items: center; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.detail-list dt { align-self: center; color: var(--muted); font-size: .68rem; }
.detail-list dd { min-width: 0; margin: 0; font-size: .82rem; line-height: 1.55; overflow-wrap: anywhere; }
.detail-list dd > span { display: block; }
.detail-list dd small { display: block; margin-top: 5px; color: var(--ink-soft); font-size: .67rem; line-height: 1.65; }
.word-card { position: relative; margin: 22px 24px 0; padding: 20px; overflow: hidden; border: 1px solid rgba(166,143,87,.14); border-radius: 18px; background: linear-gradient(135deg, rgba(249,246,232,.9), rgba(240,244,232,.76)); }
.word-card::after { position: absolute; right: -18px; bottom: -20px; width: 94px; height: 94px; border: 1px solid rgba(105,133,101,.14); border-radius: 56% 44% 61% 39%; content: ""; transform: rotate(-18deg); }
.word-card blockquote { margin: 12px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .88rem; line-height: 2; white-space: pre-line; }
.detail-letter { margin: 22px 26px 0; }
.detail-letter h3 { margin: 0; font-size: .78rem; }
.detail-letter p { margin: 10px 0 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .82rem; line-height: 1.9; }
.primary-link { display: block; width: calc(100% - 48px); min-height: 48px; margin: 24px; border: 1px solid rgba(49,95,134,.18); border-radius: 14px; background: rgba(226,238,241,.7); color: var(--indigo); font-weight: 600; cursor: pointer; }

.other-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: min(100%, 480px);
  margin: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(251,251,247,.95), rgba(246,245,239,.98)),
    var(--season-art) center / cover;
  color: var(--ink);
}
.other-screen[hidden] { display: none; }
.other-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  min-height: 78px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 8px;
  border-bottom: 1px solid rgba(67,82,82,.08);
  background: rgba(251,251,247,.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
}
.other-header h2 { margin: 0; font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: 1rem; letter-spacing: .08em; }
.other-header p { margin: 3px 0 0; color: var(--muted); font-size: .62rem; }
.other-header .icon-button { background: transparent; }
.other-header .icon-button:focus-visible,
.detail-header .icon-button:focus-visible,
.dialog-header .icon-button:focus-visible { outline-width: 2px; outline-offset: 1px; }
.other-content { display: grid; gap: 10px; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); }
.observation-control { display: grid; grid-template-columns: minmax(0, 1fr) minmax(124px, 42%); gap: 5px 12px; align-items: center; padding: 13px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,252,.72); }
.observation-control label { color: var(--ink); font-size: .78rem; font-weight: 600; }
.observation-control select { width: 100%; min-height: 38px; padding: 0 30px 0 11px; border: 1px solid rgba(63,86,86,.18); border-radius: 10px; background: rgba(255,255,252,.9); color: var(--ink); font: inherit; font-size: .76rem; }
.observation-control small { grid-column: 1 / -1; color: var(--muted); font-size: .6rem; line-height: 1.5; }
.info-card { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 17px 16px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,252,.8); box-shadow: 0 7px 22px rgba(62,76,74,.045); }
.info-card h3, .info-card label { display: block; margin: 0; font-size: .82rem; font-weight: 600; letter-spacing: .03em; }
.info-card p { margin: 7px 0 0; color: var(--ink-soft); font-family: "Hiragino Mincho ProN", "Yu Mincho", serif; font-size: .77rem; line-height: 1.75; }
.info-card dl { margin: 7px 0 0; }
.info-card dl div { display: grid; grid-template-columns: 76px 1fr; font-size: .75rem; line-height: 1.8; }
.info-card dd { margin: 0; font-variant-numeric: tabular-nums; }
.info-card small { display: block; margin-top: 5px; color: var(--muted); font-size: .57rem; line-height: 1.5; }
.info-icon {
  display: block;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  background: currentColor;
  color: var(--moss);
  -webkit-mask: var(--icon-url) center / 27px 27px no-repeat;
  mask: var(--icon-url) center / 27px 27px no-repeat;
}
.leaf-icon { --icon-url: url("./assets/icons/leaf.svg"); color: #5f8269; }
.sun-icon { --icon-url: url("./assets/icons/sunrise.svg"); color: #c45d42; }
.moon-icon { --icon-url: url("./assets/icons/moon.svg"); color: #315f86; }
.star-icon { --icon-url: url("./assets/icons/star.svg"); color: #b58628; }
.heart-icon { --icon-url: url("./assets/icons/heart.svg"); color: #aa6045; }
.book-icon { --icon-url: url("./assets/icons/book-open.svg"); color: #8c6f94; }
.is-season { background: linear-gradient(135deg, rgba(246,250,243,.9), rgba(255,253,247,.88)); }
.is-sun { background: linear-gradient(135deg, rgba(255,249,242,.92), rgba(255,252,248,.88)); }
.is-moon { background: linear-gradient(135deg, rgba(244,248,253,.92), rgba(252,252,250,.88)); }
.is-event { background: linear-gradient(135deg, rgba(255,250,237,.92), rgba(255,253,247,.88)); }
.is-recommend { background: linear-gradient(135deg, rgba(253,246,241,.92), rgba(255,252,249,.88)); }
.is-memo { background: linear-gradient(135deg, rgba(249,245,250,.92), rgba(255,253,251,.88)); }
#calendarMemo { width: 100%; margin-top: 9px; padding: 10px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.62); color: var(--ink); font: inherit; font-size: .76rem; line-height: 1.6; }
#calendarMemo:focus { outline: 3px solid rgba(49,95,134,.25); border-color: rgba(49,95,134,.35); }

.toast {
  position: fixed;
  right: 20px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  left: 20px;
  z-index: 50;
  max-width: 360px;
  margin: auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(35,47,48,.9);
  color: #fff;
  font-size: .76rem;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translateY(0); }
.noscript { margin: 16px; padding: 12px; border-radius: 12px; background: #fff; }

@media (min-width: 720px) {
  .app-header { padding-inline: 32px; }
  .season-hero { max-width: 620px; margin: 0 auto; padding-top: 34px; }
  .calendar-toolbar { max-width: 520px; margin-inline: auto; }
  .daily-letter { max-width: 620px; margin-inline: auto; }
  .detail-dialog { height: min(92dvh, 880px); margin: auto; border-radius: 28px; box-shadow: 0 24px 90px rgba(25,35,36,.24); }
  .detail-header { padding-top: 10px; }
  .other-screen { height: min(94dvh, 900px); border-radius: 26px; box-shadow: 0 24px 90px rgba(25,35,36,.22); }
  .other-header { padding-top: 10px; }
}

@media (min-width: 900px) {
  .app-shell { padding-inline: 28px; }
  .season-hero { padding-bottom: 34px; }
  .month-viewport { overflow: visible; }
  .month-track { gap: 16px; padding-inline: 0; overflow: hidden; scroll-snap-type: none; }
  .month-card { flex-basis: calc((100% - 32px) / 3); }
  .month-card[data-offset="-2"], .month-card[data-offset="2"] { display: none; }
  .calendar-hint { display: none; }
}

@media (max-width: 360px) {
  .season-hero { padding-inline: 18px; }
  .hero-date-copy { padding-inline: 18px; }
  .moon-figure { right: 8px; width: 72px; height: 72px; }
  .month-track { padding-inline: 20px; scroll-padding-inline: 20px; }
  .month-card { flex-basis: 100%; padding-inline: 9px; }
  .daily-letter { margin-inline: 20px; }
}

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

@media print {
  @page { size: A4 portrait; margin: 11mm; }
  html, body { min-height: 0; background: #fff !important; }
  body::before, body::after, .app-header, .app-credit, .bottom-nav, .today-view, .calendar-view, .words-view, .other-screen, dialog, .year-actions { display: none !important; }
  .app-shell { width: 100%; min-height: 0; padding: 0; }
  .year-view { display: block !important; max-width: none; padding: 0; }
  .tab-heading { padding: 0 0 3mm; }
  .tab-heading .section-kicker, .tab-heading > p:last-child { display: none; }
  .tab-heading h1 { font-size: 17pt; }
  .year-toolbar { max-width: none; margin: 0 0 3mm; }
  .year-toolbar .month-arrow { display: none; }
  .year-toolbar h2 { grid-column: 1 / -1; font-size: 13pt; }
  .year-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.5mm; padding: 0; break-inside: avoid; }
  .year-month { break-inside: avoid; padding: 1.8mm 1.5mm; border-color: #b9b9b2; border-radius: 0; box-shadow: none; }
  .year-month h3 { margin-bottom: 1mm; font-size: 9pt; }
  .year-weekdays span { font-size: 5pt; }
  .year-day { height: 6.8mm; aspect-ratio: auto; font-size: 6pt; line-height: 1; }
  .year-day.is-today { border: 0; background: transparent; color: var(--ink); font-weight: 400; }
  .year-day.is-today.is-sunday { color: var(--vermilion); }
  .year-day.is-today.is-saturday { color: var(--indigo); }
}
