:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050607;
  color: #eef7f8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-width: 0;
  background: radial-gradient(circle at 70% 20%, rgba(108, 50, 150, 0.22), transparent 34%), #050607;
}

.app {
  min-height: 100svh;
  height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: clamp(18px, 3vw, 48px);
  padding: 16px clamp(16px, 3vw, 44px) 16px clamp(16px, 4vw, 64px);
}

.stage {
  display: grid;
  place-items: center;
  align-self: center;
  justify-self: center;
  width: min(100%, 640px);
  height: calc(100svh - 32px);
  min-height: 0;
  padding: clamp(22px, 3.5vh, 42px) clamp(16px, 2.5vw, 34px);
  overflow: hidden;
  border: 1px solid rgba(137, 228, 241, 0.22);
  border-radius: clamp(24px, 3vw, 38px);
  background: linear-gradient(180deg, rgba(13, 21, 25, 0.92), rgba(5, 8, 10, 0.96));
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.48), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

canvas {
  width: auto;
  height: min(100%, 760px);
  max-width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 8px;
  background: #050607;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.panel {
  border-left: 1px solid rgba(137, 228, 241, 0.18);
  background: rgba(7, 10, 12, 0.82);
  padding: 22px;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  min-height: 220px;
}

.message {
  padding: 11px 12px;
  border-radius: 8px;
  line-height: 1.35;
  font-size: 14px;
}

.message.user {
  background: rgba(122, 77, 180, 0.22);
}

.message.bot {
  background: rgba(74, 216, 232, 0.12);
  border: 1px solid rgba(74, 216, 232, 0.18);
}

.form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 13px;
  color: #a9bdc1;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 76px;
  border: 1px solid rgba(137, 228, 241, 0.22);
  background: rgba(0, 0, 0, 0.34);
  color: #eef7f8;
  border-radius: 8px;
  padding: 10px 11px;
  font: inherit;
  line-height: 1.35;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  min-height: 38px;
  border: 1px solid rgba(137, 228, 241, 0.28);
  color: #eafcff;
  background: rgba(61, 207, 225, 0.14);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

button:hover {
  background: rgba(61, 207, 225, 0.22);
}

.status {
  min-height: 18px;
  margin: 0;
  color: #9db1b5;
  font-size: 13px;
}

.voice-hint {
  margin: -2px 0 0;
  color: #748b90;
  font-size: 11px;
}

button[aria-pressed="true"] {
  border-color: rgba(255, 120, 145, 0.72);
  background: rgba(255, 88, 120, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 840px) {
  .app {
    height: auto;
    min-height: 100svh;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 10px;
  }

  .stage {
    width: min(100%, 620px);
    height: min(76svh, 620px);
    min-height: 300px;
    padding: 14px;
    border-radius: 24px;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid rgba(137, 228, 241, 0.18);
  }

  canvas {
    width: min(100%, 72svh);
    height: auto;
  }

  .panel {
    padding: 18px;
  }
}

@media (max-width: 430px) {
  .stage {
    height: min(68svh, 500px);
    min-height: 260px;
  }

  .panel {
    padding: 16px;
    gap: 14px;
  }

  .actions button {
    flex: 1 1 140px;
  }
}
