:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #238636;
  --accent-active: #2ea043;
  --danger: #f85149;
  --record-size: min(72vw, 280px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 1.5rem;
}

.header {
  text-align: center;
  padding-top: 0.5rem;
}

.header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.record-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
}

.record-btn {
  position: relative;
  width: var(--record-size);
  height: var(--record-size);
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), #196c2e);
  color: #fff;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  box-shadow: 0 12px 40px rgba(35, 134, 54, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.record-btn:active,
.record-btn.is-recording {
  transform: scale(0.96);
  background: linear-gradient(145deg, var(--accent-active), var(--accent));
}

.record-btn.is-recording .record-btn__ring {
  animation: pulse 1.2s ease-out infinite;
}

.record-btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.record-btn__ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid rgba(46, 160, 67, 0.5);
  opacity: 0;
}

.record-btn.is-recording .record-btn__ring {
  opacity: 1;
}

.record-btn__icon {
  font-size: 3rem;
  display: block;
  line-height: 1;
}

.record-btn__label {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.4em;
}

.status.is-error {
  color: var(--danger);
}

.status.is-ok {
  color: var(--accent-active);
}

.result-zone {
  flex-shrink: 0;
}

.result-title {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  min-height: 120px;
  max-height: 35vh;
  overflow-y: auto;
  font-size: 1.05rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-placeholder {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.debug-zone {
  margin-top: 1rem;
  flex-shrink: 0;
}

.debug-ver {
  font-weight: normal;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}

.debug-meta {
  margin: 0.5rem 0 0;
  font-size: 0.65rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.3;
}

.boot-error {
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: rgba(248, 81, 73, 0.15);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: #ffb4af;
  font-size: 0.85rem;
}

.debug-log {
  background: #010409;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  max-height: 28vh;
  overflow-y: auto;
  font-family: ui-monospace, monospace;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #7ee787;
}

.debug-line {
  margin-bottom: 0.2rem;
  word-break: break-word;
}

.debug-clear {
  margin-top: 0.35rem;
  width: 100%;
  padding: 0.4rem;
  font-size: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
}

.debug-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.debug-btn-send {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
  grid-column: 1 / -1;
}

.debug-btn {
  flex: 1;
  padding: 0.55rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
}

.debug-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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