:root {
  --bg-a: #f2f7ff;
  --bg-b: #eefaf6;
  --panel: #ffffff;
  --panel-soft: #f8fbff;
  --text: #13233d;
  --muted: #5b6880;
  --line: #d9e4f4;
  --accent: #0a7f7a;
  --accent-dark: #06635f;
  --accent-soft: #dff5f3;
  --user-bubble: #0f7b77;
  --assistant-bubble: #eef3fb;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 6%, #ffffff 0, transparent 30%),
    radial-gradient(circle at 90% 92%, #dff5f3 0, transparent 38%),
    linear-gradient(140deg, var(--bg-a), var(--bg-b));
  padding: 24px;
}

.app {
  width: min(1100px, 100%);
  margin: 0 auto;
}

.app-header {
  margin-bottom: 14px;
}

.app-header h1 {
  margin: 0;
  letter-spacing: 0.2px;
}

.status {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.left-panel {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 16px;
  align-self: start;
}

.panel-card {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 14px 35px rgba(27, 44, 74, 0.08);
}

.controls-card {
  text-align: center;
  background: linear-gradient(180deg, #ffffff, var(--panel-soft));
}

.controls-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
}

.talk-button {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 30% 25%, #23b0a9, var(--accent-dark) 70%);
  color: #fff;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease, background 0.2s ease;
  box-shadow: 0 18px 34px rgba(10, 127, 122, 0.42);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  isolation: isolate;
}

.talk-button::after {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  /* border: 2px solid rgba(10, 127, 122, 0.26); */
  z-index: -1;
  /* animation: pulse 2.2s infinite ease-out; */
}

.talk-button:active,
.talk-button.recording {
  transform: translateY(2px) scale(0.98);
  filter: saturate(115%);
  background: linear-gradient(160deg, var(--accent-dark), var(--accent));
}

.talk-button.recording::after {
  border-color: rgba(16, 144, 139, 0.55);
  animation-duration: 0.8s;
}

.hint {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 0.94rem;
}

.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.row-head h2 {
  margin: 0;
  font-size: 1rem;
}

.secondary-btn,
.ghost-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.secondary-btn {
  background: var(--accent-soft);
  border-color: #bfe7e2;
  color: var(--accent-dark);
}

.secondary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost-btn {
  background: #fff;
  color: var(--muted);
}

.transcript-input {
  width: 100%;
  resize: vertical;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  line-height: 1.45;
  background: #fff;
}

.transcript-input:focus {
  outline: 2px solid rgba(10, 127, 122, 0.22);
  border-color: #9ed6d2;
}

.error-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--error);
  font-size: 0.9rem;
}

.right-panel {
  display: flex;
  flex-direction: column;
  min-height: 560px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.chat-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  min-height: 460px;
}

.message {
  max-width: min(80%, 620px);
  border-radius: 12px;
  padding: 10px 12px;
  white-space: pre-wrap;
  line-height: 1.45;
}

.message.user {
  align-self: flex-end;
  background: var(--user-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.assistant {
  align-self: flex-start;
  background: var(--assistant-bubble);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

@media (max-width: 900px) {
  body {
    padding: 14px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .left-panel {
    position: static;
    top: auto;
  }

  .right-panel {
    min-height: 430px;
  }

  .chat-feed {
    min-height: 320px;
  }

  .talk-button {
    width: 160px;
    height: 160px;
    font-size: 1rem;
  }
}

@keyframes pulse {
  0% {
    opacity: 0.9;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.16);
  }
}
