/* 蓮寶 on the web: the app's 素白, white and restrained; colour belongs to the user's categories. */

:root {
  --paper: #ffffff;
  --ink: #1f1f1f;
  --ink-soft: #555555;
  --ink-faint: #767676;
  --hairline: #e6e6e6;
  --quiet: #f6f6f4;
  --soft: #f0f0ee;
  --lotus: #a64b55;
  --sunday: #b5485a;
  --saturday: #3b6e96;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121212;
    --ink: #ededed;
    --ink-soft: #bdbdbd;
    --ink-faint: #9a9a9a;
    --hairline: #2c2c2c;
    --quiet: #1a1a1a;
    --soft: #2a2a2a;
    --lotus: #e08a92;
    --sunday: #eba3a9;
    --saturday: #8fb6d6;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif;
  line-break: strict;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* Signing in */

.gate { max-width: 400px; width: 100%; margin: 0 auto; padding: 12vh 16px 40px; }

.gate h1 { font-size: 24px; font-weight: 600; letter-spacing: 0.1em; margin: 0 0 8px; }

.lede { color: var(--ink-soft); margin: 0 0 28px; }

.signin { display: flex; flex-direction: column; gap: 12px; }

.signin label { display: block; position: relative; }

.signin input[type="text"], .signin input[type="password"] {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: 12px;
  background: var(--quiet);
}

.signin input:focus { border-color: var(--ink-faint); outline: none; }

.signin .code { letter-spacing: 0.08em; font-family: ui-monospace, "SF Mono", Menlo, monospace; text-transform: uppercase; }

.pw input { padding-right: 52px; }

.eye {
  position: absolute; right: 2px; top: 0; width: 48px; height: 48px; border: 0; background: none;
}
.eye::before {
  content: ""; position: absolute; left: 14px; top: 17px; width: 20px; height: 13px;
  border: 1.6px solid var(--ink-faint); border-radius: 50% / 60%;
}
.eye::after {
  content: ""; position: absolute; left: 21px; top: 20px; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint);
}
.eye.on::before { border-color: var(--ink); }
.eye.on::after { background: var(--ink); }

.check { display: flex !important; gap: 10px; align-items: flex-start; color: var(--ink-soft); font-size: 14px; padding: 4px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }

.primary {
  min-height: 48px; border: 0; border-radius: 24px; background: var(--ink); color: var(--paper); font-weight: 600; margin-top: 4px;
}
.primary:disabled { opacity: 0.55; cursor: default; }

.said { min-height: 1.6em; margin: 0; color: var(--lotus); font-size: 14px; }

.quiet { color: var(--ink-faint); font-size: 14px; margin: 16px 0 0; }

.link { border: 0; background: none; color: var(--ink-faint); padding: 12px 0; font-size: 14px; text-decoration: underline; }

/* The bar */

.top {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; background: var(--paper); z-index: 2;
}

.brand { font-weight: 600; letter-spacing: 0.1em; }

.when { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }

.title { display: flex; flex-direction: column; align-items: center; line-height: 1.15; min-width: 120px; }
.title small { color: var(--ink-faint); font-size: 12px; }
.title strong { font-size: 20px; font-weight: 600; }

.icon {
  width: 40px; height: 40px; border: 0; border-radius: 20px; background: none; font-size: 22px; line-height: 1; color: var(--ink-soft);
}
.icon:hover { background: var(--quiet); }

.pill {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--hairline); border-radius: 18px; background: var(--paper); font-size: 14px; color: var(--ink-soft);
}
.pill:hover { background: var(--quiet); }
.pill.on { background: var(--soft); color: var(--ink); border-color: var(--soft); }

.views { display: flex; background: var(--quiet); border-radius: 18px; padding: 2px; }
.tab { min-height: 34px; padding: 0 14px; border: 0; border-radius: 16px; background: none; font-size: 14px; color: var(--ink-faint); }
.tab.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }

.quiet-button { border-color: transparent; }

/* The month */

.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; flex: 1; min-height: 0; }

.month { display: flex; flex-direction: column; border-right: 1px solid var(--hairline); }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: 1; min-height: 104px; border-bottom: 1px solid var(--hairline); }
.week.head { flex: none; min-height: 0; font-size: 12px; color: var(--ink-faint); text-align: center; padding: 6px 0; }
.week.head .sun { color: var(--sunday); }
.week.head .sat { color: var(--saturday); }

.day {
  position: relative; display: flex; flex-direction: column; gap: 2px; align-items: stretch; text-align: left;
  padding: 4px 4px 6px; border: 0; border-right: 1px solid var(--hairline); background: none; min-width: 0; overflow: hidden;
}
.day:last-child { border-right: 0; }
.day:hover { background: var(--quiet); }
.day.out { color: var(--ink-faint); }
.day.out .n { opacity: 0.5; }
.day.chosen { background: var(--soft); }

.num { display: flex; align-items: center; gap: 4px; min-height: 22px; }
.n { font-size: 14px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px; }
.n.sun { color: var(--sunday); }
.n.sat { color: var(--saturday); }
.today .n { background: var(--ink); color: var(--paper); font-weight: 600; }

.lunar { font-size: 11px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lunar.holy { color: var(--lotus); }
.fast { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-faint); flex: none; }

.chip { font-size: 12px; line-height: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.chip.bar { padding: 0 4px; }
.chip.ring { display: flex; align-items: center; gap: 4px; padding: 0 2px; }
.chip.ring i { width: 9px; height: 9px; border: 1.6px solid; border-radius: 50%; flex: none; }
.chip.ring.done { color: var(--ink-faint); text-decoration: line-through; }

.more { font-size: 11px; color: var(--ink-faint); padding: 0 2px; }

.wrote { position: absolute; right: 5px; top: 9px; width: 6px; height: 6px; border-radius: 1px; background: var(--ink-faint); opacity: 0.6; }

/* A day */

.dayPanel { padding: 20px 16px; overflow-y: auto; }
.dayPanel h2 { font-size: 18px; font-weight: 600; margin: 0; }
.lunarLine { color: var(--ink-faint); font-size: 13px; margin: 2px 0 16px; }

.rows { list-style: none; margin: 0; padding: 0; }
.row .open {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--hairline);
  background: none; text-align: left;
}
.row .open:hover { background: var(--quiet); }
.row.done .what { color: var(--ink-faint); text-decoration: line-through; }
.row.ledger { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 6px; color: var(--ink-faint); }

.mark { flex: none; }
.mark.bar { width: 4px; height: 22px; border-radius: 2px; }
.mark.ring { width: 14px; height: 14px; border: 2px solid; border-radius: 50%; position: relative; }
.mark.ring.ticked::after { content: ""; position: absolute; left: 3px; top: 0; width: 4px; height: 7px; border: solid var(--ink-faint); border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.mark.page { width: 12px; height: 15px; border: 1.6px solid var(--ink-faint); border-radius: 2px; }
.mark.bean { width: 12px; height: 9px; border-radius: 50%; border: 1.6px solid var(--ink-faint); }

.time { flex: none; min-width: 3.2em; font-size: 13px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repeat { color: var(--ink-faint); font-size: 13px; }

.empty { color: var(--ink-faint); padding: 24px 0; margin: 0; }

/* 待辦 */

.todos { max-width: 640px; width: 100%; margin: 0 auto; padding: 12px 16px 40px; flex: 1; }
.todoHead { display: flex; justify-content: flex-end; padding: 4px 0 8px; }

/* One item, read */

.detail {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px); border: 0; border-radius: 20px; padding: 24px;
  background: var(--paper); color: var(--ink); box-shadow: var(--shadow);
}
.detail::backdrop { background: rgba(0, 0, 0, 0.28); }
.detail h2 { margin: 0 40px 4px 0; font-size: 20px; font-weight: 600; }
.detail .facts { color: var(--ink-faint); font-size: 14px; margin: 0 0 16px; }
.detail .body { white-space: pre-wrap; text-align: justify; }
.detail blockquote { margin: 0 0 16px; padding: 0 0 0 12px; border-left: 2px solid var(--hairline); color: var(--ink-soft); font-family: "Songti TC", "Noto Serif TC", serif; }
.detail cite { display: block; font-style: normal; font-size: 13px; color: var(--ink-faint); margin-top: 4px; }
.ask p { margin: 0 0 20px; }
.answers { display: flex; gap: 8px; justify-content: flex-end; }
.pill.strong { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.close { position: absolute; right: 12px; top: 12px; font-size: 16px; }

/* The foot */

.foot { display: flex; gap: 16px; justify-content: space-between; padding: 10px 16px; color: var(--ink-faint); font-size: 12px; border-top: 1px solid var(--hairline); }
.trouble { color: var(--lotus); }

/* A phone's width: the month over the day */

@media (max-width: 860px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .month { border-right: 0; }
  .week { min-height: 64px; }
  .chip.bar, .chip.ring { font-size: 11px; line-height: 16px; }
  .chip.ring { gap: 2px; }
  .chip.ring i { width: 7px; height: 7px; border-width: 1.4px; }
  .num { flex-wrap: wrap; gap: 0 3px; }
  .lunar { order: 3; flex-basis: 100%; line-height: 1.3; }
  .brand { display: none; }
  .top { gap: 6px; padding: 8px 8px; }
  .title { min-width: 76px; }
  .quiet-button { padding: 0 8px; }
  .foot { flex-direction: column; gap: 4px; }
}

@media (max-width: 420px) {
  .lunar { font-size: 10px; }
  .chip { font-size: 10px; }
  .tab { padding: 0 10px; }
}

/* The way in: links, the plain words before sync, the recovery code */

.gate h2 { font-size: 18px; font-weight: 600; margin: 0 0 8px; }
.ways { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; margin: 4px 0 16px; }
.plain { margin: 0 0 24px; padding: 0 0 0 1.2em; color: var(--ink-soft); }
.plain li { margin: 0 0 10px; }
.primary.wide { width: 100%; }
.code-shown {
  display: grid; grid-template-columns: repeat(4, auto); justify-content: center; gap: 10px 18px; margin: 8px 0 16px; padding: 20px 12px;
  background: var(--quiet); border-radius: 16px; font: 600 20px/1.2 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.08em;
  user-select: all;
}
.quiet-inline { color: var(--ink-faint); font-size: 14px; }

/* One quiet line at the foot, with ↶ */

.word {
  position: fixed; left: 50%; bottom: 56px; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 4px;
  max-width: calc(100vw - 32px); padding: 6px 6px 6px 16px; border-radius: 22px; background: var(--ink); color: var(--paper);
  font-size: 14px; box-shadow: var(--shadow);
}
.word span { padding-right: 10px; }
.undo { width: 36px; height: 36px; border: 0; border-radius: 18px; background: none; color: var(--paper); font-size: 18px; }
.undo:hover { background: rgba(127, 127, 127, 0.25); }

/* Adding, and ticking where a to-do stands */

.addForm { margin-top: 12px; }
.add {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid transparent; border-radius: 12px; background: var(--quiet);
}
.add:focus { outline: none; border-color: var(--hairline); background: var(--paper); }

.row { display: flex; align-items: center; }
.row .open { flex: 1; min-width: 0; }
button.mark.ring { width: 18px; height: 18px; padding: 0; margin: 0 4px 0 8px; background: none; flex: none; }
button.mark.ring::before { content: ""; position: absolute; inset: -13px; }
button.mark.ring.ticked::after { left: 4px; top: 1px; }
.row.done .time { text-decoration: line-through; }

/* 帳號 */

.account { max-width: 480px; width: 100%; margin: 0 auto; padding: 16px 16px 48px; flex: 1; }
.who { display: flex; flex-direction: column; margin: 8px 0 20px; }
.who small { color: var(--ink-faint); font-size: 12px; }
.fold { border-bottom: 1px solid var(--hairline); }
.fold summary { min-height: 52px; display: flex; align-items: center; cursor: pointer; list-style: none; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary::after { content: "›"; margin-left: auto; color: var(--ink-faint); transition: transform 150ms; }
.fold[open] summary::after { transform: rotate(90deg); }
.foldBody { padding: 0 0 20px; }
.row-button { width: 100%; min-height: 52px; text-align: left; border: 0; border-bottom: 1px solid var(--hairline); background: none; padding: 0; }
.danger { margin-top: 40px; }
.danger .fold { border-bottom: 0; color: var(--ink-faint); }

/* The editor of a to-do or event, and a diary page */

.editor { width: min(560px, calc(100vw - 24px)); padding: 12px 20px 20px; }
.editHead { display: flex; align-items: center; gap: 8px; margin: 0 -8px 8px; }
.editHead .kinds { flex: 1; display: flex; gap: 6px; justify-content: center; }
.editHead .pill.strong:disabled { opacity: 0.45; cursor: default; }
.editTitle {
  width: 100%; border: 0; border-bottom: 1px solid var(--hairline); background: none; font-size: 20px; padding: 10px 2px; margin-bottom: 4px;
}
.editTitle:focus { outline: none; border-color: var(--ink-faint); }
.editRows { display: flex; flex-direction: column; }
.editRow { display: flex; align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--hairline); }
.editName { flex: none; width: 3em; color: var(--ink-faint); font-size: 14px; }
.editParts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 6px 0; }
.editParts input[type="date"], .editParts input[type="time"], .editParts select {
  min-height: 40px; padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--quiet); color: var(--ink); font: inherit; font-size: 15px;
}
.editParts .check { padding: 0; align-items: center; }
.sep { color: var(--ink-faint); font-size: 14px; }
.hint { color: var(--ink-faint); font-size: 13px; }
.icon.small { width: 32px; height: 32px; font-size: 13px; }
.strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 0 4px; }
.pill.faint { border-style: dashed; color: var(--ink-faint); }
.cats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cat { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--hairline); border-radius: 17px; background: var(--paper); font-size: 14px; color: var(--ink-soft); }
.cat i { width: 10px; height: 10px; border-radius: 50%; }
.cat.on { background: var(--soft); border-color: var(--soft); color: var(--ink); }
.editBody, .diaryBody {
  width: 100%; margin-top: 12px; padding: 10px 12px; border: 1px solid transparent; border-radius: 12px; background: var(--quiet);
  font: inherit; color: var(--ink); resize: vertical; line-height: 1.7;
}
.editBody:focus, .diaryBody:focus { outline: none; border-color: var(--hairline); background: var(--paper); }
.diaryBody { min-height: 40vh; }
.editFoot { margin-top: 16px; align-items: center; }
.editFoot .check { padding: 0; align-items: center; }
.grow { flex: 1; }
.hidden { display: none; }

/* Photos, three to a row under the words, and on black */

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.photos:empty { display: none; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--quiet); }
.photo .open { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; color: var(--ink-faint); font-size: 12px; }
.photo .bin { position: absolute; right: 4px; top: 4px; background: rgba(0, 0, 0, 0.45); color: #fff; }
.viewer { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; }
.viewer::backdrop { background: #000; }
.viewer img { width: 100%; height: 100%; object-fit: contain; display: block; color: #aaa; }
.viewer .icon { position: absolute; color: #eee; background: rgba(255, 255, 255, 0.08); }
.viewer .prev { left: 12px; top: 50%; }
.viewer .next { right: 12px; top: 50%; }
.viewer .close { right: 12px; top: 12px; }
.thumb { width: 36px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; }

/* Quick add's hearing */

.heard { display: flex; align-items: center; gap: 4px; min-height: 32px; margin: 4px 2px 0; color: var(--ink-faint); font-size: 13px; }
.heard:empty { min-height: 0; }

/* The day's head, stickers */

.panelHead { display: flex; align-items: center; gap: 2px; }
.panelHead h2 { flex: 1; }
.icon.on { background: var(--soft); color: var(--ink); }
.sticker { position: absolute; width: 26px; height: 26px; transform: translate(-50%, -50%); pointer-events: none; object-fit: contain; }
.placed { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 8px; }
.stickerChip { width: 48px; height: 48px; padding: 6px; border: 0; border-radius: 12px; background: none; }
.stickerChip:hover { background: var(--quiet); }
.stickerChip img { width: 100%; height: 100%; object-fit: contain; }
.tray { border: 1px solid var(--hairline); border-radius: 14px; padding: 8px 10px; margin: 0 0 12px; max-height: 260px; overflow-y: auto; }
.trayPack small { display: block; color: var(--ink-faint); font-size: 12px; margin: 4px 0; }
.trayGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }

/* The week and the day */

.timeline { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--hairline); }
.tlHead { display: grid; border-bottom: 1px solid var(--hairline); }
.tlDay { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 2px; border: 0; background: none; line-height: 1.2; min-width: 0; }
.tlDay small { font-size: 12px; color: var(--ink-faint); }
.tlDay small.sun { color: var(--sunday); }
.tlDay small.sat { color: var(--saturday); }
.tlDay strong { font-size: 16px; font-weight: 500; min-width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 13px; }
.tlDay.today strong { background: var(--ink); color: var(--paper); font-weight: 600; }
.tlDay.chosen { background: var(--soft); }
.tlDay .lunar { max-width: 100%; }
.tlBandRow { display: grid; grid-template-columns: 40px 1fr; border-bottom: 1px solid var(--hairline); max-height: 120px; overflow-y: auto; }
.tlBand { display: grid; grid-auto-rows: minmax(22px, auto); gap: 2px; padding: 3px 0; min-height: 28px; }
.band { font-size: 12px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; min-width: 0; margin: 0 2px; }
.band.bar { border: 0; padding: 0 6px; text-align: left; }
.band.ring { display: flex; align-items: center; }
.band.ring .open { border: 0; background: none; padding: 0 2px; font-size: 12px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.band.ring button.mark.ring { width: 12px; height: 12px; margin: 0 2px; border-width: 1.6px; }
.band.done .open { color: var(--ink-faint); text-decoration: line-through; }
.tlScroll { flex: 1; overflow-y: auto; min-height: 0; max-height: calc(100vh - 230px); }
.tlHours { display: grid; position: relative; }
.tlRuler { position: relative; }
.tlRuler span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tlCol { position: relative; border-left: 1px solid var(--hairline); cursor: cell;
  background-image: repeating-linear-gradient(to bottom, var(--hairline) 0 1px, transparent 1px 48px); }
.tlCol.today { background-color: var(--quiet); }
.block { position: absolute; display: flex; align-items: flex-start; gap: 2px; border-radius: 4px; overflow: hidden; font-size: 12px; line-height: 16px; padding: 2px 3px; cursor: default; }
.block.todo { border: 1.6px solid; background: var(--paper); }
.block.done .open { color: var(--ink-faint); text-decoration: line-through; }
.block .open { border: 0; background: none; color: inherit; padding: 0; text-align: left; font-size: 12px; line-height: 16px; overflow: hidden; flex: 1; min-width: 0; height: 100%; }
.block .time { min-width: 0; font-size: 11px; color: inherit; opacity: 0.8; }
.block button.mark.ring { width: 12px; height: 12px; margin: 2px 2px 0 0; border-width: 1.6px; }
.nowLine { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--lotus); pointer-events: none; }
.nowLine::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--lotus); }

/* 分類, 搜尋 */

.categories { width: min(560px, calc(100vw - 24px)); }
.catList { list-style: none; margin: 0 0 8px; padding: 0; }
.catList li { border-bottom: 1px solid var(--hairline); padding: 6px 0; }
.catHead { display: flex; align-items: center; gap: 10px; }
.catHead i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.catHead input { flex: 1; min-height: 40px; border: 0; background: none; font: inherit; }
.catHead input:focus { outline: none; border-bottom: 1px solid var(--ink-faint); }
.catList summary { color: var(--ink-faint); font-size: 13px; cursor: pointer; padding: 4px 0; }
.swatches { display: grid; grid-template-columns: repeat(6, 36px); gap: 6px; padding: 8px 0; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; }
.swatch.on { border-color: var(--paper); box-shadow: 0 0 0 2px var(--ink); }
.search b { font-weight: 700; color: var(--ink); }
.search .what { white-space: normal; }

@media (max-width: 860px) {
  .timeline { border-right: 0; }
  .tlScroll { max-height: 60vh; }
  /* The views on a row of their own under the month, each an even share of it. */
  .top { flex-wrap: wrap; }
  .views { order: 3; width: 100%; }
  .tab { flex: 1; padding: 0 4px; white-space: nowrap; }
  .title small { white-space: nowrap; }
}

/* 蓮寶's page (chat.ts): one conversation, each day a page, as the app's 蓮寶 tab; the composer one box with one button. */

#app:has(> .lotusPage) { height: 100vh; height: 100dvh; }
.lotusPage { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 760px; margin: 0 auto; min-height: 0; }
.talk { flex: 1; overflow-y: auto; padding: 12px 16px 8px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }

.tFold {
  display: flex; gap: 12px; align-items: baseline; width: 100%; min-height: 44px; padding: 8px 4px; border: 0; border-bottom: 1px solid var(--hairline);
  background: none; text-align: left; color: var(--ink-soft); font-size: 14px;
}
.tFold:hover { background: var(--quiet); }
.tFold .tWhen { flex: none; color: var(--ink-faint); font-size: 13px; min-width: 7.5em; }
.tFold .tGist { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tFold[aria-expanded="true"] { color: var(--ink); }
.tMonth .tWhen { color: var(--ink-soft); }
.dayOpen { display: flex; flex-direction: column; gap: 10px; padding: 8px 0 12px; border-bottom: 1px solid var(--hairline); }

.tToday { text-align: center; color: var(--ink-faint); font-size: 12px; margin: 10px 0 2px; }

.msg { display: flex; flex-direction: column; }
.msg.mine { align-items: flex-end; }
.msg.mine .pill {
  max-width: 80%; margin: 0; padding: 10px 16px; border-radius: 22px; background: var(--soft); color: var(--ink); white-space: pre-wrap;
  overflow-wrap: anywhere; font-size: 16px; min-height: 0; border: 0;
}
.msg.lotus { align-items: flex-start; }
.bubble { max-width: 88%; padding: 10px 16px; border-radius: 22px; background: var(--quiet); overflow-wrap: anywhere; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble .heading { font-weight: 600; }
.bubble .trouble { font-size: 14px; }
.cite {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 2px;
  border: 0; border-radius: 9px; background: var(--soft); color: var(--ink-soft); font-size: 11px; vertical-align: 2px; line-height: 1;
}
.cite:hover { background: var(--hairline); }
.answerTools { display: flex; gap: 6px; margin: 6px 0 0 4px; flex-wrap: wrap; }
.pill.small { min-height: 32px; padding: 0 12px; font-size: 13px; }

.thinking { display: flex; align-items: center; gap: 10px; color: var(--ink-faint); font-size: 14px; margin: 4px 4px; }
.thinking .ink {
  width: 16px; height: 16px; border-radius: 50%; border: 1.8px solid var(--ink-faint); border-right-color: transparent; animation: turn 1.2s linear infinite;
}
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .thinking .ink { animation: none; } }

.cards { display: flex; flex-direction: column; gap: 8px; max-width: 88%; width: 420px; }
.card { border: 1px solid var(--hairline); border-radius: 16px; padding: 12px 14px; background: var(--paper); }
.card p { margin: 2px 0; font-size: 14px; color: var(--ink-soft); }
.card .hint { font-size: 13px; color: var(--ink-faint); }
.cardHead { font-size: 12px; color: var(--ink-faint); margin-bottom: 2px; }
.cardTitle { display: block; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.card .answers { margin-top: 10px; align-items: center; }
.card .answers .hint { flex: 1; }
.cards .all { align-self: flex-end; }
.pill:disabled { opacity: 0.5; cursor: default; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; max-width: 88%; }

.sources { max-width: 88%; width: 520px; font-size: 14px; }
.sources summary { cursor: pointer; color: var(--ink-soft); padding: 4px 4px; min-height: 32px; display: inline-flex; align-items: center; }
.source { padding: 8px 12px; border-left: 2px solid var(--hairline); margin: 6px 0; transition: background 200ms; }
.source.lit { background: var(--quiet); }
.source .srcHead { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.source .num { color: var(--ink-faint); font-size: 12px; }
.source .book { color: var(--ink-faint); font-size: 12px; }
.source p { margin: 4px 0 0; color: var(--ink-soft); font-family: "Songti TC", "Noto Serif TC", serif; }
.sources .hint { margin: 6px 4px 0; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 16px 4px; }
.composer .box {
  flex: 1; resize: none; min-height: 44px; max-height: 200px; padding: 10px 16px; border: 1px solid var(--hairline); border-radius: 22px;
  background: var(--quiet); font: inherit; color: inherit; line-height: 1.5; overflow-y: hidden;
}
.composer .box:focus { outline: none; border-color: var(--ink-faint); }
.composer .send { flex: none; width: 44px; height: 44px; background: var(--ink); color: var(--paper); font-size: 18px; }
.composer .send:hover { background: var(--ink); opacity: 0.85; }
.composer .send:disabled { background: var(--soft); color: var(--ink-faint); cursor: default; opacity: 1; }
.composer > .pill { flex: none; height: 44px; }
.aiNote { text-align: center; color: var(--ink-faint); font-size: 12px; margin: 0 0 8px; }

.about .memories { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.memory { display: flex; gap: 6px; align-items: center; }
.memory input, .addMemory input {
  flex: 1; min-width: 0; min-height: 40px; padding: 6px 12px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--quiet);
}
.addMemory { display: flex; gap: 6px; margin-top: 8px; }

/* 經書 (reader.ts): the shelf, a book's contents, an article set as a printed book sets Chinese. */

.views.sub { background: none; padding: 0; }
.views.sub .tab { min-height: 30px; font-size: 13px; }
.views.sub .tab.on { background: var(--soft); box-shadow: none; }
.views.small .tab { min-height: 30px; padding: 0 10px; font-size: 13px; }

.reader { width: 100%; max-width: 760px; margin: 0 auto; padding: 12px 16px 48px; }
.reader .loading { text-align: center; padding: 48px 0; }
.set { margin: 8px 0 28px; }
.set h2 { font-size: 18px; font-weight: 600; margin: 0 0 12px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.set h2 small { font-size: 12px; font-weight: 400; color: var(--ink-faint); }
.plank {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 18px 14px; padding-bottom: 14px;
  border-bottom: 6px solid var(--soft); border-radius: 0 0 2px 2px;
}
.bookFace { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-soft); }
.bookFace .name { font-size: 12px; line-height: 1.35; text-align: center; overflow-wrap: anywhere; }
.bookFace:hover .cover { transform: translateY(-2px); }
.cover { position: relative; display: block; width: 96px; aspect-ratio: 360 / 534; transition: transform 150ms; flex: none; }
.cover.big { width: 120px; }
.cover img { width: 100%; height: 100%; display: block; }
.cover .slip {
  position: absolute; left: 5.8%; top: 5%; width: 37.4%; height: 65.8%; writing-mode: vertical-rl; display: flex; justify-content: center;
  align-items: flex-start; gap: 1px; padding: 6% 0; color: #3f2c1c; font-family: "Kaiti TC", "STKaiti", "Songti TC", "Noto Serif TC", serif;
  font-size: 11px; line-height: 1.15; letter-spacing: 0.02em; overflow: hidden;
}
.cover.big .slip { font-size: 13px; }

.readBar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 6px 0; flex-wrap: wrap; }
.readBar .grow { flex: 1; }
.bookHead { display: flex; gap: 18px; align-items: flex-end; margin: 4px 0 16px; }
.bookHead h2 { font-size: 22px; margin: 0 0 4px; font-weight: 600; }
.bookHead p { margin: 0; }
.filter {
  width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--hairline); border-radius: 22px; background: var(--quiet); margin: 0 0 8px;
}
.contents h3 { font-size: 13px; color: var(--ink-faint); font-weight: 500; margin: 18px 0 4px; }
.entry {
  display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--hairline); background: none; padding: 12px 4px;
  font-size: 16px; color: var(--ink);
}
.entry:hover { background: var(--quiet); }

.articleHead { margin: 8px 0 20px; }
.articleHead h2 { font-size: 24px; font-weight: 600; margin: 4px 0; font-family: "Songti TC", "Noto Serif TC", serif; }
.articleHead p { margin: 0; }
.page { font-family: "Songti TC", "Noto Serif TC", "Source Han Serif TC", serif; line-height: 1.9; }
.para { position: relative; padding: 2px 0; border-radius: 6px; outline: none; scroll-margin-top: 112px; }
.para p { margin: 0 0 0.9em; text-align: justify; line-break: strict; word-break: normal; overflow-wrap: anywhere; white-space: pre-wrap; }
.para .trans { color: var(--ink-soft); font-size: 0.9em; }
.para .trans.only { color: var(--ink); font-size: 1em; }
.para.heading p { font-weight: 600; text-align: left; font-size: 1.1em; }
.para.verse p { text-align: center; }
.para.question p { font-weight: 600; }
.para.source p { text-align: right; color: var(--ink-faint); font-size: 0.85em; }
.para.lit { background: var(--quiet); box-shadow: 0 0 0 8px var(--quiet); }
.paraTools { display: none; gap: 6px; margin: -0.4em 0 0.9em; font-family: initial; }
.para:hover .paraTools, .para:focus-within .paraTools, .para.lit .paraTools { display: flex; }
.notes { font-size: 0.8em; color: var(--ink-soft); margin: -0.4em 0 0.9em; font-family: initial; }
.notes summary { cursor: pointer; color: var(--ink-faint); }
.notes p { margin: 4px 0; text-align: left; }
.turn { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.turn .pill { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srcFoot { display: flex; gap: 10px; align-items: center; margin-top: 6px; }

@media (max-width: 860px) {
  .views.sub { order: 4; width: 100%; justify-content: center; }
}
