/* Immersive home panels and distinct interface languages. */
.theme-world.experience {
  min-height: 260px;
  padding: 0;
  isolation: isolate;
  overflow: hidden;
}

.experience-art {
  position: absolute;
  inset: 0 0 0 43%;
  overflow: hidden;
  pointer-events: none;
}

.experience-art svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

.experience-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--color-surface), transparent 55%);
}

.experience-content {
  position: relative;
  z-index: 2;
  padding: 30px 34px;
  width: 55%;
}

.experience-label {
  font: 700 9px var(--font-mono);
  letter-spacing: .16em;
  color: var(--color-primary);
}

.experience-label span {
  margin-right: 5px;
}

.experience-content h2 {
  margin: 12px 0 8px;
  font: 800 clamp(25px, 3.5vw, 42px)/1.04 var(--font-heading);
  letter-spacing: -.045em;
  color: var(--color-text);
}

.experience-content p {
  max-width: 300px;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-muted);
}

.experience-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.experience-actions button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 12px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-line);
  border-radius: 10px;
  font-size: 11px;
  box-shadow: 0 3px 10px #0000000a;
  transition: transform .2s, box-shadow .2s;
}

.experience-actions button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px #0002;
}

.experience-actions button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.experience-actions button span {
  color: var(--color-primary);
  font-size: 16px;
  line-height: 1;
}

.experience-signature {
  position: absolute;
  right: 16px;
  bottom: 12px;
  z-index: 2;
  font: 700 8px var(--font-mono);
  letter-spacing: .13em;
  color: var(--color-text);
  opacity: .55;
}

.experience-signature span {
  opacity: .5;
}

/* Anime: a storybook cover, character art, sticker-like controls and comic panels. */
body[data-mood="anime"] .theme-world.experience {
  min-height: 330px;
  border: 3px solid #694370;
  border-radius: 24px;
  background: #fff0f7;
  box-shadow: 7px 7px 0 #e9b0cd;
}

body[data-mood="anime"] .experience-art {
  inset: 0 0 0 36%;
}

body[data-mood="anime"] .experience-art::after {
  background: linear-gradient(90deg, #fff0f7 0%, #fff0f7aa 24%, transparent 55%);
}

body[data-mood="anime"] .experience-content {
  width: 58%;
  padding: 36px;
}

body[data-mood="anime"] .experience-label {
  color: #c34888;
}

body[data-mood="anime"] .experience-content h2 {
  color: #532d5d;
  font-size: clamp(32px, 4vw, 52px);
  max-width: 320px;
}

body[data-mood="anime"] .experience-content p {
  color: #805b78;
}

body[data-mood="anime"] .experience-actions button {
  border: 2px solid #714677;
  border-radius: 18px;
  box-shadow: 3px 3px 0 #d48db5;
  background: #fff9fd;
  color: #593454;
}

body[data-mood="anime"] .experience-actions button:nth-child(2) {
  background: #f7b9d5;
}

body[data-mood="anime"] .experience-actions button span {
  color: #bc3e80;
}

body[data-mood="anime"] #todayView section {
  border: 2px solid #edc9dd !important;
  border-radius: 20px !important;
  box-shadow: 4px 4px 0 #f1d8e7;
}

body[data-mood="anime"] .sidebar-link.active {
  border: 1px solid #eaa9cd;
  border-radius: 16px;
  background: #ffe0f0;
}

body[data-mood="anime"] #captureBtn {
  border: 2px solid #72456f;
  box-shadow: 3px 3px 0 #e7a3c4;
  border-radius: 18px;
}

/* Galaxy: an observatory, orbital navigation and luminous planets. */
body[data-mood="galaxy"] .theme-world.experience {
  min-height: 330px;
  background: #14132e;
  border: 1px solid #555078;
  border-radius: 28px;
  box-shadow: 0 20px 55px #05031366, inset 0 0 50px #9982ff12;
}

body[data-mood="galaxy"] .experience-art {
  inset: 0 0 0 32%;
}

body[data-mood="galaxy"] .experience-art::after {
  background: linear-gradient(90deg, #14132e 0%, #14132eb5 28%, transparent 63%);
}

body[data-mood="galaxy"] .experience-content {
  width: 60%;
  padding: 34px;
}

body[data-mood="galaxy"] .experience-content h2 {
  color: #f7f1ff;
  font-size: clamp(30px, 4vw, 48px);
  max-width: 300px;
}

body[data-mood="galaxy"] .experience-content p {
  color: #b8b1d0;
}

body[data-mood="galaxy"] .experience-label {
  color: #c6b3ff;
}

body[data-mood="galaxy"] .experience-actions {
  gap: 16px;
}

body[data-mood="galaxy"] .experience-actions button {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #ede7ff;
}

body[data-mood="galaxy"] .experience-actions button span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: white;
  font-size: 20px;
  background: radial-gradient(circle at 32% 25%, #e6d1ff, #8b6cdb 53%, #44346d);
  border: 1px solid #d2baff;
  box-shadow: 0 0 18px #b493ff55;
}

body[data-mood="galaxy"] .experience-actions button:nth-child(2) span {
  background: radial-gradient(circle at 30% 25%, #f9d5df, #cb759c 55%, #713b79);
}

body[data-mood="galaxy"] .experience-actions button:nth-child(3) span {
  background: radial-gradient(circle at 30% 25%, #c0f6f2, #5c9eb8 55%, #354985);
}

body[data-mood="galaxy"] #todayView section {
  border-radius: 24px !important;
  box-shadow: inset 0 1px #ffffff12, 0 8px 30px #05031555;
}

body[data-mood="galaxy"] .sidebar-link.active {
  border-radius: 999px;
  box-shadow: inset 0 0 16px #a78bfa1c;
}

body[data-mood="galaxy"] .experience-signature {
  color: #ddd0ff;
}

/* Waterfall and natural landscapes: layered scenery, soft stone and leaf forms. */
body[data-mood="waterfall"] .theme-world.experience {
  min-height: 315px;
  border-radius: 28px;
  border: 1px solid #c0ded6;
  background: #e8f5ed;
}

body[data-mood="waterfall"] .experience-art {
  inset: 0 0 0 34%;
}

body[data-mood="waterfall"] .experience-art::after {
  background: linear-gradient(90deg, #e8f5ed 0%, #e8f5ed9e 22%, transparent 58%);
}

body[data-mood="waterfall"] .experience-content {
  padding: 38px;
  width: 57%;
}

body[data-mood="waterfall"] .experience-content h2 {
  color: #275f59;
  font-size: clamp(32px, 4vw, 49px);
}

body[data-mood="waterfall"] .experience-content p {
  color: #5f8179;
}

body[data-mood="waterfall"] .experience-actions button {
  border-radius: 999px;
  color: #285e59;
  border-color: #a9d4cc;
  background: #f4fbf5e8;
}

body[data-mood="waterfall"] #todayView section {
  border-radius: 22px !important;
  box-shadow: 0 10px 30px #2d787011;
}

body[data-world-family="nature"] .experience {
  border-radius: 30px 8px 30px 8px;
  background: linear-gradient(120deg, #f8fbec, #d9ead4);
}

body[data-world-family="nature"] .experience-actions button {
  border-radius: 18px 4px 18px 4px;
}

body[data-world-family="nature"] #todayView section {
  border-radius: 22px 7px 22px 7px !important;
}

body[data-world-family="water"] .experience-actions button,
body[data-world-family="land"] .experience-actions button {
  border-radius: 999px;
}

/* Other families each have their own control and surface vocabulary. */
body[data-world-family="arcade"] .experience,
body[data-world-family="tiles"] .experience {
  border: 3px solid var(--color-primary);
  border-radius: 0;
  box-shadow: 6px 6px 0 color-mix(in srgb, var(--color-primary) 50%, transparent);
}

body[data-world-family="arcade"] .experience-actions button,
body[data-world-family="tiles"] .experience-actions button {
  border: 2px solid var(--color-primary);
  border-radius: 0;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

body[data-world-family="arcade"] #todayView section,
body[data-world-family="tiles"] #todayView section {
  border-radius: 3px !important;
}

body[data-world-family="tech"] .experience,
body[data-world-family="science"] .experience {
  border-radius: 3px;
  background-image: linear-gradient(var(--color-line) 1px, transparent 1px), linear-gradient(90deg, var(--color-line) 1px, transparent 1px);
  background-size: 24px 24px;
}

body[data-world-family="tech"] .experience-actions button,
body[data-world-family="science"] .experience-actions button {
  border-radius: 2px;
  font-family: var(--font-mono);
}

body[data-world-family="tech"] #todayView section,
body[data-world-family="science"] #todayView section {
  border-radius: 3px !important;
}

body[data-world-family="paper"] .experience {
  border-radius: 2px;
  border-top: 5px solid var(--color-primary);
  box-shadow: 4px 5px 0 var(--color-line);
}

body[data-world-family="paper"] .experience-content h2 {
  font-family: Georgia, serif;
  letter-spacing: -.035em;
}

body[data-world-family="paper"] .experience-actions button {
  border-radius: 2px;
}

body[data-world-family="retro"] .experience {
  border: 4px double var(--color-primary);
  border-radius: 8px;
}

body[data-world-family="retro"] .experience-actions button {
  border: 2px solid var(--color-primary);
  border-radius: 4px;
  box-shadow: 3px 3px 0 var(--color-primary);
}

body[data-world-family="transit"] .experience {
  border-radius: 8px;
  border-bottom: 8px solid var(--color-primary);
}

body[data-world-family="transit"] .experience-actions button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

body[data-world-family="hero"] .experience,
body[data-world-family="horror"] .experience {
  border-radius: 2px 30px 2px 30px;
  border-left: 6px solid var(--color-primary);
}

body[data-world-family="hero"] .experience-actions button,
body[data-world-family="horror"] .experience-actions button {
  border-radius: 2px 12px 2px 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

body[data-world-family="abstract"] .experience {
  border-radius: 36px 8px 36px 8px;
}

body[data-world-family="abstract"] .experience-actions button {
  border-radius: 999px;
}

body[data-world-family="care"] .experience-actions button {
  border-radius: 18px;
}

body[data-world-family="minimal"] .experience,
body[data-world-family="textonly"] .experience,
body[data-world-family="micro"] .experience {
  border-radius: 0;
  box-shadow: none;
  border-width: 0 0 1px;
}

body[data-world-family="textonly"] .experience-art,
body[data-world-family="micro"] .experience-art {
  display: none;
}

@media(max-width:640px) {
  .theme-world.experience {
    min-height: 270px;
  }

  .experience-art {
    inset: 0 0 0 30%;
    opacity: .7;
  }

  .experience-content,
  body[data-mood="anime"] .experience-content,
  body[data-mood="galaxy"] .experience-content,
  body[data-mood="waterfall"] .experience-content {
    width: 78%;
    padding: 26px 20px;
  }

  .experience-content h2 {
    font-size: 30px !important;
  }

  body[data-mood="anime"] .theme-world.experience,
  body[data-mood="galaxy"] .theme-world.experience,
  body[data-mood="waterfall"] .theme-world.experience {
    min-height: 300px;
  }

  body[data-mood="anime"] .experience-art,
  body[data-mood="galaxy"] .experience-art,
  body[data-mood="waterfall"] .experience-art {
    inset: 0 0 0 20%;
  }

  body[data-mood="anime"] .experience-art::after {
    background: linear-gradient(90deg, #fff0f7 5%, #fff0f7cc 45%, transparent 100%);
  }

  body[data-mood="galaxy"] .experience-art::after {
    background: linear-gradient(90deg, #14132e 5%, #14132ebd 45%, transparent 100%);
  }

  body[data-mood="waterfall"] .experience-art::after {
    background: linear-gradient(90deg, #e8f5ed 5%, #e8f5edbd 45%, transparent 100%);
  }

  .experience-signature {
    display: none;
  }
}

@media(prefers-reduced-motion:reduce) {
  .experience-actions button {
    transition: none;
  }
}

/* Shared finishing touches: calmer hierarchy, clearer surfaces, and responsive rhythm. */
body {
  background-image: radial-gradient(ellipse at 50% -18%, color-mix(in srgb, var(--color-primary) 7%, transparent), transparent 48%);
  background-attachment: fixed;
}

body > .min-h-screen > main > header {
  background-color: color-mix(in srgb, var(--color-bg) 88%, white) !important;
  border-color: color-mix(in srgb, var(--color-line) 84%, transparent) !important;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--color-text) 2%, transparent);
}

/* Mixed towards `white`, which is right for a light theme and wrong for every dark
   one: night's sidebar came out at rgb(94,101,98) and its own muted text measured
   2.6:1 against it. Mixing towards the surface token keeps both cases correct. */
body > .min-h-screen > aside {
  background-color: color-mix(in srgb, var(--color-bg) 72%, var(--color-surface)) !important;
  border-color: var(--color-line) !important;
}

#workspace {
  max-width: 1240px !important;
  padding-top: clamp(1.25rem, 3vw, 2rem) !important;
}

#todayView > div:first-child h1 {
  line-height: 1.12;
  letter-spacing: -.055em;
}

#todayView > div:nth-child(2) > div {
  position: relative;
  overflow: hidden;
  min-height: 105px;
  border-color: color-mix(in srgb, var(--color-line) 84%, transparent) !important;
  border-radius: 15px !important;
  background: color-mix(in srgb, var(--color-surface) 96%, var(--color-accent)) !important;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--color-text) 4%, transparent);
}

#todayView > div:nth-child(2) > div::after {
  content: '';
  position: absolute;
  width: 62px;
  height: 62px;
  right: -24px;
  bottom: -32px;
  border: 1px solid color-mix(in srgb, var(--color-primary) 11%, transparent);
  border-radius: 50%;
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--color-primary) 3%, transparent), 0 0 0 19px color-mix(in srgb, var(--color-primary) 2%, transparent);
  pointer-events: none;
}

#todayView > div:nth-child(2) > div > div:nth-child(2) {
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -.055em;
}

#todayView section.rounded-\[15px\] {
  border-color: color-mix(in srgb, var(--color-line) 88%, transparent) !important;
  border-radius: 16px !important;
  background-color: var(--color-surface);
  box-shadow: 0 5px 20px color-mix(in srgb, var(--color-text) 3%, transparent);
}

#todayView section.rounded-\[15px\] > div:first-child {
  min-height: 58px;
}

#todayView .decision-row {
  transition: background-color 170ms ease, padding-left 170ms ease;
}

#todayView .decision-row:hover {
  padding-left: 1.15rem;
  background-color: color-mix(in srgb, var(--color-accent) 45%, var(--color-surface));
}

#todayView #taskList label {
  border-color: color-mix(in srgb, var(--color-line) 70%, transparent);
  transition: opacity 160ms ease, background-color 160ms ease;
}

#todayView #taskList label:has(input:checked) {
  opacity: .58;
}

#todayView #taskList label:has(input:checked) > span:first-of-type {
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--color-muted) 55%, transparent);
}

#todayView aside section {
  border-color: color-mix(in srgb, var(--color-line) 88%, transparent) !important;
}

#todayView textarea,
#workspace input:not([type="checkbox"]),
#workspace select {
  border-radius: 10px;
}

#searchBtn {
  border-color: var(--color-line) !important;
  background-color: color-mix(in srgb, var(--color-surface) 94%, var(--color-bg)) !important;
}

#searchBtn:hover {
  box-shadow: 0 3px 12px color-mix(in srgb, var(--color-text) 6%, transparent);
}

#todayView button:not(.experience-actions button),
#alternateView button {
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.mobile-dock {
  box-shadow: 0 -8px 28px color-mix(in srgb, var(--color-text) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-line) 90%, transparent) !important;
}

@media (max-width: 639px) {
  #workspace {
    padding-top: 1rem !important;
    padding-bottom: 6rem !important;
  }

  #todayView > div:first-child {
    margin-bottom: 1rem !important;
  }

  #todayView > div:nth-child(2) > div {
    min-height: 94px;
    padding: .72rem .75rem;
  }

  #todayView > div:nth-child(2) > div > div:nth-child(2) {
    font-size: 1.25rem;
  }

  #todayView > div:nth-child(2) > div > div:last-child {
    max-width: 19ch;
    line-height: 1.45;
  }

  #todayView > div:nth-child(3) {
    gap: .8rem;
  }

  #todayView > div:nth-child(3) > div,
  #todayView > div:nth-child(3) > aside {
    gap: .8rem !important;
  }

  #todayView section.rounded-\[15px\] > div:first-child {
    align-items: flex-start;
    gap: .6rem;
  }

  .mobile-dock {
    padding-top: .5rem;
    padding-bottom: max(.55rem, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  #todayView *,
  #workspace *,
  .mobile-dock * {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* Keep narrow previews and small screens from cropping content. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

main,
#workspace,
#todayView,
#alternateView {
  min-width: 0;
  max-width: 100%;
}

#todayView :is(h1, h2, h3, p, span, button),
#alternateView :is(h1, h2, h3, p, span, button) {
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .theme-world.experience {
    height: auto;
    min-height: 300px;
    overflow: hidden;
  }

  .experience-art,
  body[data-mood="anime"] .experience-art,
  body[data-mood="galaxy"] .experience-art,
  body[data-mood="waterfall"] .experience-art {
    inset: 0;
    opacity: .36;
  }

  .experience-content,
  body[data-mood="anime"] .experience-content,
  body[data-mood="galaxy"] .experience-content,
  body[data-mood="waterfall"] .experience-content {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 26px 20px;
  }

  .experience-content p {
    max-width: min(300px, 100%);
  }

  .experience-actions {
    max-width: 100%;
    gap: 8px 12px;
  }

  #todayView section.rounded-\[15px\] > div:first-child {
    flex-wrap: wrap;
  }

  #todayView section.rounded-\[15px\] > div:first-child > :first-child {
    min-width: 0;
  }
}

@media (max-width: 360px) {
  #workspace {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .experience-content,
  body[data-mood="anime"] .experience-content,
  body[data-mood="galaxy"] .experience-content,
  body[data-mood="waterfall"] .experience-content {
    padding: 24px 16px;
  }

  .experience-content h2 {
    font-size: 27px !important;
  }
}

/* Extra-tight iframe previews: keep the theme hero and actions inside their card. */
@media (max-width: 390px) {
  .theme-world.experience {
    min-height: 286px;
    max-width: 100%;
  }

  .experience-content,
  body[data-mood="anime"] .experience-content,
  body[data-mood="galaxy"] .experience-content,
  body[data-mood="waterfall"] .experience-content {
    padding: 24px 16px;
  }

  .experience-content h2 {
    max-width: 100%;
    font-size: clamp(25px, 8vw, 30px) !important;
    overflow-wrap: anywhere;
  }

  .experience-content p {
    font-size: 11px;
  }

  .experience-actions {
    gap: 7px 10px;
  }

  body[data-mood="galaxy"] .experience-actions {
    gap: 10px;
  }

  body[data-mood="galaxy"] .experience-actions button span {
    width: 40px;
    height: 40px;
  }
}

/* Full-screen surfaces and overlays size against the preview viewport itself. */
html,
body {
  width: 100%;
  min-width: 0;
}

#modal,
#toast {
  max-width: 100vw;
}
