/* The Journey — Japanese Midori × Traveler's Notebook Stationery Stylesheet */

:root {
  --desk-bg: #DFD7C8;
  --desk-accent: #CFC5B2;
  --ui-surface: rgba(251, 247, 239, 0.94);
  --ui-surface-solid: #FAF6EE;
  --ui-border: rgba(116, 98, 76, 0.22);
  --ui-ink: #2E2821;
  --ui-muted: #766959;
  --avocado: #516141;
  --avocado-dark: #3B472E;
  --terracotta: #B84A39;
  --brass: #B68F48;
  --shadow-soft: 0 10px 30px rgba(42, 33, 22, 0.14);
  --shadow-book: 0 22px 52px rgba(34, 26, 17, 0.28), 0 6px 16px rgba(34, 26, 17, 0.16);
  --font-serif: 'Cormorant Garamond', 'Shippori Mincho', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-hand: 'Caveat', 'Bradley Hand', 'Segoe Print', cursive;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--ui-ink);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 252, 244, 0.45), transparent 52%),
    radial-gradient(circle at 82% 84%, rgba(162, 146, 118, 0.28), transparent 54%),
    repeating-linear-gradient(90deg, rgba(120, 102, 78, 0.028) 0 2px, transparent 2px 14px),
    var(--desk-bg);
  user-select: none;
  -webkit-user-select: none;
}

/* ==================== TOP BAR ==================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 10px;
  background: var(--ui-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ui-border);
  z-index: 60;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  padding: 6px 12px 6px 8px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ui-ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.brand-btn:hover {
  box-shadow: 0 4px 12px rgba(45, 36, 24, 0.1);
}

.cover-swatch-mini {
  width: 24px;
  height: 30px;
  border-radius: 4px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cover-swatch-mini::after {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  right: 5px;
  width: 2px;
  background: rgba(0, 0, 0, 0.35);
}

.brand-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.brand-app {
  font-size: 9px;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--ui-ink);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  color: var(--ui-ink);
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  background: #F4ECE0;
  border-color: rgba(116, 98, 76, 0.4);
}

.pill-btn.primary {
  background: var(--avocado);
  color: #FAF7F0;
  border-color: var(--avocado-dark);
}

.pill-btn.primary:hover {
  background: var(--avocado-dark);
}

.pill-btn.danger {
  background: #FAF0EE;
  color: #9A2F22;
  border-color: rgba(184, 74, 57, 0.45);
}

.pill-btn.danger:hover {
  background: #B84A39;
  color: #FFFDF8;
  border-color: #9A2F22;
}

.pill-btn.active {
  background: #EAE2D1;
  border-color: var(--avocado);
  color: var(--avocado-dark);
  box-shadow: inset 0 0 0 1px var(--avocado);
}

.pill-btn.icon-only {
  padding: 7px 9px;
}

.privacy-badge {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--ui-border);
  background: #F7F1E5;
  color: var(--ui-muted);
  cursor: pointer;
}

.privacy-badge.family {
  background: #E8F0E2;
  border-color: #7D9969;
  color: #364B29;
}

.privacy-badge.invited {
  background: #F9EADB;
  border-color: #C98C52;
  color: #7A4B1E;
}

.cloud-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  color: var(--ui-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cloud-pill:hover {
  border-color: var(--avocado);
  color: var(--ui-ink);
}

.cloud-pill.synced {
  background: #E8F0E2;
  border-color: #7D9969;
  color: #2F4522;
}

.cloud-pill.syncing {
  background: #F6EED8;
  border-color: #C99D4A;
  color: #6B4D17;
}

.cloud-pill.error {
  background: #F8E5E3;
  border-color: #C5685C;
  color: #822A20;
}

.cloud-setup-card {
  background: #FFFDF8;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cloud-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #4D4236;
}

.cloud-steps code {
  background: #EFE7D8;
  padding: 1px 5px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.spread-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #FFFDF8;
  border: 1px solid var(--ui-border);
  border-radius: 11px;
  padding: 3px 6px;
}

.spread-indicator {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ui-muted);
  padding: 0 6px;
  min-width: 96px;
  text-align: center;
}

/* ==================== VIEWPORT & NOTEBOOK STAGE ==================== */
.desk-viewport {
  position: fixed;
  top: 58px;
  bottom: 78px;
  left: 0;
  right: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.zoom-stage {
  transform-origin: center center;
  transition: transform 0.08s ease-out;
  will-change: transform;
  padding: 28px;
}

.zoom-stage.dragging-pan {
  transition: none;
}

/* Traveler's Leather Cover Frame */
.traveler-cover {
  position: relative;
  padding: 18px 22px 20px 22px;
  border-radius: 16px;
  box-shadow: var(--shadow-book);
  transition: background 0.35s ease;
}

.traveler-cover::before {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 11px;
  border: 1.5px dashed var(--cover-stitch, rgba(232, 224, 206, 0.34));
  pointer-events: none;
}

/* Subtle brass ribbon bookmark peeking from top spine */
.ribbon-bookmark {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 36px;
  background: linear-gradient(180deg, #B84A39, #8F3224);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  z-index: 30;
  pointer-events: none;
}

/* Leather elastic band detail on right edge */
.elastic-band {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 12px;
  width: 8px;
  background: var(--cover-band, rgba(35, 28, 20, 0.55));
  pointer-events: none;
  z-index: 5;
  opacity: 0.42;
}

/* Open 2-Page Spread */
.notebook-spread {
  position: relative;
  width: 1200px;
  height: 780px;
  border-radius: 6px;
  overflow: hidden;
  background-color: #FBF7EE;
  box-shadow:
    -6px 0 0 -2px #EFE8DA,
    -11px 0 0 -4px #E2D9C7,
    6px 0 0 -2px #EFE8DA,
    11px 0 0 -4px #E2D9C7,
    0 4px 16px rgba(0, 0, 0, 0.22);
  perspective: 2200px;
}

/* Drop target glow when dragging photos from iPad Split View / Finder */
.notebook-spread.drop-active::after {
  content: 'Drop photo, video, or web text onto your spread';
  position: absolute;
  inset: 14px;
  border: 2.5px dashed var(--avocado);
  border-radius: 10px;
  background: rgba(246, 242, 232, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  color: var(--avocado-dark);
  z-index: 80;
  pointer-events: none;
}

/* Paper Texture & Pattern Layer */
.paper-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.paper-layer.pattern-dot {
  background-image: radial-gradient(var(--paper-line, rgba(130, 114, 92, 0.24)) 1.15px, transparent 1.15px);
  background-size: 24px 24px;
  background-position: 12px 12px;
}

.paper-layer.pattern-lined {
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 27px,
    var(--paper-line, rgba(130, 114, 92, 0.22)) 27px 28px
  );
  background-position: 0 16px;
}

.paper-layer.pattern-grid {
  background-image:
    linear-gradient(to right, var(--paper-line, rgba(130, 114, 92, 0.2)) 1px, transparent 1px),
    linear-gradient(to bottom, var(--paper-line, rgba(130, 114, 92, 0.2)) 1px, transparent 1px);
  background-size: 24px 24px;
}

.paper-grain {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  pointer-events: none;
  z-index: 2;
  background-image: radial-gradient(#3D2E1E 0.6px, transparent 0.6px);
  background-size: 6px 6px;
}

.watermark-layer {
  position: absolute;
  right: 115px;
  top: 230px;
  width: 310px;
  height: 310px;
  pointer-events: none;
  z-index: 3;
}

.template-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.template-layer svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Optional Vintage Brass Corner Protectors on Leather Cover & Bookshelf */
.brass-corner {
  display: none;
  position: absolute;
  width: 30px;
  height: 30px;
  pointer-events: none;
  z-index: 32;
  background: linear-gradient(135deg, #E8C97E 0%, #B88B3A 55%, #845E20 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
}

.traveler-cover.has-brass-corners .brass-corner,
.shelf-notebook.has-brass-corners .brass-corner {
  display: block;
}

.brass-corner.tl { top: -2px; left: -2px; border-top-left-radius: 14px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.brass-corner.tr { top: -2px; right: -2px; border-top-right-radius: 14px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.brass-corner.bl { bottom: -2px; left: -2px; border-bottom-left-radius: 14px; clip-path: polygon(0 0, 0 100%, 100% 100%); }
.brass-corner.br { bottom: -2px; right: -2px; border-bottom-right-radius: 14px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }

/* Cover Studio & Clipboard Paste Box */
.cover-studio-box {
  background: #F4EDE0;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.ribbon-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.ribbon-dot.active {
  transform: scale(1.18);
  box-shadow: 0 0 0 2.5px var(--avocado-dark);
}

.paste-sticker-zone {
  border: 2px dashed rgba(81, 97, 65, 0.42);
  background: #F6F1E6;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #4A4035;
  text-align: center;
  cursor: text;
  margin-bottom: 10px;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
}

.paste-sticker-zone:focus {
  border-color: var(--avocado);
  background: #FFFDF8;
}

.stamp-atlas-bar {
  background: #F4EDE0;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

/* Center Binding Spine Gutter */
.spine-gutter {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  background: linear-gradient(
    90deg,
    rgba(60, 46, 32, 0) 0%,
    rgba(60, 46, 32, 0.07) 42%,
    rgba(35, 25, 16, 0.22) 50%,
    rgba(60, 46, 32, 0.07) 58%,
    rgba(60, 46, 32, 0) 100%
  );
  pointer-events: none;
  z-index: 12;
}

/* Automatic Stylistic Date, Time & Seasonal Stamp Header */
.spread-date-header {
  position: absolute;
  top: 26px;
  left: 34px;
  width: 522px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(120, 102, 82, 0.26);
  z-index: 26;
  pointer-events: none;
}

.date-left-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.date-day-num {
  font-family: var(--font-serif);
  font-size: 50px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -1px;
  cursor: pointer;
  pointer-events: auto;
}

.date-meta-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.date-month-year {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2.2px;
  text-transform: uppercase;
}

.date-weekday-time {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.4px;
}

.date-location-input {
  margin-top: 3px;
  border: none;
  background: transparent;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13.5px;
  color: rgba(74, 62, 48, 0.78);
  outline: none;
  width: 280px;
  padding: 1px 0;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
}

.date-location-input:focus {
  border-bottom: 1px dashed rgba(120, 102, 82, 0.45);
}

.season-stamp-btn {
  width: 66px;
  height: 66px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  transform: rotate(-7deg);
  transition: transform 0.2s ease;
  opacity: 0.9;
  pointer-events: auto;
}

.season-stamp-btn:hover {
  transform: rotate(0deg) scale(1.06);
}

/* Subtle Page Numbers */
.page-number {
  position: absolute;
  bottom: 16px;
  font-family: var(--font-serif);
  font-size: 13px;
  letter-spacing: 1.5px;
  color: rgba(94, 80, 62, 0.56);
  pointer-events: none;
  z-index: 14;
}

.page-number.left { left: 32px; }
.page-number.right { right: 32px; }

/* Items Layer & Ink Canvas Layer */
.items-layer {
  position: absolute;
  inset: 0;
  z-index: 16;
  pointer-events: none;
}

.ink-canvas {
  position: absolute;
  inset: 0;
  width: 1200px;
  height: 780px;
  z-index: 22;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* When selecting/arranging items, let clicks pass straight to items */
.items-mode .ink-canvas {
  pointer-events: none;
}

/* ==================== SPREAD ITEMS ==================== */
.spread-item {
  position: absolute;
  transform-origin: center center;
  cursor: grab;
  user-select: none;
  touch-action: none;
  pointer-events: auto;
}

.spread-item:active {
  cursor: grabbing;
}

.spread-item.selected {
  outline: 2px dashed var(--avocado);
  outline-offset: 5px;
  z-index: 90 !important;
}

.item-controls {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 4px;
  background: #2E2821;
  color: #FAF6EE;
  padding: 5px 7px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.26);
  z-index: 95;
  white-space: nowrap;
}

.item-controls.below {
  top: auto;
  bottom: -44px;
}

.spread-item.selected .item-controls {
  display: flex;
}

.item-ctrl-btn {
  border: none;
  background: transparent;
  color: #FAF6EE;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.item-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.item-ctrl-btn.danger:hover {
  background: #B84A39;
}

.rotate-handle {
  display: none;
  position: absolute;
  left: -14px;
  bottom: -14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brass);
  color: #FFFDF8;
  font-size: 16px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
  border: 2.5px solid #FFFDF8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  cursor: grab;
  z-index: 96;
  touch-action: none;
}

.rotate-handle:active {
  cursor: grabbing;
  transform: scale(1.1);
}

.rotate-angle-badge {
  display: none;
  position: absolute;
  left: -18px;
  bottom: 24px;
  background: #2E2821;
  color: #FAF6EE;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 99;
  white-space: nowrap;
}

.resize-handle {
  display: none;
  position: absolute;
  right: -14px;
  bottom: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--avocado);
  border: 2.5px solid #FFFDF8;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
  cursor: nwse-resize;
  z-index: 96;
  touch-action: none;
}

.spread-item.selected .resize-handle,
.spread-item.selected .rotate-handle {
  display: block;
}

/* Picture Frames (Photos & Videos) */
.media-card {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.media-card img,
.media-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.media-card video {
  pointer-events: auto;
}

/* Polaroid Frame */
.media-card.frame-polaroid {
  background: #FFFFFF;
  padding: 10px 10px 36px 10px;
  border-radius: 2px;
  box-shadow: 0 6px 18px rgba(38, 30, 20, 0.2), 0 1px 3px rgba(38, 30, 20, 0.14);
}

.polaroid-caption {
  position: absolute;
  bottom: 7px;
  left: 10px;
  right: 10px;
  border: none;
  background: transparent;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 18px;
  color: #4A4035;
  outline: none;
}

/* Vintage Photo Corners Frame */
.media-card.frame-corners {
  background: #FAF5EA;
  padding: 7px;
  box-shadow: 0 5px 14px rgba(38, 30, 20, 0.18);
}

.media-card.frame-corners::before,
.media-card.frame-corners::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 4px solid #3B3228;
  pointer-events: none;
}

.media-card.frame-corners::before {
  top: -3px;
  left: -3px;
  border-right: none;
  border-bottom: none;
}

.media-card.frame-corners::after {
  bottom: -3px;
  right: -3px;
  border-left: none;
  border-top: none;
}

/* 35mm Film Strip Frame */
.media-card.frame-film {
  background: #23201E;
  padding: 14px 10px;
  border-radius: 3px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 10px, #FAF6EE 10px 18px, transparent 18px 26px),
    repeating-linear-gradient(90deg, transparent 0 10px, #FAF6EE 10px 18px, transparent 18px 26px);
  background-size: 100% 5px, 100% 5px;
  background-position: 0 4px, 0 calc(100% - 4px);
  background-repeat: no-repeat;
}

/* Gallery Mat Frame */
.media-card.frame-gallery {
  background: #FFFDF7;
  padding: 13px;
  border: 1.5px solid #CBBFA9;
  box-shadow: 0 6px 18px rgba(38, 30, 20, 0.16);
}

/* Washi Taped Frame */
.media-card.frame-washi {
  background: #FFFDF8;
  padding: 6px;
  box-shadow: 0 4px 12px rgba(38, 30, 20, 0.16);
}

.media-card.frame-washi::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 78px;
  height: 22px;
  background: repeating-linear-gradient(45deg, rgba(102, 124, 82, 0.72) 0 8px, rgba(132, 154, 108, 0.68) 8px 16px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.video-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(34, 28, 22, 0.72);
  color: #FFFDF8;
  font-size: 10px;
  letter-spacing: 0.8px;
  padding: 3px 7px;
  border-radius: 999px;
  pointer-events: none;
}

/* Stickers & Stamps & Washi */
.sticker-visual {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.sticker-visual svg,
.sticker-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stamp-visual {
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply;
  opacity: 0.9;
  pointer-events: none;
}

.washi-strip {
  width: 100%;
  height: 100%;
  opacity: 0.84;
  clip-path: polygon(2% 0%, 98% 2%, 100% 24%, 97% 50%, 100% 78%, 97% 100%, 2% 98%, 0% 72%, 3% 45%, 0% 18%);
  box-shadow: 0 1px 4px rgba(40, 30, 18, 0.12);
}

/* Torn-Paper Web Clipping Cutout */
.clipping-card {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #F8F1E2 0%, #F1E7D2 100%);
  border: 1px solid rgba(138, 118, 92, 0.34);
  border-radius: 3px;
  padding: 14px 16px;
  box-shadow: 0 5px 14px rgba(45, 34, 22, 0.14);
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  position: relative;
}

.clipping-card::before {
  content: 'CLIPPING';
  position: absolute;
  top: 7px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 1.5px;
  color: rgba(124, 104, 78, 0.65);
}

.clipping-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  color: #362C22;
  line-height: 1.2;
  padding-right: 52px;
}

.clipping-body {
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.45;
  color: #514539;
  overflow-y: auto;
  flex: 1;
}

.clipping-source {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 11px;
  color: #82715B;
  border-top: 1px dashed rgba(138, 118, 92, 0.32);
  padding-top: 5px;
}

/* Editable Typed Note Card & Voice Memo Card */
.note-card {
  width: 100%;
  height: 100%;
  background: rgba(255, 253, 248, 0.72);
  border: 1px dashed rgba(130, 114, 92, 0.34);
  border-radius: 7px;
  padding: 4px 12px 10px 12px;
  display: flex;
  flex-direction: column;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.note-drag-bar {
  height: 18px;
  line-height: 16px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 2px;
  color: rgba(110, 92, 70, 0.55);
  cursor: grab;
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.note-drag-bar:active {
  cursor: grabbing;
}

.note-style-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 5px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

.note-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  cursor: pointer;
  padding: 0;
}

.note-swatch.active {
  transform: scale(1.22);
  box-shadow: 0 0 0 1.5px #E7C882;
}

.note-opacity-slider {
  width: 58px;
  accent-color: #E7C882;
  cursor: pointer;
}

.note-opacity-val {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #E7DEC8;
  min-width: 28px;
  text-align: right;
}

/* ==================== WOODEN BOOKSHELF VIEW ==================== */
.bookshelf-screen {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: none;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 248, 232, 0.22), transparent 50%),
    linear-gradient(180deg, #E8E0D1 0%, #D9CEBA 100%);
  overflow-y: auto;
}

.bookshelf-screen.open {
  display: flex;
}

.bookshelf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 28px;
  background: rgba(251, 247, 239, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ui-border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.bookshelf-heading {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 700;
  color: var(--ui-ink);
  line-height: 1.05;
}

.bookshelf-sub {
  font-size: 12.5px;
  color: var(--ui-muted);
  margin-top: 2px;
}

.bookshelf-body {
  width: min(1060px, 94vw);
  margin: 26px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.shelf-tier {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shelf-tier-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 8px;
}

.shelf-tier-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: #3B3025;
  margin: 0;
}

.shelf-tier-hint {
  font-size: 12px;
  color: var(--ui-muted);
}

.wooden-ledge {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 22px;
  padding: 24px 28px 20px;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, rgba(114, 92, 66, 0.08) 0%, rgba(92, 72, 50, 0.14) 100%);
  border: 1px solid rgba(120, 96, 68, 0.16);
  border-bottom: 18px solid #8A6542;
  box-shadow:
    inset 0 -4px 10px rgba(45, 30, 15, 0.18),
    0 12px 24px rgba(42, 30, 18, 0.18);
}

.shelf-notebook {
  width: 172px;
  height: 232px;
  border-radius: 8px 14px 14px 8px;
  padding: 18px 16px 16px 20px;
  color: #F7F1E3;
  position: relative;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow:
    inset 10px 0 14px rgba(0, 0, 0, 0.22),
    -4px 6px 14px rgba(32, 22, 12, 0.28),
    4px 0 0 -1px #EFE7D8,
    7px 0 0 -2px #DFD5C3;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease;
}

.shelf-notebook::before {
  content: '';
  position: absolute;
  inset: 8px 8px 8px 14px;
  border-radius: 4px 10px 10px 4px;
  border: 1px dashed rgba(242, 232, 212, 0.34);
  pointer-events: none;
}

/* Traveler's elastic strap + brass charm */
.shelf-notebook::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 22px;
  width: 7px;
  background: rgba(24, 18, 12, 0.42);
  pointer-events: none;
}

.shelf-notebook:hover {
  transform: translateY(-10px) rotate(-1deg);
  box-shadow:
    inset 10px 0 14px rgba(0, 0, 0, 0.22),
    -6px 18px 26px rgba(32, 22, 12, 0.34),
    4px 0 0 -1px #EFE7D8,
    7px 0 0 -2px #DFD5C3;
}

.shelf-notebook.waiting {
  opacity: 0.92;
}

.shelf-brass-charm {
  position: absolute;
  right: 17px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F2D898, #A8803B);
  border: 1.5px solid #664B1C;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

.shelf-nb-tag {
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.8;
}

.shelf-nb-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.12;
  margin-top: 6px;
  padding-right: 18px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.shelf-nb-meta {
  font-size: 11px;
  opacity: 0.86;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.shelf-nb-pill {
  display: inline-block;
  align-self: flex-start;
  background: rgba(255, 252, 244, 0.2);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.6px;
}

.shelf-nb-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  padding-right: 14px;
}

.journal-edit-btn {
  border: 1px solid rgba(255, 250, 238, 0.38);
  background: rgba(28, 22, 16, 0.34);
  color: #FAF6EE;
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  z-index: 3;
}

.journal-edit-btn:hover {
  background: rgba(28, 22, 16, 0.62);
  transform: scale(1.04);
}

.note-textarea {
  width: 100%;
  flex: 1;
  min-height: 0;
  border: none;
  background: transparent;
  resize: none;
  outline: none;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.5;
  color: #342C24;
  pointer-events: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: manipulation;
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

.editable-card-text,
.polaroid-caption {
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
  cursor: text;
}

.editable-card-text:focus {
  outline: 1px dashed rgba(81, 97, 65, 0.45);
  border-radius: 4px;
}

.voice-card {
  width: 100%;
  height: 100%;
  background: #F4EFE2;
  border: 1px solid rgba(116, 98, 76, 0.32);
  border-left: 4px solid var(--avocado);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: 0 4px 12px rgba(42, 34, 24, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--avocado-dark);
}

.voice-card-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.4;
  color: #3A3229;
  overflow-y: auto;
  flex: 1;
}

/* Family Sticky Note */
.family-sticky {
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  border-radius: 2px 2px 14px 2px;
  box-shadow: 0 6px 16px rgba(46, 36, 20, 0.18);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.family-sticky::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: rgba(0, 0, 0, 0.045);
}

.family-sticky-author {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #77592F;
  margin-top: 4px;
}

.family-sticky-body {
  font-family: var(--font-hand);
  font-size: 18px;
  line-height: 1.25;
  color: #3A3024;
  flex: 1;
  overflow-y: auto;
}

.family-sticky-date {
  font-size: 9.5px;
  color: rgba(95, 76, 52, 0.7);
  text-align: right;
}

/* ==================== 3D PAGE-TURN ANIMATION ==================== */
.page-turn-leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 75;
  pointer-events: none;
  display: none;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  background: linear-gradient(90deg, #EFE7D8 0%, #FBF7EE 24%, #FBF7EE 88%, #E5DCCB 100%);
  box-shadow: 0 0 28px rgba(34, 24, 14, 0.28);
}

.page-turn-leaf.turn-next {
  display: block;
  right: 0;
  transform-origin: left center;
  animation: leafTurnNext 0.56s cubic-bezier(0.42, 0.02, 0.25, 1) forwards;
}

.page-turn-leaf.turn-prev {
  display: block;
  left: 0;
  transform-origin: right center;
  animation: leafTurnPrev 0.56s cubic-bezier(0.42, 0.02, 0.25, 1) forwards;
}

@keyframes leafTurnNext {
  0% { transform: rotateY(0deg); filter: brightness(1); }
  48% { transform: rotateY(-92deg); filter: brightness(0.92); }
  100% { transform: rotateY(-180deg); opacity: 0.15; filter: brightness(0.86); }
}

@keyframes leafTurnPrev {
  0% { transform: rotateY(0deg); filter: brightness(1); }
  48% { transform: rotateY(92deg); filter: brightness(0.92); }
  100% { transform: rotateY(180deg); opacity: 0.15; filter: brightness(0.86); }
}

/* ==================== BOTTOM PEN & STATIONERY DOCK ==================== */
.bottom-dock {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 24px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 18px;
  background: var(--ui-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--ui-border);
  box-shadow: var(--shadow-soft);
  z-index: 65;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.bottom-dock::-webkit-scrollbar {
  display: none;
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 8px;
  border-right: 1px solid var(--ui-border);
}

.dock-group:last-child {
  border-right: none;
  padding-right: 0;
}

.tool-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 48px;
  height: 46px;
  padding: 4px 7px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-ink);
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.tool-btn .ico {
  font-size: 16px;
  line-height: 1;
}

.tool-btn:hover {
  background: rgba(116, 98, 76, 0.1);
}

.tool-btn.active {
  background: var(--avocado);
  color: #FAF6EE;
  box-shadow: 0 3px 10px rgba(64, 79, 49, 0.28);
}

.ink-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ink-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #FFFDF8;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.ink-dot.active {
  transform: scale(1.22);
  box-shadow: 0 0 0 2px var(--avocado);
}

.range-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 9.5px;
  color: var(--ui-muted);
}

.range-mini input[type='range'] {
  width: 64px;
  accent-color: var(--avocado);
}

.zoom-float {
  position: fixed;
  right: 16px;
  bottom: 84px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 4px 6px;
  box-shadow: 0 6px 18px rgba(42, 33, 22, 0.12);
  z-index: 55;
}

.zoom-label {
  font-family: var(--font-mono);
  font-size: 11px;
  min-width: 42px;
  text-align: center;
  color: var(--ui-muted);
}

/* ==================== MODALS & DRAWERS ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(34, 28, 20, 0.44);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 120;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: min(760px, 95vw);
  max-height: 86vh;
  background: var(--ui-surface-solid);
  border: 1px solid var(--ui-border);
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(24, 18, 12, 0.32);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--ui-border);
  background: #F4EDE0;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tabs-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ui-border);
  padding-bottom: 10px;
}

.tab-btn {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  color: var(--ui-muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tab-btn.active {
  background: var(--avocado);
  color: #FAF6EE;
  border-color: var(--avocado);
}

.section-label {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ui-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.asset-tile {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.asset-tile:hover {
  transform: translateY(-2px);
  border-color: var(--avocado);
}

.asset-tile.selected {
  border-color: var(--avocado);
  box-shadow: 0 0 0 2px rgba(81, 97, 65, 0.25);
}

.asset-tile-thumb {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.asset-tile-thumb img,
.asset-tile-thumb svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.asset-tile-name {
  font-size: 11px;
  color: var(--ui-ink);
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ui-muted);
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  border-radius: 9px;
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ui-ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--avocado);
}

.stamp-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 156px;
  background: #FBF7EE;
  border: 1px dashed var(--ui-border);
  border-radius: 12px;
  padding: 12px;
}

.stamp-preview-box svg {
  max-height: 132px;
  max-width: 210px;
}

.cutout-preview {
  min-height: 170px;
  border-radius: 12px;
  border: 1px solid var(--ui-border);
  background-image:
    linear-gradient(45deg, #E7E2D8 25%, transparent 25%),
    linear-gradient(-45deg, #E7E2D8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #E7E2D8 75%),
    linear-gradient(-45deg, transparent 75%, #E7E2D8 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.cutout-preview img {
  max-height: 220px;
  max-width: 100%;
  object-fit: contain;
}

.sheet-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.sheet-box {
  position: absolute;
  border: 2px dashed var(--terracotta);
  background: rgba(184, 74, 57, 0.12);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.sheet-box:hover {
  background: rgba(81, 97, 65, 0.24);
  border-color: var(--avocado);
}

/* Social Deck */
.social-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.social-card {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  border-radius: 12px;
  padding: 10px 28px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.social-card:hover {
  border-color: var(--avocado);
  transform: translateY(-1px);
}

.social-card.active {
  border-color: var(--avocado);
  background: #F1F5EC;
  box-shadow: 0 0 0 2px rgba(81, 97, 65, 0.2);
}

.social-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ui-muted);
  cursor: pointer;
  font-size: 11px;
}

.social-remove:hover {
  background: var(--terracotta);
  color: #FFF;
}

.export-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #ECE5D8;
  border-radius: 12px;
  padding: 14px;
}

.export-preview-wrap canvas {
  max-width: 100%;
  max-height: 310px;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

/* Pocket Voice-to-Journal */
.pocket-mic-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 3px solid var(--avocado);
  background: #FFFDF8;
  color: var(--avocado-dark);
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto;
  box-shadow: 0 10px 24px rgba(64, 79, 49, 0.2);
  transition: all 0.2s ease;
}

.pocket-mic-ring.recording {
  background: var(--terracotta);
  border-color: #8E3022;
  color: #FFFDF8;
  animation: pulseMic 1.2s infinite;
}

@keyframes pulseMic {
  0% { box-shadow: 0 0 0 0 rgba(184, 74, 57, 0.45); }
  70% { box-shadow: 0 0 0 18px rgba(184, 74, 57, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 74, 57, 0); }
}

.pocket-item {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* Journal Shelf Cards */
.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 14px;
}

.journal-book-card {
  border-radius: 12px;
  padding: 16px 14px;
  color: #FAF6EE;
  min-height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  position: relative;
  box-shadow: 0 10px 22px rgba(34, 26, 17, 0.22);
  transition: transform 0.16s ease;
}

.journal-book-card:hover {
  transform: translateY(-3px);
}

.journal-book-card.active::after {
  content: 'OPEN';
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  background: rgba(255, 255, 255, 0.22);
  padding: 2px 7px;
  border-radius: 999px;
}

.page-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.page-pick-chip {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Toast Notification */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: #2E2821;
  color: #FAF6EE;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 200;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Guest Family Sticky-Note Banner */
.family-guest-bar {
  position: fixed;
  top: 58px;
  left: 0;
  right: 0;
  background: #475838;
  color: #FAF6EE;
  padding: 8px 18px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 58;
  font-size: 13px;
}

.family-guest-bar.open {
  display: flex;
}

/* Dedicated Guest Reader Mode (when Family opens a ?shared= link) */
body.guest-reader-mode .topbar,
body.guest-reader-mode .bottom-dock {
  display: none !important;
}

body.guest-reader-mode .family-guest-bar {
  top: 0;
  padding: 10px 16px;
}

body.guest-reader-mode .desk-viewport {
  top: 56px;
  bottom: 0;
}

body.guest-reader-mode .ink-canvas,
body.guest-reader-mode .item-controls,
body.guest-reader-mode .resize-handle,
body.guest-reader-mode .rotate-handle {
  pointer-events: none !important;
  display: none !important;
}

body.guest-reader-mode .spread-item {
  cursor: default !important;
}

/* 🔔 Alert Bell Badge & Activity Cards */
.alert-bell-btn {
  position: relative;
  padding: 6px 10px;
}

.alert-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--terracotta);
  color: #FFFDF8;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(184, 74, 57, 0.45);
}

.alert-card {
  border: 1px solid var(--ui-border);
  background: #FFFDF8;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.14s ease;
}

.alert-card:hover {
  border-color: var(--avocado);
  transform: translateY(-1px);
}

.alert-card.unread {
  border-left: 4px solid var(--terracotta);
  background: #FFF9EE;
}

/* Guest Welcome Guide Cards */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.guide-box {
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  border: 1px solid var(--ui-border);
}

.guide-box.can {
  background: #F1F6EC;
  border-color: rgba(81, 97, 65, 0.35);
}

.guide-box.cant {
  background: #FAF2EE;
  border-color: rgba(184, 74, 57, 0.28);
}

.guide-box-title {
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 13px;
}

.guide-box ul {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.guide-own-box {
  background: #F4EDE0;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  padding: 14px;
}

.postit-color-dot {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid rgba(116, 98, 76, 0.25);
  cursor: pointer;
  transition: transform 0.14s ease;
}

.postit-color-dot.active {
  transform: scale(1.14);
  border-color: var(--avocado-dark);
  box-shadow: 0 0 0 2px rgba(81, 97, 65, 0.28);
}

/* Keep bottom dock cleanly clear of bottom-right host badges on laptops, iPads & landscape phones */
@media (max-width: 1380px) {
  .bottom-dock {
    left: max(12px, env(safe-area-inset-left));
    right: max(206px, calc(env(safe-area-inset-right) + 196px));
    transform: none;
    max-width: none;
    justify-content: flex-start;
  }
}

/* Responsive tweaks for iPad Portrait & compact laptop windows */
@media (max-width: 1120px) {
  .topbar {
    padding: 0 10px;
    gap: 6px;
  }
  .pill-btn {
    padding: 6px 9px;
    font-size: 12px;
  }
  .hide-mobile {
    display: none !important;
  }
  .spread-indicator {
    min-width: 72px;
    font-size: 11px;
  }
  .bottom-dock {
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 6px 8px;
    gap: 5px;
  }
  .tool-btn {
    min-width: 42px;
    padding: 4px 5px;
  }
  .zoom-float {
    bottom: 72px;
    right: max(8px, env(safe-area-inset-right));
  }
}

/* iPhone Portrait: scrollable top bar + full-width dock cleanly above bottom-right badge */
@media (max-width: 820px) {
  .topbar {
    justify-content: flex-start;
    padding: 0 max(10px, env(safe-area-inset-left)) 0 max(10px, env(safe-area-inset-left));
    padding-right: 18px;
  }
}

@media (max-width: 600px) {
  .bottom-dock {
    left: 8px;
    right: 8px;
    bottom: max(58px, calc(env(safe-area-inset-bottom) + 52px));
  }
  .zoom-float {
    bottom: max(120px, calc(env(safe-area-inset-bottom) + 114px));
    right: 8px;
  }
}

/* iPhone Landscape: maximize desk height so the full 2-page notebook fits cleanly */
@media (max-height: 520px) {
  .topbar {
    height: 48px;
  }
  .desk-viewport {
    top: 48px;
    bottom: 62px;
  }
  .zoom-stage {
    padding: 8px;
  }
  .bottom-dock {
    bottom: 6px;
    padding: 4px 8px;
  }
  .tool-btn {
    height: 40px;
    min-width: 40px;
  }
  .zoom-float {
    bottom: 58px;
    right: max(10px, env(safe-area-inset-right));
  }
}
