/* The Nest: layout and interaction layer. Artwork lives in style.css. */
:root { --view-height:100dvh; --view-top:0px; --view-bottom:0px; --dock-height:56px; --header-height:72px; }
html, body { height:100%; overflow:hidden; overscroll-behavior:none; }
html { background:#898d91 url('/assets/images/pure_harbor_bg.jpg?v=final_pure') center 26% / cover no-repeat !important; }
body { position:relative; isolation:isolate; min-height:0 !important; }
/* Installed iOS apps can resolve percentages against a status-bar-shortened
   containing block. Size the root canvas itself, not just its background. */
@media(display-mode:standalone) {
  html,body.nest-app-body,body.pure-sanctuary-body,body.dedicated-chat-body {
    height:100lvh !important; min-height:100lvh !important; max-height:100lvh !important;
  }
}
button,input,textarea { font:inherit; }
button,a,label[for] { touch-action:manipulation; }
button { cursor:pointer; }
button:disabled { opacity:.5; cursor:wait; }
:focus-visible { outline:2px solid #ac8c57; outline-offset:4px; }
input:focus-visible,textarea:focus-visible { outline:none; }
.input-dock-crystal:focus-within { border-color:#fff !important; box-shadow:0 0 0 2px #ffffff38,0 5px 24px #f9eee02e !important; background:rgba(255,255,255,.78); }
textarea { resize:none; }
* { scrollbar-width:thin; scrollbar-color:#b7a58b80 transparent; }
*::-webkit-scrollbar { width:4px; height:4px; }
*::-webkit-scrollbar-track { background:transparent; }
*::-webkit-scrollbar-thumb { background:#b7a58b80; border-radius:8px; }
*::-webkit-scrollbar-button { display:none; }
.ambient-bg,.ambient-overlay { top:0; bottom:auto; height:100lvh; min-height:100%; }
.ambient-overlay { backdrop-filter:none; -webkit-backdrop-filter:none; }
.ambient-bg { background-position:center 26%; }
.pure-sanctuary-viewport {
  position:absolute; left:0; right:0; margin-inline:auto; top:var(--view-top); height:var(--view-height); max-height:var(--view-height);
  width:100%; max-width:480px; padding: max(8px,var(--safe-top)) 20px calc(var(--dock-height) + max(12px,var(--safe-bottom)) + 12px);
  display:grid; grid-template-rows:auto minmax(0,1fr); align-items:stretch; gap:12px; overflow:hidden;
}
.pure-header-crest { z-index:10; }
.brand-crest-wrap { max-width:370px; }
.floral-crest-img { width:100%; max-width:370px; max-height:clamp(112px,23dvh,190px); object-fit:contain; }
.pure-status-capsule { min-height:38px; padding:0 8px 0 14px; margin:0; font-size:12px; }
.status-wardrobe-trigger { width:38px; height:36px; padding:8px; }
.status-wreath-icon { width:19px; height:19px; }
#diamond-pulse::before { width:30px; }
#diamond-pulse { outline-offset:14px; }
.pure-sanctuary-viewport > .pure-cards-section {
  display:grid; grid-template-rows:auto minmax(0,1fr) auto auto; align-content:stretch;
  align-items:stretch; align-self:stretch; justify-content:stretch; gap:12px; width:100%; height:100%; max-width:none; min-height:0;
}
.pure-sanctuary-viewport #welcome-thought-floater { margin:0 4px !important; min-height:18px; font-size:11px !important; }
#nest-carousel-viewport { display:block; min-height:0; height:100%; max-width:none; padding:2px 0 12px; overflow:hidden; scroll-snap-type:none; }
.nest-carousel-track { height:100%; }
.carousel-panel { height:100%; min-width:0; padding:0 1px; }
.card-flip-container,.card-flip-inner { height:100%; }
.card-flip-inner { transition:transform .48s cubic-bezier(.22,.75,.25,1); }
.pure-sanctuary-viewport #dialogue-flow,.pure-sanctuary-viewport #welcome-row { height:100%; max-width:none !important; }
.pure-sanctuary-viewport #welcome-card { height:100%; max-width:none !important; min-height:0; }
.pure-sanctuary-viewport .sanctuary-main-card { max-width:none; border-radius:28px; padding:20px; }
.pure-sanctuary-viewport .card-header-row { flex-wrap:wrap; gap:6px; flex-shrink:0; }
.pure-sanctuary-viewport .title-text { font-size:21px; letter-spacing:.2px; }
.card-header-actions-right { margin-left:auto; gap:2px; }
.candle-icon-btn { width:32px; height:36px; flex-shrink:0; }
.draw-memo-trigger-btn { min-height:34px; padding:5px 10px; box-shadow:0 2px 8px #b9a18418; }
.card-body-text { font-size:15px; line-height:1.85; overflow-wrap:anywhere; }
.markdown-body p + p { margin-top:.85em; }
.markdown-body pre { white-space:pre-wrap; overflow-wrap:anywhere; padding:12px; border-radius:12px; background:#ffffff60; }
.markdown-body img { max-width:100%; height:auto; border-radius:12px; }
.markdown-body ul,.markdown-body ol { padding-left:1.3em; }
.markdown-body table { display:block; overflow-x:auto; max-width:100%; }
#welcome-content { flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; margin:4px 0 12px; padding-right:3px; }
.card-footer-meta { flex-shrink:0; font-size:11px; opacity:.8; }
.card-back { background:linear-gradient(145deg,#fffcf4ed,#f7f3eeeb) !important; max-height:100%; }
.memo-body-container { min-height:0; overflow-y:auto; padding:16px 0; }
.memo-content-text { text-align:left; }
.memo-footer-actions { flex-wrap:wrap; gap:8px; flex-shrink:0; }
.draw-again-pill-btn { min-height:40px; }
.flip-back-btn { width:36px; height:36px; flex-shrink:0; }
.card-front { pointer-events:auto; }
.card-back { pointer-events:none; }
.is-flipped .card-front { pointer-events:none; }
.is-flipped .card-back { pointer-events:auto; }
.desk-segment-capsule { position:relative; display:flex; gap:0; width:100%; max-width:none; padding:4px; min-height:46px; margin:0 auto; background:#fff9; border:1px solid #ffffffd9; border-radius:24px; }
#nest-carousel-viewport { touch-action:pan-y pinch-zoom; }
#nest-carousel-viewport button { touch-action:pan-y pinch-zoom; }
#nest-carousel-viewport img { -webkit-user-drag:none; user-select:none; }
.capsule-sliding-pill { position:absolute; left:4px; top:4px; bottom:4px; width:calc((100% - 8px)/4); height:auto; border-radius:20px; background:linear-gradient(120deg,#e9d9b9,#d2bb91); box-shadow:0 2px 8px #9d81552b; transition:transform .35s ease; }
.desk-segment-capsule .segment-tab-btn { position:relative; z-index:1; display:flex; align-items:center; justify-content:center; gap:6px; flex:1; width:auto; min-width:0; height:36px; border:0; border-radius:20px; background:none; box-shadow:none; font-family:var(--font-serif); font-size:12px; color:#796951; }
.desk-segment-capsule .segment-tab-btn.active { width:auto; background:none; box-shadow:none; color:#4e3c26; }
.tab-icon img { width:13px; height:13px; display:block; }
.door-to-chat-btn { width:100%; max-width:none; margin:0; min-height:66px; padding:12px 18px; border-radius:23px; flex-shrink:0; }
.door-title { font-size:16px; }
.door-desc { font-size:10px; margin-top:4px; }
.door-arrow-pill { width:32px; height:32px; }
.pure-sanctuary-viewport .live-typing-pill { position:absolute; bottom:calc(var(--dock-height) + 18px); left:50%; transform:translateX(-50%); z-index:20; width:max-content; max-width:90%; }
.polaroid-stack-card,.whisper-bottle-card { height:100%; min-height:0; }
#polaroid-card,#whispers-card { height:100%; min-height:0; }
.polaroid-photo-frame { flex:1; min-height:0; overflow:auto; background:#fffcf6; border-radius:12px; padding:10px; }
.polaroid-img { height:clamp(120px,23dvh,230px); object-fit:cover; }
.polaroid-photo-frame { display:flex; flex-direction:column; gap:10px; }
.polaroid-inner-wrap { width:100%; display:flex; flex:1; flex-direction:column; min-height:0; border:0; padding:0; background:none; text-align:left; color:inherit; }
.polaroid-inner-wrap .polaroid-img { flex:1; min-height:70px; height:0; width:100%; object-fit:cover; }
.photo-thumbnails { display:flex; flex-shrink:0; gap:8px; overflow-x:auto; padding:4px; touch-action:pan-x; }
.photo-thumbnails button { width:40px; height:40px; flex-shrink:0; border:2px solid transparent; border-radius:10px; overflow:hidden; padding:0; }
.photo-thumbnails button[aria-pressed="true"] { border-color:#b29865; }
.photo-thumbnails img { width:100%; height:100%; object-fit:cover; }
.polaroid-caption-row { flex-direction:column; align-items:flex-start; gap:4px; line-height:1.5; }
.whisper-bottle-body { flex:1; min-height:0; display:flex; flex-direction:column; gap:12px; }
#card-whispers-container { flex:1; min-height:0; overflow-y:auto; max-height:none; }
.whisper-quick-box { flex-shrink:0; display:flex; gap:8px; }
.whisper-quick-input { min-width:0; font-size:16px; }
.whisper-quick-send-btn { flex-shrink:0; min-height:40px; }
.input-dock-crystal { bottom:calc(var(--view-bottom) + max(12px,var(--safe-bottom))) !important; min-height:54px; padding:5px 8px 5px 16px; border-radius:28px; transition:box-shadow .2s; transform:none !important; }
.dock-input-capsule { min-width:0; gap:2px; align-items:flex-end; }
.dock-text-input { min-width:0; width:0; height:36px; min-height:36px; max-height:108px; padding:7px 0; font-size:16px; line-height:22px; overflow-y:auto; }
.dock-text-input::placeholder { font-size:14px; }
.dock-plane-btn { width:40px; height:40px; flex-shrink:0; }
.dock-media-btn { min-width:46px; min-height:40px; justify-content:center; padding:4px 6px; }
.dock-divider-glow { margin:0 5px; }
.media-text-label { font-family:var(--font-serif); font-size:12px; }
#chat-app { position:absolute !important; top:var(--view-top) !important; bottom:auto !important; height:var(--view-height) !important; max-height:var(--view-height) !important; min-height:0 !important; max-width:none; }
.dedicated-chat-header { top:var(--view-top) !important; min-height:0 !important; padding:max(6px,calc(var(--safe-top) - 6px)) 14px 4px !important; background:transparent !important; backdrop-filter:none !important; -webkit-backdrop-filter:none !important; border-bottom:none !important; box-shadow:none !important; }
.chat-back-pill { min-height:32px !important; padding:4px 11px !important; font-size:11.5px !important; background:rgba(255,255,255,0.72) !important; backdrop-filter:blur(16px) !important; -webkit-backdrop-filter:blur(16px) !important; border:1px solid rgba(255,255,255,0.9) !important; }
.chat-header-center { flex:0 1 auto !important; display:inline-flex !important; align-items:center !important; justify-content:center !important; gap:6px !important; background:rgba(255,255,255,0.68) !important; backdrop-filter:blur(16px) !important; -webkit-backdrop-filter:blur(16px) !important; border:1px solid rgba(255,255,255,0.88) !important; border-radius:999px !important; padding:3px 10px 3px 12px !important; box-shadow:0 2px 10px rgba(180,150,120,0.06) !important; }
.chat-action-icon-btn { width:32px !important; height:32px !important; background:rgba(255,255,255,0.72) !important; backdrop-filter:blur(16px) !important; -webkit-backdrop-filter:blur(16px) !important; border:1px solid rgba(255,255,255,0.9) !important; }
.chat-header-actions { gap:5px; }
.chat-room-title { font-size:12px !important; line-height:1.2 !important; }
.chat-room-subtitle { display:inline-flex !important; align-items:center !important; gap:4px !important; margin-top:0 !important; font-size:10px !important; line-height:1.2 !important; }
#chat-app .sanctuary-canvas { top:var(--header-height) !important; bottom:calc(var(--dock-height) + max(12px,var(--safe-bottom)) + 10px) !important; max-width:560px !important; display:block; padding:12px 16px 16px !important; overflow-y:auto !important; overscroll-behavior-y:contain; overflow-anchor:none; -webkit-mask-image:linear-gradient(to bottom, transparent 0px, #000 18px, #000 calc(100% - 16px), transparent 100%) !important; mask-image:linear-gradient(to bottom, transparent 0px, #000 18px, #000 calc(100% - 16px), transparent 100%) !important; }
#chat-app .dialogue-flow { gap:22px; }
#chat-app .dialogue-row { margin:0; gap:12px; flex-shrink:0; }
#chat-app .avatar-frame-wrap { width:36px; height:36px; min-width:36px; min-height:36px; }
#chat-app .sanctuary-main-card { max-width:none; padding:18px; border-radius:26px; }
#chat-app .thought-whisper-floater { color:#817667; white-space:normal !important; line-height:1.65; margin:0 0 10px !important; cursor:pointer; }
#chat-app .thought-whisper-floater .whisper-text { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; }
#chat-app .thought-whisper-floater.expanded .whisper-text { -webkit-line-clamp:unset; }
#chat-app .title-text { font-size:20px; }
#chat-app .li-bubble-card { max-width:calc(100% - 56px); padding:14px 16px; border-radius:22px 22px 6px 22px; }
#chat-app .li-bubble-text { white-space:pre-wrap; line-height:1.8; }
#chat-app .live-typing-pill { width:fit-content; margin:16px auto 0; }
.jump-latest { position:fixed; bottom:calc(var(--view-bottom) + var(--dock-height) + max(12px,var(--safe-bottom)) + 18px); left:50%; transform:translateX(-50%); z-index:260; border:1px solid #fff; border-radius:24px; padding:10px 18px; background:#fffcf2ed; color:#78644b; box-shadow:0 5px 20px #6c533329; font-size:12px; }
.jump-latest[hidden] { display:none; }
.crystal-modal-overlay { top:var(--view-top); bottom:auto; height:var(--view-height); min-height:0; padding:max(16px,var(--safe-top)) 16px max(16px,var(--safe-bottom)); background:#37334450; backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); }
.crystal-modal-card,.wardrobe-dialog-card,.candle-dialog-card { width:100%; max-width:420px; max-height:100%; overflow:auto; overscroll-behavior:contain; border-radius:30px; padding:24px; background:linear-gradient(145deg,#fffdf6e8,#eeeef3db); border:1px solid #fffffff2; box-shadow:0 24px 70px #51453529,inset 0 1px 0 #fff; }
.crystal-modal-overlay.active .crystal-modal-card,.crystal-modal-overlay.active .lightbox-card { animation:drawerEnter .28s ease-out; }
@keyframes drawerEnter { from { opacity:0; transform:translateY(18px) scale(.98); } to { opacity:1; transform:none; } }
.crystal-modal-title { font-size:21px; font-weight:500; color:#705c47; letter-spacing:1px; }
.crystal-modal-subtitle { font-family:var(--font-serif); font-size:11px; line-height:1.8; margin-top:6px; }
.wardrobe-dialog-card .crystal-modal-header::before { content:'The Dressing Room'; display:block; font:italic 16px 'Cormorant Garamond',serif; color:#a89070; margin-bottom:6px; }
.wardrobe-tabs { min-height:44px; padding:4px; margin-bottom:18px; background:#ddd1c72b; border:1px solid #ffffff8c; }
.wardrobe-tab-btn { padding:8px 6px; font-size:12px; }
.wardrobe-tab-btn.active { background:#fffaf1db; color:#775c3a; }
.wardrobe-avatar-preview-area { position:relative; padding:18px 10px 14px; background:radial-gradient(ellipse at 50% 20%,#fff9e3c7,#ffffff10 72%); border:0; border-bottom:1px solid #c3ab8533; border-radius:0; margin:0; }
.wardrobe-preview-frame-wrap { width:82px !important; height:82px !important; min-width:82px !important; min-height:82px !important; margin:6px 0 10px; }
.avatar-upload-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:center; }
.avatar-upload-btn-subtle { min-height:36px; display:inline-flex; align-items:center; padding:8px 12px; font-size:11px; background:#fff9; border:1px solid #c9b58e66; border-radius:20px; }
.frame-options-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:6px 0 14px; }
.frame-option-card { position:relative; flex-direction:column; justify-content:center; min-height:100px; gap:10px; padding:14px 6px 10px; border-radius:20px; background:#ffffff50; border:1px solid #ffffffb3; }
.frame-option-card.selected { background:linear-gradient(145deg,#fff9e4bf,#ffffff8c); box-shadow:inset 0 0 0 1px #c5a573,0 5px 16px #b8a27f17; }
.frame-option-card.selected::after { content:'✓'; position:absolute; right:8px; top:6px; color:#a68751; font-size:12px; }
.frame-option-card .frame-option-name { white-space:normal; text-align:center; font-size:11px; font-weight:400; line-height:1.5; }
.frame-thumb-wrap { width:40px !important; height:40px !important; min-width:40px !important; min-height:40px !important; }
.crystal-modal-footer { position:sticky; bottom:-24px; padding:12px 0 2px; gap:10px; margin-top:12px; flex-wrap:wrap; background:linear-gradient(0deg,#f6f3edf2,#f6f3ed00); }
.crystal-btn { min-height:42px; padding:10px 17px; font-size:12px; }
.crystal-btn-primary { background:linear-gradient(120deg,#ebd9b5,#ceb17d); box-shadow:0 4px 14px #b49a6b29; }
.crystal-btn-reset { border:1px solid #b99f8066; background:#fff7; color:#846952; }
.modal-note-input,.media-note-textarea { display:block; width:100%; min-height:110px; padding:14px; border:1px solid #c9b58e66; border-radius:18px; background:#ffffff70; color:#51463c; font-size:16px; line-height:1.7; }
.media-upload-dropzone,.media-upload-container { border:1px dashed #bda37a99; border-radius:20px; padding:18px; margin:14px 0; text-align:center; background:#ffffff50; }
.dropzone-content { display:flex; flex-direction:column; align-items:center; gap:9px; }
.dropzone-icon,.media-upload-icon { width:30px; height:30px; }
.dropzone-text,.media-upload-hint { font-size:13px; color:#806c53; }
.dropzone-sub { font-size:10px; color:#978877; }
.dropzone-preview,.media-preview-box { position:relative; }
.dropzone-preview img,.media-preview-img { max-width:100%; max-height:220px; border-radius:12px; }
.media-upload-trigger { display:flex; flex-direction:column; align-items:center; gap:10px; }
.lightbox-card { max-width:800px; width:100%; max-height:100%; position:relative; padding:18px; border:1px solid #fff9; border-radius:24px; background:#fff9; overflow:auto; }
.lightbox-img { display:block; max-width:100%; max-height:calc(var(--view-height) - 130px); margin:auto; object-fit:contain; border-radius:14px; }
.lightbox-close-btn,.remove-preview-btn { border:1px solid #d2c4b8; background:#fffdf3; color:#725e47; border-radius:50%; width:36px; height:36px; position:absolute; top:8px; right:8px; z-index:2; }
.lightbox-caption { margin:12px 0 0; font-size:12px; line-height:1.7; text-align:center; }
.drawer-list-body { display:flex; flex-direction:column; gap:14px; }
.drawer-whisper-item { padding:16px; background:#ffffff65; border:1px solid #fff9; border-radius:20px; }
.drawer-item-top { display:flex; justify-content:space-between; flex-wrap:wrap; gap:6px; margin-bottom:10px; font-size:10px; color:#99836a; }
.drawer-item-text { font-size:14px; line-height:1.85; overflow-wrap:anywhere; }
.drawer-item-img { display:block; max-width:100%; max-height:240px; margin-top:12px; border-radius:12px; cursor:zoom-in; }
.drawer-header-top { display:flex; justify-content:center; align-items:center; gap:8px; color:#bc9e73; }
.moment-glass-card + .moment-glass-card { margin-top:12px; }
.toast-container { position:fixed; bottom:calc(var(--view-bottom) + var(--dock-height) + 26px); left:50%; transform:translateX(-50%); width:max-content; max-width:90%; z-index:11000; pointer-events:none; }
.crystal-toast { background:#fffaf1ed; border:1px solid #fff; box-shadow:0 6px 24px #79634a26; color:#80694f; border-radius:24px; padding:12px 18px; font-size:12px; line-height:1.6; margin-top:8px; animation:drawerEnter .2s ease-out; }
.heartbeat-metrics-row[hidden] { display:none; }
.act-emoji img { width:24px; height:24px; }
.heartbeat-dialog-card { background:linear-gradient(145deg,#fffdf6e8,#eeeef3db); }
.heartbeat-message-bubble { min-height:96px; }
.hb-act-btn { min-height:74px; }
.heartbeat-message { line-height:1.85; }
.modal-open #input-dock { visibility:hidden; }
@media(max-width:360px) {
  .pure-sanctuary-viewport { padding-left:14px; padding-right:14px; }
  .pure-sanctuary-viewport .sanctuary-main-card { padding:16px; }
  .media-text-label { display:none; }
  .chat-back-pill span:not(.back-arrow) { display:none; }
  .chat-header-actions { gap:2px; }
  .crystal-modal-card { padding:20px; }
}
@media(max-height:740px) {
  .floral-crest-img { max-height:130px; }
  .pure-sanctuary-viewport { gap:8px; }
  .pure-sanctuary-viewport > .pure-cards-section { gap:8px; }
  .door-to-chat-btn { min-height:56px; padding:8px 16px; }
  .door-desc { display:none; }
}
@media(max-height:580px) {
  .floral-crest-img { max-height:70px; }
  #welcome-thought-floater { display:none !important; }
  .pure-sanctuary-viewport > .pure-cards-section { grid-template-rows:minmax(0,1fr) auto auto; }
}
/* The keyboard already occupies the home-indicator area. */
html[data-keyboard="true"] { --safe-bottom:0px; }
html[data-keyboard="true"] .pure-header-crest { display:none; }
html[data-keyboard="true"] .pure-sanctuary-viewport { grid-template-rows:minmax(0,1fr); padding-top:8px; }
.nest-touch-light { position:fixed; z-index:12000; pointer-events:none; width:84px; height:84px; border:1.5px solid #fff6dc; border-radius:50%; background:radial-gradient(circle,#fff8e466,#e6c59233 42%,transparent 70%); box-shadow:0 0 12px #fff8e48c,inset 0 0 8px #c5a36c66; }
button,a.door-to-chat-btn { transition:scale .24s cubic-bezier(.2,.85,.25,1.25),background-color .2s,box-shadow .2s; }
button.nest-pressed,a.door-to-chat-btn.nest-pressed { scale:.96; }
.crystal-modal-overlay { display:flex; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .26s ease,visibility .26s; }
.crystal-modal-overlay.active { opacity:1; visibility:visible; pointer-events:auto; }
.crystal-modal-card { transition:transform .32s cubic-bezier(.2,.85,.25,1); }
.crystal-modal-overlay:not(.active) .crystal-modal-card { transform:translateY(22px) scale(.975); }
.crystal-modal-overlay.active .crystal-modal-card { animation:none; transform:none; }
.frame-option-card { transition:scale .18s,background-color .2s,box-shadow .2s; }
.frame-option-card.selected { animation:nestSelection .4s ease-out; }
@keyframes nestSelection { from { box-shadow:inset 0 0 0 1px #c5a573,0 0 0 7px #dfca9c55; } to { box-shadow:inset 0 0 0 1px #c5a573,0 0 0 0 #dfca9c00; } }
.capsule-sliding-pill { transition:transform .3s cubic-bezier(.2,.8,.25,1); }
.dock-plane-btn.nest-pressed img { transform:translate(2px,-2px) rotate(-5deg); }
.dock-plane-btn img { transition:transform .22s ease; }
@media(hover:hover) and (pointer:fine) {
  .crystal-btn:hover,.draw-memo-trigger-btn:hover { box-shadow:0 3px 16px #cbb38345; }
}
@media(hover:none) {
  .polaroid-inner-wrap:hover { transform:none; }
}
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
