:root {
  --bg: oklch(0.19 0.012 265);
  --bg-glow: oklch(0.3 0.06 70 / 0.35);
  --surface: oklch(0.235 0.014 265);
  --surface-raised: oklch(0.27 0.016 265);
  --border: oklch(0.36 0.016 265);
  --text: oklch(0.96 0.005 265);
  --text-muted: oklch(0.76 0.012 265);
  --accent: oklch(0.8 0.14 75);
  --accent-strong: oklch(0.86 0.13 80);
  --accent-text: oklch(0.2 0.03 70);
  --danger: oklch(0.76 0.14 25);
  --danger-bg: oklch(0.3 0.07 25 / 0.45);
  --success: oklch(0.8 0.13 150);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(60rem 30rem at 50% -10rem, var(--bg-glow), transparent 70%), var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
}

.page {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 10vh, 6rem) 1rem 3rem;
  display: grid;
  gap: 1.25rem;
}

.intro {
  margin-bottom: 0.75rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 1.0625rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.label {
  display: block;
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.hint {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.field-row,
.result-row {
  display: flex;
  gap: 0.625rem;
}

input {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  padding: 0.75rem 0.875rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  /* 16px ou mais evita o zoom automático do iOS ao focar o campo. */
  font: inherit;
  font-size: 1rem;
}

input::placeholder {
  color: oklch(0.6 0.012 265);
}

input[aria-invalid="true"] {
  border-color: var(--danger);
}

input[readonly] {
  color: var(--text-muted);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    transform 120ms ease;
}

.button:active {
  transform: translateY(1px);
}

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

.button-primary:hover {
  background: var(--accent-strong);
}

.button-secondary {
  background: var(--surface-raised);
  color: var(--text);
  border-color: var(--border);
}

.button-secondary:hover {
  border-color: var(--text-muted);
}

.button-secondary[data-copied="true"] {
  color: var(--success);
  border-color: var(--success);
}

.button[aria-disabled="true"] {
  cursor: progress;
  opacity: 0.75;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

input:focus-visible {
  outline-offset: 1px;
}

.spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

form[aria-busy="true"] .spinner {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

.error:empty {
  display: none;
}

.error {
  margin-top: 0.875rem;
  padding: 0.75rem 0.875rem;
  background: var(--danger-bg);
  border: 1px solid var(--danger);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9375rem;
}

.error p {
  margin: 0;
}

.error ul {
  margin: 0.375rem 0 0;
  padding-left: 1.25rem;
}

.result {
  border-color: oklch(0.55 0.1 75);
}

.short-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 1.0625rem;
  overflow-wrap: anywhere;
  text-underline-offset: 3px;
}

/* `:not([hidden])`: um `display` na classe venceria o atributo `hidden`. */
.manual-copy:not([hidden]) {
  margin-top: 0.75rem;
  display: grid;
  gap: 0.5rem;
}

.manual-copy .hint {
  margin: 0;
}

.details {
  margin: 1rem 0 0;
  display: grid;
  gap: 0.625rem;
  font-size: 0.875rem;
}

.details dt {
  color: var(--text-muted);
}

.details dd {
  margin: 0.125rem 0 0;
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 30rem) {
  .field-row,
  .result-row {
    flex-direction: column;
  }

  .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .spinner {
    animation-duration: 2s;
  }
}
