:root {
  --bg0: #070b12;
  --bg1: #0c1420;
  --panel: rgba(16, 24, 38, 0.72);
  --panel-solid: #121a28;
  --text: #eef3fb;
  --muted: #8b9bb4;
  --accent: #7ec8ff;
  --accent-2: #c9a86c;
  --thought: #d4a8f0;
  --say: #7ddea8;
  --meta: #8b9bb4;
  --danger: #e88a92;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --font: "Noto Sans TC", "PingFang TC", "Segoe UI", sans-serif;
  --display: "Cormorant Garamond", "Noto Serif TC", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  color: var(--text);
  font-family: var(--font);
  background: var(--bg0);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  /* notch / home indicator */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.sky {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(80, 120, 200, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 10%, rgba(180, 120, 80, 0.12), transparent 50%),
    linear-gradient(180deg, #0a1020 0%, #0b1520 40%, #0a1218 100%);
}
.glow {
  position: fixed; border-radius: 50%; filter: blur(60px); z-index: -1; pointer-events: none;
  opacity: 0.45;
}
.glow-a {
  width: 320px; height: 320px; left: -40px; top: 20%;
  background: rgba(90, 140, 220, 0.25);
}
.glow-b {
  width: 280px; height: 280px; right: -30px; bottom: 15%;
  background: rgba(200, 150, 80, 0.14);
}

/* —— Header —— */
.top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1.25rem; flex-wrap: wrap;
  padding: 1.1rem 1.5rem 0.9rem;
  padding-top: max(1.1rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(8, 12, 20, 0.55);
}
.brand { display: flex; align-items: center; gap: 0.85rem; min-width: 0; flex: 1 1 auto; }
.brand-text { min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: linear-gradient(145deg, rgba(126, 200, 255, 0.25), rgba(201, 168, 108, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 24px rgba(126, 200, 255, 0.15);
  color: #f0e6c8;
}
.top h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.75rem;
  letter-spacing: 0.08em;
  background: linear-gradient(120deg, #f5f0e6 0%, #9fd0ff 55%, #e8d5a3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
}
.tagline {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.clock-card {
  text-align: right;
  min-width: 200px;
  flex: 0 1 auto;
  padding: 0.65rem 1rem;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(20, 32, 48, 0.9), rgba(14, 22, 34, 0.85));
  border: 1px solid rgba(126, 200, 255, 0.18);
  box-shadow: var(--shadow);
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}
/* Village hour advanced — auto-poll or host tick */
.clock-card.tick-flash {
  border-color: rgba(126, 200, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(126, 200, 255, 0.4),
    0 0 28px rgba(126, 200, 255, 0.3);
}
.clock-card .clock-main {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 600;
  color: #f2efe6;
  letter-spacing: 0.04em;
}
.clock-card .clock-sub {
  margin-top: 0.2rem;
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0.9;
  line-height: 1.45;
}
.clock-card .clock-sub .wx {
  color: #9ec8e8;
}
.clock-eta {
  margin-top: 0.35rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #9fd0ff;
}
.clock-eta .eta-num {
  font-variant-numeric: tabular-nums;
  color: #f2efe6;
}
.clock-eta.is-busy {
  color: #e8b07a;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}
.clock-eta.is-due {
  color: #c9e8a8;
}

.goals-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  padding: 0.55rem 1.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 14, 24, 0.45);
}
.goal-chip {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 7.2rem;
  flex: 1 1 8.5rem;
  max-width: 16rem;
  padding: 0.4rem 0.55rem 0.45rem;
  border-radius: 10px;
  background: rgba(18, 28, 42, 0.78);
  border: 1px solid rgba(126, 200, 255, 0.14);
}
.goal-chip.is-done { border-color: rgba(140, 210, 150, 0.4); }
.goal-chip.is-empty { opacity: 0.55; }
.goal-chip .g-k {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: none;
}
.goal-chip .g-t {
  font-size: 0.86rem;
  color: #f2efe6;
  font-weight: 600;
}
.goal-chip .g-p {
  font-size: 0.72rem;
  color: var(--muted);
}
.goal-chip .g-bar {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.goal-chip .g-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7ec8ff, #c9a86c);
}
.goal-chip.is-year {
  flex: 2 1 16rem;
  max-width: 28rem;
  border-color: rgba(201, 168, 108, 0.4);
}
.goal-chip .g-a,
.goal-chip .g-s {
  font-size: 0.7rem;
  color: var(--muted);
  line-height: 1.35;
}
.goal-chip .g-s { color: rgba(201, 168, 108, 0.9); }
.player-push {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translate(-50%, 120%);
  z-index: 80;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.75rem 1rem;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(24, 38, 56, 0.96), rgba(16, 24, 36, 0.94));
  border: 1px solid rgba(126, 200, 255, 0.4);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 24px rgba(126, 200, 255, 0.2);
  color: #f2efe6;
  font-size: 0.92rem;
  line-height: 1.45;
  transition: transform 0.35s ease;
}
.player-push.show {
  transform: translate(-50%, 0);
}

/* —— Layout —— */
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1.2fr minmax(300px, 380px);
  gap: 1.1rem;
  align-items: start;
  padding: 1.1rem 1.35rem 1.25rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}
/* Desktop main column: map on top, life log fills space below */
.col-main {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  min-width: 0;
  width: 100%;
  align-self: start;
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
}

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.map-panel {
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  /* zoom must not stretch grid row / side column */
  align-self: start;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.55rem;
}
.panel-head h2, .card h2 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #c5d6ea;
}
.chip {
  font-size: 0.72rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(126, 200, 255, 0.12);
  border: 1px solid rgba(126, 200, 255, 0.25);
  color: var(--accent);
}
.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  justify-content: flex-end;
  flex: 1;
  min-width: 0;
}
.map-zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.12rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.btn-zoom {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(126, 200, 255, 0.12);
  color: var(--text, #e8eef6);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.btn-zoom:hover:not(:disabled) {
  background: rgba(126, 200, 255, 0.22);
}
.btn-zoom:disabled {
  opacity: 0.35;
  cursor: default;
}
.btn-zoom-reset {
  width: auto;
  min-width: 40px;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.zoom-label {
  min-width: 2.6rem;
  text-align: center;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted, #9aabbc);
  user-select: none;
}
.map-wrap {
  position: relative;
  border-radius: 14px;
  /* Fixed viewport: zoom only scrolls inside, never resizes layout */
  width: 100%;
  height: min(62vh, 640px);
  max-height: min(62vh, 640px);
  min-height: 220px;
  flex: 0 0 auto;
  overflow: auto;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  background: #0d1a12;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  cursor: grab;
  /* app handles pan + pinch; prevent browser page-zoom steal */
  touch-action: none;
}
.map-wrap.is-panning {
  cursor: grabbing;
  user-select: none;
}
.map-panel > .hint {
  flex: 0 0 auto;
}
@media (max-width: 980px) {
  .map-wrap {
    height: min(48vh, 420px);
    max-height: min(48vh, 420px);
  }
}
@media (max-width: 720px) {
  .map-wrap {
    height: min(40vh, 320px);
    max-height: min(40vh, 320px);
    min-height: 180px;
  }
}
/* time-of-day / weather tint over map (CSS, no extra assets) */
.map-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  z-index: 2;
  transition: background 0.6s ease, box-shadow 0.6s ease;
  background: transparent;
  box-shadow: inset 0 0 48px rgba(0, 0, 0, 0.15);
}
.map-wrap.atm-dawn::after {
  background: linear-gradient(
    180deg,
    rgba(255, 180, 120, 0.14) 0%,
    rgba(255, 200, 150, 0.06) 40%,
    transparent 100%
  );
}
.map-wrap.atm-day::after {
  background: rgba(255, 250, 230, 0.03);
}
.map-wrap.atm-dusk::after {
  background: linear-gradient(
    180deg,
    rgba(120, 60, 100, 0.12) 0%,
    rgba(200, 100, 60, 0.1) 50%,
    rgba(20, 10, 30, 0.18) 100%
  );
}
.map-wrap.atm-night::after {
  background: linear-gradient(
    180deg,
    rgba(20, 30, 70, 0.28) 0%,
    rgba(8, 12, 28, 0.22) 100%
  );
  box-shadow: inset 0 0 60px rgba(0, 10, 40, 0.35);
}
.map-wrap.atm-rain::after {
  background: linear-gradient(
    180deg,
    rgba(40, 70, 100, 0.22) 0%,
    rgba(30, 50, 70, 0.18) 100%
  );
}
.map-wrap.atm-fog::after {
  background: rgba(180, 190, 200, 0.16);
}
.map-wrap.atm-snow::after {
  background: rgba(200, 220, 240, 0.14);
}
#map {
  display: block;
  margin: 0 auto;
  vertical-align: middle;
  background: #0d1a12;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
}
.hint {
  color: var(--muted);
  font-size: 0.75rem;
  margin: 0.55rem 0 0;
  text-align: center;
  opacity: 0.85;
  line-height: 1.45;
  padding: 0 0.25rem;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  align-self: start;
  width: 100%;
}
.card { padding: 0.85rem 0.95rem; }
.card.compact { flex: 1; min-width: 0; }
.stats-row { display: flex; gap: 0.75rem; }
@media (max-width: 480px) {
  .stats-row { flex-direction: column; }
}

.count {
  display: inline-block;
  min-width: 1.35em;
  padding: 0.05em 0.4em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 500;
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* —— Buttons —— */
.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.btn {
  background: rgba(36, 48, 68, 0.9);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.48rem 0.8rem;
  min-height: 40px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { border-color: rgba(126, 200, 255, 0.45); background: rgba(45, 62, 88, 0.95); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: wait; }
.btn-primary {
  background: linear-gradient(145deg, rgba(70, 130, 190, 0.55), rgba(40, 80, 130, 0.65));
  border-color: rgba(126, 200, 255, 0.35);
}
.btn-primary:hover { border-color: rgba(160, 220, 255, 0.6); }
.btn-ghost { background: transparent; opacity: 0.92; font-size: 0.78rem; }
.btn-danger {
  border-color: rgba(180, 80, 90, 0.45);
  color: #f0b8bc;
  background: rgba(60, 28, 32, 0.5);
}
.hint-inline {
  margin: 0.55rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

/* —— Life log —— */
.life-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}
.life-keep-hint {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(126, 200, 255, 0.18);
  background: rgba(20, 32, 48, 0.55);
  white-space: nowrap;
}
.life-days {
  display: flex;
  flex-wrap: wrap; /* show all m月d日 chips; avoid hiding older days off-screen */
  gap: 0.3rem;
  margin: 0 0 0.45rem;
  overflow-x: visible;
  overflow-y: hidden;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 200, 255, 0.25) transparent;
  -webkit-overflow-scrolling: touch;
}
.life-day {
  flex: 0 0 auto;
  background: rgba(20, 28, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.26rem 0.62rem;
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}
.life-day:hover {
  border-color: rgba(126, 200, 255, 0.35);
  color: var(--text);
}
.life-day.active {
  background: rgba(50, 80, 120, 0.5);
  border-color: rgba(126, 200, 255, 0.45);
  color: var(--text);
  font-weight: 600;
}
.life-day .day-n {
  opacity: 0.75;
  font-size: 0.64rem;
  margin-left: 0.2rem;
}
.life-day-sep {
  display: none;
}
.life-day-head.life-day-jump {
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  user-select: none;
}
.life-day-head.life-day-jump:hover,
.life-day-head.life-day-jump:focus-visible {
  outline: none;
  background: rgba(126, 200, 255, 0.12);
  border-color: rgba(126, 200, 255, 0.35);
}
.life-day-open {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 500;
  color: #8ec8f0;
  letter-spacing: 0.02em;
}
.life-cap-note {
  color: #a8b8cc !important;
  border-style: dashed !important;
}
/* Desktop: dedicated band under map (uses former empty space) */
@media (min-width: 981px) {
  .col-main .life-panel {
    height: min(48vh, 560px);
    min-height: 300px;
  }
  .col-main .life-log {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
  }
}
.panel-note { margin: 0 0 0.45rem; font-size: 0.72rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.filter {
  background: rgba(20, 28, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.filter:hover { border-color: rgba(126, 200, 255, 0.35); color: var(--text); }
.filter.active {
  background: rgba(50, 80, 120, 0.45);
  border-color: rgba(126, 200, 255, 0.4);
  color: var(--text);
  font-weight: 600;
}
.filter[data-filter="say"].active {
  border-color: rgba(125, 222, 168, 0.5);
  color: var(--say);
  background: rgba(30, 60, 45, 0.5);
}
.filter[data-filter="thought"].active {
  border-color: rgba(212, 168, 240, 0.5);
  color: var(--thought);
  background: rgba(60, 40, 80, 0.45);
}

.life-log {
  list-style: none; margin: 0; padding: 0;
  overflow: auto;
  max-height: min(480px, 52vh);
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 200, 255, 0.3) rgba(0, 0, 0, 0.15);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.life-log:focus-visible {
  outline: 1px solid rgba(126, 200, 255, 0.35);
  outline-offset: 2px;
}
.life-log li {
  padding: 0.5rem 0.55rem;
  margin-bottom: 0.35rem;
  border-radius: 10px;
  border: 1px solid transparent;
  color: #d0dbe8;
  background: rgba(0, 0, 0, 0.15);
}
.life-log li.life-day-head {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0.35rem 0 0.4rem;
  padding: 0.35rem 0.5rem;
  border-color: rgba(126, 200, 255, 0.2);
  background: rgba(18, 28, 44, 0.92);
  backdrop-filter: blur(6px);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-align: center;
}
.life-log li.empty {
  color: var(--muted);
  background: transparent;
  text-align: center;
  padding: 1.5rem 0.5rem;
}
.life-log li.kind-say {
  border-color: rgba(125, 222, 168, 0.2);
  background: linear-gradient(90deg, rgba(40, 90, 60, 0.25), rgba(0, 0, 0, 0.12));
}
/* 自言自語：偏琥珀，與對白綠區分 */
.life-log li.kind-say.kind-mono {
  border-color: rgba(230, 180, 90, 0.28);
  background: linear-gradient(90deg, rgba(90, 70, 30, 0.3), rgba(0, 0, 0, 0.12));
}
/* 心裡惦記：偏玫瑰，表示「說給不在場的人」 */
.life-log li.kind-say.kind-miss {
  border-color: rgba(230, 140, 160, 0.3);
  background: linear-gradient(90deg, rgba(90, 40, 55, 0.32), rgba(0, 0, 0, 0.12));
}
.life-log li.kind-thought {
  border-color: rgba(212, 168, 240, 0.22);
  background: linear-gradient(90deg, rgba(80, 50, 110, 0.28), rgba(0, 0, 0, 0.12));
}
.life-log li.kind-dream {
  border-color: rgba(140, 170, 255, 0.28);
  background: linear-gradient(90deg, rgba(40, 50, 100, 0.35), rgba(20, 15, 40, 0.2));
  font-style: italic;
}
.life-log li.kind-meta {
  border-color: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.78rem;
}

.tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 5px;
  padding: 0.08rem 0.38rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  letter-spacing: 0.04em;
}
.tag-say { background: rgba(40, 100, 70, 0.55); color: var(--say); }
.tag-mono { background: rgba(120, 85, 30, 0.6); color: #f0c878; }
.tag-miss { background: rgba(120, 45, 70, 0.6); color: #f0a8b8; }
.say-fail {
  color: #e8b07a;
  font-size: 0.86em;
  margin-left: 0.25rem;
}
.kind-chat-fail .tag-miss { background: rgba(120, 70, 30, 0.55); color: #f0d0a0; }
.tag-thought { background: rgba(90, 50, 120, 0.55); color: var(--thought); }
.tag-dream { background: rgba(50, 70, 140, 0.55); color: #b8c8ff; }
.tag-meta { background: rgba(50, 60, 75, 0.6); color: var(--meta); }

.t { color: var(--accent); margin-right: 0.3rem; font-variant-numeric: tabular-nums; font-size: 0.75rem; }
.who-say { color: var(--say); font-weight: 600; }
.who-thought { color: var(--thought); font-weight: 600; }
.who-dream { color: #b8c8ff; font-weight: 600; }
.to { color: var(--muted); font-size: 0.72rem; }
.to-miss { color: #e8a0b0; font-style: italic; }
.filter[data-filter="dream"].active {
  border-color: rgba(140, 170, 255, 0.5);
  color: #b8c8ff;
  background: rgba(40, 50, 100, 0.45);
}

/* —— Resources —— */
.resource-list { display: flex; flex-direction: column; gap: 0.45rem; }
.res-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.5rem;
  align-items: center;
  font-size: 0.8rem;
}
.res-row .label { color: var(--muted); }
.res-row .val { color: #e8eef8; font-variant-numeric: tabular-nums; font-weight: 500; }
.res-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.res-bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4a8f6a, #7ddea8);
  max-width: 100%;
}
.res-bar.gold > i { background: linear-gradient(90deg, #8a6a30, #e0c070); }
.res-bar.blue > i { background: linear-gradient(90deg, #3a6a9a, #7ec8ff); }
.structure-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.55rem;
  max-height: 14rem;
  overflow-y: auto;
}
.block-structures h2 { margin-bottom: 0.4rem; }

/* —— Villagers —— */
.vlist { list-style: none; margin: 0; padding: 0; }
.vlist li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.5rem;
  min-height: 48px;
  margin-bottom: 0.3rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.vlist li:hover {
  background: rgba(126, 200, 255, 0.06);
  border-color: rgba(126, 200, 255, 0.12);
}
.vlist li.active {
  background: rgba(126, 200, 255, 0.1);
  border-color: rgba(126, 200, 255, 0.28);
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0a1018;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.3);
  object-fit: cover;
  background: #1a2434;
}
.avatar.avatar-img {
  display: block;
  padding: 0;
  border: none;
}
.vlist .info { flex: 1; min-width: 0; }
.vlist .name {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.vlist .name .model-tag,
.pp-name .model-tag {
  font-weight: 500;
  font-size: 0.92em;
  color: #9ec8e8;
  letter-spacing: 0.02em;
}
.vlist .sub {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.morale-pip {
  width: 40px;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  padding: 0.15rem 0.2rem;
  border-radius: 8px;
  line-height: 1.2;
}

/* —— Status tones: 精疲／疲憊／尚可／充沛 etc. —— */
.st-chip,
.st-inline {
  display: inline-block;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.78em;
  line-height: 1.45;
  border: 1px solid transparent;
  white-space: nowrap;
}
.st-inline {
  font-size: 0.72em;
  padding: 0.02rem 0.35rem;
  vertical-align: baseline;
}
/* great — 精力充沛 / 振奮 / 飽足 */
.st-great,
.st-pip.st-great {
  color: #9ef0c4;
  background: rgba(60, 160, 110, 0.22);
  border-color: rgba(120, 220, 160, 0.35);
}
/* good — 精神不錯 / 開朗 */
.st-good,
.st-pip.st-good {
  color: #a8e0c0;
  background: rgba(70, 140, 100, 0.18);
  border-color: rgba(110, 190, 140, 0.28);
}
/* ok — 平常 / 平穩 */
.st-ok,
.st-pip.st-ok {
  color: #c5d0dc;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}
/* warn — 尚可 / 微飢 / 緊繃 */
.st-warn,
.st-pip.st-warn {
  color: #f0d080;
  background: rgba(180, 130, 40, 0.2);
  border-color: rgba(230, 180, 70, 0.35);
}
/* bad — 疲憊 / 飢餓 / 壓力明顯 */
.st-bad,
.st-pip.st-bad {
  color: #ffb090;
  background: rgba(180, 70, 40, 0.22);
  border-color: rgba(230, 120, 70, 0.4);
}
/* crit — 精疲力竭 / 非常飢餓 / 焦慮 */
.st-crit,
.st-pip.st-crit {
  color: #ffb0b8;
  background: rgba(180, 40, 55, 0.28);
  border-color: rgba(240, 100, 110, 0.45);
  box-shadow: 0 0 10px rgba(220, 60, 80, 0.18);
}

/* Meter fill by tone */
.pp-meter.st-meter-great > i {
  background: linear-gradient(90deg, #2d8a5a, #7ddea8);
}
.pp-meter.st-meter-good > i {
  background: linear-gradient(90deg, #3a7a58, #6ec89a);
}
.pp-meter.st-meter-ok > i {
  background: linear-gradient(90deg, #4a6070, #8aa0b0);
}
.pp-meter.st-meter-warn > i {
  background: linear-gradient(90deg, #a07820, #e8c060);
}
.pp-meter.st-meter-bad > i {
  background: linear-gradient(90deg, #a05030, #e89060);
}
.pp-meter.st-meter-crit > i {
  background: linear-gradient(90deg, #8a2838, #e87080);
}
.pp-meter.energy.st-meter-crit > i,
.pp-meter.energy.st-meter-bad > i {
  /* tired energy meter still shows remaining energy color as low */
  opacity: 0.95;
}
.person-panel .pp-row .v .st-chip {
  font-size: 0.92em;
}
.filter-hint { font-size: 0.72rem; color: var(--muted); font-weight: 400; margin-left: 0.35rem; }

/* —— Person condition panel —— */
.person-panel {
  position: relative;
  margin-top: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(126, 200, 255, 0.22);
  background: linear-gradient(160deg, rgba(24, 36, 56, 0.95), rgba(14, 20, 32, 0.92));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}
.person-panel.hidden { display: none; }
/* Corner X — always visible; sticky so it stays while scrolling long panel */
.person-panel .pp-x {
  position: sticky;
  top: 0.35rem;
  float: right;
  z-index: 3;
  width: 36px;
  height: 36px;
  margin: 0 0 -36px 0; /* sit over header without eating layout */
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(12, 18, 28, 0.88);
  color: #e8eef6;
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.person-panel .pp-x:hover {
  background: rgba(40, 56, 78, 0.95);
  border-color: rgba(126, 200, 255, 0.4);
  color: #fff;
}
.person-panel .pp-x:active {
  transform: scale(0.96);
}

/* Desktop: dock status card to the left of the viewport (over map column) */
@media (min-width: 721px) {
  .person-panel:not(.hidden) {
    position: fixed;
    left: max(1rem, env(safe-area-inset-left));
    top: max(5.25rem, calc(env(safe-area-inset-top) + 4.75rem));
    width: min(400px, calc(100vw - 2rem));
    max-width: 400px;
    max-height: calc(100vh - 6.5rem);
    max-height: calc(100dvh - 6.5rem);
    z-index: 45;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 16px;
    border: 1px solid rgba(126, 200, 255, 0.32);
    box-shadow:
      0 16px 48px rgba(0, 0, 0, 0.45),
      0 0 0 1px rgba(0, 0, 0, 0.2);
    background: linear-gradient(
      160deg,
      rgba(24, 36, 56, 0.98),
      rgba(14, 20, 32, 0.96)
    );
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: sheet-left 0.2s ease-out;
  }
  .person-panel .pp-close {
    display: block;
  }
}
.person-panel .pp-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
  padding-right: 2.4rem; /* room for × */
}
.person-panel .pp-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.95rem; color: #0a1018;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
  object-fit: cover;
  flex-shrink: 0;
}
.person-panel .pp-avatar.avatar-img {
  display: block;
  padding: 0;
}
.person-panel .pp-name {
  font-size: 1.05rem; font-weight: 700; letter-spacing: 0.04em;
}
.person-panel .pp-role {
  font-size: 0.75rem; color: var(--muted); margin-top: 0.1rem;
}
.person-panel .pp-summary {
  font-size: 0.8rem; line-height: 1.5; color: #d5e0ee;
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.2);
  border-left: 3px solid rgba(126, 200, 255, 0.45);
}
.person-panel .pp-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem;
}
@media (max-width: 420px) {
  .person-panel .pp-cols { grid-template-columns: 1fr; }
}
.person-panel .pp-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  font-weight: 600;
}
.person-panel .pp-row {
  display: grid;
  grid-template-columns: 3.2em 1fr;
  gap: 0.25rem 0.4rem;
  align-items: center;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
}
.person-panel .pp-row .k { color: var(--muted); }
.person-panel .pp-row .v { color: #eaf0f8; font-weight: 500; }
.person-panel .pp-meter {
  grid-column: 1 / -1;
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.person-panel .pp-meter > i {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #4a8f6a, #7ddea8);
}
.person-panel .pp-meter.stress > i {
  background: linear-gradient(90deg, #8a5050, #e8a0a0);
}
.person-panel .pp-meter.spirit > i {
  background: linear-gradient(90deg, #5a7ab0, #9ec8ff);
}
.person-panel .pp-context {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}
.person-panel .pp-close {
  display: none;
  width: 100%;
  margin-top: 0.75rem;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(30, 42, 60, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

/* —— Relations —— */
.pp-relations { margin-top: 0.85rem; }

.merchants-panel {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: #d5deea;
}
.merchants-panel .mp-head {
  font-weight: 600;
  font-size: 0.78rem;
  color: #e8eef8;
  margin-bottom: 0.35rem;
}
.merchants-panel .mp-empty {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.merchants-panel .mp-list {
  list-style: none;
  margin: 0 0 0.35rem;
  padding: 0;
}
.merchants-panel .mp-row {
  padding: 0.28rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  line-height: 1.35;
  font-size: 0.74rem;
}
.merchants-panel .mp-row.outbound strong { color: #f0c860; }
.merchants-panel .mp-row.returned strong { color: #8fd0a0; }
.merchants-panel .mp-row.visitor strong { color: #9ec0e0; }
.merchants-panel .mp-row.left { opacity: 0.55; }
.merchants-panel .mp-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
}
.pp-injury { margin-top: 0.85rem; }
.pp-injury .pp-want { color: #f0b0a0; }
.pp-wallet { margin-top: 0.85rem; }
.pp-wallet .pp-inv {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem 0.6rem;
}
.pp-wallet .pp-inv li {
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.15rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  color: #d5deea;
}
.pp-wallet .pp-inv .k { color: var(--muted); }
.pp-wallet .pp-inv .v { font-weight: 600; color: #eaf0f8; }

/* —— Agency: 意圖 / 心靈 / 記憶 —— */
.pp-agency,
.pp-psyche,
.pp-memory {
  margin-top: 0.85rem;
  padding: 0.65rem 0.7rem 0.55rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.16);
}
.pp-agency {
  border-left: 3px solid rgba(126, 200, 255, 0.55);
}
.pp-psyche {
  border-left: 3px solid rgba(212, 168, 240, 0.55);
}
.pp-memory {
  border-left: 3px solid rgba(201, 168, 108, 0.55);
}
.pp-agency h3,
.pp-psyche h3,
.pp-memory h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  font-weight: 600;
}
.pp-psyche h3 { color: #d4a8f0; }
.pp-agency h3 { color: #9ec8ff; }
.pp-memory h3 { color: #d4b87a; }

/* Intent quote */
.pp-quote {
  margin: 0 0 0.5rem;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: rgba(126, 200, 255, 0.08);
  border: 1px solid rgba(126, 200, 255, 0.14);
  font-size: 0.9rem;
  line-height: 1.55;
  color: #eef4fc;
  font-weight: 500;
  word-break: break-word;
}
.pp-quote.empty {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

/* Chips */
.pp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.45rem;
}
.pp-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.06);
  color: #c8d6e8;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pp-chip.act {
  background: rgba(126, 200, 255, 0.12);
  border-color: rgba(126, 200, 255, 0.28);
  color: #b8dcff;
}
.pp-chip.src {
  background: rgba(255, 255, 255, 0.05);
  color: #a8b8cc;
}
.pp-chip.src-psyche {
  background: rgba(212, 168, 240, 0.14);
  border-color: rgba(212, 168, 240, 0.3);
  color: #e0c4f5;
}
.pp-chip.src-body {
  background: rgba(125, 222, 168, 0.12);
  border-color: rgba(125, 222, 168, 0.28);
  color: #a8e8c4;
}
.pp-chip.blocked {
  background: rgba(232, 138, 146, 0.14);
  border-color: rgba(232, 138, 146, 0.35);
  color: #f0b0b6;
}
.pp-chip.sticky {
  background: rgba(201, 168, 108, 0.16);
  border-color: rgba(201, 168, 108, 0.35);
  color: #e0c890;
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
}

/* Labeled fields */
.pp-field {
  display: grid;
  grid-template-columns: 4.2em 1fr;
  gap: 0.2rem 0.45rem;
  align-items: start;
  margin: 0.28rem 0;
  font-size: 0.8rem;
  line-height: 1.5;
}
.pp-field-k {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding-top: 0.12rem;
  flex-shrink: 0;
}
.pp-field-v {
  color: #dce6f4;
  word-break: break-word;
}
.pp-field.pp-note .pp-field-v {
  color: #c0c8d8;
  font-size: 0.78rem;
}

.pp-subhead {
  margin: 0.55rem 0 0.28rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

/* Goals */
.pp-goals,
.pp-mem {
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
}
.pp-goals li {
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.4rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #d5deea;
}
.pp-goals li:first-child { border-top: none; padding-top: 0.15rem; }
.pp-goal-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.4rem;
}
.pp-goal-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  color: #e8eef8;
}
.pp-goal-pct {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.pp-goal-bar {
  margin-top: 0.28rem;
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.pp-goal-bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4a7ab0, #7ec8ff);
}

/* Psyche identity + reflection */
.pp-identity {
  margin: 0 0 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.45;
  color: #f0e8fa;
  letter-spacing: 0.02em;
}
.pp-reflection {
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: rgba(212, 168, 240, 0.06);
  border: 1px solid rgba(212, 168, 240, 0.12);
  font-size: 0.78rem;
  line-height: 1.55;
  color: #c8b8d8;
  word-break: break-word;
}
.pp-inner {
  margin: 0 0 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.pp-felt {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #e4d4f4;
  word-break: break-word;
}
.pp-callout {
  display: grid;
  grid-template-columns: 2.6em 1fr;
  gap: 0.2rem 0.4rem;
  margin: 0.35rem 0;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.45;
}
.pp-callout.dual {
  background: rgba(201, 168, 108, 0.08);
  border: 1px solid rgba(201, 168, 108, 0.18);
}
.pp-callout.pull {
  background: rgba(232, 138, 146, 0.07);
  border: 1px solid rgba(232, 138, 146, 0.16);
}
.pp-callout-k {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding-top: 0.1rem;
}
.pp-callout-v {
  color: #e8e0d0;
  word-break: break-word;
}
.pp-callout.pull .pp-callout-v { color: #f0d0d4; }
.pp-meta-line {
  margin: 0.4rem 0 0.3rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
}

/* Care / fear tags */
.pp-care-fear { margin: 0.4rem 0 0.2rem; }
.pp-cf-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0.28rem 0;
}
.pp-cf-k {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding-top: 0.22rem;
  min-width: 2.2em;
}
.pp-cf-k.care { color: #8fd0a0; }
.pp-cf-k.fear { color: #e8a0a0; }
.pp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.pp-tag {
  display: inline-block;
  padding: 0.14rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.06);
  color: #c8d4e4;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.pp-tag.care {
  background: rgba(125, 222, 168, 0.1);
  border-color: rgba(125, 222, 168, 0.22);
  color: #b0e8c4;
}
.pp-tag.fear {
  background: rgba(232, 138, 146, 0.1);
  border-color: rgba(232, 138, 146, 0.22);
  color: #f0b8bc;
}
.pp-tag.sense {
  background: rgba(212, 168, 240, 0.1);
  border-color: rgba(212, 168, 240, 0.2);
  color: #dcc4f0;
  font-size: 0.68rem;
}

/* Motive mini bars */
.pp-motives {
  margin: 0.45rem 0 0.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.pp-motive-row {
  display: grid;
  grid-template-columns: 3.2em 1fr 1.8em;
  gap: 0.3rem;
  align-items: center;
  font-size: 0.7rem;
}
.pp-motive-k { color: var(--muted); }
.pp-motive-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.pp-motive-bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #6a5a90, #d4a8f0);
}
.pp-motive-v {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #a8a0b8;
}

/* Memory cards */
.pp-mem {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.pp-mem-item {
  padding: 0.45rem 0.5rem;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.pp-mem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.pp-mem-kind {
  display: inline-block;
  padding: 0.08rem 0.4rem;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(201, 168, 108, 0.14);
  color: #d4b87a;
  border: 1px solid rgba(201, 168, 108, 0.22);
}
.pp-mem-kind.kind-social {
  background: rgba(125, 222, 168, 0.12);
  border-color: rgba(125, 222, 168, 0.25);
  color: #8fd0a0;
}
.pp-mem-kind.kind-why {
  background: rgba(212, 168, 240, 0.12);
  border-color: rgba(212, 168, 240, 0.25);
  color: #d4a8f0;
}
.pp-mem-kind.kind-will {
  background: rgba(126, 200, 255, 0.12);
  border-color: rgba(126, 200, 255, 0.25);
  color: #9ec8ff;
}
.pp-mem-kind.kind-dream {
  background: rgba(150, 140, 220, 0.14);
  border-color: rgba(150, 140, 220, 0.28);
  color: #b8b0e8;
}
.pp-mem-kind.kind-dual {
  background: rgba(201, 168, 108, 0.14);
  border-color: rgba(201, 168, 108, 0.28);
  color: #e0c890;
}
.pp-mem-time {
  font-size: 0.65rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pp-mem-text {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #d5deea;
  word-break: break-word;
}

/* Wallet / injury shared field lines */
.pp-want,
.pp-self {
  margin: 0.35rem 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #e8eef8;
}
.pp-want .k,
.pp-self .k {
  color: var(--muted);
  margin-right: 0.35rem;
  font-size: 0.78rem;
}
.pp-rel-summary {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: #c8d6e8;
  line-height: 1.45;
}
.pp-rel-empty {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.35rem 0;
}
.pp-rel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.pp-rel-row {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.4rem;
  align-items: center;
  font-size: 0.74rem;
}
.pp-rel-row .rel-dot {
  width: 10px; height: 10px; border-radius: 50%;
  grid-row: 1;
}
.pp-rel-row .rel-name { font-weight: 600; color: #e8eef6; }
.pp-rel-row .rel-label { color: var(--muted); font-size: 0.68rem; }
.pp-rel-row .rel-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  min-width: 2.4em;
  text-align: right;
  color: var(--muted);
}
.pp-rel-row .rel-score.pos { color: #7ddea8; }
.pp-rel-row .rel-score.neg { color: #e8a0a0; }
.pp-rel-row .rel-why,
.pp-rel-row .rel-changes {
  grid-column: 1 / -1;
  margin: 0.05rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--muted);
}
.pp-rel-row .rel-why {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.45rem;
}
.pp-rel-row .rel-changes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}
.pp-rel-row .rel-change {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
}
.pp-rel-row .rel-trend {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 3.2em;
}
.pp-rel-row .rel-trend.up { color: #7ddea8; }
.pp-rel-row .rel-trend.down { color: #e8a0a0; }
.pp-rel-row .rel-trend.flat { color: #9aa8b8; }
.pp-rel-row .rel-why-text {
  color: #b8c4d4;
  word-break: break-word;
  flex: 1 1 8rem;
}
.pp-rel-row .rel-when {
  font-size: 0.6rem;
  color: #7a8798;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.rel-bar {
  grid-column: 1 / -1;
  position: relative;
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.rel-bar .mid {
  position: absolute;
  left: 50%;
  top: 0; bottom: 0;
  width: 1px;
  background: rgba(255,255,255,0.22);
}
.rel-bar .fill {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 99px;
}
.rel-bar .fill.pos {
  background: linear-gradient(90deg, #4a8f6a, #7ddea8);
}
.rel-bar .fill.neg {
  background: linear-gradient(270deg, #8a5050, #e8a0a0);
}
.pp-rel-note {
  margin: 0.45rem 0 0;
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.85;
  line-height: 1.4;
}
.pp-know-boost {
  margin-top: 0.55rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.pp-know-boost h3 {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--accent-2);
}
.pp-boost-reasons li {
  font-size: 0.72rem;
  line-height: 1.45;
  margin: 0.2rem 0;
}
.skill-tag {
  display: inline-block;
  margin: 0.1rem 0.25rem 0.1rem 0;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(126, 200, 255, 0.12);
  border: 1px solid rgba(126, 200, 255, 0.28);
  color: var(--accent);
}
.know-boost-wrap {
  margin-top: 0.5rem;
}
.know-boost-wrap .pp-know-boost {
  border-top: none;
  margin-top: 0;
  padding: 0.4rem 0 0;
}
.person-sheet-backdrop {
  display: none;
}

/* —— Diaries / Changelog (vault) —— */
.block-diaries .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.block-diaries .panel-head-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.vault-tabs {
  display: flex;
  gap: 0.3rem;
  margin: 0.35rem 0 0.45rem;
  padding: 0.2rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.vault-tab {
  flex: 1;
  min-height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease, color 0.15s ease;
}
.vault-tab:hover {
  color: #e8eef6;
  background: rgba(255, 255, 255, 0.05);
}
.vault-tab.active {
  background: rgba(126, 200, 255, 0.14);
  color: #c8e4ff;
  box-shadow: inset 0 0 0 1px rgba(126, 200, 255, 0.28);
}
.vault-tab[data-vault-tab="changelog"].active {
  background: rgba(201, 168, 108, 0.16);
  color: #e8d4a0;
  box-shadow: inset 0 0 0 1px rgba(201, 168, 108, 0.32);
}
.diary-flag.cl-n {
  background: rgba(201, 168, 108, 0.14);
  border-color: rgba(201, 168, 108, 0.28);
  color: #e0c890;
}
.diary-list li.cl-item .d-meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.changelog-tabs.hidden,
.changelog-form.hidden,
.diary-body.hidden {
  display: none !important;
}
.changelog-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  max-height: min(48vh, 420px);
  overflow-y: auto;
}
.changelog-form .cl-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.changelog-form input,
.changelog-form textarea {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 18, 28, 0.9);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.7rem;
  line-height: 1.4;
}
.changelog-form textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}
.changelog-form input:focus,
.changelog-form textarea:focus {
  outline: none;
  border-color: rgba(201, 168, 108, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 168, 108, 0.15);
}
.changelog-form .cl-hint {
  margin: 0;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.4;
}
.changelog-form .cl-hint code {
  font-size: 0.65rem;
  color: #d4b87a;
}
.changelog-form .cl-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.changelog-form .cl-status {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.75rem;
  color: #8fd0a0;
}
.changelog-form .cl-status.err {
  color: var(--danger);
}
.diary-modal.mode-changelog .diary-tabs#diary-tabs {
  display: none;
}
.diary-modal.mode-diary .changelog-tabs {
  display: none !important;
}
.diary-tab[data-cl-tab].active {
  background: rgba(201, 168, 108, 0.18);
  color: #e8d4a0;
  border-color: rgba(201, 168, 108, 0.35);
}

.btn-sm {
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
}
.diary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(240px, 32vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 200, 255, 0.25) transparent;
}
.diary-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.48rem 0.55rem;
  margin-bottom: 0.3rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.diary-list li:hover,
.diary-list li:focus-visible {
  border-color: rgba(126, 200, 255, 0.4);
  background: rgba(30, 48, 72, 0.45);
  outline: none;
}
.diary-list li.empty {
  cursor: default;
  color: var(--muted);
  justify-content: center;
  text-align: center;
  border-style: dashed;
  font-size: 0.78rem;
}
.diary-list .d-date {
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text);
}
.diary-list .d-meta {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.12rem;
}
.diary-list .d-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: flex-end;
  flex-shrink: 0;
}
.diary-flag {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 5px;
  padding: 0.1rem 0.35rem;
  border: 1px solid transparent;
}
.diary-flag.kuro {
  color: #f0c4d8;
  background: rgba(120, 50, 80, 0.4);
  border-color: rgba(232, 160, 191, 0.3);
}
.diary-flag.sys {
  color: #b8d4f0;
  background: rgba(40, 70, 110, 0.45);
  border-color: rgba(126, 200, 255, 0.28);
}
.diary-flag.miss {
  color: var(--muted);
  background: rgba(40, 40, 50, 0.5);
  border-color: rgba(255, 255, 255, 0.06);
  font-weight: 500;
}

.diary-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 8, 14, 0.62);
  backdrop-filter: blur(4px);
}
body.diary-open .diary-backdrop {
  display: block;
}
.diary-modal {
  position: fixed;
  z-index: 90;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100vw - 1.5rem));
  height: min(84vh, 860px);
  max-height: calc(100dvh - 1.5rem);
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(18, 28, 42, 0.97), rgba(12, 18, 28, 0.98));
  border: 1px solid rgba(126, 200, 255, 0.22);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.diary-modal.hidden {
  display: none;
}
.diary-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem 0.65rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.diary-modal-titles h2 {
  margin: 0;
  font-size: 1.15rem;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.03em;
}
.diary-sub {
  margin: 0.25rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}
.diary-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.55rem 1rem 0.45rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.diary-tab {
  background: rgba(20, 28, 42, 0.8);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  font-size: 0.76rem;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.diary-tab:hover {
  color: var(--text);
  border-color: rgba(126, 200, 255, 0.35);
}
.diary-tab.active {
  color: var(--text);
  font-weight: 600;
  background: rgba(50, 80, 120, 0.5);
  border-color: rgba(126, 200, 255, 0.45);
}
.diary-tab[data-diary-tab="kurokawa"].active {
  background: rgba(90, 40, 70, 0.5);
  border-color: rgba(232, 160, 191, 0.45);
  color: #f5d0e0;
}
.diary-tab[data-diary-tab="system"].active {
  background: rgba(30, 60, 100, 0.55);
  border-color: rgba(126, 200, 255, 0.45);
}
.diary-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.9rem 1.15rem 1.25rem;
  font-size: 0.88rem;
  line-height: 1.65;
  color: #dce6f2;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 200, 255, 0.3) transparent;
}
.diary-body .md-h1,
.diary-body .md-h2,
.diary-body .md-h3 {
  font-family: var(--display);
  color: var(--accent);
  margin: 1rem 0 0.45rem;
  font-weight: 600;
  line-height: 1.3;
}
.diary-body .md-h1 { font-size: 1.15rem; }
.diary-body .md-h2 { font-size: 1.02rem; color: #c9a86c; }
.diary-body .md-h3 { font-size: 0.92rem; color: #b8c8dc; }
.diary-body p {
  margin: 0 0 0.7rem;
}
.diary-body .md-li {
  margin: 0 0 0.25rem 0.15rem;
  padding-left: 0.85rem;
  position: relative;
}
.diary-body .md-li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent-2);
}
.diary-body .md-table-wrap {
  overflow-x: auto;
  margin: 0.5rem 0 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.diary-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.78rem;
  min-width: 280px;
}
.diary-body th,
.diary-body td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.diary-body th {
  background: rgba(40, 60, 90, 0.4);
  color: var(--accent);
  font-weight: 600;
}
.diary-body td {
  background: rgba(0, 0, 0, 0.15);
}
.diary-body .md-hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0.9rem 0;
}
.diary-body .md-quote {
  margin: 0.4rem 0 0.75rem;
  padding: 0.4rem 0.7rem;
  border-left: 3px solid rgba(201, 168, 108, 0.55);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 8px 8px 0;
}
.diary-body .placeholder-note {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 2rem 1rem;
}
.diary-body strong { color: #f0f4fa; font-weight: 600; }
.diary-body em { color: #c5d0e0; }
.diary-body code {
  font-size: 0.82em;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.08rem 0.3rem;
  border-radius: 4px;
}
body.diary-open {
  overflow: hidden;
}

footer {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.65rem 1.5rem;
  padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.72rem;
  background: rgba(6, 10, 16, 0.6);
}

/* —— Mobile / tablet —— */
@media (max-width: 980px) {
  .top {
    padding: 0.75rem 0.9rem 0.7rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
    gap: 0.65rem;
  }
  .brand { gap: 0.55rem; }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 1.05rem; }
  .top h1 { font-size: 1.28rem; letter-spacing: 0.04em; }
  .tagline { font-size: 0.72rem; line-height: 1.35; }
  .clock-card {
    min-width: 0;
    width: 100%;
    text-align: left;
    padding: 0.55rem 0.75rem;
  }
  .clock-card .clock-main { font-size: 1.1rem; }
  .goals-strip { padding: 0.45rem 0.9rem 0.6rem; }
  .goal-chip { min-width: calc(50% - 0.4rem); max-width: none; }

  /*
   * Avoid display:contents (iOS Safari often breaks flex order / width).
   * Stack: col-main (map + life) then side (host + people + stats).
   */
  .layout {
    display: flex;
    flex-direction: column;
    padding: 0.7rem 0.7rem 1rem;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .col-main {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    order: 1;
  }
  .side {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    order: 2;
  }

  .map-panel {
    padding: 0.7rem 0.7rem 0.8rem;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    overflow: visible;
  }
  .map-panel .panel-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.4rem 0.5rem;
  }
  .map-panel .panel-head h2 {
    flex: 0 0 auto;
  }
  .map-toolbar {
    flex: 1 1 100%;
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
  }
  .map-zoom {
    flex: 0 0 auto;
  }
  #map-phase.chip {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.65rem;
  }
  .map-wrap {
    width: 100%;
    max-width: 100%;
    /* keep pan/zoom inside box; don't blow page width */
    height: min(42vh, 340px);
    max-height: min(42vh, 340px);
    min-height: 180px;
  }
  #map {
    max-width: none; /* allow zoom scroll inside wrap */
  }

  .card {
    padding: 0.75rem 0.8rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .block-people,
  .block-life,
  .block-host,
  .block-diaries,
  .block-stats {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .diary-modal {
    left: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    height: min(88dvh, 920px);
    max-height: 88dvh;
    border-radius: 16px 16px 0 0;
    animation: sheet-up 0.22s ease-out;
  }
  .diary-list {
    max-height: min(200px, 28vh);
  }

  .life-panel {
    min-height: 0;
    max-height: none;
    height: auto;
  }
  .life-log {
    max-height: min(360px, 46vh);
  }
  .life-days {
    margin-bottom: 0.4rem;
  }

  .vlist {
    max-width: 100%;
  }
  .vlist li {
    max-width: 100%;
  }
  .stats-row {
    width: 100%;
    min-width: 0;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
  }
  .actions .btn {
    width: 100%;
    justify-content: center;
    text-align: center;
    padding: 0.62rem 0.5rem;
    font-size: 0.84rem;
  }
  .actions .btn-primary { grid-column: 1 / -1; }
  .filters .filter {
    min-height: 36px;
    padding: 0.35rem 0.75rem;
  }
  .hint { font-size: 0.7rem; }
  footer {
    padding: 0.55rem 0.85rem;
    padding-bottom: max(0.55rem, env(safe-area-inset-bottom));
    font-size: 0.68rem;
  }
}

@media (max-width: 720px) {
  .person-panel .pp-cols { grid-template-columns: 1fr 1fr; }
  .person-panel .pp-close { display: block; }

  /* Bottom sheet for person status */
  .person-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(4, 8, 14, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  body.person-open .person-sheet-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  body.person-open {
    overflow: hidden;
  }
  /* Must be under body (JS reparent) so fixed is viewport-relative —
     .glass backdrop-filter would otherwise pin this inside the card. */
  .person-panel:not(.hidden) {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 50;
    margin: 0;
    border-radius: 18px 18px 0 0;
    max-height: min(72vh, 560px);
    max-height: min(72dvh, 560px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 0.95rem 1rem calc(0.95rem + env(safe-area-inset-bottom));
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(126, 200, 255, 0.28);
    border-bottom: none;
    background: linear-gradient(160deg, rgba(24, 36, 56, 0.98), rgba(14, 20, 32, 0.97));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: sheet-up 0.22s ease-out;
    /* avoid transform on self during open if possible — keep animation ok */
  }
  .person-panel:not(.hidden)::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 auto 0.7rem;
  }
}

@media (max-width: 420px) {
  .person-panel .pp-cols { grid-template-columns: 1fr; }
  .top h1 { font-size: 1.12rem; }
  .tagline { display: none; }
  .actions {
    grid-template-columns: 1fr;
  }
  .actions .btn-primary { grid-column: auto; }
  .stats-row { flex-direction: column; }
  .glow-a, .glow-b { opacity: 0.28; }
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes sheet-left {
  from { transform: translateX(-18px); opacity: 0.55; }
  to { transform: translateX(0); opacity: 1; }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .person-panel:not(.hidden) { animation: none; }
  .btn { transition: none; }
}

/* ── 入場帳號面板 ── */
.player-panel {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(126, 180, 220, 0.14);
}
.player-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}
.player-panel-head h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(200, 220, 240, 0.92);
}
.player-panel-meta {
  font-size: 0.68rem;
  opacity: 0.65;
}
.player-status {
  margin: 0.15rem 0 0.4rem;
  font-size: 0.74rem;
  line-height: 1.45;
  color: rgba(210, 225, 240, 0.88);
  min-height: 1.4em;
}
.player-account-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}
.player-account-label {
  font-size: 0.7rem;
  opacity: 0.75;
  white-space: nowrap;
}
.player-account-select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.78rem;
  padding: 0.28rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(126, 180, 220, 0.28);
  background: rgba(12, 20, 32, 0.72);
  color: rgba(230, 238, 248, 0.95);
}
.player-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
}
.player-actions .btn-sm {
  font-size: 0.72rem;
  padding: 0.28rem 0.4rem;
}

/* ── 入場行程 modal ── */
.player-sched-modal {
  max-width: min(920px, 96vw);
  max-height: min(92vh, 900px);
  display: flex;
  flex-direction: column;
}
.player-sched-modal.hidden {
  display: none;
}
.player-sched-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem 0.35rem;
  border-bottom: 1px solid rgba(126, 180, 220, 0.12);
}
.player-sched-fill-lab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.player-sched-fill-lab select {
  min-width: 8.2rem;
  padding: 0.22rem 0.4rem;
  border-radius: 8px;
  border: 1px solid rgba(126, 200, 255, 0.22);
  background: rgba(12, 20, 32, 0.85);
  color: #f2efe6;
  font-size: 0.82rem;
}
.player-sched-hint {
  font-size: 0.68rem;
  opacity: 0.7;
  flex: 1;
  min-width: 10rem;
}
.player-sched-table tr.is-next td {
  position: sticky;
  top: 1.55rem;
  z-index: 2;
  background: rgba(22, 38, 58, 0.96);
}
.player-sched-table tr.is-next {
  box-shadow: inset 3px 0 0 rgba(110, 180, 230, 0.85);
}
.player-sched-table .col-hour {
  width: 2.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.player-sched-table tr.is-night .col-hour {
  color: rgba(160, 190, 240, 0.95);
}
.player-sched-table tr.is-sleep-hour {
  background: rgba(40, 55, 90, 0.18);
}
.player-sched-body {
  flex: 1;
  overflow: auto;
  padding: 0.5rem 0.75rem 0.75rem;
  max-height: min(62vh, 560px);
}
.player-sched-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem 0.75rem;
  border-top: 1px solid rgba(126, 180, 220, 0.12);
}
.player-sched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.player-sched-table th,
.player-sched-table td {
  padding: 0.28rem 0.22rem;
  border-bottom: 1px solid rgba(100, 130, 160, 0.12);
  vertical-align: top;
  text-align: left;
}
.player-sched-table th {
  position: sticky;
  top: 0;
  background: rgba(14, 22, 36, 0.96);
  z-index: 1;
  font-weight: 600;
  opacity: 0.85;
}
.player-sched-table tr.is-current {
  background: rgba(80, 140, 200, 0.12);
}
.player-sched-table select,
.player-sched-table input,
.player-sched-table textarea {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.28rem;
  border-radius: 4px;
  border: 1px solid rgba(126, 180, 220, 0.25);
  background: rgba(10, 16, 28, 0.85);
  color: rgba(230, 238, 248, 0.95);
  box-sizing: border-box;
}
.player-sched-table textarea {
  min-height: 2.2rem;
  resize: vertical;
}
.player-sched-table .col-i {
  width: 1.6rem;
  opacity: 0.7;
  text-align: center;
}
.ps-when {
  display: block;
  font-size: 0.68rem;
  color: #e8b07a;
  margin-top: 0.15rem;
}
.player-sched-speech {
  display: grid;
  gap: 0.2rem;
  min-width: 9rem;
}
@media (max-width: 720px) {
  .player-sched-table thead {
    display: none;
  }
  .player-sched-table,
  .player-sched-table tbody,
  .player-sched-table tr,
  .player-sched-table td {
    display: block;
    width: 100%;
  }
  .player-sched-table tr {
    margin-bottom: 0.55rem;
    padding: 0.4rem;
    border: 1px solid rgba(126, 180, 220, 0.14);
    border-radius: 8px;
  }
  .player-sched-table td {
    border: none;
    padding: 0.15rem 0;
  }
  .player-sched-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.62rem;
    opacity: 0.6;
    margin-bottom: 0.1rem;
  }
  .player-actions {
    grid-template-columns: 1fr 1fr;
  }
}
