/* ====== GaiDoor · minimal black & white ====== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  background: #ffffff;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  color: #0a0a0a;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }

:root {
  --accent: #ff6b4a;
  --accent-dark: #e54e2c;
  --text: #0a0a0a;
  --muted: #9ca3af;
  --soft: #f6f6f6;
  --line: #ececec;
  --line-strong: #d4d4d4;
}

/* ====== Layout ====== */
.app {
  position: fixed;
  top: 0; bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  padding: 0 22px;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
}
.header, .lang-pair, .footer { flex-shrink: 0; }

/* ====== Header ====== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 6px;
}
.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.icon-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--soft); }
.icon-btn:active { background: var(--line); }

/* ====== Language pair pill ====== */
.lang-pair {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.lang-pair:active { transform: scale(0.97); border-color: var(--text); }
.lang-pair .arrow { color: var(--muted); }

/* ====== Content blocks ====== */
.content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  padding: 6px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.content::-webkit-scrollbar-track { background: transparent; }
.block { padding: 28px 2px; }
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.block-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.block-text {
  font-size: 22px;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -0.01em;
  word-wrap: break-word;
  min-height: 30px;
}
.block-text.muted { color: var(--muted); font-size: 17px; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
}
.text-btn:hover { background: var(--soft); }
.text-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* ====== Footer · lang pill + mic ====== */
.footer {
  text-align: center;
  padding: 18px 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.footer .status { margin-top: -2px; }
.mic {
  width: 84px; height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(255, 107, 74, 0.32);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  position: relative;
}
.mic:hover { background: var(--accent-dark); }
.mic:active { transform: scale(0.93); }
.mic .stop-icon { display: none; }
.mic.recording {
  background: #111;
  box-shadow: 0 0 0 0 rgba(17, 17, 17, 0.5);
  animation: pulse 1.4s ease-out infinite;
}
.mic.recording .mic-icon { display: none; }
.mic.recording .stop-icon { display: inline; }
.mic:disabled { opacity: 0.5; pointer-events: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(17, 17, 17, 0.35); }
  70% { box-shadow: 0 0 0 22px rgba(17, 17, 17, 0); }
  100% { box-shadow: 0 0 0 0 rgba(17, 17, 17, 0); }
}
.status {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* ====== Loading dots ====== */
.dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.dots span {
  width: 6px; height: 6px;
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.2s infinite ease-in-out;
}
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ====== Settings sheet ====== */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.backdrop.show { opacity: 1; }

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  border-radius: 22px 22px 0 0;
  z-index: 100;
  padding: 8px 22px calc(28px + env(safe-area-inset-bottom)) 22px;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.4, 1);
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
}
.sheet.open { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--line-strong);
  border-radius: 2px;
  margin: 8px auto 14px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.sheet-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 16px;
  outline: none;
  transition: border-color 0.12s ease;
}
.field input:focus, .field select:focus {
  border-color: var(--text);
}
.field .hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.primary-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: none;
  background: var(--text);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.primary-btn:active { transform: scale(0.98); }
.primary-btn:disabled { opacity: 0.4; }

/* ====== Error toast ====== */
.error {
  position: fixed;
  left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  max-width: calc(100% - 40px);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

/* ====== Larger viewports ====== */
@media (min-width: 600px) {
  .block-text { font-size: 24px; }
  .mic { width: 88px; height: 88px; }
}
