/* Motree · 纸本水墨基调，移动优先 */

:root {
  --paper: #f5f0e6;
  --ink: #3a352e;
  --ink-soft: rgba(58, 53, 46, 0.62);
  --accent: #8aa86b;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun,
           Georgia, serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  touch-action: none;
  display: block;
}

.hidden { display: none !important; }

#authPanel { position:fixed;inset:0;z-index:100;background:var(--paper);display:grid;place-items:center;padding:24px;overflow:auto; }
.auth-card { width:min(100%,360px);text-align:center; }
.auth-brand { font-size:30px;letter-spacing:.08em; }
.auth-sub { color:var(--ink-soft);margin:14px 0 30px; }
#authForm { display:grid;gap:20px;text-align:left; }
#authForm label { display:grid;gap:8px;font-size:14px;color:var(--ink-soft); }
#authForm input { width:100%;font:16px system-ui;padding:12px 14px;border:1px solid rgba(58,53,46,.25);border-radius:10px;background:rgba(255,255,255,.5);color:var(--ink);user-select:text; }
#authForm .primary { width:100%;padding:12px; }
#authStatus { min-height:1.6em;margin:20px 0 8px;font-size:14px;line-height:1.7;color:var(--ink-soft); }
#releaseVersion { display:block;margin-top:28px;color:var(--ink-soft);font-size:11px; }
#logoutBtn { pointer-events:auto;padding:8px; }
#emptyHint { position:fixed;left:24px;right:24px;top:45%;text-align:center;color:var(--ink-soft);line-height:1.9;pointer-events:none; }
#jobPanel { position:fixed;left:24px;right:24px;bottom:calc(env(safe-area-inset-bottom,0px) + 85px);text-align:center;color:var(--ink-soft);font-size:14px;line-height:1.7; }
#jobRetry { margin-left:12px;padding:10px; }
button:disabled { opacity:.5;cursor:wait; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 18px;
  pointer-events: none;
  transition: opacity 0.4s;
}
#hud.dim { opacity: 0.25; }
#dayCount {
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
#tourBtn {
  pointer-events: auto;
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(58, 53, 46, 0.25);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
}
#tourBtn.on { color: #fff; background: var(--ink); border-color: var(--ink); }

/* ---------- 今日入口 ---------- */
#todayBar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: flex;
  justify-content: center;
  transition: opacity 0.4s, transform 0.4s;
}
#todayBar.hidden { display: flex !important; opacity: 0; transform: translateY(16px); pointer-events: none; }
#todayBtn {
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(58, 53, 46, 0.3);
  border-radius: 999px;
  padding: 12px 34px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 14px rgba(90, 80, 60, 0.12);
}

/* ---------- 输入抽屉 ---------- */
#sheetWrap { position: fixed; inset: 0; z-index: 20; }
#scrim {
  position: absolute; inset: 0;
  background: rgba(58, 53, 46, 0.18);
  opacity: 0;
  transition: opacity 0.3s;
}
#sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 105%);
  transition: transform 0.34s cubic-bezier(0.22, 0.9, 0.3, 1);
  width: min(480px, 100%);
  background: #faf6ee;
  border-radius: 20px 20px 0 0;
  padding: 22px 22px calc(env(safe-area-inset-bottom, 0px) + 18px);
  box-shadow: 0 -8px 40px rgba(80, 70, 52, 0.18);
  max-height: 86vh;
  overflow-y: auto;
}
#sheetWrap.open #scrim { opacity: 1; }
#sheetWrap.open #sheet { transform: translate(-50%, 0); }

.sheet-title {
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
#sentence {
  width: 100%;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(58, 53, 46, 0.3);
  padding: 4px 2px 10px;
  resize: none;
  outline: none;
}
#sentence::placeholder { color: rgba(58, 53, 46, 0.35); }

.widget { margin-top: 20px; }
.w-label {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.w-label .opt {
  font-size: 11px;
  color: rgba(58, 53, 46, 0.35);
  margin-left: 8px;
}

.pills { display: flex; gap: 10px; }
.pill {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid rgba(58, 53, 46, 0.3);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.18s;
}
.pill.on { color: #fff; background: var(--ink); border-color: var(--ink); }

.colors { display: flex; gap: 14px; }
.dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  outline: 2px solid transparent;
  outline-offset: 2px;
  cursor: pointer;
  transition: outline-color 0.18s, transform 0.18s;
}
.dot.on { outline-color: var(--ink); transform: scale(1.12); }

#tapPad {
  position: relative;
  height: 84px;
  border: 1px dashed rgba(58, 53, 46, 0.35);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}
#tapHint { font-size: 13px; color: rgba(58, 53, 46, 0.4); pointer-events: none; }
.ripple {
  position: absolute;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: rgba(138, 168, 107, 0.5);
  animation: rip 0.8s ease-out forwards;
  pointer-events: none;
}
@keyframes rip {
  to { transform: scale(7); opacity: 0; }
}
.tap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  min-height: 20px;
}
#tapInfo { font-size: 12px; color: var(--ink-soft); }
.linkbtn {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-soft);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 26px;
}
.ghost, .primary {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 11px 26px;
  cursor: pointer;
  transition: opacity 0.18s;
}
.ghost {
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid rgba(58, 53, 46, 0.28);
}
.primary {
  color: #fff;
  background: var(--ink);
  border: 1px solid var(--ink);
}
.ghost:active, .primary:active { opacity: 0.7; }

/* ---------- 注脚卡片 ---------- */
#cardWrap {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 18px calc(env(safe-area-inset-bottom, 0px) + 30px);
  pointer-events: none;
}
.card {
  pointer-events: auto;
  width: min(440px, 100%);
  background: #faf6ee;
  border: 1px solid rgba(58, 53, 46, 0.14);
  border-radius: 18px;
  padding: 20px 22px 16px;
  box-shadow: 0 10px 44px rgba(80, 70, 52, 0.2);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.3s, transform 0.3s;
}
#cardWrap.open .card { opacity: 1; transform: translateY(0); }
.card-day {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: rgba(58, 53, 46, 0.45);
  margin-bottom: 10px;
}
.card-quote {
  font-size: 17px;
  line-height: 1.8;
  margin-bottom: 10px;
}
.card-note {
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-soft);
}
.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}
.card-actions .ghost, .card-actions .primary {
  font-size: 13px;
  padding: 8px 18px;
}
/* 巡游伴随卡片：无按钮、不拦截树的手势 */
#cardWrap.no-actions .card-actions { display: none; }
#cardWrap.no-actions .card { pointer-events: none; padding-bottom: 20px; }

/* ---------- 唤醒页 ---------- */
#wake {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(245, 240, 230, 0.86);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.9s;
  cursor: pointer;
}
#wake.fade { opacity: 0; pointer-events: none; }
.wake-inner { text-align: center; }
.wake-title {
  font-size: 32px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  margin-bottom: 14px;
}
.wake-title .t-en { letter-spacing: 0.06em; }
.wake-title .t-dot {
  align-self: center;
  margin: 0 13px;
  font-size: 17px;
  color: rgba(58, 53, 46, 0.38);
}
.wake-title .t-cn { letter-spacing: 0.26em; margin-right: -0.26em; }
.wake-sub {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin-bottom: 60px;
}
.wake-action, .wake-progress {
  font-size: 14px;
  letter-spacing: 0.18em;
  color: rgba(58, 53, 46, 0.5);
  animation: breathe 2.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

/* ---------- 提示 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  transform: translateX(-50%);
  background: rgba(58, 53, 46, 0.86);
  color: #f5f0e6;
  font-size: 13px;
  letter-spacing: 0.08em;
  border-radius: 999px;
  padding: 9px 20px;
  z-index: 40;
}
