/* GoodDay — one stylesheet, system fonts only, no external requests. */
:root {
  --bg: #f6f2ea;
  --bg-2: #efe9de;
  --surface: #fffdf8;
  --surface-2: #faf6ee;
  --ink: #221d19;
  --ink-2: #4a423a;
  --muted: #6f6459;
  --line: #e2d9c9;
  --line-2: #d3c7b4;
  --red: #ad2b28;
  --red-soft: #f7e3df;
  --gold: #8d6417;
  --gold-soft: #f6ecd4;
  --indigo: #2e4a78;
  --indigo-soft: #e4eaf5;
  --shadow: 0 1px 2px rgba(48, 36, 20, .05), 0 8px 24px rgba(48, 36, 20, .06);
  --radius: 16px;
  --max: 1080px;
}
[data-theme="dark"] {
  --bg: #12100e;
  --bg-2: #17140f;
  --surface: #1c1815;
  --surface-2: #211d19;
  --ink: #f3ece1;
  --ink-2: #d7cdbf;
  --muted: #a79b8c;
  --line: #322b24;
  --line-2: #453b31;
  --red: #ef8074;
  --red-soft: #3a201d;
  --gold: #e3b767;
  --gold-soft: #33281a;
  --indigo: #a7bce6;
  --indigo-soft: #222c3f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans CJK KR", "Noto Sans CJK JP",
    "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
svg { display: block; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--surface); color: var(--ink);
  padding: 10px 16px; z-index: 100; border-radius: 0 0 10px 0;
}
.skip:focus { left: 0; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; border-radius: 8px; }

/* header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: 0 0 auto; color: var(--red); }
.brand-name { display: block; font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand-org {
  font-size: 9.5px; letter-spacing: .09em; font-weight: 700; color: var(--muted);
  border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 4px; margin-left: 4px;
  vertical-align: 2px;
}
.brand-sub { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-tools { display: flex; align-items: center; gap: 8px; }
.langs { display: flex; gap: 2px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.langs a {
  text-decoration: none; font-size: 12.5px; padding: 5px 9px; border-radius: 999px; color: var(--muted);
  line-height: 1.2; white-space: nowrap;
}
.langs a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer;
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
[data-theme="light"] .i-moon { display: block; }
[data-theme="light"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: none; }
[data-theme="dark"] .i-sun { display: block; }

/* tabs */
.tabs { border-bottom: 1px solid var(--line); background: var(--bg); }
.tabs-in { display: flex; gap: 4px; overflow-x: auto; padding: 8px 20px; max-width: var(--max); margin: 0 auto; scrollbar-width: none; }
.tabs-in::-webkit-scrollbar { display: none; }
.tabs a {
  text-decoration: none; font-size: 13.5px; color: var(--muted); padding: 6px 12px;
  border-radius: 999px; white-space: nowrap; border: 1px solid transparent;
}
.tabs a:hover { color: var(--ink); background: var(--surface-2); border-color: var(--line); }

/* hero */
.hero { padding: 40px 20px 22px; }
.eyebrow { font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--red); font-weight: 700; margin-bottom: 12px; }
.hero h1 { font-size: clamp(30px, 5.4vw, 52px); font-weight: 800; letter-spacing: -.035em; }
.hero .lead { margin-top: 14px; max-width: 62ch; color: var(--ink-2); font-size: 16.5px; }
.points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding: 0; list-style: none; }
.points li {
  font-size: 12.5px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px;
}
.points li::before { content: "✓"; color: var(--red); margin-right: 6px; font-weight: 700; }

/* sections and cards */
.section { padding: 14px 20px 26px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(20px, 3vw, 26px); font-weight: 800; letter-spacing: -.02em; }
.section-head p { color: var(--muted); font-size: 13.5px; max-width: 60ch; }

/* calendar */
.cal-card { padding: 18px 18px 20px; }
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-title { flex: 1 1 auto; min-width: 160px; }
.cal-title h2 { font-size: clamp(19px, 3.4vw, 24px); font-weight: 800; letter-spacing: -.02em; }
.cal-title p { font-size: 12.5px; color: var(--muted); }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.nav-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); cursor: pointer; font-size: 17px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-btn:hover { border-color: var(--line-2); background: var(--bg-2); }
.today-btn {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px;
  padding: 7px 12px; font-size: 13px; cursor: pointer; font-weight: 600;
}
.today-btn:hover { border-color: var(--line-2); }
.next-line {
  margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--red-soft); color: var(--red); border-radius: 12px; padding: 10px 12px;
  font-size: 13.5px; font-weight: 700;
}
.next-line .nx-date { font-weight: 800; }
.next-line .nx-days { font-weight: 600; opacity: .85; }
[data-theme="dark"] .next-line { color: #ffb3a8; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 4px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--ink-2);
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 700; }
.summary { min-height: 22px; font-size: 13px; color: var(--muted); margin: 8px 0 10px; }
.summary b { color: var(--ink); }
.grid-head, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.grid-head span {
  text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0 6px; font-weight: 600;
}
.grid-head span:first-child { color: var(--red); }
.grid-head span:last-child { color: var(--indigo); }
.day {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 1px; min-height: 72px; padding: 7px 2px 5px; border-radius: 10px;
  border: 1px solid transparent; background: var(--surface-2); cursor: pointer; text-align: center;
  transition: background .12s ease, border-color .12s ease;
}
.day:hover { border-color: var(--line-2); }
.day.is-out { visibility: hidden; pointer-events: none; }
.day.sun .dnum { color: var(--red); }
.day.sat .dnum { color: var(--indigo); }
.day.today { box-shadow: inset 0 0 0 1.5px var(--indigo); }
.day.selected { background: var(--ink); border-color: var(--ink); }
.day.selected .dnum, .day.selected .dlunar, .day.selected .mark { color: var(--bg); }
.day.sonnal { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 26%, transparent); }
.day.selected.sonnal { background: var(--red); border-color: var(--red); }
.day.selected.sonnal .dnum, .day.selected.sonnal .dlunar, .day.selected.sonnal .mark { color: #fff; }
.day.dimmed { opacity: .32; }
.dnum { font-size: 15px; font-weight: 700; line-height: 1.2; }
.day.sonnal .dnum { color: var(--red); }
.dlunar { font-size: 10.5px; color: var(--muted); line-height: 1.15; letter-spacing: -.02em; }
.marks { display: flex; gap: 3px; align-items: center; justify-content: center; min-height: 11px; margin-top: 1px; }
.mark { font-size: 9.5px; line-height: 1; }
.mark.taian { color: var(--indigo); }
.mark.ichiryu { color: var(--gold); }
.mark.tensha { color: var(--red); }
.mark.term {
  color: var(--muted); font-size: 9px; letter-spacing: -.03em; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
}
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 12px 0 0; margin: 0;
  font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 12px;
}
.legend li { display: flex; align-items: center; gap: 5px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); }
.legend .g { width: auto; height: auto; border: 0; font-size: 11px; background: none; }
.legend .g.taian { color: var(--indigo); }
.legend .g.ichiryu { color: var(--gold); }
.legend .g.tensha { color: var(--red); }
.grid-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* day detail */
.detail { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.detail-empty { color: var(--muted); font-size: 13.5px; }
.detail-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.detail-head strong { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.detail-head span { font-size: 13px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.badge {
  font-size: 12px; border-radius: 999px; padding: 3px 10px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-2);
}
.badge.red { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); color: var(--red); font-weight: 700; }
.badge.gold { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 32%, transparent); color: var(--gold); font-weight: 700; }
.badge.indigo { background: var(--indigo-soft); border-color: color-mix(in srgb, var(--indigo) 30%, transparent); color: var(--indigo); font-weight: 700; }
.detail-meta { font-size: 13px; color: var(--muted); margin-top: 4px; }
.detail-meta b { color: var(--ink-2); font-weight: 600; }
.purpose-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.purpose-list li { font-size: 13.5px; color: var(--ink-2); display: flex; gap: 8px; align-items: flex-start; }
.purpose-list .pl {
  flex: 0 0 auto; font-size: 11.5px; font-weight: 700; color: var(--muted); min-width: 62px;
  border-right: 1px solid var(--line); padding-right: 8px; line-height: 1.5;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 12px; padding: 10px 15px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg); font-size: 13.5px;
  font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:hover { opacity: .9; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.detail-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toast { font-size: 12.5px; color: var(--red); }

/* converter + family forms */
.two-col { display: grid; gap: 14px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; gap: 20px; } }
.field-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select {
  border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 10px;
  padding: 8px 10px; font-size: 14px; min-height: 40px;
}
.field input[type="date"] { min-width: 160px; }
.field.small select { min-width: 76px; }
.field.grow { flex: 1 1 160px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); padding-bottom: 10px; }
.check input { width: 16px; height: 16px; accent-color: var(--red); }
.result {
  margin-top: 14px; border-radius: 12px; border: 1px dashed var(--line-2); background: var(--surface-2);
  padding: 12px 14px; font-size: 14px; min-height: 46px; display: flex; flex-direction: column; gap: 2px;
}
.result strong { font-size: 17px; letter-spacing: -.01em; }
.result .sub { font-size: 12.5px; color: var(--muted); }
.result.error { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.fam-form { display: grid; gap: 10px; }
.fam-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.fam-item {
  display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
  background: var(--surface-2);
}
.fam-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.fam-name { font-weight: 700; font-size: 14.5px; }
.fam-kind { font-size: 11.5px; color: var(--muted); margin-left: 6px; font-weight: 500; }
.fam-dates { font-size: 13px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.fam-dates b { font-weight: 700; }
.fam-dates .dd { color: var(--red); font-weight: 700; }
.fam-del { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; }
.fam-empty, .note { font-size: 12.5px; color: var(--muted); }
.note { margin-top: 10px; }

/* export */
.export-grid { display: grid; gap: 10px; }
@media (min-width: 720px) { .export-grid { grid-template-columns: 1fr 1fr; } }
.fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface-2); }
.fieldset legend { font-size: 12px; color: var(--muted); font-weight: 700; padding: 0 4px; }
.radios { display: flex; flex-wrap: wrap; gap: 6px; }
.radios label {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 999px; padding: 6px 11px; cursor: pointer;
}
.radios input { accent-color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }

/* guide + accuracy */
.guide { display: grid; gap: 0; }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details:first-child { border-top: 0; padding-top: 0; }
.guide summary {
  cursor: pointer; font-weight: 700; font-size: 14.5px; list-style: none; display: flex;
  justify-content: space-between; gap: 10px; align-items: center;
}
.guide summary::-webkit-details-marker { display: none; }
.guide summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; }
.guide details[open] summary::after { content: "−"; }
.guide p { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.accuracy p { font-size: 13.5px; color: var(--ink-2); margin-top: 10px; max-width: 80ch; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 10px; }
.foot-in { padding: 24px 20px 34px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.foot-brand { font-weight: 800; letter-spacing: -.02em; }
.foot-line { font-size: 12.5px; color: var(--muted); max-width: 46ch; margin-top: 4px; }
.foot-links { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.foot-links a { color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--line-2); padding-bottom: 1px; }
.foot-links a:hover { color: var(--red); border-color: var(--red); }

/* policy pages */
.doc { max-width: 760px; margin: 0 auto; padding: 34px 20px 60px; }
.doc h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -.03em; }
.doc .updated { color: var(--muted); font-size: 13px; margin-top: 8px; }
.doc section { margin-top: 22px; }
.doc h2 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.doc p { color: var(--ink-2); font-size: 14.5px; margin-top: 6px; }
.doc .back { display: inline-block; margin-top: 28px; font-size: 14px; color: var(--red); text-decoration: none; border-bottom: 1px solid currentColor; }
.contact-box { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 18px; margin-top: 22px; box-shadow: var(--shadow); }

/* novelty: today ring + print sheet */
#printSheet { display: none; }
.print-only { display: none; }

@media (max-width: 560px) {
  .tabs-in {
    gap: 2px; padding: 7px 12px;
    mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%);
  }
  .tabs a { font-size: 12px; padding: 5px 8px; }
}

@media (max-width: 420px) {
  .wrap, .section, .hero { padding-left: 16px; padding-right: 16px; }
  .cal-card { padding: 14px 12px 16px; }
  .day { min-height: 62px; padding: 5px 1px 4px; border-radius: 8px; }
  .dnum { font-size: 14px; }
  .dlunar { font-size: 9.5px; }
  .mark { font-size: 8.5px; }
  .brand-sub { display: none; }
  .brand-org { display: none; }
  .langs a { padding: 5px 7px; font-size: 12px; }
  .card { padding: 16px; }
  .field input[type="date"] { min-width: 0; width: 100%; }
  .field.grow { flex: 1 1 100%; }
}

/* ---------- print ---------- */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; }
  body > *:not(#printSheet) { display: none !important; }
  #printSheet { display: block !important; }
  #printSheet { font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Hiragino Sans", sans-serif; color: #000; }
  .ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 6px; }
  .ps-head h1 { font-size: 17pt; letter-spacing: -.02em; }
  .ps-head .ps-brand { font-size: 9pt; color: #444; }
  .ps-week, .ps-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #bbb; border: 1px solid #bbb; }
  .ps-week { margin-top: 8px; background: #ddd; border-bottom: 0; }
  .ps-week span { background: #f2f2f2; text-align: center; font-size: 8.5pt; padding: 3px 0; font-weight: 700; }
  .ps-week span:first-child { color: #a11; }
  .ps-week span:last-child { color: #225; }
  .ps-cell { background: #fff; min-height: 31mm; padding: 2.5mm 1.8mm; position: relative; }
  .ps-cell.out { background: #fafafa; }
  .ps-cell .pn { font-size: 12pt; font-weight: 700; line-height: 1.1; }
  .ps-cell.sun .pn { color: #a11; }
  .ps-cell.sat .pn { color: #225; }
  .ps-cell.sonnal { background: #fdeeeb; }
  .ps-cell.sonnal .pn { color: #a11; }
  .ps-cell .pl { font-size: 7pt; color: #444; margin-top: 1px; }
  .ps-cell .pm { font-size: 7.5pt; color: #333; margin-top: 1px; letter-spacing: .02em; }
  .ps-cell .pm .taian { color: #234; }
  .ps-cell .pm .ichiryu { color: #7a5300; }
  .ps-cell .pm .tensha { color: #a11; }
  .ps-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 8pt; color: #333; }
  .ps-note { margin-top: 5px; font-size: 8pt; color: #333; }
  .ps-year { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4mm 3mm; margin-top: 6mm; }
  .ps-mini { break-inside: avoid; }
  .ps-mini h2 { font-size: 9.5pt; margin-bottom: 1mm; }
  .ps-mini table { width: 100%; border-collapse: collapse; table-layout: fixed; }
  .ps-mini th { font-size: 6.4pt; color: #555; font-weight: 600; padding: 0.4mm 0; }
  .ps-mini td { font-size: 7pt; text-align: center; height: 6.6mm; vertical-align: middle; padding: 0; }
  .ps-mini td.sonnal { background: #fdeeeb; color: #a11; font-weight: 700; }
  .ps-mini td.sun { color: #a11; }
  .ps-mini td.sat { color: #225; }
  .ps-mini td .lm { font-size: 5.2pt; color: #777; display: block; line-height: 1.05; }
  .ps-mini td.blank { background: #fafafa; }
  .ps-title-year { font-size: 15pt; font-weight: 700; }
}
