:root {
  color-scheme: dark;
  --ink: #ecf0e7;
  --muted: #aeb7a8;
  --panel: #181a1f;
  --panel-2: #20242a;
  --line: rgba(255, 255, 255, 0.13);
  --accent: #e7b565;
  --teal: #6cc7b2;
  --rose: #d97a7f;
  --violet: #8678cc;
  --stage-top: #1f2432;
  --stage-bottom: #334045;
  --lamp: rgba(244, 181, 92, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #111317;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.stage-wrap {
  min-height: 100vh;
  padding: 0;
  background:
    radial-gradient(circle at 22% 18%, rgba(231, 181, 101, 0.18), transparent 30%),
    linear-gradient(135deg, #17191e 0%, #1d2424 52%, #241d25 100%);
}

.stage {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: linear-gradient(180deg, var(--stage-top), var(--stage-bottom));
  transition: background 450ms ease, filter 450ms ease;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: scale(1.01);
  transition: opacity 500ms ease, filter 500ms ease;
}

.stage.is-generating .hero-image {
  filter: blur(2px) brightness(0.72);
}

.stage.is-generating .realtime-dock {
  border-color: rgba(231, 181, 101, 0.44);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.58), transparent 32%, rgba(0, 0, 0, 0.22)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.46), transparent 42%),
    radial-gradient(circle at 34% 42%, rgba(231, 181, 101, 0.16), transparent 32%);
  pointer-events: none;
  transition: opacity 350ms ease;
  z-index: 8;
}

.stage::before {
  content: "Generating new scene";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 21;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(18, 20, 24, 0.72);
  color: var(--ink);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -42%);
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(18px);
}

.stage.is-generating::before {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.sky,
.room,
#particles {
  display: none;
}

.brand-mark {
  position: absolute;
  left: clamp(18px, 4vw, 54px);
  top: clamp(18px, 4vw, 44px);
  z-index: 20;
  display: grid;
  gap: 5px;
}

.brand-mark span {
  color: var(--teal);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-mark strong {
  max-width: 360px;
  font-size: clamp(30px, 5vw, 62px);
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

.ambient-status {
  position: absolute;
  top: clamp(18px, 4vw, 44px);
  right: clamp(18px, 4vw, 54px);
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 1px;
  overflow: hidden;
  width: min(360px, calc(100vw - 36px));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}

.ambient-status div {
  min-width: 0;
  padding: 12px 13px;
  background: rgba(18, 20, 24, 0.58);
}

.ambient-status span,
.ambient-status small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ambient-status span {
  color: var(--ink);
  font-size: 15px;
}

.ambient-status small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sky {
  position: absolute;
  inset: 0 0 38% 0;
  overflow: hidden;
}

.moon {
  position: absolute;
  top: 8%;
  right: 12%;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: #f4ddb1;
  box-shadow: 0 0 42px rgba(244, 221, 177, 0.42);
}

.cloud {
  position: absolute;
  width: 170px;
  height: 44px;
  border-radius: 44px;
  background: rgba(236, 240, 231, 0.12);
  animation: drift 18s linear infinite;
}

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

.cloud::before {
  left: 28px;
  width: 64px;
  height: 64px;
}

.cloud::after {
  right: 26px;
  width: 86px;
  height: 86px;
}

.cloud-a {
  top: 19%;
  left: -18%;
}

.cloud-b {
  top: 34%;
  left: 12%;
  transform: scale(0.7);
  animation-duration: 25s;
}

.city {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 0 10% 0 8%;
  height: 48%;
}

.city span {
  flex: 1;
  min-width: 44px;
  background: rgba(15, 17, 22, 0.58);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.city span:nth-child(1) { height: 42%; }
.city span:nth-child(2) { height: 68%; }
.city span:nth-child(3) { height: 50%; }
.city span:nth-child(4) { height: 76%; }
.city span:nth-child(5) { height: 36%; }

.room {
  position: absolute;
  inset: 34% 0 0 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px) 0 0 / 90px 100%,
    linear-gradient(180deg, rgba(255,255,255,0.05), transparent 52%),
    #343338;
}

.desk {
  position: absolute;
  left: 11%;
  right: 9%;
  bottom: 12%;
  height: 18%;
  border-radius: 7px;
  background: linear-gradient(180deg, #7d573e, #56392e);
  box-shadow: 0 18px 0 #33211c;
}

.laptop {
  position: absolute;
  left: 52%;
  bottom: 46%;
  width: 18%;
  height: 72%;
  border-radius: 6px 6px 2px 2px;
  background: #15191c;
  border: 5px solid #262b2e;
  display: grid;
  place-items: center;
  color: #9fd7c8;
  font-size: clamp(10px, 1.1vw, 14px);
  text-align: center;
  padding: 8px;
}

.mug {
  position: absolute;
  right: 17%;
  bottom: 35%;
  width: 48px;
  height: 52px;
  border-radius: 7px 7px 15px 15px;
  background: #e9ded0;
}

.mug::after {
  content: "";
  position: absolute;
  right: -17px;
  top: 13px;
  width: 20px;
  height: 22px;
  border: 5px solid #e9ded0;
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.mug i {
  position: absolute;
  top: -18px;
  width: 2px;
  height: 19px;
  background: rgba(255, 255, 255, 0.42);
  animation: steam 2.5s ease-in-out infinite;
}

.mug i:nth-child(1) { left: 13px; }
.mug i:nth-child(2) { left: 23px; animation-delay: 0.45s; }
.mug i:nth-child(3) { left: 33px; animation-delay: 0.85s; }

.notes {
  position: absolute;
  left: 18%;
  bottom: 39%;
  width: 13%;
  height: 34%;
  transform: rotate(-5deg);
  background: #dfcf9d;
  border-radius: 3px;
  box-shadow: 18px 10px 0 #c4dbc4;
}

.character {
  position: absolute;
  left: 32%;
  bottom: 21%;
  width: 230px;
  height: 285px;
  transform-origin: 50% 100%;
  animation: breathe 4s ease-in-out infinite;
}

.head {
  position: absolute;
  left: 78px;
  top: 56px;
  width: 82px;
  height: 94px;
  border-radius: 42% 42% 48% 48%;
  background: #c88b6e;
  z-index: 3;
}

.hair {
  position: absolute;
  left: 60px;
  top: 26px;
  width: 126px;
  height: 144px;
  border-radius: 48% 48% 40% 42%;
  background: #222128;
  z-index: 2;
}

.body {
  position: absolute;
  left: 55px;
  top: 147px;
  width: 122px;
  height: 118px;
  border-radius: 46px 46px 14px 14px;
  background: linear-gradient(180deg, #7aa89c, #456f72);
  z-index: 2;
}

.arm {
  position: absolute;
  top: 178px;
  width: 98px;
  height: 25px;
  border-radius: 20px;
  background: #b97861;
  z-index: 4;
}

.arm-left {
  left: 22px;
  transform: rotate(15deg);
}

.arm-right {
  right: 20px;
  transform: rotate(-17deg);
}

.book {
  position: absolute;
  left: 57px;
  bottom: 27px;
  width: 120px;
  height: 52px;
  border-radius: 5px;
  background: linear-gradient(90deg, #f0e5c3 49%, #d7c993 50%);
  transform: skewX(-7deg);
  z-index: 5;
}

.headphones {
  position: absolute;
  left: 66px;
  top: 50px;
  width: 106px;
  height: 88px;
  border: 8px solid #1a1d22;
  border-bottom: 0;
  border-radius: 70px 70px 0 0;
  z-index: 6;
}

.shelf {
  position: absolute;
  left: 9%;
  top: 13%;
  width: 24%;
  height: 10px;
  background: #6d4938;
  border-radius: 4px;
}

.shelf i {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 54px;
  margin: -52px 4px 0 0;
  background: #b87365;
  border-radius: 3px;
}

.shelf i:nth-child(2) { height: 44px; background: #7aa89c; }
.shelf i:nth-child(3) { height: 60px; background: #d4b36f; }

.lamp {
  position: absolute;
  right: 18%;
  top: 11%;
  width: 112px;
  height: 178px;
}

.lamp::before {
  content: "";
  position: absolute;
  left: 54px;
  top: 62px;
  width: 7px;
  height: 116px;
  background: #2b2927;
}

.lamp span {
  position: absolute;
  left: 21px;
  top: 16px;
  width: 74px;
  height: 58px;
  border-radius: 50% 50% 12px 12px;
  background: #e0a24b;
  box-shadow: 0 0 70px rgba(224, 162, 75, 0.68);
}

.poster {
  position: absolute;
  right: 7%;
  top: 9%;
  width: 96px;
  height: 128px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  text-align: center;
  line-height: 1.35;
  background: rgba(0,0,0,0.16);
}

.plant {
  position: absolute;
  left: 9%;
  bottom: 25%;
  width: 74px;
  height: 106px;
}

.plant::after {
  content: "";
  position: absolute;
  left: 20px;
  bottom: 0;
  width: 42px;
  height: 45px;
  background: #a76f55;
  border-radius: 4px 4px 14px 14px;
}

.plant i {
  position: absolute;
  bottom: 35px;
  width: 26px;
  height: 58px;
  background: #628f63;
  border-radius: 90% 10% 90% 10%;
}

.plant i:nth-child(1) { left: 8px; transform: rotate(-28deg); }
.plant i:nth-child(2) { left: 27px; bottom: 45px; }
.plant i:nth-child(3) { right: 4px; transform: rotate(27deg) scaleX(-1); }

.rain {
  opacity: 0;
  transition: opacity 300ms ease;
}

.rain i {
  position: absolute;
  top: -80px;
  width: 1px;
  height: 54px;
  background: rgba(190, 220, 236, 0.5);
  transform: rotate(15deg);
  animation: rain 900ms linear infinite;
}

#particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.realtime-dock {
  position: absolute;
  right: clamp(16px, 4vw, 54px);
  bottom: clamp(16px, 4vw, 46px);
  z-index: 22;
  width: min(460px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(18, 20, 24, 0.68);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(20px);
}

.dock-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.dock-topline p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dock-topline strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
}

.scene-progress {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: rgba(8, 10, 14, 0.48);
}

.scene-progress span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 18px rgba(108, 199, 178, 0.52);
}

.scene-progress p {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage.is-generating .scene-progress span {
  background: var(--accent);
  animation: pulse-dot 900ms ease-in-out infinite;
}

.scene-request {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  min-height: 38px;
  margin: 10px 0 0;
  overflow: hidden;
  color: rgba(236, 240, 231, 0.78);
  font-size: 12px;
  line-height: 1.45;
}

.regenerate-button {
  width: 100%;
  height: 42px;
  margin-top: 10px;
}

.energy-line {
  height: 4px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.76);
  }
  50% {
    opacity: 1;
    transform: scale(1.18);
  }
}

.energy-line span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--accent), var(--rose));
  transition: width 120ms linear;
}

.energy-readout {
  position: absolute;
  right: 16px;
  bottom: 20px;
  color: transparent;
  pointer-events: none;
}

.event-log {
  position: absolute;
  left: clamp(18px, 4vw, 54px);
  bottom: clamp(18px, 4vw, 46px);
  z-index: 21;
  width: min(430px, calc(100vw - 32px));
  max-height: 84px;
  overflow: hidden;
  color: rgba(236, 240, 231, 0.88);
  font-size: 14px;
  line-height: 1.45;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

.event-log p {
  margin: 0;
}

.event-log p:not(:first-child) {
  display: none;
}

.event-log time {
  display: block;
  margin-bottom: 3px;
  color: rgba(174, 183, 168, 0.86);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), #121418);
}

.panel-head h1 {
  margin: 4px 0 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meter-block,
.prompt-box,
.state-grid,
.control-panel .event-log {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.meter-block {
  padding: 16px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.meter-label strong {
  color: var(--ink);
}

.meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--accent), var(--rose));
  transition: width 120ms linear;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #2a3035;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  background: #333b41;
}

button.active {
  border-color: rgba(108, 199, 178, 0.8);
  background: rgba(108, 199, 178, 0.18);
}

.wide {
  width: 100%;
}

.connection-status {
  min-height: 20px;
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.prompt-box {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.prompt-box span {
  color: var(--muted);
  font-size: 13px;
}

textarea {
  resize: vertical;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111419;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

.state-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.state-grid div {
  padding: 13px;
  background: var(--panel-2);
}

.state-grid span,
.control-panel .event-log time {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.state-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.control-panel .event-log {
  min-height: 150px;
  max-height: 230px;
  overflow: auto;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.control-panel .event-log p {
  margin: 0 0 12px;
}

.stage[data-weather="rain"] .rain {
  opacity: 1;
}

.stage[data-weather="rain"] {
  --stage-top: #17202b;
  --stage-bottom: #253238;
}

.stage[data-mood="focus"] {
  --lamp: rgba(108, 199, 178, 0.32);
  filter: saturate(1.08);
}

.stage[data-mood="warm"] {
  --lamp: rgba(231, 181, 101, 0.55);
  filter: saturate(1.16);
}

.stage[data-mood="night"] {
  --stage-top: #171827;
  --stage-bottom: #242735;
  --lamp: rgba(134, 120, 204, 0.34);
}

.stage[data-mood="alert"] .character {
  animation-duration: 1.6s;
}

.stage[data-mood="alert"] {
  --lamp: rgba(217, 122, 127, 0.36);
}

@keyframes drift {
  from { transform: translateX(0); }
  to { transform: translateX(1350px); }
}

@keyframes breathe {
  0%, 100% { transform: translateY(0) rotate(-0.5deg); }
  50% { transform: translateY(5px) rotate(0.5deg); }
}

@keyframes steam {
  from { opacity: 0; transform: translateY(8px); }
  35% { opacity: 0.8; }
  to { opacity: 0; transform: translateY(-14px); }
}

@keyframes rain {
  from { transform: translateY(0) rotate(15deg); }
  to { transform: translateY(840px) rotate(15deg); }
}

@media (max-width: 980px) {
  .stage {
    min-height: 100vh;
  }

  .character {
    left: 28%;
    transform: scale(0.86);
  }
}

@media (max-width: 620px) {
  .stage {
    min-height: 100vh;
  }

  .brand-mark {
    right: 18px;
  }

  .brand-mark strong {
    max-width: 280px;
  }

  .ambient-status {
    top: 126px;
    left: 18px;
    right: auto;
    width: calc(100vw - 36px);
  }

  .laptop,
  .poster {
    font-size: 10px;
  }

  .character {
    left: 13%;
    bottom: 22%;
    transform: scale(0.72);
  }

  .realtime-dock {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
  }

  .dock-topline {
    align-items: flex-start;
  }

  .event-log {
    display: none;
  }
}
