/* ARTWAY 手帳 — 介面樣式
   版面：整個視窗是一張書桌（3D 畫布），介面像壓在桌面上的小紙片與文具。
   單一淺色世界（依 artway.ai 淺色主題），不做深色版。 */
:root {
  --bg: #ede9e1;
  --bg-2: #e4dfd5;
  --bg-3: #d8d2c6;
  --paper: #f8f4eb;
  --fg: #0c0c0c;
  --fg-2: #3a3833;
  --muted: #5e5a53;
  --line: rgba(12, 12, 12, 0.13);
  --line-2: rgba(12, 12, 12, 0.26);
  --accent: #b52519;
  --accent-2: #951e14;
  --on-accent: #ffffff;
  --pen: #22314f;
  --moss: #5f7350;
  --indigo: #34476f;
  --mustard: #c79c26;
  --shadow-1: 0 1px 2px rgba(40, 28, 12, 0.14), 0 2px 8px rgba(40, 28, 12, 0.08);
  --shadow-2: 0 2px 4px rgba(40, 28, 12, 0.14), 0 14px 38px rgba(40, 28, 12, 0.18);
  --f-display: "Anton", "Roboto Condensed", "Noto Sans TC", sans-serif;
  --f-serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --f-sans: "Roboto", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --f-mono: "Roboto Mono", "Noto Sans TC", monospace;
  --f-hand: "Iansui", "LXGW WenKai TC", "Klee One", "DFKai-SB", "BiauKai", cursive;
  --gut-l: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-sans);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app {
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}
#stage {
  position: absolute;
  inset: 0;
  touch-action: none;
}
#stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

/* ── 刊頭 ─────────────────────────────────────────────────────────────── */
.mast {
  position: absolute;
  inset: 0 0 auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 14px 0;
  padding-left: var(--gut-l);
  padding-right: var(--gut-r);
  pointer-events: none;
}
.mast > * {
  pointer-events: auto;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  user-select: none;
}
.brand-mark {
  font-family: var(--f-display);
  font-size: 24px;
  letter-spacing: 0.02em;
  line-height: 1;
}
.brand-sq {
  width: 9px;
  height: 9px;
  background: var(--accent);
  align-self: center;
}
.brand-zh {
  font-family: var(--f-serif);
  font-weight: 900;
  font-size: 19px;
  line-height: 1;
}
.brand-meta {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mast-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(237, 233, 225, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 0;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover {
  background: var(--paper);
  border-color: var(--fg);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn[aria-pressed="false"] {
  color: var(--muted);
}
.sync {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}
.sync::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  background: var(--muted);
  vertical-align: 1px;
}
.sync[data-state="live"]::before {
  background: var(--moss);
}
.sync[data-state="local"]::before {
  background: var(--mustard);
}
.sync[data-state="error"]::before {
  background: var(--accent);
}
.presence {
  display: flex;
  align-items: center;
}
.presence .who {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 2px solid var(--bg);
  margin-left: -7px;
  background: var(--bg-3) center/cover;
  box-shadow: 0 0 0 1px var(--line-2);
  font-family: var(--f-mono);
  font-size: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.presence .who img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hint {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  margin: 0;
  padding-left: var(--gut-l);
  padding-right: var(--gut-r);
  max-width: 430px;
  box-sizing: content-box;
  text-align: left;
  font-size: 12px;
  line-height: 1.9;
  letter-spacing: 0.06em;
  color: var(--muted);
  pointer-events: none;
  transition: opacity 0.6s;
}
.hint.seen {
  opacity: 0;
}
.hint b {
  font-weight: 500;
  color: var(--fg-2);
}
.hint .h-item {
  white-space: nowrap;
  margin-right: 10px;
}
.hint .dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin: 0 7px 0 0;
  background: var(--accent);
  vertical-align: middle;
}

/* ── 歷年手帳（書背） ─────────────────────────────────────────────────── */
.years {
  position: absolute;
  left: calc(var(--gut-l) - 8px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 6px 10px 8px;
  border-radius: 4px;
  background: rgba(237, 233, 225, 0.78);
  backdrop-filter: blur(6px);
}
.years .yr {
  display: grid;
  grid-template-columns: 10px auto;
  align-items: center;
  gap: 9px;
  height: 30px;
  padding: 0 12px 0 0;
  border: 0;
  background: none;
  font-family: var(--f-display);
  font-size: 17px;
  letter-spacing: 0.03em;
  color: var(--muted);
  transition: color 0.15s, transform 0.2s;
}
.years .yr .chip {
  width: 10px;
  height: 26px;
  border-radius: 2px;
  background: var(--c, var(--bg-3));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12), inset 2px 0 0 rgba(255, 255, 255, 0.28);
  transition: width 0.2s, height 0.2s;
}
.years .yr small {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  margin-left: 7px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s;
}
.years .yr:hover,
.years .yr[aria-current="true"] {
  color: var(--fg);
  transform: translateX(3px);
}
.years .yr:hover small,
.years .yr[aria-current="true"] small {
  opacity: 1;
}
.years .yr[aria-current="true"] .chip {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), inset 2px 0 0 rgba(255, 255, 255, 0.28), 0 0 0 2px var(--bg), 0 0 0 3px var(--fg);
}

/* ── 底部工具列 ───────────────────────────────────────────────────────── */
.dock {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding-block: 0 max(16px, env(safe-area-inset-bottom, 0px));
  padding-left: var(--gut-l);
  padding-right: var(--gut-r);
  pointer-events: none;
}
.dock > * {
  pointer-events: auto;
}
.pill {
  height: 38px;
  padding: 0 17px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(244, 240, 231, 0.86);
  backdrop-filter: blur(8px);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.pill:hover {
  border-color: var(--fg);
  background: var(--paper);
}
.pill:active {
  transform: translateY(1px);
}
.pill.solid {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.pill.solid:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.pill.round {
  width: 38px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
.pill.label {
  min-width: 132px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
}
.pill[disabled] {
  opacity: 0.4;
  pointer-events: none;
}
.pager {
  display: flex;
  gap: 5px;
}
.only-narrow {
  display: none;
}

/* ── 直接寫在頁面上的輸入框（以 matrix3d 貼合頁面透視） ─────────────────── */
.ink {
  position: absolute;
  left: 0;
  top: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: rgba(181, 37, 25, 0.05);
  box-shadow: 0 0 0 1px rgba(181, 37, 25, 0.5);
  color: var(--pen);
  font-family: var(--f-hand);
  transform-origin: 0 0;
  caret-color: var(--accent);
  z-index: 30;
}
.ink::placeholder {
  color: rgba(34, 49, 79, 0.35);
}

/* ── 浮動提示 ─────────────────────────────────────────────────────────── */
.toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100% - 32px));
  padding: 9px 16px;
  border-radius: 4px;
  background: var(--fg);
  color: var(--bg);
  font-size: 13px;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-2);
  z-index: 60;
}

.boot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
  z-index: 100;
  transition: opacity 0.5s;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.boot.gone {
  opacity: 0;
  pointer-events: none;
}
.boot-sq {
  width: 12px;
  height: 12px;
  background: var(--accent);
  animation: bootpulse 1.1s ease-in-out infinite;
}
@keyframes bootpulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.55);
  }
}

@media (max-width: 760px) {
  .brand-meta,
  .hint {
    display: none;
  }
  .only-narrow {
    display: inline-block;
  }
  .years {
    top: 58px;
    transform: none;
    flex-direction: row;
    gap: 2px;
    left: 0;
    right: 0;
    padding-left: var(--gut-l);
    padding-right: var(--gut-r);
    overflow-x: auto;
  }
  .years .yr {
    grid-template-columns: 8px auto;
    gap: 5px;
    padding-right: 8px;
    font-size: 14px;
  }
  .years .yr small {
    display: none;
  }
  .years .yr .chip {
    width: 8px;
    height: 18px;
  }
  .pill {
    height: 36px;
    padding: 0 13px;
    font-size: 13px;
  }
  .pill.label {
    min-width: 96px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── 小選單 ───────────────────────────────────────────────────────────── */
.menu {
  position: absolute;
  z-index: 50;
  min-width: 190px;
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 6px;
  border-radius: 4px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-2);
}
.menu button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 3px;
  background: none;
  text-align: left;
  font-size: 13.5px;
}
.menu button:hover,
.menu button:focus-visible {
  background: var(--bg-2);
}
.menu button.cur {
  color: var(--accent);
  font-weight: 500;
}
.menu button small {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 5px 4px;
}

/* ── 側邊卡片（像一張抽出來的索引卡） ─────────────────────────────────── */
.sheet {
  position: absolute;
  z-index: 40;
  top: 62px;
  right: var(--gut-r);
  bottom: 70px;
  width: min(384px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  box-shadow: var(--shadow-2);
  animation: sheet-in 0.24s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.sheet.out {
  animation: sheet-out 0.18s ease-in both;
}
@keyframes sheet-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}
@keyframes sheet-out {
  to {
    transform: translateX(24px);
    opacity: 0;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px 12px 11px 18px;
  border-bottom: 1px solid var(--fg);
}
.sheet-head .sq {
  width: 9px;
  height: 9px;
  background: var(--accent);
}
.sheet-head .cap {
  flex: 1;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.24em;
}
.icon-btn.sm {
  width: 28px;
  height: 28px;
  border-color: transparent;
  background: none;
}
.icon-btn.sm svg {
  width: 13px;
  height: 13px;
}
.sheet-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sheet-body > * {
  flex-shrink: 0;
}
.sheet-body.drop {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
}
.sheet-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 12px 18px;
  border-top: 1px solid var(--line);
}
.sheet-foot .meta,
.meta {
  flex: 1;
  min-width: 0;
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.link {
  border: 0;
  background: none;
  padding: 4px 2px;
  font-size: 12.5px;
  color: var(--fg-2);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link.danger {
  color: var(--accent);
}
.fine {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.types {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: none;
  font-size: 12.5px;
}
.type i,
.r-type i {
  width: 8px;
  height: 8px;
  background: var(--c);
  display: inline-block;
}
.type[aria-checked="true"] {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}
.f-title,
.f-note,
.quick {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  border-bottom: 1px solid var(--line-2);
  border-radius: 0;
  background: none;
  outline: none;
  resize: none;
  font-family: var(--f-hand);
  color: var(--pen);
}
.f-title {
  font-size: 25px;
  line-height: 1.35;
  padding: 2px 0 6px;
  overflow: hidden;
}
.f-note {
  font-size: 17px;
  line-height: 30px;
  padding: 0;
  min-height: 120px;
  border-bottom: 0;
  background-image: repeating-linear-gradient(to bottom, transparent 0 29px, var(--line) 29px 30px);
  background-attachment: local;
}
.f-title:focus,
.quick:focus {
  border-bottom-color: var(--accent);
}
.f-title::placeholder,
.f-note::placeholder,
.quick::placeholder {
  color: rgba(34, 49, 79, 0.34);
}
.quick {
  font-size: 19px;
  padding: 6px 0;
}
.quick.big {
  font-size: 22px;
}
.row {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: start;
}
.row > label {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--muted);
  padding-top: 7px;
}
.date-f {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 5px;
  font-size: 12.5px;
  color: var(--fg-2);
}
.date-f .wd {
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}
.date-f .end {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}
select {
  height: 30px;
  padding: 0 6px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  background: var(--paper);
  font-size: 13px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  padding: 3px 0;
  border-bottom: 1px solid var(--line-2);
}
.chips input {
  flex: 1;
  min-width: 110px;
  height: 26px;
  border: 0;
  outline: none;
  background: none;
  font-size: 13.5px;
}
.chipp {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 4px 0 9px;
  border-radius: 4px;
  background: var(--bg-2);
  font-family: var(--f-hand);
  font-size: 15.5px;
  color: var(--pen);
}
.chipp button {
  border: 0;
  background: none;
  padding: 0 4px;
  font-size: 14px;
  color: var(--muted);
}
.photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}
.ph {
  position: relative;
  aspect-ratio: 1;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-3);
}
.ph-open {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ph-x {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 0;
  background: rgba(12, 12, 12, 0.72);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.ph:hover .ph-x,
.ph-x:focus-visible,
.ph:hover .ph-pin,
.ph-pin:focus-visible {
  opacity: 1;
}
.ph-pin {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 3px;
  height: 22px;
  border: 0;
  border-radius: 3px;
  background: rgba(12, 12, 12, 0.72);
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 0.15s;
}
@media (hover: none) {
  .ph-x,
  .ph-pin {
    opacity: 1;
  }
}
.ph.add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px dashed var(--line-2);
  background: none;
  font-size: 11.5px;
  color: var(--muted);
}
.ph.add .plus {
  font-size: 20px;
  line-height: 1;
  color: var(--accent);
}
.ph.add:hover {
  border-color: var(--accent);
  color: var(--fg);
}
.ph.add.busy {
  pointer-events: none;
  opacity: 0.6;
}

.day-h {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-weight: 400;
}
.day-h b {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 40px;
  line-height: 1;
}
.day-h span {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.daylist,
.results {
  display: flex;
  flex-direction: column;
}
.rrow {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}
.rrow:hover {
  background: var(--bg-2);
}
.r-date {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.r-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.r-type {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.r-title {
  font-family: var(--f-hand);
  font-size: 18px;
  line-height: 1.3;
  color: var(--pen);
  overflow-wrap: anywhere;
}
.r-title.print {
  font-family: var(--f-serif);
  font-weight: 700;
  font-size: 14.5px;
  color: var(--fg);
}
.r-people {
  font-size: 11.5px;
  color: var(--muted);
}
.r-ph {
  display: flex;
  gap: 3px;
  align-items: center;
}
.r-ph img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--bg-3);
}
.r-ph .more {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--muted);
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filters select {
  flex: 1;
  min-width: 96px;
}
.res-year {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 2px;
  font-weight: 400;
}
.res-year b {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 20px;
}
.res-year i {
  width: 22px;
  height: 8px;
  border-radius: 2px;
}
.help section h3 {
  margin: 0 0 3px;
  font-family: var(--f-serif);
  font-weight: 900;
  font-size: 15px;
}
.help section p {
  margin: 0;
  font-size: 13px;
  color: var(--fg-2);
  line-height: 1.7;
}

/* ── 相簿 ─────────────────────────────────────────────────────────────── */
.lightbox {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  justify-items: center;
  padding: 56px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px));
  background: rgba(237, 233, 225, 0.93);
  backdrop-filter: blur(10px);
}
.lightbox figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
  background: #fdfbf6;
  padding: 10px;
  box-shadow: var(--shadow-2);
}
.lightbox figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 6px 16px;
}
.lightbox figcaption b {
  font-family: var(--f-hand);
  font-weight: 400;
  font-size: 21px;
  color: var(--pen);
}
.lightbox figcaption span {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.lb-x {
  position: absolute;
  top: 14px;
  right: max(16px, env(safe-area-inset-right, 0px));
}
.lightbox.single .lb-prev,
.lightbox.single .lb-next {
  visibility: hidden;
}

/* ── 貼紙抽屜（小螢幕或收起 3D 貼紙本時使用） ───────────────────────────── */
.tray {
  position: absolute;
  z-index: 35;
  left: 50%;
  bottom: 66px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 32px));
  max-height: 46%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  box-shadow: var(--shadow-2);
}
.tray-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--fg);
  overflow-x: auto;
}
.tray-tabs button {
  border: 0;
  background: none;
  padding: 7px 12px;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-radius: 3px 3px 0 0;
  white-space: nowrap;
}
.tray-tabs button[aria-selected="true"] {
  background: var(--fg);
  color: var(--bg);
}
.tray-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 6px;
  padding: 10px;
  overflow: auto;
}
.tray-grid button {
  aspect-ratio: 1;
  border: 0;
  border-radius: 3px;
  background: none;
  padding: 4px;
  cursor: grab;
  touch-action: none;
}
.tray-grid button:hover {
  background: var(--bg-2);
}
.tray-grid canvas,
.tray-grid img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 1px 1.5px rgba(40, 28, 12, 0.3));
  pointer-events: none;
}
.tray-foot {
  padding: 6px 12px 9px;
  font-size: 11.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.tray.dragging {
  opacity: 0.18;
  pointer-events: none;
}
.stk-bar {
  position: absolute;
  z-index: 45;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 999px;
  background: var(--fg);
  box-shadow: var(--shadow-2);
}
.stk-bar button {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--bg);
  font-size: 13px;
}
.stk-bar button:hover {
  background: rgba(255, 255, 255, 0.16);
}
.memo-edit {
  position: absolute;
  z-index: 70;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  width: 232px;
  padding: 18px 16px 12px;
  background: linear-gradient(#f6dc7a, #f0cf5c);
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.memo-edit textarea {
  width: 100%;
  height: 132px;
  box-sizing: border-box;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  font-family: var(--f-hand);
  font-size: 22px;
  line-height: 1.35;
  color: #2b2a26;
}

@media (max-width: 760px) {
  .sheet {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 78%;
    border-radius: 12px 12px 0 0;
    border-width: 1px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation-name: sheet-up;
  }
  .sheet.out {
    animation-name: sheet-down;
  }
  @keyframes sheet-up {
    from {
      transform: translateY(28px);
      opacity: 0;
    }
  }
  @keyframes sheet-down {
    to {
      transform: translateY(28px);
      opacity: 0;
    }
  }
  .lightbox {
    grid-template-columns: 40px 1fr 40px;
  }
}

/* ── 共用與權限 ───────────────────────────────────────────────────────── */
.share {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(237, 233, 225, 0.72);
  backdrop-filter: blur(6px);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.share:hover {
  background: var(--paper);
  border-color: var(--fg);
}
.share-cap {
  color: var(--muted);
}
.share-role {
  font-weight: 500;
}
.share-role::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  background: var(--moss);
  vertical-align: 1px;
}
.share[data-role="viewer"] .share-role::before {
  background: var(--muted);
}
.share[data-role="owner"] .share-role::before {
  background: var(--accent);
}
.pill.off {
  opacity: 0.45;
}
.pop {
  position: absolute;
  z-index: 60;
  width: min(372px, calc(100% - 16px));
  max-height: min(78vh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  box-shadow: var(--shadow-2);
  animation: pop-in 0.18s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes pop-in {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
}
.pop-body {
  overflow: auto;
  padding: 16px 18px 18px;
}
.pop-body h3,
.dp-h {
  margin: 18px 0 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.pop-body h3 small,
.dp-h small {
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 0.06em;
}
.av {
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  overflow: hidden;
  background: var(--c, var(--bg-3));
  color: #fff;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(12, 12, 12, 0.12);
}
.av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.acc-me {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 4px 12px;
  align-items: center;
}
.acc-id {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.acc-id b {
  font-size: 15px;
  font-weight: 500;
}
.acc-me p {
  grid-column: 2;
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-2);
}
.role-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 3px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  line-height: 22px;
  letter-spacing: 0.06em;
}
.role-chip small {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  opacity: 0.7;
}
.role-chip[data-role="viewer"] {
  background: var(--bg-3);
  color: var(--fg-2);
}
.roles,
.plist {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.roles li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.roles li b {
  display: flex;
  flex-direction: column;
  font-weight: 500;
  font-size: 13px;
  color: var(--fg-2);
}
.roles li b small {
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.roles li.cur {
  background: var(--bg-2);
  color: var(--fg);
}
.roles li.cur b {
  color: var(--accent);
}
.roles + .fine {
  margin-top: 9px;
}
.plist li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.p-name {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.p-name b {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.p-name i,
.note header i {
  font-style: normal;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg-2);
  color: var(--muted);
}
.p-name i.on {
  background: none;
  color: var(--moss);
  padding: 0;
}
.p-what {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.gate {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--fg-2);
  background: var(--bg-2);
}
.link.daylink {
  justify-self: start;
  align-self: flex-start;
  margin: -6px 0 -4px 48px;
  color: var(--accent);
}

/* ── 某一天的手札：工具列與展開面板 ───────────────────────────────────── */
#app[data-mode="day"] #dock,
#app[data-mode="day"] .years,
#app[data-mode="day"] .hint {
  display: none;
}
.daydock[hidden] {
  display: none;
}
.pill.count {
  padding: 0 14px;
}
.pill.count b {
  margin-left: 3px;
  font-family: var(--f-mono);
  font-weight: 500;
  color: var(--accent);
}
.daypanel {
  position: relative;
  gap: 0;
  padding-top: 14px;
}
.day-peers {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}
.day-peers[hidden] {
  display: none;
}
.day-peers span:last-child {
  margin-left: 6px;
}
.seg {
  position: sticky;
  top: -14px;
  z-index: 2;
  display: flex;
  gap: 4px;
  margin: 12px -18px 0;
  padding: 8px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.seg-b {
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.seg-b:hover {
  color: var(--fg);
  background: var(--bg-2);
}
.seg-b[aria-current="true"] {
  border-color: var(--fg);
  color: var(--fg);
}
.dp {
  padding-bottom: 6px;
}
.dp-h {
  margin-top: 20px;
}
.dp-h .link {
  margin-left: auto;
  font-family: var(--f-sans);
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
}
.dp-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dp-editor[hidden] {
  display: none;
}
.dp-editor > .link {
  align-self: flex-start;
}
.dp-text {
  min-height: 150px;
}
.dp-under {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: -6px;
}
.dp-count {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.dp-count.near {
  color: var(--accent);
}
.moods {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 46px;
  gap: 4px;
}
.mood {
  height: 46px;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 3px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  font-size: 11px;
  color: var(--muted);
  transition: background 0.12s, transform 0.12s;
}
.mood canvas {
  max-width: 100%;
  max-height: 38px;
  width: auto;
  height: auto;
  display: block;
}
.mood:hover {
  background: var(--bg-2);
  transform: translateY(-1px);
}
.mood[aria-checked="true"] {
  border-color: var(--fg);
  background: var(--bg-2);
}
.note {
  position: relative;
  padding: 12px 0 13px;
  border-bottom: 1px solid var(--line);
}
.note.flash {
  animation: note-flash 1.4s ease-out;
}
@keyframes note-flash {
  0%,
  35% {
    background: rgba(181, 37, 25, 0.1);
  }
}
.note header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.note header b {
  font-weight: 500;
}
.note header time {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.note header .link {
  margin-left: auto;
  font-size: 12px;
}
.note-mood {
  float: right;
  width: 46px;
  height: auto;
  margin: 6px 0 2px 10px;
  transform: rotate(6deg);
}
.note-t {
  margin: 7px 0 0 38px;
  font-family: var(--f-hand);
  font-size: 17px;
  line-height: 1.6;
  color: var(--pen);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-ph {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 9px 0 0 38px;
}
.note-ph button {
  width: 62px;
  height: 62px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-3);
}
.note-ph img,
.pg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pg {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--bg-3);
}
.pg .av {
  position: absolute;
  left: 4px;
  bottom: 4px;
  box-shadow: 0 0 0 2px var(--paper);
}

@media (max-width: 760px) {
  .share-cap {
    display: none;
  }
  .share {
    padding: 0 10px;
  }
  .pop {
    left: 8px;
    right: 8px !important;
    width: auto;
  }
  .daydock .pill.count,
  .daydock #dayStickers {
    display: none;
  }
  .moods {
    grid-template-columns: repeat(9, 1fr);
  }
}
.brand-zh {
  white-space: nowrap;
}
@media (max-width: 760px) {
  /* 窄螢幕：同步狀態只留一個小方塊，把位置讓給品牌與角色 */
  .sync {
    font-size: 0;
    letter-spacing: 0;
  }
  .sync::before {
    margin-right: 0;
    width: 8px;
    height: 8px;
  }
}
