:root {
  color-scheme: dark;
  --ink: #f3eee2;
  --muted: #bdb39f;
  --panel: rgba(22, 24, 25, 0.74);
  --panel-strong: rgba(17, 18, 19, 0.9);
  --line: rgba(243, 238, 226, 0.16);
  --accent: #f0b66a;
  --accent-deep: #8ec5bf;
  --shadow: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 14%, rgba(240, 182, 106, 0.18), transparent 30%),
    radial-gradient(circle at 80% 20%, rgba(142, 197, 191, 0.18), transparent 26%),
    linear-gradient(145deg, #182025 0%, #101617 44%, #241d18 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 380px);
  width: min(1120px, 100%);
  min-height: min(680px, calc(100vh - 56px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 15, 16, 0.46);
  box-shadow: 0 30px 90px var(--shadow);
  backdrop-filter: blur(18px);
}

.window-scene {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(83, 120, 132, 0.18), rgba(28, 23, 20, 0.42));
  background-size:
    100% 25%,
    25% 100%,
    100% 100%;
}

#rainCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.window-glow {
  position: absolute;
  inset: 12% 13%;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 62%, rgba(240, 182, 106, 0.24), transparent 27%),
    radial-gradient(circle at 36% 32%, rgba(142, 197, 191, 0.2), transparent 22%),
    linear-gradient(180deg, rgba(230, 224, 204, 0.08), rgba(8, 10, 10, 0.24));
  filter: blur(1px);
}

.table {
  position: absolute;
  right: 7%;
  bottom: 0;
  left: 7%;
  height: 28%;
  border-radius: 8px 8px 0 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18% 80%, rgba(0, 0, 0, 0.12)),
    linear-gradient(180deg, #5b4232, #33261f);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.22);
}

.cup {
  position: absolute;
  left: 18%;
  bottom: 35%;
  width: 118px;
  height: 84px;
  border-radius: 0 0 44px 44px;
  background: linear-gradient(135deg, #efe0c4, #b16c42 78%);
  box-shadow: inset -18px 0 34px rgba(69, 37, 20, 0.28);
}

.cup::before {
  position: absolute;
  top: 20px;
  right: -34px;
  width: 44px;
  height: 36px;
  border: 10px solid #b97449;
  border-left: 0;
  border-radius: 0 22px 22px 0;
  content: "";
}

.cup::after {
  position: absolute;
  top: -10px;
  left: 8px;
  width: 102px;
  height: 18px;
  border-radius: 50%;
  background: #3f2a21;
  content: "";
}

.steam {
  position: absolute;
  bottom: 92%;
  width: 18px;
  height: 92px;
  border-radius: 50%;
  border-left: 2px solid rgba(243, 238, 226, 0.5);
  animation: steam 4.8s ease-in-out infinite;
}

.steam-one {
  left: 20px;
}

.steam-two {
  left: 46px;
  animation-delay: 1.4s;
}

.steam-three {
  left: 72px;
  animation-delay: 2.2s;
}

.plant {
  position: absolute;
  right: 15%;
  bottom: 33%;
  width: 84px;
  height: 118px;
}

.plant::after {
  position: absolute;
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 52px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(135deg, #d5a25b, #7f5132);
  content: "";
}

.plant span {
  position: absolute;
  bottom: 45px;
  left: 36px;
  width: 24px;
  height: 70px;
  border-radius: 24px 24px 4px 24px;
  background: linear-gradient(135deg, #79b586, #345f48);
  transform-origin: bottom center;
  animation: leaf 5.5s ease-in-out infinite;
}

.plant span:nth-child(1) {
  transform: rotate(-34deg);
}

.plant span:nth-child(2) {
  height: 88px;
  transform: rotate(2deg);
  animation-delay: 0.8s;
}

.plant span:nth-child(3) {
  transform: rotate(36deg);
  animation-delay: 1.5s;
}

.controls {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 520px;
  padding: clamp(24px, 4vw, 48px);
  background: linear-gradient(180deg, var(--panel), var(--panel-strong));
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  display: grid;
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 4.25rem;
  line-height: 0.9;
}

h1 span {
  display: block;
}

.status {
  max-width: 30ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #ede6d8;
  background: rgba(255, 255, 255, 0.05);
}

.mood-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.mood-label {
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

#patternName {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #6d7770;
  box-shadow: 0 0 0 0 rgba(240, 182, 106, 0);
}

.signal.active {
  background: var(--accent);
  animation: pulse 1.2s ease-out infinite;
}

.button-row {
  display: flex;
  gap: 12px;
}

.primary-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border-radius: 8px;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.primary-button {
  gap: 10px;
  min-width: 154px;
  padding: 0 24px;
  background: linear-gradient(135deg, #f0b66a, #d8764d);
  color: #201713;
  font-weight: 800;
}

.icon-button {
  width: 52px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.45rem;
}

.primary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.sliders {
  display: grid;
  gap: 18px;
}

.sliders label {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

@keyframes steam {
  0% {
    opacity: 0;
    transform: translateY(0) scaleX(0.8);
  }
  35% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
    transform: translateY(-34px) scaleX(1.8);
  }
}

@keyframes leaf {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.1);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(240, 182, 106, 0.42);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(240, 182, 106, 0);
  }
}

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

  .app-shell {
    min-height: auto;
    padding: 16px;
  }

  .stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .window-scene {
    min-height: 48vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .controls {
    min-height: auto;
  }

  h1 {
    font-size: 3.2rem;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  h1 {
    font-size: 3.7rem;
  }
}
