:root {
  --panel-blue-top: #243f77;
  --panel-blue-bottom: #1f3562;
  --button-blue-top: #3a8ff1;
  --button-blue-bottom: #2c67c5;
  --button-red-top: #ed4a45;
  --button-red-bottom: #c62f2d;
  --status-green: #2f7c3a;
  --status-red: #b92f28;
  --status-neutral: #374151;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 24px 12px 36px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #dadbe0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.app {
  width: min(100%, 480px);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 22px 46px rgba(22, 31, 56, 0.28);
  background: #ffffff;
}

.hero {
  padding: 20px 16px 14px;
  text-align: center;
  color: #eef4ff;
  background: linear-gradient(180deg, var(--panel-blue-top) 0%, var(--panel-blue-bottom) 100%);
}

.hero h1 {
  margin: 0;
  font-size: 64px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.subtitle {
  margin: 8px 0 14px;
  font-size: 36px;
  line-height: 1.12;
  color: #d4deff;
}

.controls {
  display: flex;
  gap: 12px;
}

.controls button {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 10px;
  padding: 11px 10px;
  color: #ffffff;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 10px rgba(0, 0, 0, 0.25);
}

#btn-start {
  background: linear-gradient(180deg, var(--button-blue-top) 0%, var(--button-blue-bottom) 100%);
}

#btn-stop {
  background: linear-gradient(180deg, var(--button-red-top) 0%, var(--button-red-bottom) 100%);
}

.controls button:disabled,
.feedback-link-button:disabled,
.feedback-submit-button:disabled,
.feedback-voice-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#status {
  margin: 0;
  padding: 18px 10px 16px;
  text-align: center;
  font-size: 74px;
  line-height: 1.02;
  font-weight: 900;
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f7 100%);
}

#status.status-speaking {
  color: var(--status-red);
}

#status.status-listening {
  color: var(--status-green);
}

#status.status-neutral {
  color: var(--status-neutral);
}

.therapist-photo {
  width: 100%;
  display: block;
  aspect-ratio: 644 / 712;
  object-fit: cover;
  object-position: center top;
}

.status-line {
  margin: 0;
  padding: 10px 14px;
  text-align: center;
  font-size: 14px;
  color: #646d7d;
  background: #ffffff;
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(8, 16, 31, 0.62);
  backdrop-filter: blur(8px);
}

.feedback-overlay.is-open {
  display: flex;
}

.feedback-dialog {
  width: min(100%, 520px);
  padding: 22px 18px 18px;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.34);
}

.feedback-title {
  margin: 0;
  color: #14213d;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 900;
}

.feedback-copy {
  margin: 12px 0 0;
  color: #475569;
  font-size: 18px;
  line-height: 1.45;
}

.feedback-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #2c67c5;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  cursor: pointer;
  box-shadow: none;
}

.feedback-text-panel {
  margin-top: 14px;
}

.feedback-textarea {
  display: block;
  width: 100%;
  min-height: 148px;
  padding: 14px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  resize: vertical;
  color: #14213d;
  background: #f8fafc;
  font: 500 17px/1.45 "Trebuchet MS", "Segoe UI", sans-serif;
}

.feedback-textarea:focus {
  outline: 2px solid rgba(58, 143, 241, 0.3);
  border-color: #60a5fa;
}

.feedback-submit-button {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--button-blue-top) 0%, var(--button-blue-bottom) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 8px 18px rgba(37, 99, 235, 0.24);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
  cursor: pointer;
}

.feedback-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: #64748b;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 700;
}

.feedback-status.is-error {
  color: #c62828;
}

.feedback-status.is-success {
  color: #1f7a37;
}

.feedback-voice-button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 14px;
  padding: 16px 18px;
  color: #ffffff;
  background: linear-gradient(180deg, #2f7c3a 0%, #235f2d 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 10px 24px rgba(26, 74, 36, 0.26);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.feedback-voice-button[hidden] {
  display: none;
}

.feedback-voice-button.is-recording {
  background: linear-gradient(180deg, #ed4a45 0%, #c62f2d 100%);
}

.debug-panel {
  margin: 0;
  border-top: 1px solid #e5e7eb;
  background: #f8f9fb;
  color: #1f2937;
}

.debug-panel > summary {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.debug-panel pre {
  margin: 0;
  padding: 0 14px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.4;
}

.build-line {
  margin: 0;
  padding: 8px 14px 12px;
  text-align: right;
  font-size: 11px;
  color: #8a90a0;
  background: #f8f9fb;
}

@media (max-width: 640px) {
  body {
    padding: 10px 6px 20px;
  }

  .hero {
    padding: 16px 10px 12px;
  }

  .hero h1 {
    font-size: 50px;
  }

  .subtitle {
    margin: 6px 0 10px;
    font-size: 28px;
  }

  .controls button {
    font-size: 24px;
    padding: 10px 8px;
  }

  #status {
    font-size: 56px;
    padding: 16px 8px 14px;
  }

  .feedback-dialog {
    padding: 18px 14px 14px;
  }

  .feedback-title {
    font-size: 26px;
  }

  .feedback-copy {
    font-size: 16px;
  }

  .feedback-voice-button {
    font-size: 21px;
  }

  .feedback-submit-button {
    font-size: 18px;
  }
}
