:root {
  --tractor-red: #e93425;
  --tractor-red-dark: #a61912;
  --tractor-yellow: #ffd348;
  --tractor-green: #39a954;
  --tractor-blue: #35b9ef;
  --tractor-ink: #2d183f;
  --tractor-safe-top: env(safe-area-inset-top, 0px);
  --tractor-safe-right: env(safe-area-inset-right, 0px);
  --tractor-safe-bottom: env(safe-area-inset-bottom, 0px);
  --tractor-safe-left: env(safe-area-inset-left, 0px);
}

.tractor-page {
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 10%, rgba(255,255,255,.92), transparent 28%),
    linear-gradient(180deg, #dff7ff 0%, #f9f4e8 66%, #f5e8c8 100%);
}

.tractor-site-header { flex: 0 0 auto; }

#tractor-game-root,
#tractor-game-root * {
  -webkit-tap-highlight-color: transparent;
}

#tractor-canvas {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  outline: none;
}

.tractor-shell {
  min-height: calc(100dvh - 84px);
  padding: clamp(8px, 1.8vw, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tractor-card {
  width: 100%;
  max-width: 1380px;
  min-width: 0;
  flex: 1 1 100%;
  border-radius: clamp(18px, 2.6vw, 34px);
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(84,45,22,.13);
  box-shadow: 0 22px 70px rgba(80,42,16,.19);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.tractor-topbar {
  min-height: 88px;
  padding: 12px clamp(14px, 2vw, 26px);
  display: grid;
  grid-template-columns: minmax(240px,1fr) auto auto;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,.99), rgba(255,249,231,.95));
  border-bottom: 1px solid rgba(84,45,22,.1);
}

.tractor-title-block { min-width: 0; }
.tractor-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--tractor-red-dark);
  font-weight: 900;
  font-size: clamp(.84rem, 1.5vw, 1.02rem);
}
.tractor-title-block h1 {
  margin: 2px 0 0;
  font-size: clamp(1.05rem, 2.2vw, 1.55rem);
  line-height: 1.15;
  color: var(--tractor-ink);
}

.tractor-hud {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tractor-hud-item,
.tractor-objective-pill,
.tractor-hearts {
  min-height: 46px;
  padding: 7px 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff;
  border: 1px solid rgba(84,45,22,.12);
  box-shadow: 0 8px 20px rgba(84,45,22,.08);
  color: #4a2d1e;
  font-weight: 900;
  white-space: nowrap;
}
.tractor-hud-item strong,
.tractor-objective-pill strong { font-size: 1.08rem; }
.tractor-objective-pill {
  background: linear-gradient(180deg, #fff9cb, #fff2a6);
  border-color: rgba(191,127,0,.24);
}
.tractor-objective-pill span { font-size: 1.35rem; }
.tractor-hearts { color: #ed2f58; letter-spacing: 2px; min-width: 104px; }
.tractor-hearts.is-low { animation: tractor-pulse .55s ease-in-out 2; }

.tractor-controls { display: flex; gap: 7px; }
.tractor-icon-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 15px;
  background: #fff;
  color: #6c2d18;
  font-size: 1.24rem;
  font-weight: 900;
  box-shadow: 0 8px 20px rgba(84,45,22,.1);
  cursor: pointer;
  touch-action: manipulation;
}
.tractor-icon-btn:hover { transform: translateY(-2px); }
.tractor-icon-btn:active { transform: scale(.95); }

.tractor-stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 192px);
  min-height: 340px;
  overflow: hidden;
  background: #76d4ff;
  isolation: isolate;
  user-select: none;
  touch-action: none;
}
#tractor-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

.tractor-lane-button {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: clamp(64px, 7vw, 86px);
  height: clamp(64px, 7vw, 86px);
  border: 4px solid rgba(255,255,255,.96);
  border-radius: 26px;
  background: linear-gradient(180deg, #ffdf63, #ff9d2f);
  box-shadow: 0 10px 0 #bd5615, 0 18px 34px rgba(67,27,8,.3);
  color: #5d2507;
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 1000;
  cursor: pointer;
  z-index: 4;
  touch-action: manipulation;
}
.tractor-lane-left { left: clamp(14px, 2.2vw, 30px); }
.tractor-lane-right { right: clamp(14px, 2.2vw, 30px); }
.tractor-lane-button:active {
  transform: translateY(7px);
  box-shadow: 0 3px 0 #bd5615, 0 10px 18px rgba(67,27,8,.24);
}
.tractor-lane-button[disabled] { opacity: .45; cursor: default; }

.tractor-tip {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(62%, 560px);
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(35,18,53,.82);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 800;
  font-size: clamp(.78rem, 1.7vw, 1rem);
  pointer-events: none;
  transition: opacity .3s ease;
  z-index: 3;
  text-align: center;
}
.tractor-tip.is-hidden { opacity: 0; }

.tractor-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(30,18,40,.66);
  backdrop-filter: blur(9px);
}
.tractor-overlay[hidden] { display: none; }
.tractor-overlay-card {
  width: min(650px, 100%);
  max-height: min(760px, calc(100dvh - 28px));
  overflow: auto;
  padding: clamp(22px, 4vw, 38px);
  border-radius: 32px;
  text-align: center;
  background: linear-gradient(180deg, #fff, #fff8df);
  border: 1px solid rgba(84,45,22,.13);
  box-shadow: 0 32px 90px rgba(25,10,35,.35);
}
.tractor-overlay-icon {
  width: 78px;
  height: 78px;
  margin: 0 auto 12px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffdf64, #ff9e31);
  box-shadow: 0 12px 24px rgba(183,85,18,.22);
  font-size: 2.2rem;
}
.tractor-overlay-kicker {
  display: block;
  color: var(--tractor-red-dark);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}
.tractor-overlay-card h2 {
  margin: 6px 0 8px;
  color: var(--tractor-ink);
  font-size: clamp(1.55rem, 5vw, 2.2rem);
}
.tractor-overlay-card > p {
  margin: 0 auto;
  max-width: 520px;
  color: #725745;
  line-height: 1.55;
}

.tractor-phase-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 12px;
  margin-top: 24px;
}
.tractor-phase-btn {
  min-height: 176px;
  padding: 16px 12px;
  border: 2px solid rgba(84,45,22,.12);
  border-radius: 22px;
  background: #fff;
  color: #3f281c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(84,45,22,.08);
}
.tractor-phase-btn:hover:not([disabled]) { transform: translateY(-4px); border-color: #ef8b27; }
.tractor-phase-btn[disabled] { opacity: .48; cursor: not-allowed; filter: grayscale(.55); }
.tractor-phase-number {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #f04431, #bd2018);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
}
.tractor-phase-btn strong { font-size: .98rem; line-height: 1.15; }
.tractor-phase-btn small { color: #806858; font-weight: 700; line-height: 1.3; }
.tractor-phase-lock { font-size: .78rem; color: #8d786d; font-weight: 900; }
.tractor-phase-item { font-size: 1.7rem; }

.tractor-result-stats {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin: 20px 0;
}
.tractor-result-stats div {
  padding: 14px 8px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(84,45,22,.11);
}
.tractor-result-stats strong { display: block; font-size: 1.5rem; color: var(--tractor-red-dark); }
.tractor-result-stats span { font-size: .78rem; color: #806858; font-weight: 800; }
.tractor-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

@keyframes tractor-pulse { 50% { transform: scale(1.08); } }

@media (max-width: 1020px) {
  .tractor-topbar {
    grid-template-columns: 1fr auto;
  }
  .tractor-hud { grid-column: 1 / -1; justify-content: center; order: 3; }
  .tractor-title-block { order: 1; }
  .tractor-controls { order: 2; }
  .tractor-stage-wrap { max-height: none; }
}

@media (max-width: 700px) {
  .tractor-shell { padding: 6px; align-items: flex-start; }
  .tractor-card { border-radius: 20px; }
  .tractor-topbar { padding: 9px 10px; gap: 8px; }
  .tractor-title-block h1 { font-size: .98rem; }
  .tractor-eyebrow { font-size: .78rem; }
  .tractor-icon-btn { width: 40px; height: 40px; border-radius: 13px; }
  .tractor-hud { gap: 5px; overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; }
  .tractor-hud-item, .tractor-objective-pill, .tractor-hearts { min-height: 40px; padding: 5px 9px; border-radius: 13px; font-size: .82rem; }
  .tractor-hearts { min-width: 92px; }
  .tractor-stage-wrap { min-height: 300px; }
  .tractor-tip { bottom: 18px; max-width: 58%; padding: 7px 10px; border-radius: 18px; }
  .tractor-phase-grid { grid-template-columns: 1fr; }
  .tractor-phase-btn { min-height: 118px; display: grid; grid-template-columns: 48px 44px 1fr; text-align: left; }
  .tractor-phase-lock { grid-column: 1 / -1; text-align: center; }
}

@media (max-width: 460px) {
  .tractor-stage-wrap { min-height: 270px; }
  .tractor-lane-button { width: 58px; height: 58px; border-radius: 20px; font-size: 1.45rem; }
  .tractor-tip { display: none; }
  .tractor-result-stats { gap: 6px; }
  .tractor-result-stats div { padding: 10px 5px; }
}

@media (orientation: landscape) and (max-height: 650px) {
  .tractor-site-header { display: none; }
  .tractor-shell { height: 100dvh; min-height: 0; padding: 0; }
  .tractor-card { min-height: 0; flex: 1 1 0; display: flex; flex-direction: column; border-radius: 0; }
  .tractor-topbar { flex: 0 0 58px; grid-template-columns: minmax(120px,1fr) auto auto; padding: 5px 10px; gap: 5px; }
  .tractor-title-block { order: 0; }
  .tractor-title-block h1 { display: none; }
  .tractor-eyebrow { font-size: .72rem; }
  .tractor-hud { grid-column: auto; order: 0; flex-wrap: nowrap; overflow-x: auto; }
  .tractor-controls { order: 0; }
  .tractor-hud-item,
  .tractor-objective-pill,
  .tractor-hearts { min-height: 36px; padding: 4px 8px; }
  .tractor-stage-wrap { height: auto; min-height: 0; flex: 1 1 auto; aspect-ratio: auto; max-height: none; }
  .tractor-overlay-card { max-height: 94dvh; overflow-y: auto; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .tractor-shell {
    width: 100%;
    height: calc(var(--lila-app-height, 100dvh) - 40px - var(--lila-safe-top, 0px) - var(--lila-safe-bottom, 14px));
    min-height: 0;
    padding: 0 var(--lila-safe-right, 0px) 0 var(--lila-safe-left, 0px);
  }
  .tractor-card { height: 100%; min-height: 0; }
  .tractor-topbar {
    min-height: 44px;
    flex: 0 0 44px;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 3px 7px;
    gap: 4px;
  }
  .tractor-title-block { display: none; }
  .tractor-hud { justify-content: flex-start; gap: 3px; overflow: hidden; padding: 0; }
  .tractor-hud-item,
  .tractor-objective-pill,
  .tractor-hearts {
    min-height: 32px;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: .73rem;
  }
  .tractor-hearts { min-width: 78px; letter-spacing: 1px; }
  .tractor-controls { gap: 4px; }
  .tractor-icon-btn { width: 36px; height: 36px; border-radius: 11px; font-size: 1rem; }
  .tractor-stage-wrap {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
    aspect-ratio: auto;
  }
  #tractor-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center bottom;
  }
  .tractor-lane-button {
    width: 52px;
    height: 52px;
    bottom: 8px;
    border-radius: 17px;
    font-size: 1.25rem;
  }
  .tractor-lane-left { left: max(8px, var(--lila-safe-left, 0px)); }
  .tractor-lane-right { right: max(8px, var(--lila-safe-right, 0px)); }
  .tractor-tip { display: none; }
  .tractor-overlay {
    padding: max(6px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    overflow: hidden;
  }
  .tractor-overlay-card {
    width: min(780px, 100%);
    max-height: calc(100svh - max(12px, env(safe-area-inset-top, 0px) + env(safe-area-inset-bottom, 0px)));
    padding: 9px 13px;
    border-radius: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .tractor-overlay-icon {
    width: 42px;
    height: 42px;
    margin-bottom: 3px;
    border-radius: 14px;
    font-size: 1.35rem;
  }
  .tractor-overlay-kicker { font-size: .63rem; }
  .tractor-overlay-card h2 { margin: 2px 0 3px; font-size: 1.12rem; }
  .tractor-overlay-card > p { font-size: .72rem; line-height: 1.2; }
  .tractor-phase-grid { gap: 7px; margin-top: 7px; }
  .tractor-phase-btn { min-height: 126px; padding: 7px 6px; border-radius: 15px; gap: 3px; }
  .tractor-phase-number { width: 35px; height: 35px; border-radius: 11px; font-size: .95rem; }
  .tractor-phase-item { font-size: 1.25rem; }
  .tractor-phase-btn strong { font-size: .78rem; }
  .tractor-phase-btn small,
  .tractor-phase-lock { font-size: .63rem; line-height: 1.15; }
  .tractor-result-stats { margin: 7px 0; gap: 6px; }
  .tractor-result-stats div { padding: 6px 4px; border-radius: 12px; }
  .tractor-result-stats strong { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tractor-icon-btn,
  .tractor-lane-button,
  .tractor-phase-btn { transition: none; }
}

/* Fullscreen game shell: HUD, controls and dialogs stay in the same top layer. */
body.game-pseudo-fullscreen { overflow: hidden !important; }

.jumper-card,
.tractor-card { position: relative; }

.jumper-objective-pill {
  min-height: 46px;
  padding: 7px 12px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, #efffe8, #d8f8cb);
  border: 1px solid rgba(48,137,56,.2);
  box-shadow: 0 8px 20px rgba(75,23,127,.08);
  color: #2f7138;
  font-weight: 900;
  white-space: nowrap;
}

.jumper-icon-btn,
.tractor-icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  line-height: 1;
}

.jumper-exit-btn,
.tractor-exit-btn {
  background: #fff4f1;
  color: #9d2e2e;
}

.jumper-overlay,
.tractor-overlay {
  position: absolute;
  inset: 0;
}

.jumper-overlay-actions,
.tractor-overlay-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
}

.jumper-pause-card,
.tractor-pause-card { width: min(500px, 100%); }

.jumper-card:fullscreen,
.jumper-card:-webkit-full-screen,
.jumper-card.is-pseudo-fullscreen,
.tractor-card:fullscreen,
.tractor-card:-webkit-full-screen,
.tractor-card.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100vw;
  max-width: none;
  height: 100vh;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #f7f1ff;
}

.jumper-card:fullscreen .jumper-topbar,
.jumper-card:-webkit-full-screen .jumper-topbar,
.jumper-card.is-pseudo-fullscreen .jumper-topbar,
.tractor-card:fullscreen .tractor-topbar,
.tractor-card:-webkit-full-screen .tractor-topbar,
.tractor-card.is-pseudo-fullscreen .tractor-topbar {
  flex: 0 0 auto;
  position: relative;
  z-index: 8;
  padding-top: max(6px, env(safe-area-inset-top, 0px));
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
}

.jumper-card:fullscreen .jumper-stage-wrap,
.jumper-card:-webkit-full-screen .jumper-stage-wrap,
.jumper-card.is-pseudo-fullscreen .jumper-stage-wrap,
.tractor-card:fullscreen .tractor-stage-wrap,
.tractor-card:-webkit-full-screen .tractor-stage-wrap,
.tractor-card.is-pseudo-fullscreen .tractor-stage-wrap {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.jumper-card:fullscreen #jumper-canvas,
.jumper-card:-webkit-full-screen #jumper-canvas,
.jumper-card.is-pseudo-fullscreen #jumper-canvas,
.tractor-card:fullscreen #tractor-canvas,
.tractor-card:-webkit-full-screen #tractor-canvas,
.tractor-card.is-pseudo-fullscreen #tractor-canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
}

.jumper-card:fullscreen .jumper-overlay,
.jumper-card:-webkit-full-screen .jumper-overlay,
.jumper-card.is-pseudo-fullscreen .jumper-overlay,
.tractor-card:fullscreen .tractor-overlay,
.tractor-card:-webkit-full-screen .tractor-overlay,
.tractor-card.is-pseudo-fullscreen .tractor-overlay {
  position: absolute;
  z-index: 100;
}

@media (orientation: portrait) {
  .jumper-card:fullscreen #jumper-canvas,
  .jumper-card:-webkit-full-screen #jumper-canvas,
  .jumper-card.is-pseudo-fullscreen #jumper-canvas,
  .tractor-card:fullscreen #tractor-canvas,
  .tractor-card:-webkit-full-screen #tractor-canvas,
  .tractor-card.is-pseudo-fullscreen #tractor-canvas {
    object-fit: contain;
  }
}

@media (max-width: 900px) {
  .jumper-objective-pill { min-height: 38px; padding: 5px 9px; border-radius: 12px; font-size: .8rem; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .jumper-objective-pill {
    min-height: 32px;
    padding: 3px 6px;
    border-radius: 10px;
    font-size: .73rem;
  }
  .jumper-objective-pill strong { display: none; }
  .jumper-overlay-actions,
  .tractor-overlay-actions { margin-top: 6px; }
  .jumper-pause-card,
  .tractor-pause-card { width: min(520px, 100%); }
}


/* Android: the phase chooser is a normal scrolling card, not a dark fullscreen overlay. */
body.game-phase-selection {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.game-phase-selection .tractor-shell {
  height: auto !important;
  min-height: calc(100dvh - 84px) !important;
  padding: 8px !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

.tractor-card.is-phase-selection {
  height: auto !important;
  min-height: 0 !important;
  flex: 0 0 auto !important;
  display: block !important;
  overflow: visible !important;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.tractor-card.is-phase-selection .tractor-topbar,
.tractor-card.is-phase-selection .tractor-stage-wrap {
  display: none !important;
}

.tractor-card.is-phase-selection #tractor-phase-overlay {
  position: relative;
  inset: auto;
  min-height: 0;
  padding: 0;
  overflow: visible;
  place-items: start stretch;
  background: transparent;
  backdrop-filter: none;
}

.tractor-card.is-phase-selection #tractor-phase-overlay .tractor-overlay-card {
  width: 100%;
  max-width: none;
  max-height: none;
  min-height: 0;
  overflow: visible;
  border-radius: 24px;
  box-shadow: 0 16px 42px rgba(30,18,40,.16);
}

@media (max-width: 700px) {
  .tractor-card.is-phase-selection #tractor-phase-overlay .tractor-overlay-card {
    padding: 18px 14px 20px;
    border-radius: 20px;
  }
}

@media (orientation: landscape) and (max-height: 650px) {
  body.game-phase-selection .tractor-site-header { display: block; }
  body.game-phase-selection .tractor-shell { min-height: calc(100dvh - 64px) !important; }
  .tractor-card.is-phase-selection .tractor-phase-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Trator Divertido: seleção de fases premium, isolada da partida. */
@font-face {
  font-family: "Tractor Lilita One";
  src: url("/assets/fonts/LilitaOne-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Tractor Baloo 2";
  src: url("/assets/fonts/Baloo2-Variable.ttf") format("truetype");
  font-display: swap;
}

body.tractor-page.game-phase-selection {
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden !important;
  background: #75d3f5 url("/assets/images/tractor/tractor-menu.webp") center / cover no-repeat fixed;
  font-family: "Tractor Baloo 2", system-ui, sans-serif;
}

body.tractor-page.game-phase-selection::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(230, 250, 255, .08), rgba(255, 244, 205, .13));
}

body.tractor-page.game-phase-selection .tractor-site-header {
  display: none !important;
}

body.tractor-page.game-phase-selection .tractor-shell {
  width: 100%;
  height: 100dvh !important;
  min-height: 100dvh !important;
  padding: max(6px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) max(6px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px)) !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden;
}

body.tractor-page.game-phase-selection .tractor-card.is-phase-selection {
  position: relative;
  width: 100%;
  height: 100% !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  display: block !important;
  overflow: hidden !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body.tractor-page.game-phase-selection .tractor-card.is-phase-selection #tractor-phase-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  backdrop-filter: none;
}

body.tractor-page.game-phase-selection .tractor-phase-scene {
  position: relative;
  width: min(1120px, 100%);
  height: min(360px, calc(100% - 26px));
  min-height: 0;
  max-width: 1120px !important;
  max-height: 360px !important;
  padding: clamp(10px, 2svh, 17px) clamp(14px, 2.2vw, 26px) clamp(12px, 2.2svh, 20px) !important;
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: clamp(6px, 1.5svh, 12px);
  overflow: hidden !important;
  border: 3px solid #e2a637;
  border-radius: clamp(24px, 3vw, 34px) !important;
  background: linear-gradient(180deg, rgba(255, 251, 226, .94), rgba(255, 241, 195, .9));
  box-shadow: 0 16px 0 rgba(156, 93, 21, .22), 0 24px 46px rgba(64, 38, 18, .28), inset 0 0 0 3px rgba(255, 255, 255, .72) !important;
  backdrop-filter: blur(2px);
}

body.tractor-page.game-phase-selection .tractor-phase-back {
  position: absolute;
  z-index: 4;
  top: clamp(9px, 2svh, 15px);
  left: clamp(10px, 1.8vw, 20px);
  width: clamp(48px, 6svh, 56px);
  height: clamp(48px, 6svh, 56px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  outline-offset: 3px;
  transition: transform .16s ease;
}

body.tractor-page.game-phase-selection .tractor-phase-back:active {
  transform: scale(.94);
}

body.tractor-page.game-phase-selection .tractor-phase-back img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  transform: scale(1.9);
}

body.tractor-page.game-phase-selection .tractor-phase-heading {
  min-height: 58px;
  padding: 0 clamp(60px, 8vw, 92px);
  display: grid;
  place-content: center;
  text-align: center;
}

body.tractor-page.game-phase-selection .tractor-phase-heading h2 {
  margin: 0;
  color: #7136a8;
  font-family: "Tractor Lilita One", cursive;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: .94;
  letter-spacing: .01em;
  text-shadow: 0 3px 0 #fff7d6, 0 5px 8px rgba(80, 41, 108, .18);
}

body.tractor-page.game-phase-selection .tractor-phase-heading p {
  margin: 3px 0 0;
  color: #78572d;
  font-size: clamp(14px, 1.8vw, 19px);
  font-weight: 800;
  line-height: 1;
}

body.tractor-page.game-phase-selection .tractor-phase-grid {
  min-height: 0;
  height: auto;
  margin: 0;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(7px, 1.2vw, 14px);
}

body.tractor-page.game-phase-selection .tractor-phase-btn {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: clamp(205px, 55svh, 244px);
  padding: clamp(9px, 1.5svh, 14px) clamp(6px, 1vw, 12px) clamp(10px, 1.8svh, 16px);
  border: 3px solid #e0a33a;
  border-radius: clamp(19px, 2.3vw, 28px);
  background: linear-gradient(180deg, #fffdf0, #fff0bf);
  color: #563319;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, .8svh, 7px);
  text-align: center;
  box-shadow: 0 7px 0 #c78224, 0 12px 20px rgba(88, 52, 18, .2), inset 0 0 0 3px rgba(255, 255, 255, .78);
  font-family: "Tractor Baloo 2", system-ui, sans-serif;
  overflow: hidden;
  transition: transform .16s ease, filter .16s ease, border-color .16s ease;
}

body.tractor-page.game-phase-selection .tractor-phase-btn:hover:not([disabled]),
body.tractor-page.game-phase-selection .tractor-phase-btn:focus-visible:not([disabled]) {
  transform: translateY(-3px);
  border-color: #9844c4;
}

body.tractor-page.game-phase-selection .tractor-phase-btn:active:not([disabled]) {
  transform: translateY(2px);
}

body.tractor-page.game-phase-selection .tractor-phase-btn[disabled] {
  opacity: .7;
  cursor: not-allowed;
  filter: saturate(.62) brightness(.97);
}

body.tractor-page.game-phase-selection .tractor-phase-btn.is-unlocked {
  border-color: #d99628;
}

body.tractor-page.game-phase-selection .tractor-phase-btn.is-completed {
  border-color: #58a84c;
  background: linear-gradient(180deg, #fffef0, #ecf8c9);
  box-shadow: 0 7px 0 #43853d, 0 12px 20px rgba(53, 104, 47, .18), inset 0 0 0 3px rgba(255, 255, 255, .78);
}

body.tractor-page.game-phase-selection .tractor-phase-btn.premium-locked {
  border-color: #9960ca;
  background: linear-gradient(180deg, #fffdf2, #f0e4fb);
  cursor: pointer;
}

body.tractor-page.game-phase-selection .tractor-phase-btn.premium-locked::after {
  content: none;
}

body.tractor-page.game-phase-selection .tractor-phase-number {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 9px;
  width: clamp(35px, 5svh, 44px);
  height: clamp(35px, 5svh, 44px);
  border: 2px solid #ffe9a1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #8d50c7, #64319b);
  color: #fff;
  font-size: clamp(17px, 2.2vw, 23px);
  font-weight: 900;
  box-shadow: 0 3px 0 #47206f;
}

body.tractor-page.game-phase-selection .tractor-phase-item {
  width: auto;
  height: clamp(62px, 15svh, 88px);
  max-width: 76%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 5px 4px rgba(82, 47, 16, .2));
}

body.tractor-page.game-phase-selection .tractor-phase-btn > span:not(.tractor-phase-number):not(.tractor-phase-lock) {
  display: grid;
  gap: 1px;
}

body.tractor-page.game-phase-selection .tractor-phase-btn br {
  display: none;
}

body.tractor-page.game-phase-selection .tractor-phase-btn strong {
  color: #62369b;
  font-size: clamp(15px, 1.75vw, 21px);
  font-weight: 900;
  line-height: 1.05;
}

body.tractor-page.game-phase-selection .tractor-phase-btn small {
  color: #725438;
  font-size: clamp(11px, 1.15vw, 14px);
  font-weight: 750;
  line-height: 1.12;
}

body.tractor-page.game-phase-selection .tractor-phase-description {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.tractor-page.game-phase-selection .tractor-phase-lock {
  position: absolute;
  z-index: 3;
  right: 7px;
  top: 7px;
  width: 40px;
  min-height: 40px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ddb65e;
  border-radius: 999px;
  background: rgba(255, 247, 213, .94);
  color: #785c34;
  font-size: clamp(9px, .95vw, 12px);
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 3px 7px rgba(79, 53, 19, .16);
}

body.tractor-page.game-phase-selection .tractor-phase-lock img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  transform: scale(1.65);
  filter: none;
}

body.tractor-page.game-phase-selection .tractor-phase-lock-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.tractor-page.game-phase-selection .tractor-phase-complete {
  position: absolute;
  z-index: 3;
  top: 8px;
  right: 8px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #e8ffc9;
  border-radius: 50%;
  background: linear-gradient(180deg, #66cb58, #378a3c);
  color: #fff;
  box-shadow: 0 3px 0 #276a2f, 0 5px 9px rgba(39, 106, 47, .22);
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
}

@media (orientation: landscape) and (max-height: 430px) {
  body.tractor-page.game-phase-selection .tractor-phase-scene {
    height: min(342px, calc(100% - 18px));
    padding: 7px 12px 10px !important;
    gap: 4px;
    border-radius: 23px !important;
  }

  body.tractor-page.game-phase-selection .tractor-phase-heading {
    min-height: 48px;
  }

  body.tractor-page.game-phase-selection .tractor-phase-heading h2 {
    font-size: clamp(27px, 3.8vw, 36px);
  }

  body.tractor-page.game-phase-selection .tractor-phase-heading p {
    margin-top: 1px;
    font-size: 14px;
  }

  body.tractor-page.game-phase-selection .tractor-phase-grid {
    gap: 9px;
  }

  body.tractor-page.game-phase-selection .tractor-phase-btn {
    padding: 7px 7px 10px;
    gap: 2px;
    border-radius: 18px;
  }

  body.tractor-page.game-phase-selection .tractor-phase-item {
    height: clamp(58px, 15svh, 72px);
  }

  body.tractor-page.game-phase-selection .tractor-phase-lock span {
    display: none;
  }

  body.tractor-page.game-phase-selection .tractor-phase-lock {
    width: 38px;
    min-height: 38px;
    padding: 1px;
    justify-content: center;
  }
}

/* Trator Divertido: HUD premium da partida, sem interferir na seleção. */
body.tractor-page:not(.game-phase-selection) header.tractor-site-header,
body.tractor-page:not(.game-phase-selection) main > .active-child-bar,
body.tractor-page:not(.game-phase-selection) .progress-sync-badge {
  display: none !important;
}

body.tractor-page:not(.game-phase-selection) .tractor-shell {
  width: 100%;
  height: var(--lila-app-height, 100dvh) !important;
  min-height: var(--lila-app-height, 100dvh) !important;
  padding: 0 max(0px, var(--lila-safe-right, 0px)) 0 max(0px, var(--lila-safe-left, 0px)) !important;
  overflow: hidden;
}

body.tractor-page:not(.game-phase-selection) .tractor-card {
  width: 100%;
  height: 100%;
  max-width: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: #76d4ff;
  box-shadow: none;
  backdrop-filter: none;
}

.tractor-card:not(.is-phase-selection) .tractor-stage-wrap {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
  background: #75d3f5 url("/assets/images/tractor/background.webp") center / cover no-repeat;
}

.tractor-card:not(.is-phase-selection) #tractor-canvas {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0 auto;
  object-fit: cover;
}

.tractor-card:not(.is-phase-selection) .tractor-topbar {
  position: relative;
  z-index: 20;
  min-height: 62px;
  flex: 0 0 62px;
  padding: 5px max(10px, env(safe-area-inset-right, 0px)) 7px max(10px, env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(7px, 1.2vw, 15px);
  border: 0;
  border-bottom: 3px solid #dca13a;
  border-radius: 0 0 20px 20px;
  background: linear-gradient(180deg, rgba(255,253,239,.98), rgba(255,231,177,.96));
  box-shadow: 0 4px 0 rgba(153,78,18,.55), 0 8px 18px rgba(63,36,18,.2), inset 0 2px 0 rgba(255,255,255,.95);
  font-family: "Tractor Baloo 2", "Trebuchet MS", sans-serif;
}

.tractor-card:not(.is-phase-selection) .tractor-title-block {
  display: none !important;
}

.tractor-card:not(.is-phase-selection) .tractor-hud {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(4px, .8vw, 8px);
  overflow: visible;
}

.tractor-card:not(.is-phase-selection) .tractor-hud-item,
.tractor-card:not(.is-phase-selection) .tractor-objective-pill,
.tractor-card:not(.is-phase-selection) .tractor-hearts {
  box-sizing: border-box;
  min-width: 0;
  min-height: 42px;
  height: 42px;
  padding: 4px clamp(7px, 1vw, 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 2px solid #e2b65a;
  border-radius: 15px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 3px 0 rgba(173,96,24,.34), inset 0 1px 0 #fff;
  color: #552b6b;
  font-size: clamp(.76rem, 1.35vw, .95rem);
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.tractor-card:not(.is-phase-selection) .tractor-hud-item strong,
.tractor-card:not(.is-phase-selection) .tractor-objective-pill strong {
  color: #7026aa;
  font-family: "Tractor Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 400;
}

.tractor-score-pill img,
.tractor-card:not(.is-phase-selection) .tractor-objective-pill img {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: block;
  object-fit: contain;
}

.tractor-card:not(.is-phase-selection) .tractor-objective-pill {
  color: #34703d;
  border-color: #a4c975;
  background: linear-gradient(180deg, #f7ffef, #e5f5ce);
}

.tractor-card:not(.is-phase-selection) .tractor-hearts {
  min-width: 108px;
  gap: 6px;
  letter-spacing: 0;
}

.tractor-life {
  width: 27px;
  height: 25px;
  flex: 0 0 27px;
  display: block;
  background: linear-gradient(145deg, #ff83ad 0%, #ef3d78 58%, #c91f58 100%);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7-4.35-9.33-8.03C.15 9 1.8 4 6.4 4c2.2 0 4.1 1.28 5.6 3.16C13.5 5.28 15.4 4 17.6 4c4.6 0 6.25 5 3.73 8.97C19 16.65 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21s-7-4.35-9.33-8.03C.15 9 1.8 4 6.4 4c2.2 0 4.1 1.28 5.6 3.16C13.5 5.28 15.4 4 17.6 4c4.6 0 6.25 5 3.73 8.97C19 16.65 12 21 12 21z'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 2px 1px rgba(145, 30, 75, .25));
}

.tractor-life.is-empty {
  background: linear-gradient(145deg, #eadde1, #cbbac1);
  filter: drop-shadow(0 1px 0 rgba(102, 70, 83, .2));
  opacity: .72;
}

.tractor-card:not(.is-phase-selection) .tractor-controls {
  align-self: center;
  height: 52px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 52px;
  align-items: center;
  justify-content: end;
  gap: 6px;
  line-height: 0;
}

.tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn,
.tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn:hover {
  box-sizing: border-box;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  place-self: center;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 4px 3px rgba(61,31,17,.26));
  text-decoration: none;
  line-height: 0;
  transform: none;
}

.tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn img {
  display: block;
  margin: auto;
  object-fit: contain;
  pointer-events: none;
  transform: none;
}

.tractor-card:not(.is-phase-selection) .tractor-controls .tractor-exit-btn img {
  width: 42px;
  height: 44px;
}

.tractor-card:not(.is-phase-selection) .tractor-controls #tractor-sound-btn img {
  width: 43px;
  height: 43px;
}

.tractor-card:not(.is-phase-selection) .tractor-controls #tractor-pause-btn img {
  width: 42px;
  height: 43px;
}

.tractor-card:not(.is-phase-selection) .tractor-controls #tractor-restart-btn img {
  width: 43px;
  height: 43px;
}

.tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn:active {
  transform: scale(.92);
}

@media (hover: hover) and (pointer: fine) {
  .tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn:hover {
    transform: scale(1.03);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .tractor-card:not(.is-phase-selection) .tractor-topbar {
    min-height: 60px;
    flex-basis: 60px;
    padding-block: 4px 6px;
    gap: 6px;
  }

  .tractor-card:not(.is-phase-selection) .tractor-hud {
    gap: 4px;
  }

  .tractor-card:not(.is-phase-selection) .tractor-hud-item,
  .tractor-card:not(.is-phase-selection) .tractor-objective-pill,
  .tractor-card:not(.is-phase-selection) .tractor-hearts {
    min-height: 40px;
    height: 40px;
    padding-inline: 7px;
  }

  .tractor-score-pill img,
  .tractor-card:not(.is-phase-selection) .tractor-objective-pill img {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .tractor-card:not(.is-phase-selection) .tractor-hearts {
    min-width: 100px;
    gap: 4px;
  }

  .tractor-life {
    width: 25px;
    height: 23px;
    flex-basis: 25px;
  }
}

/* Premium pause and result overlays; phase selection and gameplay HUD stay isolated. */
#tractor-pause-overlay,
#tractor-result-overlay {
  padding: max(8px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  overflow: hidden;
  background: rgba(31, 17, 38, .7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

#tractor-pause-overlay .tractor-overlay-card,
#tractor-result-overlay .tractor-overlay-card {
  position: relative;
  overflow: hidden;
  border: 3px solid #dfa23a;
  border-radius: clamp(24px, 3vw, 34px);
  background:
    radial-gradient(circle at 8% 12%, rgba(255, 217, 109, .35) 0 4px, transparent 5px),
    radial-gradient(circle at 92% 88%, rgba(134, 74, 172, .18) 0 5px, transparent 6px),
    linear-gradient(180deg, #fffdf0 0%, #fff1c8 100%);
  box-shadow: 0 14px 0 rgba(145, 83, 22, .24), 0 28px 58px rgba(25, 10, 35, .42), inset 0 0 0 3px rgba(255, 255, 255, .72);
  font-family: "Tractor Baloo 2", system-ui, sans-serif;
}

#tractor-pause-overlay .tractor-overlay-card::before,
#tractor-pause-overlay .tractor-overlay-card::after,
#tractor-result-overlay .tractor-overlay-card::before,
#tractor-result-overlay .tractor-overlay-card::after {
  content: "";
  position: absolute;
  width: 52px;
  height: 24px;
  pointer-events: none;
  opacity: .62;
  background: radial-gradient(ellipse at 25% 50%, #76a94c 0 20%, transparent 22%), radial-gradient(ellipse at 70% 46%, #9bc767 0 21%, transparent 23%);
}

#tractor-pause-overlay .tractor-overlay-card::before,
#tractor-result-overlay .tractor-overlay-card::before { top: 10px; left: 14px; transform: rotate(-22deg); }
#tractor-pause-overlay .tractor-overlay-card::after,
#tractor-result-overlay .tractor-overlay-card::after { right: 14px; bottom: 10px; transform: rotate(158deg); }

.tractor-pause-card {
  width: min(620px, 88vw) !important;
  max-height: min(350px, calc(100svh - 20px)) !important;
  padding: clamp(15px, 3svh, 24px) clamp(22px, 4vw, 40px) !important;
  display: grid;
  grid-template-rows: auto auto auto;
  justify-items: center;
  align-content: center;
  gap: clamp(7px, 1.8svh, 13px);
}

.tractor-result-card {
  width: min(850px, 92vw) !important;
  max-height: min(410px, calc(100svh - 18px)) !important;
  padding: clamp(10px, 2svh, 18px) clamp(18px, 3vw, 32px) !important;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: center;
  gap: clamp(5px, 1.2svh, 9px);
}

#tractor-result-overlay .tractor-result-card.is-final-victory {
  border-color: #d9a229;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 219, 72, .28), transparent 18%),
    radial-gradient(circle at 88% 16%, rgba(181, 103, 221, .2), transparent 20%),
    linear-gradient(180deg, #fffdf0, #fff0c4);
  box-shadow: 0 13px 0 rgba(153, 91, 22, .24), 0 22px 42px rgba(83, 42, 23, .3), inset 0 0 0 4px rgba(255, 255, 255, .76) !important;
}

#tractor-result-overlay .tractor-result-card.is-final-victory .tractor-overlay-kicker {
  color: #37833d;
}

#tractor-result-overlay .tractor-result-card.is-final-victory .tractor-overlay-message h2 {
  color: #7c35ad;
  text-shadow: 0 2px 0 #fff, 0 5px 10px rgba(92, 39, 124, .22);
}

.tractor-overlay-art {
  display: grid;
  place-items: center;
  margin: 0 auto;
}

.tractor-overlay-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.tractor-pause-art {
  width: clamp(66px, 17svh, 86px);
  height: clamp(66px, 17svh, 86px);
  filter: drop-shadow(0 7px 5px rgba(91, 48, 21, .22));
}

.tractor-result-art {
  width: clamp(94px, 25svh, 130px);
  height: clamp(62px, 16svh, 84px);
  filter: drop-shadow(0 7px 5px rgba(91, 48, 21, .22));
}

.tractor-overlay-message {
  min-width: 0;
  text-align: center;
}

#tractor-pause-overlay .tractor-overlay-message h2,
#tractor-result-overlay .tractor-overlay-message h2 {
  margin: 0;
  color: #7136a8;
  font-family: "Tractor Lilita One", cursive;
  font-size: clamp(27px, 6svh, 38px);
  line-height: 1;
  text-shadow: 0 2px 0 #fff, 0 4px 7px rgba(74, 37, 99, .15);
}

#tractor-pause-overlay .tractor-overlay-message p,
#tractor-result-overlay .tractor-overlay-message p {
  margin: 5px auto 0;
  max-width: 640px;
  color: #76542e;
  font-size: clamp(13px, 2.8svh, 17px);
  font-weight: 700;
  line-height: 1.18;
}

#tractor-result-overlay .tractor-overlay-kicker {
  margin-bottom: 2px;
  color: #a85c1d;
  font-size: clamp(10px, 2.1svh, 13px);
  font-weight: 900;
  letter-spacing: .1em;
}

#tractor-result-overlay .tractor-result-stats {
  width: min(600px, 86%);
  margin: 0 auto;
  gap: clamp(7px, 1.5vw, 13px);
}

#tractor-result-overlay .tractor-result-stats div {
  min-width: 0;
  padding: clamp(6px, 1.5svh, 10px) 8px;
  border: 2px solid #e6bd65;
  border-radius: 16px;
  background: rgba(255, 253, 239, .92);
  box-shadow: 0 4px 0 rgba(190, 126, 38, .18), inset 0 0 0 2px rgba(255, 255, 255, .72);
}

#tractor-result-overlay .tractor-result-stats strong {
  color: #7136a8;
  font-size: clamp(19px, 4.2svh, 26px);
  line-height: 1;
}

#tractor-result-overlay .tractor-result-stats span {
  display: block;
  margin-top: 2px;
  color: #76542e;
  font-size: clamp(10px, 2.1svh, 13px);
  line-height: 1;
}

#tractor-pause-overlay .tractor-result-actions,
#tractor-result-overlay .tractor-result-actions {
  width: min(760px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(8px, 1.6vw, 14px);
}

#tractor-pause-overlay .tractor-result-actions {
  width: min(460px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#tractor-result-overlay .tractor-result-actions:has(#tractor-next-btn[hidden]) {
  width: min(520px, 100%);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tractor-overlay-action {
  box-sizing: border-box;
  min-width: 0;
  min-height: clamp(46px, 11svh, 58px);
  padding: 5px clamp(8px, 1.4vw, 14px);
  border: 2px solid #dca13d;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #673a20;
  font-family: "Tractor Baloo 2", system-ui, sans-serif;
  font-size: clamp(12px, 2.6svh, 16px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 5px 0 #bd7924, inset 0 0 0 2px rgba(255, 255, 255, .66);
}

.tractor-overlay-action.is-secondary { background: linear-gradient(180deg, #fffdf0, #ffe9ae); }
.tractor-overlay-action.is-primary { border-color: #71369e; background: linear-gradient(180deg, #9857ce, #7136a8); color: #fff; box-shadow: 0 5px 0 #4d2377, inset 0 0 0 2px rgba(255, 255, 255, .2); }
.tractor-overlay-action:active { transform: translateY(3px); box-shadow: 0 2px 0 #955c20; }
.tractor-overlay-action[hidden] { display: none !important; }

.tractor-overlay-action img {
  width: clamp(27px, 6.5svh, 35px);
  height: clamp(27px, 6.5svh, 35px);
  flex: 0 0 auto;
  object-fit: contain;
}

@media (orientation: landscape) and (max-height: 400px) {
  .tractor-pause-card { max-height: calc(100svh - 14px) !important; padding-block: 10px !important; gap: 5px; }
  .tractor-result-card { max-height: calc(100svh - 12px) !important; padding-block: 7px !important; gap: 3px; }
  .tractor-result-art { width: 88px; height: 56px; }
  #tractor-result-overlay .tractor-overlay-message h2 { font-size: 25px; }
  #tractor-result-overlay .tractor-overlay-message p { margin-top: 2px; font-size: 12px; }
  #tractor-result-overlay .tractor-result-stats div { padding-block: 5px; }
  .tractor-overlay-action { min-height: 46px; }
}

/* Web mobile fullscreen: um único canvas lógico 1280 × 720 recebe toda a UI.
   O shell mede a visualViewport e aplica somente esta escala uniforme contain. */
@media (orientation: landscape) {
  html.lila-portable-touch-game:fullscreen,
  html.lila-portable-touch-game:fullscreen body.tractor-page {
    width: var(--tractor-visible-width, 100%);
    height: var(--tractor-visible-height, 100%);
    min-height: 0;
    overflow: hidden !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page {
    background: #75d3f5 url("/assets/images/tractor/background.webp") center / cover no-repeat fixed;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection {
    background-image: url("/assets/images/tractor/tractor-menu.webp");
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page .tractor-site-header,
  html.lila-portable-touch-game:fullscreen body.tractor-page .progress-sync-badge {
    display: none !important;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page .tractor-shell {
    position: fixed;
    inset: auto;
    left: var(--tractor-visible-left, 0px);
    top: var(--tractor-visible-top, 0px);
    display: block;
    width: var(--tractor-visible-width, 100%);
    height: var(--tractor-visible-height, 100%);
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page .tractor-card,
  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-card.is-phase-selection {
    position: absolute;
    z-index: 2;
    left: var(--tractor-stage-center-x, 50%);
    top: var(--tractor-stage-center-y, 50%);
    display: block !important;
    width: 1280px !important;
    min-width: 1280px;
    max-width: 1280px;
    height: 720px !important;
    min-height: 720px !important;
    max-height: 720px;
    margin: 0;
    overflow: hidden !important;
    border: 0;
    border-radius: 28px;
    background: transparent;
    box-shadow: 0 18px 40px rgba(46, 27, 14, .24);
    backdrop-filter: none;
    transform: translate(-50%, -50%) scale(var(--tractor-stage-scale, 1));
    transform-origin: center;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-card.is-phase-selection {
    box-shadow: none;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-stage-wrap {
    position: absolute;
    inset: 0;
    display: block;
    width: 1280px;
    height: 720px;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) #tractor-canvas {
    width: 1280px;
    height: 720px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-topbar {
    position: absolute;
    z-index: 20;
    left: 20px;
    right: 20px;
    top: 16px;
    display: grid;
    width: auto;
    height: 100px;
    min-height: 0;
    padding: 6px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    border: 4px solid #dca13a;
    border-radius: 28px;
    box-shadow: 0 7px 0 rgba(153,78,18,.55), 0 12px 24px rgba(63,36,18,.22), inset 0 3px 0 rgba(255,255,255,.95);
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-hud {
    gap: 10px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-hud-item,
  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-objective-pill,
  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-hearts {
    height: 70px;
    min-height: 70px;
    padding: 8px 16px;
    gap: 9px;
    border-width: 3px;
    border-radius: 22px;
    font-size: 22px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-hud-item strong,
  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-objective-pill strong {
    font-size: 34px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-score-pill img,
  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-objective-pill img {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-hearts {
    min-width: 172px;
    gap: 10px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-life {
    width: 42px;
    height: 39px;
    flex-basis: 42px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls {
    height: 92px;
    grid-auto-columns: 92px;
    gap: 8px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn,
  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls .tractor-icon-btn:hover {
    width: 92px;
    min-width: 92px;
    max-width: 92px;
    height: 92px;
    min-height: 92px;
    max-height: 92px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls .tractor-exit-btn img {
    width: 75px;
    height: 78px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls #tractor-sound-btn img,
  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls #tractor-restart-btn img {
    width: 77px;
    height: 77px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-card:not(.is-phase-selection) .tractor-controls #tractor-pause-btn img {
    width: 75px;
    height: 77px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-lane-button {
    bottom: 28px;
    width: 118px;
    height: 118px;
    border-width: 6px;
    border-radius: 34px;
    font-size: 54px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-lane-left { left: 36px; }
  html.lila-portable-touch-game:fullscreen .tractor-lane-right { right: 36px; }

  html.lila-portable-touch-game:fullscreen .tractor-tip {
    display: flex;
    bottom: 34px;
    max-width: 660px;
    padding: 15px 25px;
    border-radius: 24px;
    font-size: 24px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection #tractor-phase-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    width: 1280px;
    height: 720px;
    place-items: center;
    padding: 0;
    overflow: hidden;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-scene {
    width: 1120px;
    min-width: 1120px;
    max-width: 1120px !important;
    height: 610px;
    min-height: 610px;
    max-height: 610px !important;
    padding: 22px 28px 28px !important;
    grid-template-rows: 100px 1fr;
    gap: 18px;
    border-width: 5px;
    border-radius: 38px !important;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-back {
    top: 23px;
    left: 26px;
    width: 92px;
    height: 92px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-heading {
    min-height: 100px;
    padding: 0 110px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-heading h2 {
    font-size: 54px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-heading p {
    margin-top: 7px;
    font-size: 24px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-grid {
    height: 436px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-btn {
    height: 436px;
    padding: 18px 10px 20px;
    gap: 9px;
    border-width: 4px;
    border-radius: 27px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-number {
    top: 12px;
    left: 12px;
    width: 54px;
    height: 54px;
    border-width: 3px;
    font-size: 29px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-item {
    height: 150px;
    max-width: 88%;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-btn strong {
    font-size: 25px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-btn small {
    font-size: 17px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-lock {
    right: 10px;
    top: 10px;
    width: 58px;
    min-height: 58px;
    border-width: 3px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-lock img {
    width: 46px;
    height: 46px;
  }

  html.lila-portable-touch-game:fullscreen body.tractor-page.game-phase-selection .tractor-phase-complete {
    top: 11px;
    right: 11px;
    width: 52px;
    height: 52px;
    border-width: 3px;
    font-size: 31px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-pause-overlay,
  html.lila-portable-touch-game:fullscreen #tractor-result-overlay {
    position: absolute;
    inset: 0;
    width: 1280px;
    height: 720px;
    padding: 24px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-pause-card {
    width: 650px !important;
    max-height: 560px !important;
    padding: 34px 46px !important;
    gap: 18px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-result-card {
    width: 900px !important;
    max-height: 650px !important;
    padding: 22px 34px !important;
    gap: 12px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-pause-art {
    width: 124px;
    height: 124px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-result-art {
    width: 174px;
    height: 116px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-pause-overlay .tractor-overlay-message h2,
  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-overlay-message h2 {
    font-size: 48px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-pause-overlay .tractor-overlay-message p,
  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-overlay-message p {
    font-size: 22px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-overlay-kicker {
    font-size: 17px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-result-stats {
    width: 650px;
    gap: 16px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-result-stats div {
    padding: 12px 10px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-result-stats strong {
    font-size: 34px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-result-stats span {
    font-size: 16px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-pause-overlay .tractor-result-actions,
  html.lila-portable-touch-game:fullscreen #tractor-result-overlay .tractor-result-actions {
    width: 810px;
    gap: 16px;
  }

  html.lila-portable-touch-game:fullscreen #tractor-pause-overlay .tractor-result-actions {
    width: 520px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-overlay-action {
    min-height: 88px;
    padding: 9px 16px;
    border-width: 3px;
    border-radius: 22px;
    font-size: 23px;
  }

  html.lila-portable-touch-game:fullscreen .tractor-overlay-action img {
    width: 50px;
    height: 50px;
  }
}
