:root {
  --bg: #09060f;
  --surface: #140e22;
  --surface-2: #1c1430;
  --border: #31244f;
  --text: #f3eefe;
  --muted: #b3a6cf;
  --primary: #7c3aed;
  --primary-hover: #8b4cf6;
  --accent: #c084fc;
  --danger: #fda4af;
  --warning: #fde68a;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* O atributo hidden precisa vencer os "display" definidos abaixo. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 50% -150px, rgba(124, 58, 237, 0.38), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.header, main, footer {
  width: min(1040px, 100% - 32px);
  margin-inline: auto;
}

.header { text-align: center; padding: 36px 0 24px; }
.brand { display: flex; align-items: center; justify-content: center; gap: 14px; }
.brand img { filter: drop-shadow(0 6px 18px rgba(168, 85, 247, 0.55)); }
h1 { margin: 0; font-size: clamp(1.6rem, 6vw, 2.4rem); letter-spacing: -0.03em; line-height: 1.15; }
h1 span {
  background: linear-gradient(90deg, #d8b4fe, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { margin: 12px auto; color: var(--muted); max-width: 520px; }
.badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.badges li {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(28, 20, 48, 0.7);
  color: var(--accent);
  font-size: 0.82rem;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin: 0 auto 20px;
  max-width: 460px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.tabs button {
  flex: 1;
  padding: 10px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tabs button[aria-selected="true"] {
  background: linear-gradient(135deg, var(--primary), #5b21b6);
  color: #fff;
}

.panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }

.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 1.05rem; }
.dropzone ~ h2, fieldset ~ h2, #audio-tools ~ h2, .file-info ~ h2, .notice ~ h2 { margin-top: 22px; }
.step {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  font-size: 0.85rem;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 24px 16px;
  border: 2px dashed #4c367a;
  border-radius: 12px;
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { border-color: var(--accent); background: #251944; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone small { color: var(--muted); }

.file-info { margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.notice { margin: 8px 0 0; color: var(--warning); font-size: 0.88rem; }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; padding: 0; color: var(--muted); font-size: 0.9rem; }
fieldset:disabled { opacity: 0.55; }

.choices { display: flex; gap: 8px; margin-bottom: 12px; }
.choices label { flex: 1; cursor: pointer; }
.choices input { position: absolute; opacity: 0; }
.choices span {
  display: block;
  height: 100%;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  text-align: center;
  font-size: 0.92rem;
}
.choices input:checked + span { border-color: var(--accent); background: #33215c; }
.choices input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.fields label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.86rem; }
select, input[type="number"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
audio { width: 100%; margin: 12px 0; }
#audio-tools .actions { margin-top: 10px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid #52398a;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover:not(:disabled) { border-color: var(--accent); }
.button.primary { border-color: transparent; background: var(--primary); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--primary-hover); }
.button:disabled { opacity: 0.45; cursor: not-allowed; }
.button.wide { width: 100%; margin-top: 18px; }
.button.small { padding: 7px 12px; font-size: 0.86rem; }
:is(.button, .tabs button, select, input[type="number"], summary, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .button:not(.small) { flex: 1 1 140px; }

.status { margin: 12px 0 0; color: var(--muted); font-size: 0.92rem; }
.status:empty { margin: 0; }
.status.is-error { color: var(--danger); }
.status.is-success { color: #86efac; }
.hint { margin: 10px 0 0; color: var(--muted); font-size: 0.86rem; }

progress {
  display: block;
  width: 100%;
  height: 10px;
  margin-top: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  appearance: none;
}
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--primary), var(--accent)); }
progress::-moz-progress-bar { background: var(--primary); }

.stage {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #06040b;
}
.stage.checker { background: repeating-conic-gradient(#221a36 0 25%, #151023 0 50%) 0 0 / 24px 24px; }
.stage canvas, .stage img, .stage video { display: block; max-width: 100%; max-height: 520px; height: auto; }
.placeholder { color: var(--muted); text-align: center; }
.result { margin-top: 14px; }
.result-meta { margin: 0 0 12px; font-size: 0.9rem; }

.web-send { margin-top: 14px; color: var(--muted); font-size: 0.86rem; }
.web-send .button { width: 100%; border-color: #22c55e; }
.web-send .button:hover { border-color: #86efac; }
.web-send ol { margin: 10px 0 0; padding-left: 20px; }
.web-send p { margin: 8px 0 0; }
/* No celular o envio é pelo aplicativo, não pelo WhatsApp Web. */
@media (hover: none) and (pointer: coarse) {
  .web-send { display: none; }
}

.help { margin-top: 20px; }
details { border-top: 1px solid var(--border); padding: 12px 0; }
summary { cursor: pointer; font-weight: 600; }
details p, details ul { color: var(--muted); font-size: 0.93rem; }

footer { padding: 28px 0 36px; text-align: center; color: var(--muted); font-size: 0.8rem; }
a { color: var(--accent); }
a.button { color: var(--text); }

@media (max-width: 760px) {
  .panel { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .header { padding-top: 24px; }
  .stage { min-height: 240px; }
}
