/* 三間書房的色票，與 App 的 theme.js 相同。 */
:root,
:root[data-theme="japanese"] {
  --paper: #fdfbf7;
  --ink: #3a3228;
  --ink-soft: #6a5c4e;
  --button: #de9147;
  --button-light: #f0b27a;
  --button-rgb: 222, 145, 71;
  --ink-on-button: #3a3228;
  --line: #e6ddcd;
  --danger: #b5523a;
  --input: rgba(255, 247, 236, 0.96);
  --chip: rgba(222, 145, 71, 0.2);
  --fill: rgba(255, 250, 242, 0.97);
  --fill-strong: rgba(255, 252, 247, 0.99);
  --sheen: rgba(255, 255, 255, 0.5);
  --edge: rgba(138, 96, 58, 0.55);
  --glow-rgb: 222, 145, 71;
  --field: rgba(222, 145, 71, 0.2);
  color-scheme: light;
}

:root[data-theme="midnight"] {
  --paper: #16191e;
  --ink: #e8e4dc;
  --ink-soft: #9aa3b2;
  --button: #e0a96d;
  --button-light: #f0c490;
  --button-rgb: 224, 169, 109;
  --ink-on-button: #1a140e;
  --line: #343b47;
  --danger: #e7b1a4;
  --input: rgba(14, 17, 22, 0.5);
  --chip: rgba(22, 25, 30, 0.5);
  --fill: rgba(34, 39, 47, 0.52);
  --fill-strong: rgba(30, 35, 44, 0.9);
  --sheen: rgba(255, 255, 255, 0.11);
  --edge: rgba(255, 255, 255, 0.14);
  --glow-rgb: 111, 125, 255;
  --field: rgba(14, 17, 22, 0.5);
  color-scheme: dark;
}

:root[data-theme="nordic"] {
  --paper: #eff2f0;
  --ink: #2c3330;
  --ink-soft: #6a736e;
  --button: #8c7a6b;
  --button-light: #a8978a;
  --button-rgb: 140, 122, 107;
  --ink-on-button: #f7f4f1;
  --line: #c9d2cd;
  --danger: #a15a45;
  --input: rgba(255, 255, 255, 0.92);
  --chip: rgba(78, 115, 100, 0.18);
  --fill: rgba(247, 250, 248, 0.97);
  --fill-strong: rgba(252, 253, 252, 0.99);
  --sheen: rgba(255, 255, 255, 0.62);
  --edge: rgba(62, 102, 88, 0.5);
  --glow-rgb: 94, 143, 124;
  --field: rgba(78, 115, 100, 0.18);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang TC", "Hiragino Sans CNS", "Noto Sans TC", "Noto Sans CJK TC",
    "Microsoft JhengHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

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

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  user-select: none;
}

p,
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: inherit;
}

::selection {
  background: rgba(var(--button-rgb), 0.28);
}

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

#backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  background: linear-gradient(152deg, #f0c492, #f6d7b4, #d2e3c2);
}

:root[data-theme="midnight"] #backdrop {
  background: linear-gradient(152deg, #16191e, #181c29, #1c2136);
}

:root[data-theme="nordic"] #backdrop {
  background: linear-gradient(152deg, #a9cabb, #d5e4dc, #e4d4c4);
}

.orb {
  position: absolute;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

#stage {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

#app {
  width: min(480px, 100%);
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: env(safe-area-inset-top);
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 20px 96px;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar {
  display: none;
}

.shelf-scroll {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.hero {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 8px 20px 4px;
}

.hero-art {
  flex: 1.15;
  min-height: 132px;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
}

.hero-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.scene-chip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--chip);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.hero-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.app-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 32px;
}

.theme-name {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--ink-soft);
}

.theme-chip {
  align-self: flex-start;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
}

.press {
  transition: transform 120ms ease-out, opacity 120ms ease-out;
}

.press:active {
  transform: scale(0.98);
  opacity: 0.92;
}

.glass {
  position: relative;
  background: var(--fill);
  border-radius: 26px;
  box-shadow: 0 10px 22px rgba(var(--glow-rgb), 0.2);
}

.glass.strong {
  background: var(--fill-strong);
  box-shadow: 0 10px 22px rgba(var(--glow-rgb), 0.16);
}

.glass::before,
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.glass::before {
  z-index: 0;
  background: linear-gradient(155deg, var(--sheen), transparent 72%);
}

.glass::after {
  z-index: 2;
  border: 1px solid var(--edge);
}

.glass > * {
  position: relative;
  z-index: 1;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
}

.cal,
.form,
.note,
.dialog {
  align-items: stretch;
}

.cal {
  margin-bottom: 4px;
  border-radius: 24px;
}

.section-row {
  margin: 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shelf-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  flex: none;
}

.shelf-tools {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.decor {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: none;
}

.decor svg {
  display: block;
}

.search {
  flex: 1 1 auto;
  min-width: 112px;
  max-width: 200px;
  min-height: 36px;
  border-radius: 999px;
  background: var(--chip);
  display: flex;
  align-items: center;
  padding: 0 8px 0 14px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  padding: 6px 0;
  outline: none;
  color: var(--ink);
}

.search input::placeholder {
  color: var(--ink-soft);
}

.search-clear {
  font-size: 18px;
  line-height: 20px;
  padding: 0 4px;
  color: var(--ink-soft);
}

.miss {
  font-size: 14px;
  line-height: 22px;
  margin: 0 0 8px;
  color: var(--ink-soft);
}

.empty-title {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

.empty-body {
  font-size: 14px;
  line-height: 22px;
  text-align: center;
  margin-top: 8px;
  color: var(--ink-soft);
}

.book {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 12px;
}

.spine {
  width: 6px;
  align-self: stretch;
  border-radius: 3px;
  margin-right: 12px;
  flex: none;
}

.book-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.book-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 26px;
  overflow-wrap: anywhere;
}

.meta {
  font-size: 13px;
  line-height: 20px;
  margin-top: 4px;
  color: var(--ink-soft);
}

.chevron {
  font-size: 28px;
  line-height: 1;
  margin-left: 8px;
  color: var(--ink-soft);
  flex: none;
}

.track {
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
  background: var(--line);
}

.track.room {
  margin-top: 12px;
}

.track-fill {
  height: 100%;
  background: var(--button);
}

.mini {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.card > svg {
  display: block;
}

.mini.hollow {
  background: transparent;
  border: 1.5px solid var(--ink-soft);
  color: var(--ink);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cal-arrow {
  min-width: 44px;
  min-height: 44px;
  font-size: 28px;
  line-height: 32px;
  color: var(--ink);
}

.cal-month {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

.cal-row {
  display: flex;
  gap: 6px;
}

.cal-day {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cal-pill {
  width: 100%;
  min-height: 64px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  background: var(--chip);
  border: 1.5px solid transparent;
}

.cal-day[data-today="true"] .cal-pill {
  background: var(--ink);
}

.cal-day[aria-pressed="true"]:not([data-today="true"]) .cal-pill {
  border-color: var(--ink);
}

.cal-weekday {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.cal-date {
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--ink);
}

.cal-day[data-today="true"] .cal-weekday,
.cal-day[data-today="true"] .cal-date {
  color: var(--paper);
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 3px;
  margin-top: 6px;
  background: transparent;
}

.cal-day[data-marked="true"] .cal-dot {
  background: var(--button);
}

.cal-chosen {
  font-size: 13px;
  margin-top: 12px;
  color: var(--ink-soft);
}

.day-line {
  font-size: 14px;
  line-height: 22px;
  margin-top: 8px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.fab {
  position: absolute;
  right: 20px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 2;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--button);
  color: var(--ink-on-button);
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 8px 16px rgba(var(--button-rgb), 0.28);
}

.back {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 14px;
  margin-top: 10px;
  border-radius: 14px;
  background: var(--chip);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.room-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 38px;
  margin-top: 16px;
  overflow-wrap: anywhere;
}

.section {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  margin: 22px 0 12px;
}

.form {
  margin-top: 22px;
  border-radius: 24px;
}

.page-date {
  font-size: 13px;
  color: var(--ink-soft);
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 16px 0 8px;
  color: var(--ink-soft);
}

.label.tight {
  margin-top: 12px;
}

.field {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 22px;
  background: var(--field);
  color: var(--ink);
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.dialog .field {
  background: var(--input);
}

.field::placeholder {
  color: var(--ink-soft);
}

.field.gap {
  margin-top: 12px;
}

.area {
  min-height: 140px;
  padding-top: 14px;
  resize: none;
  line-height: 24px;
}

.capsule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.capsule {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}

.category {
  border: 2px solid transparent;
}

.category[aria-pressed="true"] {
  border-color: var(--ink);
}

.mood {
  border: 1.5px solid var(--ink-soft);
  background: transparent;
  color: var(--ink);
}

.mood[aria-pressed="true"] {
  border-color: var(--ink);
}

.primary {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  padding: 0 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--button-light), var(--button));
  color: var(--ink-on-button);
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(var(--glow-rgb), 0.28);
}

.error {
  color: var(--danger);
  font-size: 13px;
  line-height: 20px;
  margin-top: 12px;
}

.edit-hint {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 14px;
}

.cancel {
  min-height: 44px;
  margin-top: 4px;
  width: 100%;
  color: var(--ink-soft);
  font-size: 14px;
}

.year {
  margin-top: 4px;
}

.year-label {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.month {
  margin-top: 8px;
}

.month-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tick {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--button);
}

.month-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--ink-soft);
}

.day-label {
  font-size: 13px;
  font-weight: 700;
  margin: 8px 0;
}

.note {
  margin-bottom: 12px;
  border-radius: 22px;
}

.note.editing::after {
  border-width: 1.5px;
  border-color: var(--ink);
}

.note-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.note-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.note-time {
  font-size: 12px;
  color: var(--ink-soft);
}

.edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.note-page {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
}

.note-text {
  font-size: 15px;
  line-height: 24px;
  margin-top: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.share-link {
  align-self: flex-start;
  margin-top: 14px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  overflow: auto;
  overscroll-behavior: contain;
  padding: calc(16px + env(safe-area-inset-top)) 24px calc(16px + env(safe-area-inset-bottom));
  background: rgba(8, 10, 14, 0.72);
}

#modal[hidden] {
  display: none;
}

#modal.share {
  background: rgba(8, 10, 14, 0.82);
}

#modal:not([hidden]) {
  animation: fade 180ms ease;
}

.dialog {
  width: min(420px, 100%);
  margin: auto;
  border-radius: 24px;
  padding: 22px;
}

.dialog-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.share-column {
  width: min(300px, 100%);
  margin: auto;
  display: flex;
  flex-direction: column;
}

.share-image {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  border-radius: 28px;
  display: block;
  background: #fffcf8;
}

.share-go {
  width: 100%;
  margin-top: 14px;
  min-height: 48px;
  border-radius: 16px;
  background: var(--button);
  color: var(--ink-on-button);
  font-size: 16px;
  font-weight: 700;
}

.share-hint {
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  color: #f7f3ec;
}

.share-hint:empty {
  display: none;
}

.share-cancel {
  color: #f7f3ec;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
