/* ============================================================
   Sunlit Workstation — a small desktop world with a living sky
   ============================================================ */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --amber: #e8963c;
  --amber-deep: #c97a24;
  --sage: #7fa06a;
  --ink: #2c2620;
  --ink-soft: #6d6355;
  --paper: rgba(253, 250, 244, 0.93);
  --paper-solid: #fdfaf4;
  --line: rgba(90, 70, 40, 0.14);

  --win-radius: 13px;
  --win-shadow: 0 24px 70px rgba(20, 16, 40, 0.34), 0 4px 16px rgba(20, 16, 40, 0.18);
  --win-shadow-focus: 0 34px 90px rgba(20, 16, 40, 0.44), 0 6px 20px rgba(20, 16, 40, 0.22);

  --menubar-h: 34px;
  --dock-h: 74px;

  --ease-spring: cubic-bezier(0.34, 1.4, 0.44, 1);
  --ease-out: cubic-bezier(0.22, 0.8, 0.3, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

body {
  position: fixed;
  inset: 0;
  user-select: none;
  cursor: default;
}

button { font-family: inherit; }

/* ============================================================
   SCENE — the world beyond the glass
   ============================================================ */

#scene { position: absolute; inset: 0; overflow: hidden; }

#sky {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #6fb3e8 0%, #a8d0ea 55%, #d8f0f7 100%);
  transition: opacity 1s linear;
}

#sun, #moon {
  position: absolute;
  width: 76px; height: 76px;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}
#sun {
  background: radial-gradient(circle, #fff6da 0%, #ffd873 55%, #ffb545 100%);
  box-shadow: 0 0 60px 24px rgba(255, 200, 90, 0.55), 0 0 140px 70px rgba(255, 180, 80, 0.25);
}
#moon {
  width: 58px; height: 58px;
  background: radial-gradient(circle at 38% 36%, #f4f1e6 0%, #cfd3d8 70%, #b6bcc6 100%);
  box-shadow: 0 0 40px 12px rgba(210, 220, 255, 0.28);
}
#moon::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background:
    radial-gradient(circle at 62% 30%, rgba(140,150,165,.5) 0 8%, transparent 9%),
    radial-gradient(circle at 30% 60%, rgba(140,150,165,.45) 0 6%, transparent 7%),
    radial-gradient(circle at 55% 68%, rgba(140,150,165,.4) 0 5%, transparent 6%);
}

#clouds { position: absolute; inset: 0; pointer-events: none; }
.cloud {
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  filter: blur(14px);
  will-change: transform;
  animation-name: drift;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes drift { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }

#landscape { position: absolute; inset: 0; width: 100%; height: 100%; }

#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#bird {
  position: absolute;
  font-size: 17px;
  opacity: 0;
  pointer-events: none;
  filter: grayscale(1) brightness(0.25);
}
#bird.fly { animation: birdfly 9s linear forwards; }
@keyframes birdfly {
  0%   { transform: translate(-6vw, 0) scaleX(1); opacity: 0; }
  6%   { opacity: 0.85; }
  92%  { opacity: 0.85; }
  100% { transform: translate(106vw, -6vh) scaleX(1); opacity: 0; }
}

/* ---------- The sill (desk edge with fern & coffee) ---------- */

#sill { position: absolute; inset: 0; pointer-events: none; }
#sill-board {
  position: absolute; left: 0; right: 0; bottom: 0; height: 30px;
  background: linear-gradient(180deg, #8a6742 0%, #6e4f30 55%, #54391f 100%);
  box-shadow: 0 -3px 14px rgba(30, 18, 6, 0.35);
}
.prop { position: absolute; bottom: 22px; pointer-events: auto; }

#fern { left: 24px; width: 152px; height: 172px; cursor: pointer; }
#fern svg { width: 100%; height: 100%; overflow: visible; }
#fern .fronds {
  transform-origin: 50% 96%;
  transition: transform 3.2s var(--ease-out);
}
#fern.wiggle .fronds { animation: fernwig 0.9s var(--ease-spring); }
@keyframes fernwig {
  0% { transform: rotate(0deg); } 30% { transform: rotate(-7deg); }
  60% { transform: rotate(5deg); } 100% { transform: rotate(0deg); }
}
#fern.happy .fronds { animation: fernhappy 1.4s var(--ease-spring); }
@keyframes fernhappy {
  0% { transform: scale(1) rotate(0); } 40% { transform: scale(1.07) rotate(-4deg); }
  70% { transform: scale(1.03) rotate(3deg); } 100% { transform: scale(1) rotate(0); }
}

#coffee { left: 192px; width: 54px; height: 62px; opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
#coffee.show { opacity: 1; }
#coffee svg { width: 100%; height: 100%; overflow: visible; }
#coffee .steam path {
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  animation: steam 2.6s ease-in-out infinite;
}
#coffee .steam path:nth-child(2) { animation-delay: 0.8s; }
#coffee .steam path:nth-child(3) { animation-delay: 1.6s; }
@keyframes steam {
  0% { stroke-dashoffset: 22; opacity: 0; }
  35% { opacity: 0.75; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

/* ============================================================
   MENU BAR
   ============================================================ */

#menubar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--menubar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  background: rgba(30, 28, 44, 0.32);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  color: #fdf8ee;
  font-size: 13px;
  z-index: 5000;
  box-shadow: 0 1px 0 rgba(255,255,255,0.12) inset;
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 14px; }
.mb-brand { display: flex; align-items: center; gap: 7px; font-weight: 700; letter-spacing: 0.2px; }
.mb-sun {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #ffe9ad, #f2a541);
  box-shadow: 0 0 8px 2px rgba(242, 165, 65, 0.8);
  display: inline-block;
}
.mb-app { opacity: 0.82; }
.mb-weather { font-size: 12.5px; opacity: 0.9; display: flex; gap: 6px; align-items: center; }
.mb-clock {
  background: none; border: 0; color: inherit; font-size: 13px;
  display: flex; gap: 8px; align-items: baseline;
  padding: 3px 8px; border-radius: 7px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.mb-clock:hover { background: rgba(255,255,255,0.14); }
#mb-time { font-weight: 600; }
#mb-date { opacity: 0.75; font-size: 12px; }

.mb-popover {
  position: absolute; top: calc(var(--menubar-h) + 6px); right: 10px;
  background: var(--paper);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--win-shadow);
  color: var(--ink);
  padding: 10px 12px;
  min-width: 220px;
  font-size: 13px;
}
.pop-title { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--ink-soft); margin-bottom: 6px; }
.pop-row { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 7px; cursor: pointer; }
.pop-row:hover { background: rgba(232, 150, 60, 0.12); }
.pop-row .dim { color: var(--ink-soft); font-size: 12px; }

/* ============================================================
   DESKTOP
   ============================================================ */

#desktop { position: absolute; inset: var(--menubar-h) 0 0 0; z-index: 10; pointer-events: none; }
#desktop .window, #desktop .desk-icon { pointer-events: auto; }

.desk-icon {
  position: absolute;
  width: 92px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 10px;
}
.desk-icon:hover { background: rgba(255, 255, 255, 0.14); }
.desk-icon .glyph { width: 46px; height: 46px; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.3)); }
.desk-icon .glyph svg { width: 100%; height: 100%; }
.desk-icon .label {
  font-size: 11.5px; color: #fff; text-align: center; line-height: 1.25;
  text-shadow: 0 1px 3px rgba(0,0,0,0.65);
  max-width: 88px; word-wrap: break-word;
}

/* ============================================================
   WINDOWS
   ============================================================ */

.window {
  position: absolute;
  border-radius: var(--win-radius);
  background: var(--paper);
  backdrop-filter: blur(26px) saturate(1.25);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  box-shadow: var(--win-shadow);
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 300px; min-height: 200px;
  opacity: 1;
  transition: box-shadow 0.25s ease, opacity 0.18s ease;
}
.window.focused { box-shadow: var(--win-shadow-focus); }
.window:not(.focused) .titlebar { background: rgba(120, 110, 95, 0.1); }
.window:not(.focused) .traffic { opacity: 0.45; }
.window.opening { animation: winopen 0.32s var(--ease-spring); }
@keyframes winopen {
  from { transform: scale(0.86) translateY(14px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.window.minimizing, .window.restoring {
  transition: transform 0.38s var(--ease-out), opacity 0.34s ease;
  pointer-events: none;
}
.window.minimized { display: none; }
.window.closing { transition: transform 0.2s ease, opacity 0.18s ease; transform: scale(0.92); opacity: 0; }
.window.dragging { transition: none; }
.window.dragging .win-body { pointer-events: none; }
.window.resizing { transition: none; }
.window.resizing .win-body { pointer-events: none; }

.titlebar {
  height: 40px;
  flex: 0 0 40px;
  display: flex; align-items: center;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.35);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  position: relative;
}
.titlebar:active { cursor: grabbing; }
.traffic { display: flex; gap: 8px; align-items: center; }
.tlight {
  width: 12px; height: 12px; border-radius: 50%;
  border: 0; cursor: pointer; padding: 0;
  display: grid; place-items: center;
  transition: transform 0.12s ease;
}
.tlight:hover { transform: scale(1.15); }
.tlight.close { background: #ec6a5e; }
.tlight.min { background: #f4bf4f; }
.tlight.max { background: #61c554; }
.tlight svg { width: 8px; height: 8px; opacity: 0; transition: opacity 0.1s; }
.traffic:hover .tlight svg { opacity: 0.75; }

.win-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 7px;
  pointer-events: none;
  max-width: 55%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win-title .wicon { width: 15px; height: 15px; display: inline-flex; }
.win-title .wicon svg { width: 100%; height: 100%; }

.win-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
}

.resize-grip {
  position: absolute; right: 0; bottom: 0;
  width: 22px; height: 22px;
  cursor: nwse-resize;
  z-index: 30;
}
.resize-grip::after {
  content: ""; position: absolute; right: 5px; bottom: 5px;
  width: 9px; height: 9px;
  border-right: 2px solid rgba(90, 70, 40, 0.35);
  border-bottom: 2px solid rgba(90, 70, 40, 0.35);
  border-bottom-right-radius: 3px;
}

/* ============================================================
   DOCK
   ============================================================ */

#dock {
  position: absolute;
  left: 50%; bottom: 38px;
  transform: translateX(-50%);
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px 10px;
  background: rgba(30, 28, 44, 0.36);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  box-shadow: 0 18px 50px rgba(10, 8, 24, 0.45);
  z-index: 4000;
}
.dock-item {
  position: relative;
  width: 52px; height: 52px;
  border: 0; background: none; cursor: pointer;
  border-radius: 14px;
  display: grid; place-items: center;
  transition: transform 0.16s var(--ease-out);
  transform-origin: bottom center;
  will-change: transform;
}
.dock-item svg { width: 44px; height: 44px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3)); pointer-events: none; }
.dock-item:hover::before {
  content: attr(data-name);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%; transform: translateX(-50%);
  background: rgba(24, 22, 36, 0.85);
  color: #fdf8ee;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
}
.dock-item .run-dot {
  position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: #ffe9c4;
  opacity: 0;
  box-shadow: 0 0 6px rgba(255, 233, 196, 0.9);
}
.dock-item.running .run-dot { opacity: 1; }
.dock-item .badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 19px; height: 19px;
  border-radius: 10px;
  background: #e8534a;
  color: #fff;
  font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
  padding: 0 5px;
  border: 2px solid rgba(30, 28, 44, 0.9);
  transform: scale(0);
  transition: transform 0.25s var(--ease-spring);
}
.dock-item .badge.show { transform: scale(1); }
.dock-item.bounce { animation: dockbounce 0.85s var(--ease-spring) 2; }
@keyframes dockbounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-22px); }
  70% { transform: translateY(-6px); }
}
.dock-sep { width: 1px; align-self: stretch; margin: 6px 3px; background: rgba(255,255,255,0.18); }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */

#notifications {
  position: absolute;
  top: calc(var(--menubar-h) + 10px);
  right: 12px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 6000;
  width: 330px;
  pointer-events: none;
}
.notif {
  pointer-events: auto;
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--paper);
  backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--win-shadow);
  padding: 12px 14px;
  cursor: pointer;
  transform: translateX(120%);
  transition: transform 0.42s var(--ease-spring), opacity 0.3s ease;
  font-size: 13px;
}
.notif.in { transform: translateX(0); }
.notif.out { transform: translateX(115%); opacity: 0; }
.notif .nicon { width: 30px; height: 30px; flex: 0 0 30px; }
.notif .nicon svg { width: 100%; height: 100%; }
.notif .ntitle { font-weight: 700; margin-bottom: 1px; }
.notif .nbody { color: var(--ink-soft); line-height: 1.35; }

/* ============================================================
   APP: shared bits
   ============================================================ */

.app-scroll { overflow-y: auto; }
.app-scroll::-webkit-scrollbar { width: 9px; }
.app-scroll::-webkit-scrollbar-thumb { background: rgba(90,70,40,0.22); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
.app-scroll::-webkit-scrollbar-track { background: transparent; }

.toolbar {
  flex: 0 0 44px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.25);
}
.tbtn {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.5);
  border-radius: 8px;
  height: 28px; min-width: 28px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: background 0.12s, transform 0.1s;
}
.tbtn:hover { background: rgba(232, 150, 60, 0.18); }
.tbtn:active { transform: scale(0.94); }
.tbtn:disabled { opacity: 0.35; pointer-events: none; }
.tbtn.primary { background: var(--amber); border-color: var(--amber-deep); color: #fff; font-weight: 600; }
.tbtn.primary:hover { background: #f0a24c; }
.crumb { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; gap: 4px; align-items: center; }
.crumb b { color: var(--ink); }
.spacer { flex: 1; }

.empty-hint {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--ink-soft); font-size: 13px;
  text-align: center; padding: 20px; line-height: 1.5;
  pointer-events: none;
}

/* ============================================================
   APP: Files
   ============================================================ */

.files-wrap { display: flex; flex: 1; min-height: 0; }
.files-side {
  flex: 0 0 150px;
  border-right: 1px solid var(--line);
  background: rgba(255,255,255,0.22);
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.files-side .side-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-soft); padding: 4px 8px 5px; }
.side-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  border: 0; background: none; text-align: left; width: 100%;
  color: var(--ink);
}
.side-item:hover { background: rgba(232, 150, 60, 0.12); }
.side-item.active { background: rgba(232, 150, 60, 0.24); font-weight: 600; }
.side-item svg { width: 16px; height: 16px; flex: 0 0 16px; }

.files-grid {
  flex: 1;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  align-content: start;
  overflow-y: auto;
}
.fitem {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px 8px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.fitem:hover { background: rgba(232, 150, 60, 0.1); }
.fitem.sel { background: rgba(232, 150, 60, 0.2); border-color: rgba(232, 150, 60, 0.45); }
.fitem .glyph { width: 44px; height: 44px; }
.fitem .glyph svg { width: 100%; height: 100%; }
.fitem .fname { font-size: 11.5px; text-align: center; line-height: 1.25; word-break: break-word; max-height: 2.5em; overflow: hidden; }
.fitem .fmeta { font-size: 10px; color: var(--ink-soft); }
.files-status {
  flex: 0 0 26px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 12px;
  font-size: 11.5px; color: var(--ink-soft);
  background: rgba(255,255,255,0.2);
}

/* ============================================================
   APP: Text / markdown viewer
   ============================================================ */

.reader {
  flex: 1; overflow-y: auto;
  padding: 22px 28px 30px;
  font-size: 14px; line-height: 1.62;
  color: var(--ink);
  user-select: text;
}
.reader h1, .reader h2, .reader h3 { line-height: 1.3; margin: 0.9em 0 0.35em; }
.reader h1 { font-size: 21px; }
.reader h2 { font-size: 17px; }
.reader h3 { font-size: 15px; }
.reader h1:first-child, .reader h2:first-child { margin-top: 0; }
.reader p { margin: 0.5em 0; }
.reader ul { margin: 0.4em 0 0.4em 1.3em; }
.reader li { margin: 0.25em 0; }
.reader code { font-family: var(--mono); font-size: 12.5px; background: rgba(232,150,60,0.14); padding: 1px 5px; border-radius: 5px; }
.reader pre { font-family: var(--mono); font-size: 12.5px; background: rgba(60,45,25,0.07); border: 1px solid var(--line); padding: 12px 14px; border-radius: 10px; overflow-x: auto; margin: 0.7em 0; user-select: text; }
.reader s { color: var(--ink-soft); }
.reader .soft { color: var(--ink-soft); }

/* ============================================================
   APP: Photo viewer
   ============================================================ */

.photo-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; background: rgba(46, 38, 28, 0.9); }
.photo-stage { flex: 1; display: grid; place-items: center; padding: 18px; min-height: 0; }
.photo-stage svg { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 10px 34px rgba(0,0,0,0.5); background: #fff; }
.photo-caption {
  flex: 0 0 auto;
  padding: 12px 16px;
  color: #f4ecdd;
  font-size: 13px;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  background: rgba(20, 16, 10, 0.55);
}
.photo-caption .dim { opacity: 0.6; font-size: 12px; }

/* ============================================================
   APP: Messages
   ============================================================ */

.msg-wrap { display: flex; flex: 1; min-height: 0; }
.msg-list {
  flex: 0 0 190px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: rgba(255,255,255,0.2);
}
.convo {
  display: flex; gap: 10px; align-items: center;
  padding: 11px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(90,70,40,0.07);
}
.convo:hover { background: rgba(232,150,60,0.1); }
.convo.active { background: rgba(232,150,60,0.2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex: 0 0 36px;
  box-shadow: inset 0 -2px 4px rgba(0,0,0,0.15);
}
.convo .cmeta { min-width: 0; flex: 1; }
.convo .cname { font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.convo .cname .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-deep); flex: 0 0 8px; margin-top: 4px; }
.convo .cprev { font-size: 11.5px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.msg-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 7px; }
.bubble {
  max-width: 74%;
  padding: 8px 12px;
  border-radius: 17px;
  font-size: 13.5px; line-height: 1.4;
  user-select: text;
  animation: bubblein 0.28s var(--ease-spring);
  width: fit-content;
}
@keyframes bubblein { from { transform: translateY(8px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.bubble.them { background: rgba(255,255,255,0.85); border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.bubble.me { background: var(--amber); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; box-shadow: 0 2px 8px rgba(200, 120, 40, 0.35); }
.bubble .btime { display: block; font-size: 10px; opacity: 0.55; margin-top: 3px; }
.typing { display: inline-flex; gap: 4px; padding: 11px 14px; background: rgba(255,255,255,0.85); border: 1px solid var(--line); border-radius: 17px; border-bottom-left-radius: 5px; align-self: flex-start; width: fit-content; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #b3a48d; animation: tp 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.18s; }
.typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes tp { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
.msg-day { text-align: center; font-size: 11px; color: var(--ink-soft); margin: 4px 0; }

.msg-compose { flex: 0 0 auto; padding: 10px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; background: rgba(255,255,255,0.25); }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  border: 1px solid rgba(201, 122, 36, 0.55);
  background: rgba(232, 150, 60, 0.12);
  color: var(--amber-deep);
  font-size: 12.5px; font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
}
.chip:hover { background: rgba(232, 150, 60, 0.28); }
.chip:active { transform: scale(0.95); }
.msg-idle { font-size: 12px; color: var(--ink-soft); padding: 2px 4px 0; }

/* ============================================================
   APP: Calendar
   ============================================================ */

.cal-wrap { display: flex; flex: 1; min-height: 0; }
.cal-side {
  flex: 0 0 208px;
  border-right: 1px solid var(--line);
  padding: 14px;
  background: rgba(255,255,255,0.2);
  overflow-y: auto;
}
.cal-side h3 { font-size: 14px; margin-bottom: 2px; }
.cal-side .cal-date-big { font-size: 12px; color: var(--ink-soft); margin-bottom: 12px; }
.minical { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; font-size: 11px; text-align: center; margin-bottom: 14px; }
.minical .dow { font-size: 9.5px; font-weight: 700; color: var(--ink-soft); padding: 3px 0; }
.minical .day { padding: 4px 0; border-radius: 6px; position: relative; }
.minical .day.today { background: var(--amber); color: #fff; font-weight: 700; }
.minical .day.ritual::after { content: ""; position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; border-radius: 50%; background: var(--amber-deep); }
.minical .day.today.ritual::after { background: #fff; }
.ritual-legend { font-size: 11.5px; color: var(--ink-soft); line-height: 1.7; }
.ritual-legend b { color: var(--ink); }

.cal-day { flex: 1; position: relative; overflow-y: auto; min-width: 0; }
.cal-hours { position: relative; padding: 0 0 0 52px; }
.cal-hour { position: relative; height: 46px; border-bottom: 1px solid rgba(90,70,40,0.08); }
.cal-hour .hlabel { position: absolute; left: -46px; top: -7px; font-size: 10.5px; color: var(--ink-soft); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.cal-event {
  position: absolute;
  left: 6px; right: 10px;
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 12px;
  overflow: hidden;
  cursor: pointer;
  border-left: 3px solid;
  background: rgba(255,255,255,0.75);
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.cal-event:hover { transform: scale(1.015); box-shadow: 0 4px 14px rgba(60,40,20,0.18); z-index: 5; }
.cal-event .etime { font-size: 10.5px; opacity: 0.7; }
.cal-event .ename { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event.ritual { background: linear-gradient(135deg, rgba(255, 214, 140, 0.85), rgba(255, 190, 110, 0.75)); border-left-color: var(--amber-deep); }
.cal-event.plain { border-left-color: #8aa4c0; }
.cal-event.done { opacity: 0.55; }
.cal-event.done .ename { text-decoration: line-through; }
.cal-now {
  position: absolute; left: 44px; right: 0;
  border-top: 2px solid #d6563c;
  z-index: 6; pointer-events: none;
}
.cal-now::before { content: ""; position: absolute; left: -5px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: #d6563c; }

.cal-detail {
  position: absolute;
  bottom: 12px; left: 12px; right: 12px;
  background: var(--paper-solid);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--win-shadow);
  padding: 13px 15px;
  z-index: 10;
  animation: bubblein 0.25s var(--ease-spring);
}
.cal-detail h4 { font-size: 14px; margin-bottom: 2px; }
.cal-detail .dtime { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.cal-detail p { font-size: 12.5px; line-height: 1.45; color: var(--ink); margin-bottom: 9px; }

/* ============================================================
   APP: Sketchbook
   ============================================================ */

.sketch-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #f6efe2; }
.sketch-canvas-box { flex: 1; position: relative; min-height: 0; cursor: crosshair; }
.sketch-canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.swatches { display: flex; gap: 6px; align-items: center; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.8); cursor: pointer; padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.1s; }
.swatch:hover { transform: scale(1.18); }
.swatch.active { outline: 2px solid var(--amber-deep); outline-offset: 2px; }

/* ============================================================
   Small screens
   ============================================================ */

@media (max-width: 760px) {
  .files-side { flex-basis: 120px; }
  .msg-list { flex-basis: 150px; }
  .cal-side { display: none; }
  .mb-app { display: none; }
  #notifications { width: min(330px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, #bird.fly, #coffee .steam path { animation: none !important; }
  .window.opening, .bubble, .notif { animation: none !important; transition-duration: 0.01s !important; }
}
