/* Mobile-first, contraste alto para ler ao sol, tema claro/escuro automático. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --surface: #f1f1f1;
  --fg: #000000;
  --muted: #4a4a4a;
  --border: #6b6b6b;
  --accent: #0b3d91;
  --on-accent: #ffffff;
  --highlight: #ffe066;
  --on-highlight: #000000;
  --error: #a40000;
  --ok: #0a5c1f;
  --warning: #6b4700;
  --nav-height: 3.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1c;
    --fg: #ffffff;
    --muted: #c4c4c4;
    --border: #9a9a9a;
    --accent: #9cc2ff;
    --on-accent: #000000;
    --highlight: #ffd43b;
    --on-highlight: #000000;
    --error: #ff9a9a;
    --ok: #8ee6a4;
    --warning: #ffd27a;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 18px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 1.5rem);
}

h1 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.15rem;
}

p {
  margin: 0.5rem 0;
}

a {
  color: var(--accent);
}

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

/* Navegação inferior */

nav {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 2px solid var(--border);
}

nav a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--nav-height);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

nav a[aria-current='page'] {
  background: var(--accent);
  color: var(--on-accent);
}

/* Formulários e botões */

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

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

input[type='text'],
input[type='search'],
input[type='password'],
input[type='date'],
textarea,
select {
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
}

.check input {
  width: 1.5rem;
  height: 1.5rem;
}

.row {
  display: flex;
  gap: 0.75rem;
}

.grow {
  flex: 1;
  min-width: 0;
}

.narrow {
  width: 6rem;
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.25rem;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  border: 2px solid var(--fg);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button-danger {
  border-color: var(--error);
  color: var(--error);
}

.button:disabled {
  opacity: 0.6;
}

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

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

.chips,
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  min-height: 2.75rem;
  padding: 0.25rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 1.5rem;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}

/* Avisos */

.alert {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border: 2px solid currentColor;
  border-radius: 0.5rem;
  font-weight: 600;
}

.alert-error {
  color: var(--error);
}

.alert-warning {
  color: var(--warning);
}

.alert-ok {
  color: var(--ok);
}

/* Resultados da pesquisa */

.results {
  margin: 0;
  padding: 0;
  list-style: none;
}

.result {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  text-decoration: none;
}

.thumb {
  flex: none;
  width: 6rem;
  height: 3.75rem;
  border-radius: 0.25rem;
  background: var(--surface);
  object-fit: contain;
}

.result-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.img-failed {
  display: none;
}

/* Nota */

.back {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
  text-decoration: none;
}

.subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.pick {
  padding: 0.1rem 0.6rem;
  border-radius: 0.4rem;
  background: var(--highlight);
  color: var(--on-highlight);
  font-size: 1.15rem;
  font-weight: 800;
}

.photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

figure {
  margin: 0;
}

figcaption {
  font-size: 0.75rem;
}

.photo {
  display: block;
  width: 100%;
  min-height: 4rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--surface);
  cursor: zoom-in;
}

.photo img {
  display: block;
  width: 100%;
  height: auto;
}

.zoom {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000000;
  cursor: zoom-out;
}

.zoom[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  margin: 0.75rem 0;
}

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

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.grades {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

.grade {
  min-height: 3rem;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.grade[aria-pressed='true'] {
  border-color: var(--highlight);
  background: var(--highlight);
  color: var(--on-highlight);
}

.prices {
  width: 100%;
  margin: 0.75rem 0;
  border-collapse: collapse;
}

.prices th,
.prices td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.prices th {
  font-weight: 700;
  text-align: left;
}

.prices th span {
  font-weight: 400;
}

.prices td {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.prices .selected th,
.prices .selected td {
  background: var(--highlight);
  color: var(--on-highlight);
  font-size: 1.2rem;
  font-weight: 800;
}

.prices .selected th span {
  color: var(--on-highlight);
}

.fair {
  font-size: 1.2rem;
}

.links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.5rem;
}

/* Definições */

.usage progress {
  width: 100%;
  height: 1rem;
}

/* Bloco eBay */

h3 {
  margin: 1.25rem 0 0.25rem;
  font-size: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.stats div {
  padding: 0.5rem;
  border: 2px solid var(--border);
  border-radius: 0.5rem;
  text-align: center;
}

.stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.stats dd {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Coleção */

.stats-4 {
  grid-template-columns: 1fr 1fr;
}

.stats small {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
}
