:root {
  --bg: #f5f7f7;
  --card: #ffffff;
  --text: #132423;
  --muted: #647473;
  --muted-2: #8b9998;
  --line: #dfe7e6;
  --line-strong: #c9d6d4;
  --brand: #0f766e;
  --brand-dark: #0b5d57;
  --brand-soft: #e8f5f3;
  --brand-softer: #f3faf9;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 18px 55px rgba(22, 51, 48, 0.08);
  --radius: 22px;
  --radius-sm: 14px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Garante que componentes com o atributo HTML hidden sejam realmente ocultados. */
[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -10%, rgba(15, 118, 110, 0.09), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
textarea,
input {
  font: inherit;
}

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

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
label[for="audioFile"]:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.22);
  outline-offset: 2px;
}

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: var(--brand);
  box-shadow: 0 7px 18px rgba(15, 118, 110, 0.2);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: white;
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.brand-mark .brand-spark {
  fill: white;
  stroke: none;
}

.brand > span:last-child {
  display: flex;
  flex-direction: column;
}

.brand strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.73rem;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  cursor: pointer;
  transition: 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  color: var(--brand);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.main {
  width: min(760px, calc(100% - 32px));
  margin: 32px auto 0;
  flex: 1;
}

.hero {
  text-align: center;
  margin: 20px 0 34px;
}

.eyebrow {
  display: inline-flex;
  padding: 7px 11px;
  border: 1px solid #cce5e1;
  border-radius: 999px;
  background: var(--brand-softer);
  color: var(--brand);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.hero h1 {
  margin: 15px auto 13px;
  max-width: 700px;
  font-size: clamp(2rem, 6vw, 3.45rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
}

.hero h1 span {
  color: var(--brand);
}

.hero p {
  max-width: 630px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.app-card,
.result-card {
  background: var(--card);
  border: 1px solid rgba(203, 216, 214, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.app-card {
  padding: 9px 24px 25px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
  margin: 0 -24px 23px;
  padding: 0 24px;
}

.tab {
  position: relative;
  min-height: 58px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.tab::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -1px;
  height: 2px;
  border-radius: 999px 999px 0 0;
  background: transparent;
}

.tab.is-active {
  color: var(--brand);
}

.tab.is-active::after {
  background: var(--brand);
}

.tab svg,
.primary-button svg,
.copy-button svg,
.upload-button svg,
.privacy-note svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.panel {
  min-height: 255px;
}

.field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.field-header label,
.modal-card label {
  font-size: 0.84rem;
  font-weight: 750;
}

.field-actions {
  display: flex;
  gap: 12px;
}

.text-action {
  border: 0;
  padding: 3px;
  background: transparent;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.text-action:hover {
  text-decoration: underline;
}

.text-action.danger {
  color: var(--danger);
}

.textarea-wrap {
  position: relative;
}

#messageInput {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 16px 16px 38px;
  background: #fbfcfc;
  color: var(--text);
  line-height: 1.55;
  transition: 160ms ease;
}

#messageInput::placeholder {
  color: #9eabaa;
}

#messageInput:focus {
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.07);
  outline: 0;
}

.char-count {
  position: absolute;
  right: 13px;
  bottom: 12px;
  color: var(--muted-2);
  font-size: 0.7rem;
  pointer-events: none;
}

.audio-box {
  min-height: 245px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: 17px;
  padding: 22px;
  background: #fbfcfc;
  text-align: center;
}

.audio-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.audio-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.audio-copy {
  display: flex;
  flex-direction: column;
  margin: 11px 0 16px;
}

.audio-copy strong {
  font-size: 0.96rem;
}

.audio-copy span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.record-timer {
  color: var(--danger) !important;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.record-button,
.upload-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 12px;
  padding: 0 17px;
  cursor: pointer;
  font-weight: 750;
  font-size: 0.83rem;
  transition: 160ms ease;
}

.record-button {
  border: 1px solid var(--line-strong);
  background: white;
  color: var(--text);
}

.record-button:hover {
  border-color: #a9bfbc;
  transform: translateY(-1px);
}

.record-button.is-recording {
  color: var(--danger);
  border-color: #f2bbb6;
  background: var(--danger-soft);
}

.record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d44b40;
}

.record-button.is-recording .record-dot {
  border-radius: 2px;
  animation: pulse 1.2s infinite;
}

.audio-divider {
  width: min(260px, 80%);
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.audio-divider::before,
.audio-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.upload-button {
  color: var(--brand);
  background: var(--brand-soft);
}

.upload-button:hover {
  background: #dcefeb;
}

.audio-hint {
  margin: 11px 0 0;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.audio-preview-wrap {
  width: 100%;
  max-width: 500px;
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.audio-preview {
  width: 100%;
}

#audioPreview {
  width: 100%;
  height: 38px;
}

.tone-block {
  margin-top: 22px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.tone-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.tone-label span {
  font-size: 0.84rem;
  font-weight: 750;
}

.tone-label small {
  color: var(--muted-2);
  font-size: 0.69rem;
}

.tone-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.tone-option {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfc;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: 160ms ease;
}

.tone-option:hover {
  border-color: var(--line-strong);
  background: white;
}

.tone-option.is-selected {
  border-color: #78b8b2;
  background: var(--brand-softer);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.09);
}

.tone-emoji {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: #eef3f2;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
}

.tone-option.is-selected .tone-emoji {
  background: var(--brand-soft);
  color: var(--brand);
}

.tone-option > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tone-option strong {
  font-size: 0.75rem;
}

.tone-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.65rem;
  white-space: nowrap;
}

.primary-button,
.copy-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--brand);
  box-shadow: 0 10px 25px rgba(15, 118, 110, 0.18);
  font-weight: 800;
  cursor: pointer;
  transition: 160ms ease;
}

.primary-button {
  margin-top: 20px;
}

.primary-button:hover,
.copy-button:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.button-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.primary-button.is-loading .button-label {
  display: none;
}

.spinner {
  width: 19px;
  height: 19px;
  margin: auto;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.status-message {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #ffd4d0;
}

.result-card {
  margin-top: 18px;
  padding: 24px;
  scroll-margin-top: 18px;
}

.result-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.result-kicker {
  color: var(--brand);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.result-header h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.safe-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.67rem;
  font-weight: 800;
  white-space: nowrap;
}

.safe-badge svg {
  width: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-text {
  width: 100%;
  min-height: 150px;
  margin-top: 17px;
  resize: none;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px;
  background: #fbfcfc;
  color: var(--text);
  line-height: 1.58;
}

.transcript-details {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.transcript-details summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 700;
}

.transcript-details p {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  background: #fafcfc;
  line-height: 1.5;
  white-space: pre-wrap;
}

.result-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 10px;
}

.copy-button {
  min-height: 46px;
  box-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.secondary-button {
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: white;
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}

.secondary-button:hover {
  background: #f8fafa;
}

.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 18px 0 0;
  color: var(--muted-2);
  font-size: 0.67rem;
  text-align: center;
}

.privacy-note svg {
  width: 14px;
  height: 14px;
}

footer {
  width: min(1120px, calc(100% - 32px));
  margin: 45px auto 0;
  min-height: 76px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-2);
  font-size: 0.68rem;
}

footer span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(9, 28, 27, 0.52);
  backdrop-filter: blur(5px);
}

.modal-card {
  width: min(390px, 100%);
  padding: 26px;
  border-radius: 20px;
  background: white;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.23);
  text-align: center;
}

.modal-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
}

.modal-icon svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-card h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-card p {
  margin: 7px 0 18px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.modal-card label {
  display: block;
  text-align: left;
  margin-bottom: 6px;
}

.modal-card input {
  width: 100%;
  height: 45px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 0 12px;
  color: var(--text);
}

.modal-card input:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.07);
}

.modal-card .compact {
  margin-top: 12px;
  min-height: 45px;
}

.modal-close {
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.modal-card > small {
  display: block;
  margin-top: 14px;
  color: var(--muted-2);
  font-size: 0.65rem;
}

.modal-error {
  margin-top: 7px;
  color: var(--danger);
  font-size: 0.73rem;
  text-align: left;
}

.toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 15px;
  border-radius: 12px;
  background: #16332f;
  color: white;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
  font-size: 0.76rem;
  font-weight: 700;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

@media (max-width: 620px) {
  .site-header {
    min-height: 72px;
  }

  .brand small {
    display: none;
  }

  .main {
    width: min(100% - 22px, 760px);
    margin-top: 18px;
  }

  .hero {
    margin: 12px 5px 25px;
  }

  .hero h1 {
    margin-top: 13px;
    font-size: clamp(2rem, 11vw, 2.7rem);
  }

  .hero p {
    font-size: 0.9rem;
  }

  .app-card {
    padding-left: 16px;
    padding-right: 16px;
    border-radius: 18px;
  }

  .tabs {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }

  .panel {
    min-height: 240px;
  }

  #messageInput {
    min-height: 210px;
  }

  .tone-options {
    grid-template-columns: 1fr;
  }

  .tone-option {
    min-height: 57px;
  }

  .tone-option small {
    white-space: normal;
  }

  .result-card {
    padding: 18px 16px;
    border-radius: 18px;
  }

  .result-header {
    align-items: flex-start;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  footer {
    min-height: 65px;
    margin-top: 32px;
  }

  footer span:last-child {
    display: none;
  }
}

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