:root {
  --g: #39ff88;
  --o: #d8e2d0;
  --m: #7a8f7a;
  --l: #1f6b45;
  --a: #d6a83a;
  --r: #c43d3d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #020503;
  color: var(--o);
  font-family: monospace;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}
.app {
  width: min(430px, 100%);
  background: #07120c;
  border: 1px solid var(--l);
  border-radius: 18px;
  overflow: hidden;
}
.top {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--l);
}
.brand {
  color: var(--g);
  font-weight: 700;
}
.conn {
  font-size: 11px;
  color: var(--m);
}
.room {
  position: relative;
  height: 430px;
  background: #061009;
  border-bottom: 1px solid var(--l);
  overflow: hidden;
}
.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 110px;
  background: #0a120d;
  border-top: 2px solid #173522;
  z-index: 0;
}
.desk {
  position: absolute;
  left: 20px;
  bottom: 95px;
  width: 115px;
  height: 68px;
  border: 2px solid var(--l);
  z-index: 2;
}
.monitor {
  position: absolute;
  left: 14px;
  top: 8px;
  width: 54px;
  height: 32px;
  border: 2px solid var(--g);
  background: #021b0d;
}
.shelf {
  position: absolute;
  right: 18px;
  bottom: 95px;
  width: 92px;
  height: 120px;
  border: 2px solid var(--l);
  z-index: 2;
}
.book {
  height: 9px;
  margin: 9px;
  background: #1a4e31;
  border-left: 4px solid var(--g);
}
.nest {
  position: absolute;
  right: 24px;
  bottom: 42px;
  width: 92px;
  height: 30px;
  border-radius: 50%;
  background: #1a241b;
  border: 2px solid #556255;
  box-shadow: inset 0 -6px 0 #0f1711;
  z-index: 2;
}
.nest:before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  top: 5px;
  height: 6px;
  background: #28352a;
  border-radius: 50%;
}
.status {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 5px 7px;
  border: 1px solid var(--l);
  font-size: 11px;
  color: var(--m);
  z-index: 4;
}
.room-flavor {
  position: absolute;
  left: 12px;
  top: 47px;
  max-width: 230px;
  padding: 6px 8px;
  background: rgba(2, 5, 3, 0.72);
  border-left: 2px solid var(--l);
  color: var(--m);
  font-size: 10px;
  line-height: 1.35;
  z-index: 4;
}
.goblin {
  position: absolute;
  width: 48px;
  height: 56px;
  left: 50%;
  bottom: 76px;
  transform: translateX(-50%);
  transition:
    left 0.5s,
    bottom 0.5s;
  z-index: 3;
}
.head {
  position: absolute;
  left: 8px;
  top: 0;
  width: 32px;
  height: 26px;
  background: #6f8d65;
  border: 3px solid #142416;
}
.ear {
  position: absolute;
  top: 5px;
  width: 10px;
  height: 10px;
  background: #6f8d65;
  border: 3px solid #142416;
}
.ear.l {
  left: -7px;
}
.ear.r {
  right: -7px;
}
.eye {
  position: absolute;
  top: 8px;
  width: 4px;
  height: 4px;
  background: var(--g);
}
.eye.l {
  left: 7px;
}
.eye.r {
  right: 7px;
}
.body {
  position: absolute;
  left: 11px;
  top: 24px;
  width: 26px;
  height: 26px;
  background: #17211a;
  border: 3px solid #142416;
}
.leg {
  position: absolute;
  bottom: 0;
  width: 8px;
  height: 10px;
  background: #17211a;
  border: 3px solid #142416;
}
.leg.l {
  left: 11px;
}
.leg.r {
  right: 11px;
}
.bubble {
  position: absolute;
  width: min(300px, calc(100% - 24px));
  max-width: none;
  left: 50%;
  bottom: 145px;
  transform: translateX(-50%);
  padding: 8px 10px;
  background: var(--o);
  color: #101510;
  border: 3px solid #101510;
  border-radius: 10px;
  font-size: 11px;
  display: none;
  z-index: 5;
  transition: none;
}
.controls {
  padding: 14px;
}
.buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
button {
  border: 1px solid var(--l);
  background: #08110b;
  color: var(--o);
  padding: 9px 6px;
  border-radius: 8px;
  font: inherit;
  font-size: 11px;
}
button.active {
  border-color: var(--g);
  color: var(--g);
}
.wake {
  width: 100%;
  border-color: #725d24;
  color: var(--a);
}
@keyframes bob {
  50% {
    transform: translateX(-50%) translateY(-4px);
  }
}
@keyframes squash {
  50% {
    transform: translateX(-50%) scale(1.08, 0.9);
  }
}
@keyframes talk {
  40% {
    transform: translateX(-50%) translateY(-6px);
  }
}
@keyframes glitch {
  25% {
    transform: translateX(-45%);
  }
  30% {
    transform: translateX(-55%);
  }
}
.idle {
  animation: bob 1.3s infinite steps(2);
}
.thinking {
  animation: squash 0.8s infinite;
}
.talking {
  animation: talk 0.65s infinite;
}
.tool_use {
  animation: bob 0.35s infinite steps(2);
}
.sleeping {
  animation: squash 2s infinite;
}
.offline {
  animation: glitch 1.5s infinite;
  filter: grayscale(1);
  opacity: 0.3;
}

.tabs {
  display: flex;
  border-top: 1px solid var(--l);
  background: #040a06;
}
.tab {
  flex: 1;
  border: 0;
  border-right: 1px solid var(--l);
  border-radius: 0;
  padding: 11px 8px;
  background: #040a06;
  color: var(--m);
}
.tab:last-child {
  border-right: 0;
}
.tab.active {
  color: var(--g);
  background: #08110b;
  box-shadow: none;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.home-wrap {
  position: relative;
}
.chat-view {
  min-height: 520px;
  background: #050b07;
}
.chat-log {
  height: 470px;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 82%;
  padding: 9px 11px;
  border: 1px solid var(--l);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.35;
}
.msg.user {
  align-self: flex-end;
  background: #0c1911;
  color: var(--o);
}
.msg.goblinica {
  align-self: flex-start;
  background: #07110b;
  color: var(--o);
}
.msg .who {
  display: block;
  color: var(--m);
  font-size: 9px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 8;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid var(--g);
  background: #07120c;
  color: var(--g);
  font-size: 22px;
  box-shadow: 0 0 16px rgba(57, 255, 136, 0.16);
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.modal-backdrop.open {
  display: flex;
}
.composer {
  width: min(430px, 100%);
  background: #07120c;
  border: 1px solid var(--l);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 0 30px rgba(57, 255, 136, 0.1);
}
.composer-title {
  font-size: 11px;
  color: var(--m);
  margin-bottom: 8px;
}
textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  background: #030805;
  color: var(--o);
  border: 1px solid var(--l);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
}
.composer-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.composer-actions button {
  flex: 1;
}
.send {
  border-color: var(--g);
  color: var(--g);
}
.gear-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  font-size: 18px;
}
.debug-panel {
  display: none;
  padding: 12px;
  border-top: 1px solid var(--l);
  background: #040a06;
}
.debug-panel.open {
  display: block;
}
.debug-title {
  font-size: 11px;
  color: var(--m);
  margin-bottom: 8px;
}
.debug-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
