  :root {
    --bg: #FAF6EF;
    --halo: #FFFDF8;
    --surface: #FDFAF4;
    --ink: #33291F;
    --muted: #7A6A58;
    --accent: #A0563B;
    --accent-ink: #FFFFFF;
    --soft: #F0E6D6;
    --line: #E7DBC9;
    --shadow: rgba(90, 60, 40, 0.10);
    --fs: 1.05rem;
  }
  [data-theme="dark"] {
    --bg: #1A1410;
    --halo: #241C15;
    --surface: #221A13;
    --ink: #E8DCC9;
    --muted: #B09C86;
    --accent: #D8A76A;
    --accent-ink: #1A1410;
    --soft: #2C2118;
    --line: #33271C;
    --shadow: rgba(0, 0, 0, 0.5);
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
  body {
    background: radial-gradient(60rem 32rem at 50% -12rem, var(--halo) 0%, transparent 70%), var(--bg);
    color: var(--ink);
    font-family: 'Lora', 'Gowun Batang', 'Apple SD Gothic Neo', serif;
    transition: background .5s, color .5s;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-tap-highlight-color: transparent;
  }
  button {
    font-family: inherit; border: none; background: none; color: var(--ink);
    cursor: pointer; border-radius: 10px; padding: .45rem .65rem; font-size: .9rem;
    transition: background .2s, color .2s;
    min-height: 44px; min-width: 44px;
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    touch-action: manipulation;
  }
  button:hover { background: var(--soft); }
  button:active { background: var(--soft); opacity: .75; }
  button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  button svg {
    width: 18px; height: 18px; stroke: currentColor; fill: none;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none;
  }
  svg[hidden] { display: none; }
  /* ---------- top bar ---------- */
  .top {
    max-width: 44rem; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem max(1.3rem, env(safe-area-inset-right)) 0 max(1.3rem, env(safe-area-inset-left));
  }
  .mark {
    font-family: 'Gowun Batang', serif; font-size: .8rem; letter-spacing: .42em;
    color: var(--muted); padding-left: 0;
  }
  .tools { display: flex; gap: .5rem; }
  /* ---------- entry ---------- */
  main { max-width: 44rem; margin: 0 auto; padding: 4.5rem 1.5rem calc(8rem + env(safe-area-inset-bottom)); }
  .entry { animation: rise .6s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  .date {
    display: block; width: 100%; text-align: center;
    font-size: .78rem; letter-spacing: .38em; text-transform: uppercase;
    color: var(--muted); font-family: 'Gowun Batang', serif;
  }
  .date:hover { background: none; color: var(--accent); }
  .source {
    text-align: center; margin-top: .5rem;
    font-size: .72rem; letter-spacing: .02em; color: var(--muted);
    font-family: 'Gowun Batang', serif; opacity: .8; word-break: keep-all;
  }
  h1.title {
    font-family: 'Cormorant Garamond', 'Gowun Batang', serif;
    font-weight: 600; font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.2;
    text-align: center; margin: .6rem 0 1.8rem; letter-spacing: .01em;
  }
  .verse {
    font-style: italic; font-size: 1.22rem; line-height: 1.9;
    text-align: center; max-width: 33rem; margin: 0 auto;
  }
  .ref {
    text-align: center; margin-top: 1.1rem; color: var(--accent);
    font-size: .8rem; letter-spacing: .28em; text-transform: uppercase;
  }
  .ornament { display: flex; justify-content: center; margin: 3rem 0; color: var(--accent); }
  .ornament svg { width: 120px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1; }
  .body p {
    font-size: var(--fs); line-height: 1.95; margin-bottom: .9rem;
    word-break: keep-all; text-indent: 1.6em;
  }
  .body p:first-of-type { text-indent: 0; }
  /* ---------- done ---------- */
  .done {
    display: flex; margin: 3.5rem auto 0;
    border: 1px solid var(--line); border-radius: 999px;
    padding: .6rem 1.6rem; color: var(--muted); font-size: .9rem;
    font-family: 'Gowun Batang', serif;
  }
  .done.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  .done.on:hover { background: var(--accent); opacity: .9; }
  /* ---------- dock ---------- */
  .dock {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .progress { height: 2px; background: var(--line); }
  .progress > div { height: 100%; background: var(--accent); transition: width .4s; }
  .dock-in {
    max-width: 44rem; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: .4rem 1rem;
  }
  .dock-in button { color: var(--muted); font-size: .88rem; }
  .dock-in button:hover { color: var(--ink); }
  .dock-date { color: var(--accent) !important; font-family: 'Gowun Batang', serif; }
  /* ---------- calendar ---------- */
  .overlay {
    position: fixed; inset: 0; z-index: 40; display: none;
    background: color-mix(in srgb, var(--bg) 55%, transparent);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    align-items: flex-end; justify-content: center;
    overflow-y: auto;
  }
  .overlay.open { display: flex; }
  .overlay { overscroll-behavior: contain; }
  .cal {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 22px 22px 0 0; box-shadow: 0 -10px 44px var(--shadow);
    padding: 1.5rem 1.4rem calc(1.2rem + env(safe-area-inset-bottom));
    width: 100%; max-width: 26rem;
    animation: sheet .3s ease-out;
  }
  @keyframes sheet { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
  @media (min-width: 640px) {
    .overlay { align-items: center; padding: 2rem; }
    .cal { border-radius: 22px; padding-bottom: 1.4rem; }
  }
  .cal:focus { outline: none; }
  .cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
  .m-name { font-family: 'Gowun Batang', serif; font-weight: 700; font-size: 1.05rem; }
  .dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: .3rem; }
  .dow span {
    text-align: center; font-size: .68rem; color: var(--muted);
    letter-spacing: .08em; font-family: 'Gowun Batang', serif;
  }
  .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; }
  .days .pad { min-height: 0; }
  .days button {
    aspect-ratio: 1; font-size: .85rem; position: relative; padding: 0;
    min-width: 0; min-height: 0; border-radius: 50%;
  }
  .days button.cur { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
  .days button.read::after {
    content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px;
    border-radius: 50%; background: var(--accent);
  }
  .days button.cur.read::after { background: var(--accent-ink); }
  .cal-foot {
    margin-top: 1rem; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    color: var(--muted); font-size: .78rem;
  }
  .cal-foot .acts { display: flex; gap: .4rem; }
  .cal-foot button { border: 1px solid var(--line); font-size: .82rem; color: var(--muted); border-radius: 999px; padding: .4rem 1rem; }
  /* ---------- language toggle ---------- */
  .lang {
    border: 1px solid var(--line); color: var(--muted);
    font-size: .74rem; letter-spacing: .12em; font-family: 'Gowun Batang', serif;
  }
  .lang:hover { color: var(--ink); }
  .book { letter-spacing: .02em; max-width: 42vw; }
  .book span {
    min-width: 0; display: block;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* ---------- commentary ---------- */
  .comm { margin: 3.4rem auto 0; border-top: 1px solid var(--line); }
  .comm summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: .5rem;
    padding: 1.5rem 0 .3rem; color: var(--accent);
    font-family: 'Gowun Batang', serif; font-size: .96rem; letter-spacing: .02em;
    min-height: 44px;
  }
  .comm summary::-webkit-details-marker { display: none; }
  .comm summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
  .comm summary .chev { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s; }
  .comm[open] summary .chev { transform: rotate(180deg); }
  .comm-in { animation: rise .5s ease-out; padding-top: .8rem; }
  .comm-deep {
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--soft) 45%, transparent);
    padding: 1.1rem 1.3rem .3rem; border-radius: 0 12px 12px 0;
  }
  .comm-deep p {
    font-size: var(--fs); line-height: 1.95; margin-bottom: .9rem;
    word-break: keep-all;
  }
  .comm-block {
    margin-top: 1.4rem; padding: 1.15rem 1.25rem;
    background: var(--soft); border-radius: 14px;
  }
  .comm-label {
    display: block; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase;
    color: var(--accent); margin-bottom: .55rem; font-family: 'Gowun Batang', serif;
  }
  .comm-block p { font-size: var(--fs); line-height: 1.9; word-break: keep-all; margin: 0; }
  .comm-block.is-verse p { font-style: italic; }
  /* ---------- loading / error ---------- */
  .load {
    text-align: center; color: var(--muted); padding: 4.5rem 1rem;
    font-family: 'Gowun Batang', serif; animation: rise .5s ease-out;
  }
  .load-title { font-size: 1.12rem; color: var(--ink); margin-bottom: 1rem; }
  .load-body { font-size: .95rem; line-height: 1.85; max-width: 30rem; margin: 0 auto; word-break: keep-all; }
  .load code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--soft); padding: .12rem .42rem; border-radius: 6px; font-size: .86rem;
  }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
      animation-duration: .01ms !important;
      transition-duration: .01ms !important;
    }
  }
