:root {
  --bg: #111318;
  --panel: #1b1f27;
  --text: #eef1f6;
  --muted: #98a2b3;
  --red: #e11d2e;
  --red-dark: #a10f1d;
  --ok: #22c55e;
  --err: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

h1 { margin: 0; font-size: 1.35rem; font-weight: 600; }
h2 { margin: 0 0 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* --- červené tlačítko --- */
.rec-btn {
  width: 130px;
  height: 130px;
  border: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff4757, var(--red) 55%, var(--red-dark));
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(225, 29, 46, .35);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s ease;
  touch-action: manipulation;
  user-select: none;
}

.rec-btn:active { transform: scale(.96); }

.rec-btn[disabled] {
  filter: grayscale(.7) brightness(.7);
  cursor: not-allowed;
  box-shadow: none;
}

.rec-btn.is-recording {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 46, .55), 0 12px 30px rgba(225, 29, 46, .35); }
  50%      { box-shadow: 0 0 0 24px rgba(225, 29, 46, 0), 0 12px 30px rgba(225, 29, 46, .35); }
}

@media (prefers-reduced-motion: reduce) {
  .rec-btn.is-recording { animation: none; outline: 3px solid #fff; outline-offset: 4px; }
}

.status { margin: 0; min-height: 1.5em; text-align: center; color: var(--muted); }
.status.is-ok  { color: var(--ok); }
.status.is-err { color: var(--err); }

.panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid #262b35;
  border-radius: 14px;
  padding: 14px 16px;
}

.transcript { margin: 0; font-size: 1.05rem; min-height: 1.5em; word-break: break-word; }
.transcript .interim { color: var(--muted); }
.muted { color: var(--muted); }

.result {
  margin: 0;
  font-size: .82rem;
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  min-height: 1.5em;
}

/* --- ruční zadání textu --- */
.manual {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.manual__input {
  width: 100%;
  padding: 11px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background-color: #14181f;
  border: 1px solid #333a46;
  border-radius: 12px;
  resize: vertical;
  min-height: 4.5em;
  /* Kde to prohlížeč umí, roste pole samo podle obsahu. */
  field-sizing: content;
  max-height: 40vh;
}

.manual__input::placeholder { color: var(--muted); }

.manual__input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.manual__input:disabled,
.manual .submit-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.manual .submit-btn { padding: 11px 18px; font-size: .95rem; }

/* --- výběr typu záznamu --- */
.field {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.field__select {
  width: 100%;
  padding: 13px 40px 13px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background-color: var(--panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2398a2b3'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 22px;
  border: 1px solid #333a46;
  border-radius: 12px;
  appearance: none;
  cursor: pointer;
}

.field__select:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.field__select:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Rozbalená nabídka dědí barvy systému, na tmavém pozadí je nutné vynutit kontrast */
.field__select option {
  background-color: var(--panel);
  color: var(--text);
}

/* --- PWA: hlavička, instalace, offline --- */
.head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ghost-btn {
  padding: 8px 14px;
  font: inherit;
  font-size: .85rem;
  color: var(--text);
  background: transparent;
  border: 1px solid #3a4250;
  border-radius: 999px;
  cursor: pointer;
}

.ghost-btn:active { background: #232935; }

.offline-bar {
  width: 100%;
  margin: 0;
  padding: 10px 14px;
  font-size: .9rem;
  text-align: center;
  color: #fecaca;
  background: rgba(225, 29, 46, .16);
  border: 1px solid rgba(225, 29, 46, .4);
  border-radius: 12px;
}

/* --- přihlášení --- */
.login {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field__input {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background-color: #14181f;
  border: 1px solid #333a46;
  border-radius: 12px;
}

.field__input:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.submit-btn {
  padding: 14px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--red);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  touch-action: manipulation;
}

.submit-btn:active { background: var(--red-dark); }

.head__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
