:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #1c1c1e;
  --muted: #5f5f66;
  --line: #e7e1d8;
  --bs: #1e4fa8;
  --bs-dark: #163c82;
  --en: #2e7d32;
  --en-dark: #1b5e20;
  --red: #c62828;
}

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

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 32px);
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; -webkit-user-select: none; user-select: none; }
[hidden] { display: none !important; }

.title { font-size: 34px; margin: 4px 0 12px; letter-spacing: -0.5px; }

/* The latest translation */
.result {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 26px;
  padding: 20px 18px;
  min-height: 190px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.result p { margin: 0; }
.hint { text-align: center; font-size: 26px; font-weight: 700; color: var(--ink); }
.hint-small { font-size: 19px; font-weight: 500; color: var(--muted); margin-top: 8px !important; }
.flag { margin-right: 8px; }
.heard { font-size: 21px; color: var(--muted); }
.arrow { font-size: 26px; color: #b9b1a5; margin: 4px 0 !important; }
.translation { font-size: 33px; font-weight: 800; line-height: 1.22; overflow-wrap: anywhere; }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.act {
  flex: 1;
  background: #efe9df;
  border-radius: 16px;
  min-height: 58px;
  font-size: 21px;
  font-weight: 700;
}
.act:active { background: #e2dace; }
.error { color: var(--red); font-size: 23px; font-weight: 700; text-align: center; }
.working { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 28px; font-weight: 700; }
.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 5px solid #e2dace; border-top-color: var(--bs);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* The two big microphone buttons */
.mics { display: flex; flex-direction: column; gap: 14px; }
.mic {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 112px;
  padding: 14px 22px;
  border-radius: 28px;
  color: #fff;
  text-align: left;
}
.mic-bs { background: var(--bs); box-shadow: 0 6px 18px rgba(30, 79, 168, 0.28); }
.mic-en { background: var(--en); box-shadow: 0 6px 18px rgba(46, 125, 50, 0.25); }
.mic-bs:active { background: var(--bs-dark); }
.mic-en:active { background: var(--en-dark); }
.mic:disabled { opacity: 0.55; }
.mic-icon {
  flex: none;
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: grid; place-items: center;
  font-size: 40px;
}
.mic-text { display: flex; flex-direction: column; }
.mic-text b { font-size: 32px; font-weight: 800; }
.mic-text small { font-size: 21px; font-weight: 600; opacity: 0.92; }

.type-btn {
  width: 100%;
  margin-top: 14px;
  min-height: 60px;
  border-radius: 18px;
  background: #efe9df;
  font-size: 21px;
  font-weight: 700;
  color: #3a3a3c;
}
.type-btn:active { background: #e2dace; }

/* Earlier translations */
.history { margin-top: 26px; }
.history h2 { font-size: 26px; margin: 0 0 10px; }
.item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.item:active { background: #f3efe8; }
.item-orig { display: block; font-size: 18px; color: var(--muted); }
.item-trans { display: block; font-size: 22px; font-weight: 700; margin-top: 2px; }

/* Full-screen layers */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 24px);
}
.listen { background: var(--bs); color: #fff; text-align: center; }
.listen.en { background: var(--en); }
.listen-lang { font-size: 30px; font-weight: 800; margin: 0 0 30px; }
.pulse { position: relative; width: 190px; height: 190px; display: grid; place-items: center; }
.level {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transform: scale(0.75);
  transition: transform 0.1s linear;
}
.big-mic {
  position: relative;
  width: 140px; height: 140px; border-radius: 50%;
  background: #fff;
  display: grid; place-items: center;
  font-size: 72px;
}
.listen-text { font-size: 28px; font-weight: 700; margin: 30px 0 34px; min-height: 2.6em; }
.stop {
  width: 100%;
  max-width: 420px;
  min-height: 96px;
  border-radius: 28px;
  background: #fff;
  color: var(--red);
  font-size: 36px;
  font-weight: 800;
}
.stop:active { background: #f1f1f1; }
.cancel {
  margin-top: 16px;
  min-height: 56px;
  padding: 0 30px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
}
.cancel.dark { background: #efe9df; color: #3a3a3c; width: 100%; }

.sheet { background: rgba(0, 0, 0, 0.45); justify-content: flex-start; }
.sheet-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border-radius: 26px;
  padding: 20px 16px 16px;
}
.sheet-title { font-size: 23px; font-weight: 800; margin: 0 0 12px; }
textarea {
  width: 100%;
  font: inherit;
  font-size: 23px;
  padding: 14px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #fff;
  resize: none;
}
textarea:focus { outline: none; border-color: var(--bs); }
.go {
  width: 100%;
  margin-top: 12px;
  min-height: 72px;
  border-radius: 20px;
  background: var(--bs);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
}
.go:active { background: var(--bs-dark); }

.big { background: #fff; text-align: center; }
.big-text { font-size: 52px; font-weight: 800; line-height: 1.18; margin: auto 0; overflow-wrap: anywhere; }
.big-close { font-size: 19px; color: var(--muted); margin: 10px 0 0; }
