/* Paleta do logo Sal da Terra. Pensado primeiro para celular. */
:root {
  --creme: #fefaf1;
  --creme-quente: #f7ebd7;
  --marrom: #5a2a07;
  --caramelo: #8e531b;
  --ambar: #c37c25;
  --dourado: #e8a84f;
  --luz: #fccb62;
  --sal: #c8b8aa;
  --erro: #a32a12;
  --titulo: "Yeseva One", Georgia, serif;
  --corpo: "Nunito Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--creme);
  color: var(--marrom);
  font: 17px/1.45 var(--corpo);
  -webkit-tap-highlight-color: transparent;
}
h1 { margin: 0; font: 400 1.7rem/1.15 var(--titulo); text-wrap: balance; }
p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--ambar); outline-offset: 2px; }

.page {
  width: 100%;
  max-width: 460px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  text-align: center;
}
.page.wide { max-width: 720px; justify-content: flex-start; }
.logo { display: block; width: min(72vw, 300px); height: auto; margin: 0 auto; }
.logo.small { width: min(40vw, 150px); }
.lead { color: var(--caramelo); }

.form, .form section { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.form h1 { text-align: center; margin-bottom: 6px; }
label { font-weight: 800; }
input[type="text"], input[type="tel"], input[type="password"] {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--sal);
  border-radius: 10px;
  background: #fff;
  font-size: 18px; /* abaixo de 16px o iPhone dá zoom no campo */
}
.field { position: relative; }
.field .bi {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--ambar);
  font-size: 1.15rem;
  line-height: 1;
  pointer-events: none;
}
.field input { padding-left: 44px; }
input:focus { border-color: var(--ambar); outline: none; }
input::placeholder { color: var(--caramelo); opacity: .55; }
.hint { color: var(--caramelo); font-size: .9rem; }
.error { color: var(--erro); font-weight: 800; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  border: 2px solid var(--marrom);
  border-radius: 10px;
  background: var(--marrom);
  color: var(--creme);
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}
.button .bi { flex: none; font-size: 1.15em; line-height: 1; }
.button.quiet { background: transparent; color: var(--marrom); }
.link { padding: 8px; border: 0; background: none; color: var(--caramelo); text-decoration: underline; }

.field-label { font-weight: 800; }
.photo-box {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 2px dashed var(--ambar);
  border-radius: 10px;
  background: var(--creme-quente);
  color: var(--caramelo);
  text-align: center;
}
.photo-box img, .photo-box video { width: 100%; height: 100%; object-fit: cover; }
.photo-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.photo-actions .button { padding-inline: 8px; }
.cook-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cook-list li { padding: 10px 12px; border-radius: 8px; background: var(--creme-quente); overflow-wrap: anywhere; }

/* Duelo: ocupa a tela inteira, sem rolagem. */
.duel-page { height: 100dvh; overflow: hidden; }
.duel {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.duel-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.duel-top h1 { font-size: 1.2rem; }
.count { color: var(--caramelo); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 6px; flex: none; overflow: hidden; border-radius: 3px; background: var(--creme-quente); }
.bar i { display: block; width: 0; height: 100%; background: var(--ambar); transition: width .2s; }
.arena { position: relative; flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.dish {
  position: relative;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: var(--creme-quente);
  transition: transform .12s, opacity .12s;
  touch-action: manipulation;
}
.dish img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dish strong {
  position: absolute;
  inset: auto 0 0;
  padding: 30px 12px 10px;
  background: linear-gradient(transparent, rgba(45, 20, 4, .88));
  color: var(--creme);
  font: 400 clamp(1.1rem, 5vw, 1.6rem)/1.15 var(--titulo);
  text-align: left;
  overflow-wrap: anywhere;
}
/* No celular o VS fica entre os cartões: o nome de cima vai para o topo para não ficar coberto. */
.dish:first-of-type strong {
  inset: 0 0 auto;
  padding: 10px 12px 30px;
  background: linear-gradient(rgba(45, 20, 4, .88), transparent);
}
.dish.chosen { transform: scale(1.015); box-shadow: 0 0 0 4px var(--luz); }
.dish.dropped { opacity: .3; }
.versus {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 3px solid var(--creme);
  border-radius: 50%;
  background: var(--marrom);
  color: var(--luz);
  font: 400 .85rem var(--titulo);
  pointer-events: none;
}

/* Ranking */
.ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ranking li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 10px;
  background: var(--creme-quente);
}
.ranking li:first-child { background: var(--luz); }
.ranking img { flex: none; width: 64px; height: 64px; border-radius: 8px; object-fit: cover; }
.ranking div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ranking strong { overflow-wrap: anywhere; }
.ranking div span { font-size: .85rem; overflow-wrap: anywhere; }
.position { flex: none; width: 2.1rem; font: 400 1.2rem var(--titulo); text-align: center; }
.elo { flex: none; font: 400 1.1rem var(--titulo); text-align: right; font-variant-numeric: tabular-nums; }
.elo small { display: block; font: 800 .65rem var(--corpo); letter-spacing: .06em; }

@media (min-width: 760px) {
  .duel { max-width: 1100px; margin: 0 auto; }
  .duel-top h1 { font-size: 1.6rem; }
  .arena { grid-template-rows: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  .dish:first-of-type strong {
    inset: auto 0 0;
    padding: 30px 12px 10px;
    background: linear-gradient(transparent, rgba(45, 20, 4, .88));
  }
  .dish:hover { box-shadow: 0 0 0 4px var(--dourado); }
}
@media (prefers-reduced-motion: reduce) {
  .dish, .bar i { transition: none; }
}
