:root {
  --paper: #fffaf6;
  --ink: #32152f;
  --muted: #806276;
  --coral: #ff7964;
  --coral-dark: #ea604e;
  --mint: #ddf4e8;
  --mint-ink: #176a4b;
  --lavender: #eee1f7;
  --yellow: #fff0bd;
  --sky: #dff0fb;
  --line: #ecd8c9;
  --danger: #d14e48;
  --ready: #55b98a;
  --shadow: 0 18px 55px rgba(74, 35, 56, .15);
  color: var(--ink);
  background: var(--paper);
  font-family: "Nunito", "Segoe UI", sans-serif;
}

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

html, body {
  margin: 0;
  min-width: 320px;
  min-height: 100%;
  background:
    radial-gradient(circle at 88% 7%, rgba(238,225,247,.95), transparent 25%),
    radial-gradient(circle at 6% 36%, rgba(255,225,192,.8), transparent 28%),
    var(--paper);
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}

.screen {
  min-height: 100dvh;
}

.splash-screen,
.auth-screen,
.pending-screen {
  display: grid;
  place-items: center;
  padding: 24px 0;
}

.splash-logo {
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  background: var(--coral);
  border-radius: 34px;
  box-shadow: 0 18px 36px rgba(255, 121, 100, .26);
  animation: pulse 1.3s ease-in-out infinite alternate;
}

.splash-logo img,
.auth-logo,
.pending-card img {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  object-fit: cover;
}

.splash-screen h1 {
  margin: 22px 0 4px;
  font-size: 31px;
  font-weight: 900;
}

.splash-screen p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.loading-dots {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin-top: 22px;
}

.loading-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lavender);
}

.loading-dots i:nth-child(2) {
  width: 10px;
  height: 10px;
  background: var(--coral);
  animation: blink .9s ease-in-out infinite alternate;
}

.auth-card,
.pending-card {
  width: 100%;
  padding: 22px;
  text-align: center;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.auth-card h1,
.pending-card h1 {
  margin: 12px 0 4px;
  font-size: 29px;
  line-height: 1.08;
  font-weight: 900;
}

.auth-card p,
.pending-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: #fff8f1;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.tabs button {
  min-height: 45px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 14px;
  font-weight: 900;
}

.tabs button.active {
  color: white;
  background: var(--coral);
}

label {
  display: block;
  text-align: left;
}

label > span {
  display: block;
  margin: 10px 0 5px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  font-weight: 800;
}

input:focus,
select:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(255,121,100,.16);
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.password-row button {
  min-width: 92px;
  color: var(--coral-dark);
  background: var(--yellow);
  border: 0;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 900;
}

.primary-button,
.secondary-button,
.start-button {
  width: 100%;
  min-height: 55px;
  border: 0;
  border-radius: 18px;
  font-weight: 900;
}

.primary-button {
  margin-top: 12px;
  color: white;
  background: linear-gradient(#ff856f, #ff6e5a);
  box-shadow: 0 12px 22px rgba(255, 111, 91, .22);
}

.secondary-button {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.message {
  min-height: 17px;
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

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

.main-screen {
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  padding: 10px 0 14px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.brand {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  box-shadow: 0 9px 18px rgba(255, 121, 100, .26);
}

.brand strong {
  font-size: 24px;
  font-weight: 900;
}

.header-actions {
  display: flex;
  gap: 7px;
}

.icon-button {
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  color: var(--ink);
  background: rgba(255,255,255,.76);
  border: 1px solid var(--line);
  border-radius: 15px;
  font-size: 11px;
  font-weight: 900;
}

.language-card {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
}

.language-card select {
  min-height: 46px;
  color: white;
  background: var(--coral);
  border: 0;
}

.swap-button {
  min-width: 82px;
  min-height: 46px;
  padding: 0 10px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
  font-size: 12px;
  font-weight: 900;
}

.transcript-card {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin-top: 12px;
  padding: 16px;
  background: var(--sky);
  border: 1px solid #cfe6f4;
  border-radius: 20px;
}

.route-hint {
  margin: 0 0 10px;
  color: #5c5570;
  font-size: 12px;
  font-weight: 900;
}

.transcript {
  flex: 1;
  min-height: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 800;
  text-align: center;
  white-space: pre-wrap;
}

.transcript.active {
  color: var(--ink);
  text-align: left;
  background: white;
  border-radius: 16px;
  padding: 14px;
}

.headphone-hint {
  margin: 9px 4px 0;
  color: var(--danger);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.start-button {
  margin-top: 8px;
  color: white;
  background: var(--ready);
  font-size: 16px;
  box-shadow: 0 12px 22px rgba(85, 185, 138, .24);
}

.start-button.active {
  background: var(--ink);
  box-shadow: none;
}

.start-button:disabled,
.primary-button:disabled {
  color: var(--muted);
  background: var(--lavender);
  box-shadow: none;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(50,21,47,.34);
}

.bottom-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(100%, 480px);
  max-height: 92dvh;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
  overflow: auto;
  transform: translateX(-50%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 60px rgba(50,21,47,.18);
}

.sheet-handle {
  width: 46px;
  height: 5px;
  margin: 0 auto 12px;
  background: #e1cfc3;
  border-radius: 99px;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-header h2 {
  flex: 1;
  margin: 0;
  font-size: 25px;
  font-weight: 900;
}

.close-sheet {
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
  min-height: 38px;
}

.range-row {
  margin-top: 18px;
}

.range-row strong {
  float: right;
  margin-top: -25px;
  color: var(--muted);
  font-size: 13px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--coral);
}

.wide {
  margin-top: 12px;
}

.password-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.share-card {
  display: grid;
  gap: 12px;
  justify-items: center;
  margin-top: 12px;
  padding: 16px;
  background: var(--lavender);
  border-radius: 18px;
}

.share-card img {
  width: 190px;
  height: 190px;
  border-radius: 16px;
}

.share-card p {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
}

@keyframes pulse {
  from { transform: scale(.96); }
  to { transform: scale(1.04); }
}

@keyframes blink {
  from { opacity: .35; }
  to { opacity: 1; }
}

@media (max-height: 700px) {
  .auth-card,
  .pending-card {
    padding: 17px;
  }

  .splash-logo {
    width: 96px;
    height: 96px;
  }

  .transcript {
    min-height: 210px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
