/* Sophia r10 · 灰青静室 — cool ash–ink hospitality system (NOT r8/r9 cream collage) */
:root {
  --paper: #e7ebe6;
  --ink: #1f2422;
  --ink-muted: #5c6661;
  --celadon: #4f6b5c;
  --celadon-soft: rgba(79, 107, 92, 0.14);
  --plum: #7a4e5c;
  --plum-soft: rgba(122, 78, 92, 0.1);
  --rain: #8a9694;
  --timber: #c5b8a4;
  --surface: rgba(248, 250, 248, 0.88);
  --surface-solid: #f7f9f7;
  --line: rgba(31, 36, 34, 0.1);
  --shadow: 0 14px 44px rgba(31, 36, 34, 0.12);
  --radius: 10px;
  --radius-sheet: 16px;
  --font-ui: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --font-lit: "Noto Serif SC", "Songti SC", "Source Han Serif SC", Georgia, serif;
  --dock-h: 64px;
  --focus-progress: 0;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --washi: url("assets/textures/washi.jpg");
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.has-overlay { overflow: hidden; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--celadon); }

/* —— Stage: place-led rooms —— */
.stage {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none;
}
.stage-photo {
  position: absolute; inset: -5%;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.4s ease;
  filter: saturate(0.82) contrast(0.98) brightness(0.97) hue-rotate(4deg);
}
.stage-day { opacity: 1; }
body[data-room] .stage-dusk { opacity: calc(var(--focus-progress) * 0.62); }
.stage-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(220,230,228,0.38), rgba(231,235,230,0.72) 42%, rgba(231,235,230,0.92)),
    radial-gradient(110% 75% at 50% 8%, transparent, rgba(31,40,38,0.28));
}
.stage-grain {
  position: absolute; inset: 0; opacity: 0.055;
  background-image: var(--washi);
  background-size: 420px;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.room-bamboo .stage-veil {
  background: linear-gradient(180deg, rgba(210,226,220,0.42), rgba(228,234,230,0.9));
}
.room-plum .stage-veil {
  background: linear-gradient(180deg, rgba(220,226,230,0.45), rgba(228,232,234,0.92));
}
.room-ink .stage-veil {
  background: linear-gradient(180deg, rgba(198,208,212,0.52), rgba(218,224,226,0.94));
}

.lang-toggle {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 14px; z-index: 40;
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 12px; min-height: 36px; cursor: pointer;
  backdrop-filter: blur(12px);
}
.title-chip {
  position: fixed; top: max(14px, env(safe-area-inset-top)); left: 14px; z-index: 40;
  font-size: 12px; letter-spacing: 0.06em; color: var(--plum);
  background: var(--surface); border: 1px solid rgba(122,78,92,0.22);
  border-radius: 999px; padding: 4px 10px;
}

.shell {
  position: relative; z-index: 1;
  max-width: 520px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 18px calc(var(--dock-h) + var(--safe-b) + 24px);
  min-height: 100%;
}
.page-head { margin-bottom: 16px; }
.eyebrow {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-muted); margin: 0 0 8px;
}
.page-title {
  font-family: var(--font-lit); font-weight: 600; font-size: 1.58rem;
  line-height: 1.35; margin: 0 0 8px; text-wrap: balance;
}
.lede { color: var(--ink-muted); line-height: 1.55; margin: 0 0 12px; }
.presence { font-size: 0.92rem; color: var(--ink-muted); line-height: 1.5; }
.sample-tag {
  display: inline-block; font-size: 10px; letter-spacing: 0.06em;
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px;
  color: var(--rain); vertical-align: middle;
}
.section-title {
  font-size: 0.92rem; letter-spacing: 0.08em; color: var(--ink-muted);
  margin: 22px 0 10px; font-weight: 500;
}
.formats, .hint, .demo-hint, .version { font-size: 0.85rem; color: var(--ink-muted); }

.sheet {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sheet); padding: 16px;
  backdrop-filter: blur(16px); box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.field-label {
  display: block; font-size: 0.8rem; color: var(--ink-muted);
  margin: 10px 0 6px;
}
.field-label:first-child { margin-top: 0; }
.field {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; background: var(--surface-solid); outline: none;
  min-height: 44px;
}
.field:focus {
  border-color: var(--celadon);
  box-shadow: 0 0 0 3px var(--celadon-soft);
}
.field-narrow { max-width: 140px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 12px 16px; min-height: 44px; cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, opacity 0.2s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--celadon); color: #f4f8f5;
  box-shadow: 0 6px 18px rgba(79,107,92,0.28);
}
.btn-primary:hover { background: #425c4e; }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: 0.9rem; }
.btn-file { cursor: pointer; }
.linkish {
  background: none; border: 0; color: var(--ink-muted); text-decoration: underline;
  cursor: pointer; padding: 8px; min-height: 44px;
}
.icon-close {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: transparent; font-size: 24px; line-height: 1;
  cursor: pointer; min-width: 44px; min-height: 44px; color: var(--ink-muted);
}

.list-block { display: flex; flex-direction: column; gap: 10px; }
.task-row, .desk-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sheet); padding: 14px 16px;
  backdrop-filter: blur(12px);
}
.task-name { margin: 0; font-size: 1.05rem; font-weight: 600; }
.task-meta { margin: 4px 0 0; font-size: 0.85rem; color: var(--ink-muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-hint { color: var(--ink-muted); padding: 12px 4px; }

.interrupt-banner {
  background: var(--plum-soft); border: 1px solid rgba(122,78,92,0.28);
  border-radius: var(--radius-sheet); padding: 12px 14px; margin-bottom: 12px;
}

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--dock-h) + var(--safe-b));
  padding: 6px 8px var(--safe-b);
  background: rgba(247,249,247,0.94); border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  max-width: 520px; margin: 0 auto;
}
.dock-btn {
  border: 0; background: transparent; color: var(--ink-muted);
  font-size: 0.78rem; cursor: pointer; border-radius: 10px;
}
.dock-btn.is-on {
  color: var(--ink); font-weight: 600;
  background: var(--celadon-soft);
}

.overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 18px;
  background: rgba(20, 24, 22, 0.42); backdrop-filter: blur(8px);
}
.overlay[hidden] { display: none !important; }
.overlay-card {
  position: relative; width: min(440px, 100%);
  max-height: min(92vh, 900px); overflow: auto;
  background: var(--surface-solid); border-radius: 20px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 22px 20px 20px;
}
.overlay-timer {
  background: rgba(16, 20, 18, 0.32);
  align-items: stretch;
}
.timer-wrap {
  width: min(440px, 100%); margin: auto; text-align: center;
  background: var(--surface); border-radius: 22px; border: 1px solid var(--line);
  padding: 24px 18px 20px; backdrop-filter: blur(18px);
}
.ring-wrap { position: relative; width: 228px; height: 228px; margin: 16px auto; }
.timer-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(31,36,34,0.1); stroke-width: 7; }
.ring-fg {
  fill: none; stroke: var(--celadon); stroke-width: 7; stroke-linecap: round;
  stroke-dasharray: 540; stroke-dashoffset: 540;
  transition: stroke-dashoffset 0.2s linear;
}
.ring-center {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 2px;
}
.timer-display {
  font-variant-numeric: tabular-nums; font-size: 2rem; font-weight: 600; margin: 0;
  letter-spacing: 0.02em;
}
.timer-bird {
  margin: 0 auto; width: 96px; height: auto;
  filter: drop-shadow(0 6px 12px rgba(31,36,34,0.18));
}
.timer-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.onboard-bird {
  margin: 0 auto 14px; width: 132px; height: auto;
  filter: drop-shadow(0 10px 20px rgba(31,36,34,0.16));
}
.onboard-card h2, .paywall-card h2 {
  font-family: var(--font-lit); text-wrap: balance; font-size: 1.35rem;
}

.creator-note {
  margin: 8px 0 16px; padding: 14px 16px;
  border-left: 3px solid var(--plum);
  background: var(--plum-soft); border-radius: 0 12px 12px 0;
}
.creator-note p { margin: 0 0 6px; font-family: var(--font-lit); line-height: 1.65; }
.creator-en { color: var(--ink-muted); font-size: 0.95rem; }
.creator-label { font-size: 0.8rem; color: var(--plum); letter-spacing: 0.08em; margin: 0; }
.creator-note-hero { margin-top: 4px; }
.benefit-list { padding-left: 1.1rem; color: var(--ink-muted); line-height: 1.55; }
.sales-badge {
  display: inline-block; font-size: 0.8rem; letter-spacing: 0.04em;
  border: 1px dashed var(--rain); color: var(--ink-muted);
  padding: 4px 8px; border-radius: 6px;
}

.plan-list { display: grid; gap: 10px; margin: 14px 0; }
.plan-card {
  text-align: left; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; padding: 14px 14px 12px; cursor: pointer;
  display: grid; gap: 4px; position: relative;
}
.plan-card.is-featured {
  border-color: var(--celadon);
  box-shadow: 0 0 0 2px var(--celadon-soft);
  background: linear-gradient(180deg, #eef4f0, #fff);
}
.plan-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 11px; background: var(--celadon); color: #fff;
  border-radius: 999px; padding: 3px 8px;
}
.plan-title { font-weight: 600; }
.plan-price { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.plan-note, .plan-renew { font-size: 0.82rem; color: var(--ink-muted); }

/* Literary card — paper slip + flip */
.card-face {
  margin: 16px 0; padding: 22px 20px;
  min-height: 180px;
  border-radius: 12px;
  border: 1px solid rgba(79,107,92,0.28);
  background:
    linear-gradient(160deg, rgba(247,249,247,0.92), rgba(236,240,236,0.95)),
    var(--washi);
  background-size: auto, 280px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5);
  transform-style: preserve-3d;
}
.card-face.is-flip { animation: cardReveal 0.65s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes cardReveal {
  0% { opacity: 0; transform: rotateY(-18deg) translateY(10px) scale(0.96); }
  100% { opacity: 1; transform: none; }
}
.lit-text {
  font-family: var(--font-lit); font-size: 1.06rem; line-height: 1.75; margin: 0 0 12px;
  white-space: pre-wrap; color: var(--ink);
}
.lit-attr { margin: 0; font-size: 0.85rem; color: var(--ink-muted); }
.cards-grid, .bookmarks-grid { display: grid; gap: 12px; }
.lit-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px;
}

.bamboo-card {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px;
}
.bamboo-slip {
  width: 52px; height: 78px; border-radius: 5px;
  background-image: url("assets/bookmarks/bamboo-slip.jpg");
  background-size: cover; background-position: center;
  box-shadow: 0 4px 12px rgba(31,36,34,0.14);
  position: relative;
}
.bamboo-slip.big {
  width: 88px; height: 132px; margin: 12px auto;
  border-radius: 6px;
}
.pill {
  display: inline-block; font-size: 11px; margin-left: 8px;
  background: var(--celadon-soft); color: var(--celadon);
  border-radius: 999px; padding: 2px 8px;
}

.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--surface); border-radius: 12px; padding: 4px; border: 1px solid var(--line);
  margin-bottom: 16px;
}
.trail-seg {
  border: 0; background: transparent; border-radius: 10px; min-height: 40px; cursor: pointer;
  color: var(--ink-muted);
}
.trail-seg.is-on { background: var(--celadon); color: #f4f8f5; }
.trail-stats { display: grid; gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sheet); padding: 16px;
}
.stat-label { margin: 0; color: var(--ink-muted); font-size: 0.85rem; }
.stat-value { margin: 6px 0 0; font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.room-grid { display: grid; gap: 10px; }
.room-card {
  display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center;
  text-align: left; border: 1px solid var(--line); border-radius: 14px;
  background: #fff; padding: 10px; cursor: pointer;
}
.room-card.is-on {
  border-color: var(--celadon);
  box-shadow: 0 0 0 2px var(--celadon-soft);
}
.room-thumb {
  width: 88px; height: 64px; border-radius: 10px;
  background-size: cover; background-position: center;
}
.room-name { font-weight: 600; display: block; }
.room-desc { font-size: 0.82rem; color: var(--ink-muted); }

.watch-face {
  margin: 12px auto; width: 180px; height: 220px; border-radius: 40px;
  border: 8px solid #1f2422; background: linear-gradient(180deg, #1c2420, #101412);
  color: #e4ebe6; display: grid; place-content: center; gap: 8px; text-align: center;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.45);
}
.watch-time { font-size: 1.6rem; font-variant-numeric: tabular-nums; margin: 0; }
.watch-sophia { font-size: 0.75rem; letter-spacing: 0.08em; opacity: 0.7; margin: 0; }

.viewer-card { width: min(920px, 100%); height: min(90vh, 900px); display: flex; flex-direction: column; }
#viewer-frame, #viewer-img { flex: 1; width: 100%; border: 0; border-radius: 12px; background: #111; }
#viewer-text {
  flex: 1; overflow: auto; white-space: pre-wrap; background: #f7f9f7;
  border-radius: 12px; padding: 16px; margin: 0;
}

.me-sheet .me-value { margin: 0 0 12px; font-weight: 600; }
.legal { margin-top: 18px; }
.timer-chip {
  display: inline-block; background: var(--celadon-soft); color: var(--celadon);
  border-radius: 999px; padding: 4px 10px; font-size: 0.8rem;
}

.reward-bird {
  margin: 0 auto 10px; width: 110px; height: auto;
  filter: drop-shadow(0 8px 16px rgba(31,36,34,0.16));
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
  }
  .card-face.is-flip { animation: none; }
}

@media (min-width: 720px) {
  .shell { padding-top: 36px; }
  .page-title { font-size: 1.85rem; }
}

/* —— Alive Sophia (micro-motion; honor reduced-motion) —— */
:root {
  --cinnabar: #9c3b32;
  --persimmon: #c4683a;
  --jacaranda: #6b5b8a;
  --magnolia: #d4a0b0;
}
.alive-bird {
  transform-origin: 50% 80%;
  animation: birdBreath 3.6s ease-in-out infinite;
}
.timer-bird.alive-bird {
  animation: birdBreath 3.2s ease-in-out infinite, birdSettle 0.8s ease-out 1;
}
@keyframes birdBreath {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.015); }
}
@keyframes birdSettle {
  from { transform: translateY(6px) scale(0.96); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.plan-card.is-featured .plan-badge {
  background: var(--cinnabar);
}
.title-chip { border-color: rgba(154, 59, 50, 0.25); }

@media (prefers-reduced-motion: reduce) {
  .alive-bird { animation: none !important; }
}

/* Pro-locked scene cards */
.room-card.is-locked { opacity: 0.92; position: relative; }
.room-card.is-locked .room-thumb { filter: saturate(0.85) brightness(0.92); }
.room-card.is-locked::after {
  content: "";
  position: absolute; inset: 0; border-radius: 14px;
  background: linear-gradient(120deg, transparent 40%, rgba(31,36,34,0.08));
  pointer-events: none;
}
.pro-lock-badge {
  display: inline-block; margin-left: 8px; font-size: 10px; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 999px;
  background: var(--plum-soft); color: var(--plum); border: 1px solid rgba(122,78,92,0.25);
  vertical-align: middle;
}
.room-body { display: grid; gap: 4px; }
.room-vermilion .stage-veil {
  background: linear-gradient(180deg, rgba(228,214,210,0.48), rgba(228,232,230,0.92));
}
.room-jacaranda .stage-veil {
  background: linear-gradient(180deg, rgba(216,214,228,0.48), rgba(228,230,234,0.92));
}

/* Sophia blends into the place — soft contact shadow + warm perch shelf */
.sophia-perch-slot {
  position: fixed; z-index: 2; pointer-events: none;
  right: max(18px, calc(50% - 240px));
  bottom: calc(var(--dock-h) + var(--safe-b) + 88px);
  width: 112px;
}
.sophia-perch-slot img {
  width: 100%; height: auto;
  filter: drop-shadow(0 12px 18px rgba(31,40,38,0.34)) saturate(0.92) brightness(0.98);
}
.sophia-perch-slot .perch-shadow {
  display: block; height: 12px; margin: -8px auto 0; width: 62%;
  background: radial-gradient(ellipse at center, rgba(31,40,38,0.36), transparent 72%);
  border-radius: 50%;
}
body[data-room="ink"] .sophia-perch-slot img { filter: drop-shadow(0 10px 16px rgba(20,28,32,0.4)); }
body[data-room="plum"] .sophia-perch-slot img { filter: drop-shadow(0 10px 14px rgba(90,60,70,0.28)); }
body[data-room="vermilion"] .sophia-perch-slot img { filter: drop-shadow(0 10px 14px rgba(120,50,40,0.3)); }
body[data-room="jacaranda"] .sophia-perch-slot img { filter: drop-shadow(0 10px 14px rgba(70,50,100,0.32)); }

.timer-bird.alive-bird {
  filter: drop-shadow(0 8px 12px rgba(31,36,34,0.32));
}
