:root {
  --bg-gradient: radial-gradient(
    circle at top center,
    #1e1e24 0%,
    #0f0f12 100%
  );
  --card-bg: rgba(24, 24, 27, 0.8);
  --card-border: rgba(63, 63, 70, 0.45);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #10b981;
  --success-hover: #059669;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --input-bg: #09090b;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  background: var(--bg-gradient);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem; /* Padding reduzido para telas pequenas */
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 760px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header Responsivo */
.app-header {
  text-align: center;
  padding: 0 0.5rem;
}

.a:hover,
.a.active {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.app-header h1 {
  font-size: clamp(
    1.6rem,
    5vw,
    2.25rem
  ); /* Tamanho fluido baseado no display */
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.gradient-text {
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  line-height: 1.4;
}

/* Container Principal Otimizado para Mobile e Desktop */
.app-main {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: clamp(1.25rem, 4vw, 2rem); /* Padding dinâmico */
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

/* Seletor Segmentado Fluido */
.mode-selector {
  display: flex;
  background: var(--input-bg);
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 1.5rem;
  gap: 0.25rem;
}

.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.75rem 0.5rem;
  font-size: clamp(0.8rem, 2.8vw, 0.95rem);
  font-weight: 600;
  cursor: pointer;
  border-radius: 9px;
  transition: var(--transition);
  white-space: nowrap;
}

.mode-btn svg {
  flex-shrink: 0; /* Impede distorção do ícone */
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* Painéis de Animação */
.panel {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Info Card Adaptável */
.info-card {
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: clamp(0.8rem, 2.5vw, 0.875rem);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
}

/* Zona de Upload Responsiva (Área de toque aumentada no mobile) */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: clamp(2rem, 6vw, 3.5rem) 1rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
}

.drop-icon {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  transition: var(--transition);
}

.drop-zone:hover .drop-icon {
  color: var(--accent);
  transform: translateY(-2px);
}

.main-text {
  font-size: clamp(0.9rem, 2.8vw, 1rem);
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.sub-text {
  color: var(--text-secondary);
  font-size: clamp(0.75rem, 2.2vw, 0.8rem);
  line-height: 1.3;
}

.drop-zone input {
  display: none;
}

/* Divisor "ou" entre upload e gravação */
.divider-or {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.25rem 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.divider-or::before,
.divider-or::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.divider-or span {
  padding: 0 0.85rem;
}

/* Bloco de Gravação de Áudio */
.record-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.btn-record {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  min-height: 46px;
  background: rgba(0, 0, 0, 0.15);
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: clamp(0.85rem, 2.8vw, 0.95rem);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-record:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
  color: var(--text-primary);
}

.btn-record .mic-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: var(--transition);
}

.btn-record:hover .mic-icon {
  color: var(--accent);
}

.btn-record.recording {
  border-style: solid;
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  color: var(--text-primary);
  animation: pulse-border 1.6s ease-in-out infinite;
}

.btn-record.recording .mic-icon {
  color: var(--danger);
}

@keyframes pulse-border {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.25);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
}

.record-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink-dot 1s ease-in-out infinite;
}

@keyframes blink-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* Badges empilháveis no Mobile */
.meta-data {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badge {
  background: #27272a;
  border: 1px solid #3f3f46;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Formulários e Inputs */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

textarea {
  width: 100%;
  height: clamp(
    120px,
    20vh,
    160px
  ); /* Altura balanceada para telas de smartphones */
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.85rem;
  color: var(--text-primary);
  font-family: "Courier New", Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: none;
  transition: var(--transition);
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Grid Inteligente de Controle (Se transforma de 2 colunas para 1 coluna) */
.control-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}

.select-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

select {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--input-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a1a1aa'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C//svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.1rem;
}

/* Botões com Toque Aumentado (Otimização Mobile UX) */
button.btn-primary,
button.btn-success {
  width: 100%;
  padding: 0.85rem 1.25rem;
  min-height: 46px; /* Tamanho mínimo de clique recomendado pela Apple/Google */
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}

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

/* Bloco de Resultados */
.result-box {
  margin-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 1.25rem;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.action-link {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

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

.audio-player-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

audio {
  width: 100%;
  border-radius: 8px;
}

/* Rodapé Responsivo */
.app-footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 0 0.5rem;
}

.dev-name {
  color: var(--text-primary);
  font-weight: 600;
}

.rights {
  opacity: 0.5;
  font-size: 0.7rem;
  margin-top: 0.25rem;
}

/* Media Query Crítica para Smartphones e Displays Pequenos */
@media (max-width: 580px) {
  .control-row {
    grid-template-columns: 1fr; /* Quebra as duas colunas do select/botão em linhas cheias */
    gap: 0.85rem;
  }

  body {
    padding: 0.5rem; /* Máximo proveito de tela em celulares estreitos */
  }
}

.hidden {
  display: none !important;
}
