* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.app {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2rem, 5vw, 2.8rem);
  text-align: center;
  color: #38bdf8;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.record {
  padding: 0.9rem 2.4rem;
  border: none;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
  background: linear-gradient(135deg, #f97316, #ef4444);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.record:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(249, 115, 22, 0.35);
}

.record[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.status {
  min-width: 180px;
  text-align: center;
  font-size: 0.95rem;
  color: #e2e8f0;
}

.status[data-state="error"] {
  color: #f87171;
}

.status[data-state="done"] {
  color: #34d399;
}

.status[data-state="processing"] {
  color: #38bdf8;
}

.messages {
  display: grid;
  gap: 1rem;
}

.message {
  position: relative;
  padding: 1rem 1rem 1.25rem;
  border-radius: 1rem;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.5);
  line-height: 1.5;
  backdrop-filter: blur(12px);
}

.message[data-state="processing"] {
  border-color: rgba(56, 189, 248, 0.6);
}

.message[data-state="done"] {
  border-color: rgba(52, 211, 153, 0.6);
}

.message[data-state="error"] {
  border-color: rgba(248, 113, 113, 0.6);
}

.message textarea.message-body {
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.message .actions {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  display: flex;
  gap: 0.4rem;
}

.actions button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.12);
  color: #e2e8f0;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  transition: background 0.15s ease;
}

.actions button:hover {
  background: rgba(226, 232, 240, 0.25);
}

.actions button:active {
  background: rgba(226, 232, 240, 0.4);
}

.empty {
  text-align: center;
  color: rgba(226, 232, 240, 0.6);
  font-size: 1rem;
}

@media (max-width: 520px) {
  .message {
    padding: 0.9rem 0.9rem 1.1rem;
  }

  .actions button {
    width: 30px;
    height: 30px;
  }
}
