@font-face {
  font-family: "Fruit Parcel Fraunces";
  src: url("artes-resultados/fraunces.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

#inicio .home-actions { align-self: start; margin-top: clamp(19px, 6dvh, 54px); }
#open-settings, #open-results {
  position: absolute;
  left: max(5%, env(safe-area-inset-left));
  width: clamp(44px, 14cqw, 56px);
  height: auto;
  aspect-ratio: 1;
  z-index: 2;
}
#open-settings { top: max(3%, env(safe-area-inset-top)); }
#open-results { bottom: max(4%, env(safe-area-inset-bottom)); }
#open-results svg { fill: #f5c26b; }

.orchard-results {
  position: relative;
  height: var(--stage-height);
  overflow: hidden;
  background: #efbd81 url("artes-resultados/quadro-cedro.webp") center / 100% 100% no-repeat;
}
body[data-screen="resultados"] .test-head { top: max(3%, env(safe-area-inset-top)); inset-inline-start: max(5%, env(safe-area-inset-left)); }
body[data-screen="resultados"] #back-home {
  width: clamp(42px, 14cqw, 56px);
  height: auto;
  aspect-ratio: 1;
  padding: 0;
}
#back-home svg { display: none; }
body[data-screen="resultados"] #back-home span { display: none; }
body[data-screen="resultados"] #back-home svg { display: block; }
#results-title { position: absolute; inset: 10% 8% auto; height: 10%; margin: 0; color: #4b280f; }
#results-title svg { display: block; width: 100%; height: 100%; overflow: visible; }
#results-title text {
  fill: currentColor;
  font: 790 29px "Fruit Parcel Fraunces", Georgia, serif;
  letter-spacing: .3px;
  text-shadow: 0 1px 0 #ffde9b;
}
#results-average {
  position: absolute;
  inset: 26% 0 auto;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
}
#results-average .star-rating { gap: 1.5cqw; filter: drop-shadow(0 2px 2px #2b21188c); }
#results-average .rating-star { width: 14cqw; }
.results-body { position: absolute; inset: 34% 8.2% 12%; overflow: auto; padding: 2px; overscroll-behavior: contain; }
#results-list { display: grid; gap: 4.6cqw; margin: 0; padding: 0; list-style: none; }
.level-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 2%;
  min-height: 15.7cqw;
  padding: 2.5% 4%;
  border: 1px solid #b7784d;
  border-radius: 7px;
  color: #553722;
  background: #fff0d1;
  box-shadow: 1px 2px 2px #6b432d35;
}
.level-result strong { font-size: 4.8cqw; white-space: nowrap; }
.level-result .game-control { width: clamp(34px, 12cqw, 56px); height: auto; aspect-ratio: 1; }
.results-empty {
  margin: 9px 0;
  padding: 11px;
  border: 1px solid #c28a58;
  border-radius: 8px;
  background: #fff2d6;
  color: #422f21;
  font-size: .8rem;
}

.star-rating { display: inline-flex; gap: 2px; vertical-align: middle; }
.rating-star {
  position: relative;
  display: block;
  width: clamp(20px, 6.4cqw, 27px);
  aspect-ratio: 1;
  --star-fill: 0%;
}
.rating-star[data-fill="25"] { --star-fill: 25%; }
.rating-star[data-fill="50"] { --star-fill: 50%; }
.rating-star[data-fill="75"] { --star-fill: 75%; }
.rating-star[data-fill="100"] { --star-fill: 100%; }
.rating-star img { display: block; width: 100%; height: 100%; object-fit: contain; }
.rating-star img + img {
  position: absolute;
  inset: 0;
  clip-path: inset(0 calc(100% - var(--star-fill)) 0 0);
}

.delivery-face { width: 29px; height: 29px; object-fit: contain; flex: 0 0 auto; vertical-align: middle; }
#partida #loading { overflow: visible; }
#partida .dispatch { padding-top: clamp(23px, 7cqw, 35px); }
.truck-face {
  position: absolute;
  z-index: 3;
  left: 65%;
  bottom: 83%;
  width: 12.6cqw;
  aspect-ratio: 1;
  pointer-events: none;
}
.truck-face.face-in-flight, .truck-face.waiting-for-pickup { visibility: hidden; }
.face-flight {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: 50%;
  width: 35%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 4px 6px #623c1f74);
}
.truck-face img, .face-flight img { display: block; width: 100%; height: 100%; }
.face-flight .face-happy.reacting { animation: parcel-face-happy .68s cubic-bezier(.2,.7,.3,1) both; }
.face-flight .face-okay.reacting { animation: parcel-face-okay .51s ease-out both; }
.face-flight .face-angry.reacting { animation: parcel-face-angry .57s ease-out both; }
@keyframes parcel-face-happy {
  0% { opacity: 0; transform: translateY(12px) scale(.65,.76); }
  42% { opacity: 1; transform: translateY(-13px) scale(1.12,1.03); }
  69% { transform: translateY(3px) scale(1.06,.94); }
  100% { transform: none; }
}
@keyframes parcel-face-okay {
  0% { opacity: 0; transform: translateY(8px) scale(.8); }
  48% { opacity: 1; transform: rotate(-8deg) translateY(-2px); }
  75% { transform: rotate(5deg); }
  100% { transform: none; }
}
@keyframes parcel-face-angry {
  0% { opacity: 0; transform: translateY(6px) scale(.78); }
  36% { opacity: 1; transform: translateX(-5px) rotate(-6deg) scale(1.08); }
  56% { transform: translateX(5px) rotate(4deg); }
  74% { transform: translateX(-3px) rotate(-3deg); }
  100% { transform: none; }
}

#settings-dialog {
  width: min(calc(100% - 32px), 360px);
  max-height: calc(100% - 24px);
  padding: 21px;
  border: 5px solid #955a36;
  border-radius: 18px;
  background: #fff0d1;
  color: #4b280f;
  box-shadow: 0 0 0 1px #472b19, 0 14px 35px #2714086b;
}
#settings-dialog::backdrop { background: #19251dd1; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.settings-head h2 { margin: 0; font: 790 clamp(1.45rem, 6vw, 1.8rem)/1.13 "Fruit Parcel Fraunces", Georgia, serif; }
.settings-head .game-control { width: 44px; height: 44px; flex: none; }
#lang-options { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
#lang-options legend { font-weight: 800; margin-bottom: 7px; }
.lang-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 11px;
  border: 1px solid #b6865a;
  border-radius: 8px;
  background: #fff8e9;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.22;
}
.lang-choice:has(input:checked) { background: #e5ebcd; border-color: #50724a; color: #294b32; }
.lang-choice input { accent-color: #3b633b; width: 16px; height: 16px; margin: 0; flex: none; }
.lang-choice small { display: block; font-weight: 500; margin-top: 3px; }

#finish-stars .star-rating { gap: 6px; }
#finish-stars .rating-star { width: clamp(34px, 14cqw, 55px); }
body[data-screen="conclusao"] :is(.test-head, #install-help) { display: none; }
.finish-actions {
  display: grid;
  justify-items: center;
  gap: 9px;
  width: min(100%, 235px);
}
.finish-secondary { display: flex; gap: 12px; }
.finish-secondary .game-control {
  width: 62px;
  height: 56px;
  grid-template-rows: 21px auto;
  align-content: center;
  gap: 3px;
  font-size: .65rem;
  font-weight: 800;
  line-height: 1;
}
.finish-secondary svg { width: 21px; height: 21px; }
#finish-next {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 5px 13px 7px;
  font-size: clamp(.85rem, 4.2cqw, 1.05rem);
}
@media (max-height: 420px) {
  #conclusao { padding-block: 6px; }
  .finish-card { gap: 7px; padding-block: 100px 14px; }
  .finish-secondary .game-control { height: 48px; }
  #finish-next { min-height: 46px; }
}

@media (min-width: 650px) {
  .orchard-results { border-radius: 13px; }
}
