:root {
  color-scheme: dark;
  --bg: #111318;
  --panel: rgba(255, 249, 239, 0.10);
  --panel-strong: rgba(255, 249, 239, 0.16);
  --text: #fff8eb;
  --muted: #cabfa9;
  --line: rgba(255, 255, 255, 0.13);
  --teal: #74eadb;
  --coral: #ff9f8d;
  --gold: #ffd36f;
  --leaf: #9eeb95;
  --berry: #d693ff;
  --ink: #26242b;
  --side-panel-width: clamp(240px, 19vw, 300px);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(116, 234, 219, 0.22), transparent 28rem),
    radial-gradient(circle at 84% 18%, rgba(255, 159, 141, 0.18), transparent 26rem),
    radial-gradient(circle at 55% 72%, rgba(214, 147, 255, 0.12), transparent 30rem),
    linear-gradient(145deg, #171921, #0d0f14 70%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: var(--side-panel-width) minmax(560px, 1fr) minmax(300px, 340px);
  gap: 14px;
  width: min(1560px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  margin: 16px auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
}

.hud,
.agent {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.hud {
  gap: 14px;
  overflow: hidden;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.9rem, 2.6vw, 2.7rem);
  line-height: 1;
}

.agent-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.agent-status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px var(--gold);
}

.agent-status.online::before {
  background: var(--leaf);
  box-shadow: 0 0 18px var(--leaf);
}

.agent-status.offline::before {
  background: var(--coral);
  box-shadow: 0 0 18px var(--coral);
}

h2 {
  font-size: 1.5rem;
  line-height: 1.1;
}

.meters {
  display: grid;
  gap: 12px;
}

.meters label {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

meter {
  width: 100%;
  height: 12px;
}

meter::-webkit-meter-bar {
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
}

meter::-webkit-meter-optimum-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--leaf));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stat-grid div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stat-grid span {
  display: block;
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-grid small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.15;
}

.inner-life {
  display: grid;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-title .eyebrow {
  margin: 0;
}

.section-title small {
  color: var(--muted);
  font-weight: 750;
  text-align: right;
}

.interest-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.interest-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 750;
}

.interest-list li:nth-child(n+4) {
  display: none;
}

.interest-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interest-list meter {
  height: 10px;
}

.identity-strip {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.identity-strip strong {
  color: var(--text);
  font-size: 0.98rem;
}

.identity-strip span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.life-section,
.memory-section,
.research-feed,
.vault-feed {
  display: none;
}

.life-section {
  display: grid;
  gap: 8px;
}

.life-section > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.life-feed {
  display: grid;
  gap: 8px;
  max-height: 128px;
  overflow: auto;
}

.life-feed article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(214, 147, 255, 0.09);
}

.life-feed strong {
  display: block;
  color: var(--berry);
  font-size: 0.82rem;
}

.life-feed p {
  margin: 5px 0 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.3;
}

.social-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.social-list span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-list small {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.memory-section {
  display: grid;
  gap: 8px;
}

.memory-section > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.memory-graph {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.memory-graph li {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(116, 234, 219, 0.09);
}

.memory-graph span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memory-graph small {
  color: var(--muted);
  font-size: 0.68rem;
}

.research-feed {
  display: grid;
  gap: 8px;
  min-height: 92px;
  max-height: 155px;
  overflow: auto;
}

.research-feed article,
.vault-feed article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.research-feed strong,
.vault-feed strong {
  display: block;
  color: var(--gold);
  font-size: 0.82rem;
}

.research-feed p,
.vault-feed p {
  margin: 5px 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.3;
}

.research-feed small {
  color: var(--muted);
}

.vault-feed {
  display: grid;
  gap: 8px;
  max-height: 132px;
  overflow: auto;
}

.vault-feed strong {
  color: var(--teal);
}

.hud .life-section,
.hud .memory-section,
.hud .research-feed,
.hud .vault-feed {
  display: none;
}

.room-wrap {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 35%),
    rgba(255, 255, 255, 0.04);
  perspective: 1050px;
  overflow: hidden;
}

.room {
  position: relative;
  width: min(100%, 880px);
  height: min(72vh, 640px);
  transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-38deg);
}

.room-presence {
  position: absolute;
  left: 50%;
  top: 8%;
  z-index: 12;
  max-width: min(360px, 72%);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 24, 0.76);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 780;
  line-height: 1.25;
  text-align: center;
  transform: translateX(-50%) rotateZ(38deg) rotateX(-58deg) translateZ(90px);
  opacity: 0;
  pointer-events: none;
}

.mochi-away .room-presence {
  opacity: 1;
}

.wall,
.floor {
  position: absolute;
  z-index: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  backface-visibility: visible;
}

.floor {
  inset: 12%;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(135deg, #3f4944, #20272b);
  background-size: 48px 48px, 48px 48px, auto;
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.35);
  transform-style: preserve-3d;
}

.wall-back {
  left: 12%;
  right: 12%;
  top: 12%;
  height: 42%;
  transform: rotateX(90deg);
  transform-origin: top;
  background: linear-gradient(145deg, #55586a, #313542);
}

.wall-left {
  left: 12%;
  top: 12%;
  bottom: 12%;
  width: 30%;
  transform: rotateY(-90deg);
  transform-origin: left;
  background: linear-gradient(160deg, #395962, #203038);
  opacity: 0.78;
}

.wall-right {
  right: 12%;
  top: 12%;
  bottom: 12%;
  width: 32%;
  transform: rotateY(90deg);
  transform-origin: right;
  background: linear-gradient(160deg, #604845, #302525);
  opacity: 0.82;
}

.window {
  position: absolute;
  top: 18%;
  left: 12%;
  width: 118px;
  height: 84px;
  border: 8px solid rgba(247, 240, 223, 0.20);
  border-radius: 8px;
  background: linear-gradient(180deg, #7dd9ff, #576dd2);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.window span {
  position: absolute;
  right: 14px;
  top: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff1a8;
}

.shelf {
  position: absolute;
  right: 12%;
  top: 28%;
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 0 12px 10px;
  width: 154px;
  height: 58px;
  border-bottom: 8px solid rgba(38, 36, 43, 0.5);
}

.shelf i {
  display: block;
  width: 28px;
  border-radius: 5px 5px 2px 2px;
  background: var(--gold);
}

.shelf i:nth-child(1) { height: 34px; background: var(--teal); }
.shelf i:nth-child(2) { height: 46px; background: var(--coral); }
.shelf i:nth-child(3) { height: 26px; background: var(--leaf); }

.rug {
  position: absolute;
  z-index: 2;
  left: 29%;
  top: 35%;
  width: 42%;
  height: 32%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 201, 107, 0.45), rgba(255, 140, 120, 0.25) 58%, transparent 60%);
  transform: translateZ(2px);
}

.decor {
  opacity: 0;
  pointer-events: none;
  transition: opacity 350ms ease, transform 220ms ease;
}

.decor.is-unlocked {
  opacity: 1;
  pointer-events: auto;
}

.pc-object {
  position: absolute;
  z-index: 3;
  width: 86px;
  height: 64px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, #f7f0df, #9da8ac);
  box-shadow: 0 18px 0 #24262d, 0 28px 30px rgba(0, 0, 0, 0.35);
  transform: translateZ(14px);
  transition: transform 180ms ease, outline-color 180ms ease;
}

.pc-object span {
  position: absolute;
  inset: 12px;
  border-radius: 6px;
  background: var(--ink);
}

.pc-object:hover {
  outline: 3px solid var(--teal);
  transform: translateZ(20px);
}

.browser { left: 16%; top: 24%; }
.files { right: 18%; top: 34%; }
.focus { left: 48%; bottom: 18%; }
.files span { background: #2f5e86; }
.focus span { background: #64455d; }

.pet {
  position: absolute;
  z-index: 20;
  left: 48%;
  top: 48%;
  width: 118px;
  height: 138px;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transform-style: flat;
  transform: translate3d(0, 0, 132px) rotateZ(38deg) rotateX(-58deg);
  transition: left 1.5s ease, top 1.5s ease;
  filter: drop-shadow(0 28px 18px rgba(0, 0, 0, 0.32));
}

.mochi-away .pet {
  opacity: 0;
  pointer-events: none;
}

.pet.is-held {
  cursor: grabbing;
  transition: filter 140ms ease;
  filter: drop-shadow(0 34px 22px rgba(0, 0, 0, 0.38));
}

.pet.is-dragging {
  transition: none;
}

.pet.is-petted .body {
  animation: petSquish 520ms ease;
}

.pet.is-petted .face i {
  top: 14px;
  width: 18px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
  border-top: 4px solid #111217;
  animation: none;
}

.pet.is-petted .face i:first-child { left: 12px; }
.pet.is-petted .face i:nth-child(2) { right: 12px; }

.pet.is-petted .face b {
  bottom: 0;
  width: 32px;
  height: 18px;
  border-bottom: 5px solid #111217;
  border-top: 0;
  animation: smilePop 520ms ease;
}

.pet.is-petted .cheek {
  width: 18px;
  height: 10px;
  background: rgba(255, 111, 139, 0.86);
}

.pet.is-poked .ears {
  animation: headPoke 380ms cubic-bezier(.2, 1.4, .5, 1);
}

.pet.is-poked .face {
  animation: facePoke 380ms cubic-bezier(.2, 1.4, .5, 1);
}

.pet.is-poked .face::before,
.pet.is-poked .face::after {
  content: "";
  position: absolute;
  top: 3px;
  z-index: 3;
  width: 22px;
  height: 4px;
  border-radius: 999px;
  background: #111217;
}

.pet.is-poked .face::before {
  left: 10px;
  transform: rotate(18deg);
}

.pet.is-poked .face::after {
  right: 10px;
  transform: rotate(-18deg);
}

.pet.is-poked .face i {
  top: 12px;
  width: 13px;
  height: 13px;
  border: 3px solid #111217;
  background: rgba(255, 248, 235, 0.92);
  animation: none;
}

.pet.is-poked .face i:first-child { left: 15px; }
.pet.is-poked .face i:nth-child(2) { right: 15px; }

.pet.is-poked .face b {
  bottom: 3px;
  width: 22px;
  height: 10px;
  border-top: 4px solid #111217;
  border-bottom: 0;
}

.pet.is-poked .cheek {
  opacity: 0.35;
}

.ears {
  position: absolute;
  inset: 0;
}

.ears span {
  position: absolute;
  top: 3px;
  width: 42px;
  height: 56px;
  border-radius: 60% 60% 20% 20%;
  background: linear-gradient(160deg, #8df6e6, #34a69a);
  box-shadow: inset 0 0 0 7px rgba(255, 248, 235, 0.18);
}

.ears span:first-child {
  left: 10px;
  transform: rotate(-22deg);
}

.ears span:last-child {
  right: 10px;
  transform: rotate(22deg);
}

.body,
.face {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.body {
  z-index: 1;
  bottom: 0;
  width: 104px;
  height: 104px;
  border-radius: 48% 48% 42% 42%;
  background:
    radial-gradient(circle at 35% 22%, rgba(255, 255, 255, 0.45), transparent 16%),
    linear-gradient(145deg, #84f3e4, #347f99);
  border: 3px solid rgba(255, 255, 255, 0.35);
}

.arm {
  position: absolute;
  top: 46px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border-radius: 58% 58% 54% 54%;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.34), transparent 26%),
    linear-gradient(160deg, #74e6de, #2d8ca0);
  box-shadow:
    inset -4px -5px 0 rgba(0, 0, 0, 0.11),
    0 3px 5px rgba(0, 0, 0, 0.10);
  transform-origin: 50% 8px;
  transition:
    top 220ms ease,
    height 220ms ease,
    transform 220ms ease;
}

.arm::after {
  content: "";
  position: absolute;
  left: 7px;
  bottom: 5px;
  width: 16px;
  height: 6px;
  border-radius: 999px;
  background: rgba(247, 240, 223, 0.44);
}

.arm-left {
  left: -5px;
  --arm-left-pose: 20deg;
  transform: rotate(var(--arm-left-pose));
}

.arm-right {
  right: -5px;
  --arm-right-pose: -20deg;
  transform: rotate(var(--arm-right-pose));
}

.pet.is-happy .arm-left {
  top: 34px;
  height: 32px;
  --arm-left-pose: -34deg;
  transform: rotate(var(--arm-left-pose));
}

.pet.is-happy .arm-right {
  top: 34px;
  height: 32px;
  --arm-right-pose: 34deg;
  transform: rotate(var(--arm-right-pose));
}

.pet.is-upset .arm {
  top: 56px;
  height: 28px;
}

.pet.is-upset .arm-left {
  --arm-left-pose: 38deg;
  transform: rotate(var(--arm-left-pose));
}

.pet.is-upset .arm-right {
  --arm-right-pose: -38deg;
  transform: rotate(var(--arm-right-pose));
}

.pet.is-held .arm-left,
.pet.is-dragging .arm-left {
  top: 40px;
  --arm-left-pose: -24deg;
  transform: rotate(var(--arm-left-pose));
}

.pet.is-held .arm-right,
.pet.is-dragging .arm-right {
  top: 40px;
  --arm-right-pose: 24deg;
  transform: rotate(var(--arm-right-pose));
}

.pet.is-moving .arm-left {
  animation: armSwingLeft 420ms ease;
}

.pet.is-moving .arm-right {
  animation: armSwingRight 420ms ease;
}

.pet.is-petted .arm-left {
  top: 34px;
  height: 32px;
  --arm-left-pose: -46deg;
  transform: rotate(var(--arm-left-pose));
}

.pet.is-petted .arm-right {
  top: 34px;
  height: 32px;
  --arm-right-pose: 46deg;
  transform: rotate(var(--arm-right-pose));
}

.pet.is-poked .arm-left {
  top: 44px;
  --arm-left-pose: 42deg;
  transform: rotate(var(--arm-left-pose));
}

.pet.is-poked .arm-right {
  top: 44px;
  --arm-right-pose: -42deg;
  transform: rotate(var(--arm-right-pose));
}

.belly {
  position: absolute;
  left: 25px;
  bottom: 16px;
  width: 54px;
  height: 50px;
  border-radius: 50%;
  background: rgba(247, 240, 223, 0.62);
}

.tail {
  position: absolute;
  right: -5px;
  bottom: 26px;
  z-index: -1;
  width: 20px;
  height: 20px;
  border-radius: 58% 68% 62% 52%;
  background: linear-gradient(145deg, #55c8c5, #2f8797);
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.12);
  transform: rotate(12deg);
}

.face {
  top: 44px;
  z-index: 2;
  width: 76px;
  height: 48px;
}

.face i {
  position: absolute;
  top: 10px;
  width: 10px;
  height: 16px;
  border-radius: 999px;
  background: #111217;
  animation: blink 5s infinite;
}

.face i:first-child { left: 18px; }
.face i:nth-child(2) { right: 18px; }

.face b {
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 24px;
  height: 12px;
  border-bottom: 4px solid #111217;
  border-radius: 50%;
  transform: translateX(-50%);
}

.cheek {
  position: absolute;
  top: 27px;
  width: 14px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 151, 162, 0.72);
}

.cheek-left { left: 7px; }
.cheek-right { right: 7px; }

.foot {
  position: absolute;
  bottom: -7px;
  width: 34px;
  height: 18px;
  border-radius: 50%;
  background: #23656f;
}

.foot-left { left: 14px; }
.foot-right { right: 14px; }

.thought {
  position: absolute;
  left: 50%;
  bottom: 128px;
  z-index: 5;
  width: 210px;
  padding: 12px 14px;
  border-radius: 18px 18px 18px 4px;
  background: rgba(247, 240, 223, 0.94);
  color: #23242a;
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.2;
  transform: translateX(-50%);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.28);
}

.agent {
  gap: 14px;
}

.agent-head {
  position: relative;
  padding-right: 54px;
}

.settings-toggle {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--text);
}

.settings-toggle:hover {
  border-color: var(--teal);
}

.settings-toggle svg,
.dialog-close svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.log {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.35;
}

.pet-bubble {
  align-self: start;
  background: rgba(247, 240, 223, 0.13);
  border: 1px solid var(--line);
}

.user-bubble {
  align-self: end;
  background: linear-gradient(145deg, #3aa59b, #2f798f);
  color: white;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.composer input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  outline: none;
}

.composer input:focus {
  border-color: var(--teal);
}

.composer button {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--text);
  color: #18191d;
  font-weight: 850;
  min-width: 0;
}

.settings-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.settings-dialog::backdrop {
  background: rgba(8, 9, 12, 0.62);
  backdrop-filter: blur(10px);
}

.settings-surface {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(31, 30, 36, 0.98);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.settings-head,
.gmail-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.settings-head h2 {
  margin-top: 2px;
}

.dialog-close {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.dialog-close:hover {
  border-color: var(--coral);
}

.gmail-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.settings-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.settings-card strong {
  display: block;
  font-size: 1rem;
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-actions button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 850;
}

.settings-actions button:hover {
  border-color: var(--teal);
}

.gmail-card-head strong {
  display: block;
  font-size: 1.02rem;
}

.gmail-card-head small {
  color: var(--muted);
  font-weight: 850;
  text-align: right;
}

.settings-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.gmail-actions,
.gmail-search {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.gmail-search {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.gmail-card input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  outline: none;
}

.gmail-card input:focus {
  border-color: var(--teal);
}

.gmail-card button {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 850;
}

.gmail-card button:hover {
  border-color: var(--teal);
}

.gmail-results {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
}

.gmail-results article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(116, 234, 219, 0.08);
}

.gmail-results strong,
.gmail-results code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--teal);
  font-size: 0.82rem;
}

.gmail-results p {
  margin: 5px 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.3;
}

.gmail-results small {
  color: var(--muted);
  font-size: 0.74rem;
}

@keyframes blink {
  0%, 94%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}

@keyframes petSquish {
  0%, 100% { transform: translateX(-50%) scale(1); }
  42% { transform: translateX(-50%) scale(1.08, 0.92); }
  68% { transform: translateX(-50%) scale(0.97, 1.04); }
}

@keyframes smilePop {
  0%, 100% { transform: translateX(-50%) scale(1); }
  45% { transform: translateX(-50%) scale(1.18, 1.08); }
}

@keyframes armSwingLeft {
  0%, 100% { transform: rotate(var(--arm-left-pose, 26deg)); }
  50% { transform: rotate(calc(var(--arm-left-pose, 26deg) - 18deg)); }
}

@keyframes armSwingRight {
  0%, 100% { transform: rotate(var(--arm-right-pose, -26deg)); }
  50% { transform: rotate(calc(var(--arm-right-pose, -26deg) + 18deg)); }
}

@keyframes headPoke {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(7px); }
  62% { transform: translateY(-3px); }
}

@keyframes facePoke {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  35% { transform: translateX(-50%) translateY(7px); }
  62% { transform: translateX(-50%) translateY(-3px); }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    gap: 10px;
    width: min(100vw - 20px, 620px);
    height: auto;
    min-height: calc(100vh - 20px);
    margin: 10px auto;
  }

  .hud {
    display: none;
  }

  .room-wrap {
    order: 1;
    min-height: 0;
    height: min(54vh, 430px);
  }

  .room {
    width: min(720px, 118vw);
    max-width: none;
    height: min(390px, 48vh);
    transform: scale(0.86) rotateX(58deg) rotateZ(-38deg);
  }

  .agent {
    order: 2;
    min-height: 0;
    height: calc(100vh - min(54vh, 430px) - 30px);
    max-height: 390px;
    padding: 12px;
  }

  .agent-head {
    min-height: 42px;
  }

  .agent-head .eyebrow,
  .agent-head h2 {
    display: none;
  }

  .log {
    gap: 8px;
  }

  .bubble {
    max-width: 94%;
    padding: 10px 12px;
    font-size: 0.92rem;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .composer input,
  .composer button {
    padding: 11px 10px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: 100vw;
    height: 100svh;
    min-height: 100svh;
    margin: 0;
    overflow: hidden;
  }

  .panel,
  .room-wrap {
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .room-wrap {
    height: 46svh;
  }

  .room {
    width: 620px;
    height: 340px;
    transform: scale(0.55) rotateX(58deg) rotateZ(-38deg);
  }

  .agent {
    height: calc(54svh - 10px);
    max-height: none;
  }

  .thought {
    width: 150px;
    font-size: 0.78rem;
    transform: translateX(-78%);
  }
}
