:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #778196;
  --line: #e7e9ee;
  --panel: #ffffff;
  --background: #f5f6f9;
  --accent: #263e62;
  --accent-light: #e9eef6;
  --green: #25845d;
  --red: #bd4a4a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont,
               "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.topbar {
  min-height: 76px;
  padding: 12px max(20px, calc((100vw - 720px) / 2));
  background: #111d30;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-icon {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: linear-gradient(140deg, #d9c39a, #9d8356);
  color: #172033;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: bold;
}

.brand-title {
  font-weight: 800;
  letter-spacing: 2.3px;
  font-size: 17px;
}

.brand-subtitle {
  font-size: 11px;
  color: #bbc5d4;
  margin-top: 3px;
}

.language-badge {
  color: #e4d4b2;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
}

.language-badge span {
  margin: 0 6px;
  color: white;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 27px 18px 48px;
}

.welcome {
  margin: 8px 0 22px;
}

.eyebrow,
.section-label,
.language-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 800;
  color: #8b94a5;
}

.welcome h1 {
  font-size: clamp(25px, 6vw, 33px);
  letter-spacing: -1px;
  margin: 8px 0;
}

.welcome p,
.login-panel p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
  margin: 0;
}

.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  margin-bottom: 26px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  background: #9ba4b2;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator.active {
  background: var(--green);
  box-shadow: 0 0 0 5px #e3f2eb;
}

.status-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.status-copy strong {
  font-size: 13px;
}

.status-copy span {
  font-size: 11px;
  color: var(--muted);
}

.elapsed {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 700;
}

.mode-section {
  margin-bottom: 22px;
}

.section-label {
  margin-bottom: 10px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-button {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  display: grid;
  text-align: left;
  gap: 5px;
  color: var(--ink);
}

.mode-button.active {
  border-color: var(--accent);
  background: #f0f3f8;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.mode-icon {
  font-size: 23px;
  margin-bottom: 5px;
  color: var(--accent);
}

.mode-button strong {
  font-size: 14px;
}

.mode-button small {
  color: var(--muted);
  font-size: 11px;
}

.translation-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 19px;
  margin-bottom: 13px;
}

.translation-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.translation-heading h2 {
  margin: 5px 0 0;
  font-size: 16px;
}

.language-circle {
  background: #edf1f6;
  color: var(--accent);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.result-circle {
  background: #e8f2ed;
  color: var(--green);
}

.transcript {
  min-height: 75px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  margin-top: 18px;
  font-size: 15px;
}

.source-text {
  color: #606e81;
}

.translated-text {
  color: var(--ink);
  font-size: 19px;
  font-weight: 500;
  min-height: 105px;
}

.translation-note {
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.audio-settings {
  padding: 17px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin: 15px 0;
}

.audio-title {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.audio-title span {
  color: var(--muted);
}

input[type="range"] {
  width: 100%;
  margin: 16px 0 5px;
  accent-color: var(--accent);
}

.small-note {
  color: var(--muted);
  font-size: 11px;
  margin: 5px 0 0;
}

.control-panel {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

.primary-button,
.stop-button,
.clear-button {
  width: 100%;
  min-height: 52px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
  border: none;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:disabled {
  opacity: .6;
  cursor: wait;
}

.start-button span {
  margin-right: 9px;
}

.stop-button {
  background: #f9ebeb;
  color: var(--red);
}

.clear-button {
  background: transparent;
  color: var(--muted);
  min-height: 38px;
}

.session-info {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.session-info div {
  display: grid;
  gap: 5px;
}

.session-info span {
  color: var(--muted);
  font-size: 10px;
}

.session-info strong {
  font-size: 12px;
}

.error-message {
  color: var(--red);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 12px;
}

footer {
  margin-top: 28px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

footer button {
  border: none;
  background: transparent;
  color: var(--muted);
}

.login-panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 19px;
  max-width: 430px;
  margin: 50px auto;
  padding: 27px;
}

.login-symbol {
  color: #9d8356;
  font-size: 35px;
}

.login-panel h1 {
  font-size: 24px;
  margin: 10px 0;
}

.login-panel form {
  display: grid;
  gap: 11px;
  margin-top: 25px;
}

.login-panel label {
  font-size: 12px;
  font-weight: 700;
}

.login-panel input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  background: white;
}

@media (max-width: 430px) {
  .container {
    padding-left: 13px;
    padding-right: 13px;
  }

  .translation-card {
    padding: 16px;
  }

  .translated-text {
    font-size: 18px;
  }
}

/* BIBLIO installable web app */

.install-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin: 0 0 20px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.install-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.install-copy strong {
  font-size: 13px;
}

.install-copy span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

#installButton {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.install-help {
  grid-column: 1 / -1;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

@media (max-width: 390px) {
  .install-card {
    grid-template-columns: 1fr;
  }

  #installButton {
    width: 100%;
  }
}
