:root {
  --tg-bg: #ffffff;
  --tg-text: #222222;
  --tg-hint: #999999;
  --tg-button: #2481cc;
  --tg-button-text: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--tg-bg);
  color: var(--tg-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif;
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.hidden { display: none !important; }

#main {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

#hint {
  color: var(--tg-hint);
  font-size: 15px;
}

#micBtn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: none;
  background: var(--tg-button);
  color: var(--tg-button-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

#micBtn:active {
  transform: scale(0.94);
}

#micBtn.recording {
  background: #e53935;
  animation: pulse 1.2s infinite;
}

#micBtn.busy {
  opacity: 0.5;
  cursor: default;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.5); }
  70% { box-shadow: 0 0 0 18px rgba(229, 57, 53, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); }
}

#status {
  min-height: 20px;
  font-size: 14px;
  color: var(--tg-hint);
}

#result {
  width: 100%;
  background: rgba(127, 127, 127, 0.08);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#resultText {
  white-space: pre-wrap;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
}

#replayBtn, #retryBtn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--tg-button);
  color: var(--tg-button-text);
  font-size: 14px;
  cursor: pointer;
}

#unsupported {
  text-align: center;
  color: var(--tg-hint);
  font-size: 14px;
  line-height: 1.8;
  max-width: 320px;
}
