:root {
  --ink: #24342f;
  --muted: #63756e;
  --paper: #fbfdf9;
  --cream: #f5f1e7;
  --sage-050: #f0f7f2;
  --sage-100: #e0efe4;
  --sage-300: #afd1ba;
  --sage-500: #5e9273;
  --sage-700: #38664e;
  --blue-100: #e3f3f4;
  --blue-300: #a8d6d9;
  --blue-600: #4f8f96;
  --amber: #e5ad62;
  --clay: #bb765b;
  --shadow: 0 18px 50px rgba(45, 76, 63, 0.14);
  --soft-shadow: 0 10px 28px rgba(45, 76, 63, 0.1);
  --radius: 24px;
  --font: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: #edf6f0;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(79, 143, 150, 0.45);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-150%);
  border-radius: 12px;
  color: white;
  background: var(--sage-700);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(1500px, calc(100% - 28px));
  min-height: calc(100vh - 28px);
  margin: 14px auto 110px;
  overflow: hidden;
  border: 1px solid rgba(56, 102, 78, 0.12);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: 0 20px 70px rgba(50, 81, 67, 0.08);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  min-height: 84px;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(56, 102, 78, 0.09);
  background: rgba(251, 253, 249, 0.94);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 15px 18px 14px 20px;
  color: white;
  background: var(--sage-700);
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  transform: rotate(-3deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: var(--sage-050);
}

.nav-pill {
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.nav-pill.is-active,
.nav-pill:hover {
  background: white;
  box-shadow: 0 3px 12px rgba(45, 76, 63, 0.09);
}

.profile {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.connection-dot.is-live {
  background: var(--sage-500);
}

.profile-button {
  width: 40px;
  height: 40px;
  margin-left: 8px;
  border: 1px solid rgba(56, 102, 78, 0.12);
  border-radius: 50%;
  background: var(--sage-100);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.welcome {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 38px clamp(24px, 5vw, 74px) 26px;
}

.eyebrow {
  display: block;
  margin-bottom: 9px;
  color: var(--sage-700);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.welcome h1,
.resource-strip h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.welcome h1 {
  font-size: clamp(34px, 4.5vw, 58px);
}

.welcome p {
  max-width: 650px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.calm-control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px 9px 14px;
  border: 1px solid rgba(56, 102, 78, 0.12);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 11px;
}

.view-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.ambient-control {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 148px;
  padding: 7px 9px 7px 8px;
  border: 1px solid rgba(56, 102, 78, 0.12);
  border-radius: 999px;
  text-align: left;
  background: white;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.ambient-control:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 18px rgba(45, 76, 63, 0.1);
}

.ambient-icon {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #8a6a32;
  background: #f7e8bd;
  font-size: 15px;
}

.ambient-copy {
  min-width: 0;
}

.ambient-copy small,
.ambient-copy strong {
  display: block;
}

.ambient-copy small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.ambient-copy strong {
  margin-top: 1px;
  font-size: 10px;
  white-space: nowrap;
}

.ambient-cycle {
  margin-left: auto;
  color: var(--sage-500);
  font-size: 13px;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #b9c7c0;
  cursor: pointer;
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  transition: transform 180ms ease;
}

.switch.is-on {
  background: var(--sage-500);
}

.switch.is-on span {
  transform: translateX(16px);
}

.world {
  --ambient-shadow: rgba(51, 111, 103, 0.12);
  --contact-shadow: rgba(45, 68, 52, 0.3);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px minmax(0, 1fr);
  gap: 8px;
  min-height: 760px;
  margin: 0 clamp(14px, 3vw, 42px);
  padding: 34px 26px 88px;
  overflow: hidden;
  border-radius: 28px;
  background: linear-gradient(180deg, #dff2f2 0%, #d8eff0 52%, #cde8e8 100%);
  isolation: isolate;
  transition: background 650ms ease, box-shadow 650ms ease;
}

.world::before {
  position: absolute;
  z-index: -1;
  top: -140px;
  right: 5%;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 246, 194, 0.58), rgba(255, 246, 194, 0) 68%);
  content: "";
  pointer-events: none;
  transition: top 650ms ease, right 650ms ease, background 650ms ease, opacity 650ms ease;
}

.world[data-ambient="golden"] {
  --ambient-shadow: rgba(113, 76, 51, 0.18);
  --contact-shadow: rgba(93, 61, 43, 0.38);
  background: linear-gradient(180deg, #f1d9bd 0%, #e8cdb6 48%, #b9d6d1 100%);
  box-shadow: inset 0 0 90px rgba(223, 151, 96, 0.12);
}

.world[data-ambient="golden"]::before {
  top: 22%;
  right: 72%;
  background: radial-gradient(circle, rgba(255, 198, 112, 0.72), rgba(255, 198, 112, 0) 68%);
}

.world[data-ambient="evening"] {
  --ambient-shadow: rgba(24, 43, 61, 0.32);
  --contact-shadow: rgba(19, 32, 47, 0.5);
  background: linear-gradient(180deg, #607b91 0%, #7893a1 46%, #6f9da0 100%);
  box-shadow: inset 0 -120px 120px rgba(22, 51, 66, 0.14);
}

.world[data-ambient="evening"]::before {
  top: -100px;
  right: 12%;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(242, 239, 205, 0.52), rgba(212, 226, 224, 0) 66%);
}

.world::after {
  position: absolute;
  z-index: -1;
  right: -8%;
  bottom: -26%;
  left: -8%;
  height: 45%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  content: "";
  transition: background 650ms ease, opacity 650ms ease;
}

.world[data-ambient="golden"]::after {
  background: rgba(255, 226, 195, 0.2);
}

.world[data-ambient="evening"]::after {
  background: rgba(184, 224, 218, 0.14);
}

.water-shape {
  position: absolute;
  z-index: -1;
  width: 180px;
  height: 70px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
}

.water-shape-one {
  top: 78px;
  left: 40%;
  transform: rotate(-8deg);
}

.water-shape-two {
  right: 8%;
  bottom: 60px;
  transform: rotate(12deg);
}

.cloud {
  position: absolute;
  z-index: 0;
  width: 62px;
  height: 17px;
  border-radius: 50px;
  background: rgba(255, 255, 255, 0.62);
  filter: blur(0.2px);
  transition: background 650ms ease, opacity 650ms ease, transform 650ms ease;
}

.world[data-ambient="golden"] .cloud {
  background: rgba(255, 235, 218, 0.58);
}

.world[data-ambient="evening"] .cloud {
  background: rgba(217, 229, 230, 0.28);
}

.cloud::before,
.cloud::after {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: inherit;
  content: "";
}

.cloud::before {
  left: 11px;
  width: 25px;
  height: 25px;
}

.cloud::after {
  right: 7px;
  width: 18px;
  height: 18px;
}

.cloud-one {
  top: 50px;
  left: 23%;
}

.cloud-two {
  top: 96px;
  right: 18%;
  transform: scale(0.75);
}

.island {
  position: relative;
  z-index: 2;
  align-self: center;
  height: 570px;
  isolation: isolate;
  transition: transform 250ms ease, filter 250ms ease;
}

.island::before,
.island::after {
  position: absolute;
  z-index: 0;
  border: 8px solid #f7e2a5;
  background: #a8ce78;
  box-shadow: 0 8px 0 rgba(71, 130, 127, 0.18), 0 14px 22px rgba(51, 111, 103, 0.1);
  content: "";
  pointer-events: none;
}

.island-autism::before {
  bottom: 58px;
  left: -18px;
  width: 84px;
  height: 59px;
  border-radius: 64% 36% 58% 42% / 52% 63% 37% 48%;
  background:
    radial-gradient(circle at 35% 35%, #d9c6e7 0 5px, transparent 6px),
    #a9cf7f;
  transform: rotate(-14deg);
}

.island-autism::after {
  bottom: 41px;
  left: 20%;
  width: 38px;
  height: 27px;
  border-width: 6px;
  border-radius: 48% 52% 65% 35% / 55% 42% 58% 45%;
  background: #c4d99a;
  transform: rotate(12deg);
}

.island-adhd::before {
  top: 108px;
  right: -18px;
  width: 92px;
  height: 70px;
  border-color: #f2d58b;
  border-radius: 39% 61% 48% 52% / 68% 40% 60% 32%;
  background:
    radial-gradient(circle at 64% 32%, #e9b66e 0 7px, transparent 8px),
    #b5d77b;
  transform: rotate(16deg);
}

.island-adhd::after {
  right: 13%;
  bottom: 27px;
  width: 53px;
  height: 35px;
  border-width: 6px;
  border-color: #f2d58b;
  border-radius: 65% 35% 42% 58% / 45% 63% 37% 55%;
  background: #c8dc80;
  transform: rotate(-8deg);
}

.island.is-selected {
  transform: translateY(-7px);
  filter: drop-shadow(0 14px 12px rgba(46, 84, 70, 0.12));
}

.island-heading {
  position: absolute;
  z-index: 8;
  top: -5px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  padding: 10px 17px 10px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(56, 102, 78, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--soft-shadow);
}

.island-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  color: var(--sage-700);
  background: var(--sage-100);
  font-size: 21px;
}

.island-adhd .island-icon {
  color: #8d6734;
  background: #f7e9c8;
}

.island-heading small,
.island-heading h2 {
  display: block;
  margin: 0;
}

.island-heading small {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.island-heading h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  font-weight: 500;
}

.land {
  position: absolute;
  z-index: 1;
  overflow: hidden;
  border: 11px solid #f7e2a5;
  background:
    radial-gradient(circle at 18% 25%, rgba(255, 255, 255, 0.25) 0 2px, transparent 3px),
    linear-gradient(145deg, #b9d77b, #91bf67 75%);
  box-shadow:
    0 8px 0 rgba(71, 130, 127, 0.22),
    0 15px 24px var(--ambient-shadow);
  transition: filter 650ms ease, box-shadow 650ms ease;
}

.world[data-ambient="golden"] .land {
  filter: saturate(0.94) sepia(0.06) brightness(1.02);
}

.world[data-ambient="evening"] .land {
  filter: saturate(0.82) brightness(0.82) hue-rotate(4deg);
}

.island-autism .land {
  inset: 86px -2% 34px 1%;
  border-radius: 33% 67% 43% 57% / 57% 39% 61% 43%;
  background:
    radial-gradient(ellipse at 18% 72%, rgba(214, 191, 229, 0.62) 0 11%, transparent 11.5%),
    radial-gradient(ellipse at 74% 18%, rgba(238, 229, 173, 0.55) 0 12%, transparent 12.5%),
    radial-gradient(circle at 18% 25%, rgba(255, 255, 255, 0.28) 0 2px, transparent 3px),
    linear-gradient(145deg, #b9d991, #91bd71 78%);
  transform: rotate(-2.5deg);
}

.island-adhd .land {
  inset: 56px 7% 10px -2%;
  border-radius: 65% 35% 29% 71% / 37% 64% 36% 63%;
  background:
    radial-gradient(circle at 18% 25%, rgba(112, 171, 172, 0.18) 0 4%, transparent 4.5%),
    radial-gradient(circle at 78% 70%, rgba(232, 181, 98, 0.25) 0 10%, transparent 10.5%),
    radial-gradient(circle at 75% 22%, rgba(255, 255, 255, 0.27) 0 2px, transparent 3px),
    linear-gradient(145deg, #c8df7e, #8fc06c 78%);
  transform: rotate(3deg);
}

.terrain {
  position: absolute;
  z-index: 1;
  display: block;
  pointer-events: none;
}

.autism-pond {
  top: 35%;
  left: 10%;
  width: 23%;
  height: 15%;
  border: 6px solid rgba(239, 224, 183, 0.78);
  border-radius: 61% 39% 58% 42% / 47% 64% 36% 53%;
  background:
    radial-gradient(circle at 62% 39%, rgba(255, 255, 255, 0.6) 0 3px, transparent 4px),
    linear-gradient(145deg, #b5dedb, #82c5c5);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.17);
  transform: rotate(-9deg);
}

.autism-meadow {
  right: 10%;
  bottom: 11%;
  width: 25%;
  height: 17%;
  border-radius: 50% 43% 55% 40%;
  background:
    radial-gradient(circle, #f7e6aa 0 2px, transparent 2.5px) 2px 3px / 18px 18px,
    radial-gradient(circle, #d5b8e1 0 2px, transparent 2.5px) 10px 9px / 20px 20px,
    rgba(113, 156, 87, 0.34);
  transform: rotate(7deg);
}

.autism-pebble-garden {
  top: 24%;
  right: 28%;
  width: 16%;
  height: 10%;
  border: 4px solid rgba(239, 224, 183, 0.68);
  border-radius: 58% 42% 50% 50%;
  background:
    radial-gradient(ellipse, #c9c6b6 0 5px, transparent 5.5px) 0 0 / 22px 15px,
    #e6dfc7;
  transform: rotate(5deg);
}

.autism-grove {
  bottom: 16%;
  left: 37%;
  width: 18%;
  height: 12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 15% 55%, #3f7750 0 8px, transparent 8.5px),
    radial-gradient(circle at 45% 28%, #4c8658 0 10px, transparent 10.5px),
    radial-gradient(circle at 76% 62%, #3f7750 0 9px, transparent 9.5px),
    rgba(60, 112, 71, 0.12);
}

.autism-cove {
  right: -9%;
  bottom: 28%;
  width: 31%;
  height: 23%;
  border: 7px solid rgba(242, 222, 171, 0.88);
  border-right: 0;
  border-radius: 58% 0 0 54% / 50% 0 0 50%;
  background:
    repeating-radial-gradient(ellipse at 85% 50%, rgba(255, 255, 255, 0.24) 0 2px, transparent 3px 12px),
    #a8d7d5;
  transform: rotate(-5deg);
}

.adhd-stream {
  top: 45%;
  left: 5%;
  width: 82%;
  height: 12%;
  border: 5px solid rgba(242, 218, 156, 0.76);
  border-radius: 62% 38% 55% 45% / 36% 60% 40% 64%;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 12px, transparent 12px 28px),
    #83c8c7;
  transform: rotate(13deg);
}

.adhd-sun-court {
  top: 20%;
  right: 18%;
  width: 17%;
  aspect-ratio: 1;
  border: 6px solid rgba(249, 231, 177, 0.82);
  border-radius: 50%;
  background: repeating-conic-gradient(from 10deg, #e6b56a 0 13deg, #f2d98e 13deg 26deg);
  box-shadow: inset 0 0 0 10px rgba(255, 248, 220, 0.42);
  transform: rotate(-8deg);
}

.adhd-color-steps {
  bottom: 18%;
  left: 12%;
  width: 29%;
  height: 10%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 12% 50%, #d98568 0 8px, transparent 8.5px),
    radial-gradient(circle at 34% 50%, #e7bd64 0 8px, transparent 8.5px),
    radial-gradient(circle at 56% 50%, #6fa5a7 0 8px, transparent 8.5px),
    radial-gradient(circle at 78% 50%, #d7a0a2 0 8px, transparent 8.5px),
    rgba(255, 255, 255, 0.16);
  transform: rotate(-8deg);
}

.adhd-orchard {
  top: 27%;
  left: 31%;
  width: 19%;
  height: 12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 16% 60%, #397a4b 0 8px, transparent 8.5px),
    radial-gradient(circle at 48% 26%, #4b8855 0 10px, transparent 10.5px),
    radial-gradient(circle at 81% 62%, #397a4b 0 9px, transparent 9.5px),
    rgba(60, 112, 71, 0.1);
}

.adhd-deck {
  right: 4%;
  bottom: 25%;
  width: 22%;
  height: 8%;
  border: 3px solid rgba(119, 87, 55, 0.45);
  border-radius: 9px;
  background: repeating-linear-gradient(90deg, #d2a66f 0 9px, #bc8e59 9px 11px);
  transform: rotate(8deg);
}

.path {
  position: absolute;
  z-index: 2;
  width: 60%;
  height: 42%;
  border: 26px solid transparent;
  border-top-color: rgba(248, 226, 165, 0.78);
  border-radius: 50%;
}

.path-a {
  top: 55%;
  left: 20%;
  width: 54%;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #ead69c 0 24px, transparent 24px 35px);
  transform: rotate(9deg);
}

.path-b {
  top: 36%;
  left: 24%;
  width: 50%;
  height: 42%;
  border: 18px solid rgba(244, 220, 151, 0.78);
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-22deg);
}

.tree {
  position: absolute;
  z-index: 2;
  width: 13px;
  height: 24px;
  border-radius: 10px 10px 6px 6px;
  background: #437d50;
  box-shadow: inset -4px 0 rgba(31, 95, 58, 0.2);
}

.tree::after {
  position: absolute;
  bottom: -7px;
  left: 5px;
  width: 3px;
  height: 9px;
  background: #7d6949;
  content: "";
}

.tree-a { top: 20%; left: 18%; transform: scale(0.8); }
.tree-b { top: 39%; right: 13%; transform: scale(1.1); }
.tree-c { bottom: 18%; left: 15%; }
.tree-d { top: 17%; right: 15%; transform: scale(0.9); }
.tree-e { top: 46%; left: 13%; transform: scale(1.1); }
.tree-f { right: 19%; bottom: 14%; }

.stone {
  position: absolute;
  width: 12px;
  height: 8px;
  border-radius: 50%;
  background: #cbd3bd;
}

.stone-a { top: 17%; right: 27%; }
.stone-b { right: 19%; bottom: 18%; }
.stone-c { top: 30%; left: 26%; }
.stone-d { right: 25%; bottom: 27%; }

.building {
  position: absolute;
  z-index: 6;
  display: grid;
  justify-items: center;
  width: 126px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 8px 7px rgba(45, 76, 63, 0.15));
  transition: transform 180ms ease, filter 180ms ease;
}

.building-visual {
  position: relative;
  overflow: visible;
  isolation: isolate;
}

.building-visual::before,
.building-visual::after {
  position: absolute;
  left: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.building-visual::before {
  z-index: 0;
  bottom: 1px;
  width: 88%;
  height: 19px;
  background: radial-gradient(ellipse, var(--contact-shadow) 0%, rgba(45, 68, 52, 0.13) 45%, transparent 74%);
  filter: blur(1.5px);
}

.building-visual::after {
  z-index: 1;
  bottom: 4px;
  width: 76%;
  height: 13px;
  border: 2px solid rgba(238, 217, 163, 0.78);
  background: #9bc176;
  box-shadow: inset 0 -3px 0 rgba(63, 116, 74, 0.12);
}

.island-adhd .building-visual::after {
  border-color: rgba(242, 213, 139, 0.82);
  background: #a8cd70;
}

.building:hover,
.building.is-selected {
  z-index: 12;
  transform: translateY(-7px) scale(1.035);
  filter: drop-shadow(0 14px 10px rgba(45, 76, 63, 0.22));
}

.building.is-selected {
  --label-border: var(--sage-500);
}

.building-visual {
  display: block;
  width: 122px;
  height: 78px;
  margin-bottom: -7px;
  overflow: hidden;
  pointer-events: none;
}

.building .building-visual > img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: translateY(3px);
  transform-origin: center bottom;
  transition: filter 650ms ease, transform 180ms ease;
}

.world[data-ambient="golden"] .building .building-visual > img {
  filter: sepia(0.06) saturate(0.94) drop-shadow(-3px 4px 4px rgba(99, 61, 37, 0.16));
}

.world[data-ambient="evening"] .building .building-visual > img {
  filter: brightness(0.8) saturate(0.86) drop-shadow(0 0 4px rgba(255, 205, 120, 0.3));
}

.building-label {
  display: grid;
  width: 100%;
  min-height: 43px;
  align-content: center;
  padding: 6px 7px 7px;
  border: 1px solid var(--label-border, rgba(56, 102, 78, 0.13));
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 3px 9px rgba(45, 76, 63, 0.1);
}

.world[data-ambient="evening"] .building-label,
.world[data-ambient="evening"] .island-heading,
.world[data-ambient="evening"] .village-note {
  border-color: rgba(214, 230, 223, 0.25);
  background: rgba(245, 248, 240, 0.9);
}

.building-label strong,
.building-label small {
  display: block;
  text-align: center;
}

.building-label strong {
  font-size: 9.5px;
  line-height: 1.2;
}

.building-label small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 6.5px;
  line-height: 1.2;
}

.building-sensory,
.building-focus { top: 124px; left: 7%; }
.building-communication,
.building-energy { top: 132px; right: 6%; }
.building-routines,
.building-planning { top: 270px; left: 50%; transform: translateX(-50%); }
.building-routines:hover,
.building-routines.is-selected,
.building-planning:hover,
.building-planning.is-selected { transform: translateX(-50%) translateY(-7px) scale(1.035); }
.building-learning { bottom: 31px; left: 9%; }
.building-legal { right: 8%; bottom: 26px; }

.bridge {
  position: relative;
  z-index: 3;
  display: flex;
  align-self: center;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-top: 46px;
  transform: perspective(90px) rotateX(12deg);
}

.bridge::before,
.bridge::after {
  position: absolute;
  right: 0;
  left: 0;
  height: 2px;
  background: #84694f;
  content: "";
}

.bridge::before { top: 5px; }
.bridge::after { bottom: 5px; }

.bridge span {
  width: 13px;
  height: 38px;
  border-radius: 3px;
  background: #d0a873;
  box-shadow: inset -2px 0 rgba(98, 73, 49, 0.12);
}

.village-note {
  position: absolute;
  z-index: 8;
  bottom: 20px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  width: min(560px, calc(100% - 38px));
  padding: 11px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(56, 102, 78, 0.11);
  border-radius: 16px;
  background: rgba(250, 253, 249, 0.88);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(8px);
}

.village-note > span {
  display: grid;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  place-items: center;
  border-radius: 50%;
  color: var(--sage-700);
  background: var(--sage-100);
}

.village-note p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.village-note strong {
  color: var(--ink);
}

.resource-strip {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  gap: 12px;
  align-items: stretch;
  padding: 34px clamp(24px, 5vw, 74px) 48px;
}

.resource-strip > div {
  align-self: center;
  padding-right: 18px;
}

.resource-strip h2 {
  max-width: 240px;
  font-size: 28px;
}

.resource-card {
  display: grid;
  min-height: 130px;
  padding: 17px;
  border: 1px solid rgba(56, 102, 78, 0.11);
  border-radius: 20px;
  text-align: left;
  background: white;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.resource-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--soft-shadow);
}

.resource-card > span {
  color: var(--sage-500);
  font-family: Georgia, serif;
  font-size: 24px;
}

.resource-card strong {
  align-self: end;
  font-size: 13px;
}

.resource-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.agent-launcher {
  position: fixed;
  z-index: 35;
  right: 28px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(340px, calc(100vw - 40px));
  padding: 10px 12px 10px 10px;
  border: 1px solid rgba(56, 102, 78, 0.16);
  border-radius: 22px;
  text-align: left;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 180ms ease;
}

.agent-launcher:hover {
  transform: translateY(-3px);
}

.agent-portrait {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 66px;
  height: 66px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--cream);
}

.agent-portrait img,
.chat-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease, filter 300ms ease;
}

[data-agent-state="thinking"] img {
  transform: scale(1.06) translateY(2px);
  filter: saturate(0.88);
  animation: breathe 1.6s ease-in-out infinite;
}

[data-agent-state="speaking"] img {
  transform: scale(1.04);
}

.agent-status {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 13px;
  height: 13px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--sage-500);
}

.agent-launcher-copy {
  min-width: 0;
}

.agent-launcher-copy small,
.agent-launcher-copy strong {
  display: block;
}

.agent-launcher-copy small {
  margin-bottom: 4px;
  color: var(--sage-700);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.agent-launcher-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.launcher-arrow {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  margin-left: auto;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--sage-700);
}

.chat-panel {
  position: fixed;
  z-index: 50;
  top: 14px;
  right: 14px;
  bottom: 14px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  width: min(440px, calc(100vw - 28px));
  overflow: hidden;
  border: 1px solid rgba(56, 102, 78, 0.14);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: -14px 20px 70px rgba(36, 63, 52, 0.22);
  transform: translateX(calc(100% + 40px));
  visibility: hidden;
  transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1), visibility 280ms;
}

.chat-panel.is-open {
  transform: translateX(0);
  visibility: visible;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 17px 14px;
  border-bottom: 1px solid rgba(56, 102, 78, 0.1);
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.chat-avatar {
  display: block;
  width: 54px;
  height: 54px;
  overflow: hidden;
  border-radius: 16px;
  background: var(--cream);
}

.chat-identity small,
.chat-identity h2,
.chat-identity span span {
  display: block;
}

.chat-identity small {
  color: var(--sage-700);
  font-size: 7px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

.chat-identity h2 {
  margin: 2px 0 1px;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 500;
}

#chat-mode {
  color: var(--muted);
  font-size: 9px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--sage-050);
  cursor: pointer;
  font-size: 22px;
}

.context-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 14px 0;
  padding: 9px 11px;
  border-radius: 13px;
  color: var(--sage-700);
  background: var(--sage-100);
  font-size: 10px;
}

.context-banner button {
  margin-left: auto;
  padding: 4px 7px;
  border: 0;
  border-radius: 8px;
  color: var(--sage-700);
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  font-size: 9px;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 18px 16px;
  scroll-behavior: smooth;
}

.message {
  max-width: 86%;
  padding: 12px 14px;
  border-radius: 17px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message p {
  margin: 0;
}

.message > span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.assistant-message {
  align-self: flex-start;
  border-bottom-left-radius: 5px;
  background: var(--sage-100);
}

.user-message {
  align-self: flex-end;
  border-bottom-right-radius: 5px;
  color: white;
  background: var(--sage-700);
}

.typing-message {
  display: flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
}

.typing-message i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage-500);
  animation: typing 1.2s ease-in-out infinite;
}

.typing-message i:nth-child(2) { animation-delay: 0.15s; }
.typing-message i:nth-child(3) { animation-delay: 0.3s; }

.quick-prompts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 14px 10px;
  scrollbar-width: none;
}

.quick-prompts::-webkit-scrollbar {
  display: none;
}

.quick-prompts button {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(56, 102, 78, 0.14);
  border-radius: 999px;
  background: white;
  cursor: pointer;
  font-size: 9px;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  margin: 0 14px;
  padding: 7px;
  border: 1px solid rgba(56, 102, 78, 0.16);
  border-radius: 18px;
  background: white;
}

.chat-form textarea {
  width: 100%;
  max-height: 120px;
  padding: 9px 8px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  line-height: 1.45;
}

.chat-form textarea::placeholder {
  color: #8b9c95;
}

.chat-form button {
  align-self: end;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--sage-700);
  cursor: pointer;
  font-size: 18px;
}

.chat-form button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.chat-footer {
  margin: 8px 18px 13px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
  text-align: center;
}

.drawer-scrim {
  position: fixed;
  z-index: 45;
  inset: 0;
  background: rgba(35, 54, 47, 0.28);
  backdrop-filter: blur(2px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.motion-soft *,
body.motion-soft *::before,
body.motion-soft *::after {
  animation: none !important;
  scroll-behavior: auto !important;
  transition-duration: 0.01ms !important;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

@keyframes breathe {
  0%, 100% { transform: scale(1.04); }
  50% { transform: scale(1.08); }
}

@media (max-width: 1000px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .topbar nav {
    display: none;
  }

  .world {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 94px;
  }

  .island {
    width: min(620px, 100%);
    margin: 0 auto;
  }

  .bridge {
    display: none;
  }

  .resource-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .resource-strip > div {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    margin: 0 0 112px;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    min-height: 72px;
    padding: 10px 16px;
  }

  .brand small,
  #connection-label,
  .calm-control > span:not(:first-child),
  .ambient-copy {
    display: none;
  }

  .profile-button {
    margin-left: 0;
  }

  .welcome {
    align-items: flex-start;
    padding: 28px 20px 20px;
  }

  .welcome h1 {
    font-size: 38px;
  }

  .calm-control {
    padding-left: 9px;
  }

  .view-controls {
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
  }

  .ambient-control {
    min-width: 0;
    padding: 6px;
  }

  .ambient-cycle {
    display: none;
  }

  .world {
    min-height: 1320px;
    margin: 0 10px;
    padding: 30px 8px 105px;
    border-radius: 22px;
  }

  .island {
    height: 570px;
  }

  .building {
    width: 112px;
  }

  .building-visual {
    width: 108px;
    height: 70px;
  }

  .building-label {
    min-height: 40px;
    padding: 5px 6px 6px;
  }

  .building-label strong { font-size: 8.5px; }
  .building-label small { font-size: 6px; }

  .building-sensory,
  .building-focus { left: 0; }
  .building-communication,
  .building-energy { right: 0; }
  .building-learning { left: 1%; }
  .building-legal { right: 1%; }

  .resource-strip {
    grid-template-columns: 1fr;
    padding: 30px 20px 44px;
  }

  .resource-strip > div {
    grid-column: auto;
  }

  .resource-card {
    min-height: 110px;
  }

  .agent-launcher {
    right: 14px;
    bottom: 13px;
    left: 14px;
    width: auto;
  }

  .chat-panel {
    inset: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
