/* ==== JPM KIT v1 — base visual dos jogos (sincronizado; regras do jogo vêm depois do "fim da base") ==== */
.jpm-game[data-game="trator"] {
  --g-glass: rgba(23, 27, 52, .72);
  --g-accent: var(--primary, #6046FF);
  font-family: inherit;
  color: var(--ink, #172033);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  container-type: size;
  font-size: clamp(11px, 2.1cqw, 17px);
}
.jpm-game[data-game="trator"] [hidden] { display: none; }
.jpm-game[data-game="trator"] button { font: inherit; color: inherit; cursor: pointer; }
.jpm-game[data-game="trator"] button:focus-visible { outline: 3px solid var(--ink, #172033); outline-offset: 2px; }
.jpm-game[data-game="trator"] .g-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
.jpm-game[data-game="trator"] .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* HUD numa faixa só */
.jpm-game[data-game="trator"] .g-hud { position: absolute; left: 0; right: 0; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; pointer-events: none; }
.jpm-game[data-game="trator"] .g-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: var(--r-pill, 999px); background: var(--g-glass); color: var(--surface, #fff); font-weight: 900; font-size: clamp(13px, 2.3cqw, 19px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jpm-game[data-game="trator"] .g-chip--right { margin-left: auto; }
.jpm-game[data-game="trator"] .g-chip--warn { background: var(--coral, #FF6868); }
.jpm-game[data-game="trator"] .g-ico { width: 1.2em; height: 1.2em; flex: none; }
.jpm-game[data-game="trator"] .g-bar { position: relative; width: clamp(70px, 18cqw, 180px); height: .7em; border-radius: var(--r-pill, 999px); background: rgba(255, 255, 255, .25); overflow: hidden; }
.jpm-game[data-game="trator"] .g-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--yellow, #FFD43B); transition: width .2s linear; }
.jpm-game[data-game="trator"] .g-hearts { display: flex; gap: 4px; padding: 6px 10px; border-radius: var(--r-pill, 999px); background: var(--g-glass); }
.jpm-game[data-game="trator"] .g-heart { width: clamp(16px, 3cqw, 26px); height: clamp(16px, 3cqw, 26px); color: var(--coral, #FF6868); transition: transform .2s, opacity .2s; }
.jpm-game[data-game="trator"] .g-heart.is-lost { color: rgba(255, 255, 255, .35); transform: scale(.85); }

/* telas */
.jpm-game[data-game="trator"] .g-screen { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 12px; }
.jpm-game[data-game="trator"] .g-intro, .jpm-game[data-game="trator"] .g-over, .jpm-game[data-game="trator"] .g-paused { background: rgba(23, 27, 52, .32); }
.jpm-game[data-game="trator"] .g-intro { background: linear-gradient(90deg, rgba(23, 27, 52, .38), rgba(23, 27, 52, .05) 70%); justify-items: start; padding-left: 6cqw; }
.jpm-game[data-game="trator"] .g-card { width: min(92%, 420px); padding: clamp(14px, 3.4cqw, 28px); border-radius: var(--r-card, 16px); background: var(--surface, #fff); color: var(--ink, #172033); text-align: center; box-shadow: var(--shadow2, 0 18px 44px rgba(23, 32, 51, .16)); }
.jpm-game[data-game="trator"] .g-intro .g-card { width: min(56%, 400px); }
.jpm-game[data-game="trator"] .g-card--small { width: auto; padding: 16px 22px; }
.jpm-game[data-game="trator"] .g-kicker { margin: 0; font-size: clamp(10px, 1.8cqw, 13px); font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted, #606B80); }
.jpm-game[data-game="trator"] .g-title { margin: 4px 0 6px; font-size: clamp(20px, 4.6cqw, 34px); line-height: 1.05; letter-spacing: -.04em; font-weight: 900; }
.jpm-game[data-game="trator"] .g-text { margin: 0 0 14px; color: var(--muted, #606B80); font-weight: 600; font-size: clamp(12px, 2.2cqw, 16px); }
.jpm-game[data-game="trator"] .g-btn { min-height: 46px; padding: 0 26px; border: 0; border-radius: var(--r-pill, 999px); background: var(--g-accent); color: var(--surface, #fff); font-weight: 900; font-size: clamp(15px, 2.6cqw, 19px); box-shadow: 0 8px 18px rgba(23, 32, 51, .22); transition: transform .12s; }
.jpm-game[data-game="trator"] .g-btn:active { transform: scale(.96); }
.jpm-game[data-game="trator"] .g-btn--ghost { background: var(--bg, #F3F6FA); color: var(--ink, #172033); box-shadow: inset 0 0 0 2px var(--line, #E3E8EF); }
.jpm-game[data-game="trator"] .g-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.jpm-game[data-game="trator"] .g-results { display: flex; justify-content: center; gap: clamp(12px, 4cqw, 30px); margin: 10px 0; }
.jpm-game[data-game="trator"] .g-num { display: block; font-size: clamp(20px, 4.4cqw, 32px); font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.jpm-game[data-game="trator"] .g-lbl { font-size: clamp(11px, 1.8cqw, 13px); color: var(--muted, #606B80); font-weight: 700; }
.jpm-game[data-game="trator"] .g-best { margin: 0 0 14px; font-weight: 800; color: var(--g-accent); min-height: 1.2em; }
.jpm-game[data-game="trator"] .g-stars { display: flex; justify-content: center; gap: 6px; margin: 4px 0 8px; font-size: clamp(22px, 5cqw, 36px); }
.jpm-game[data-game="trator"] .g-star { width: 1em; height: 1em; color: var(--line, #E3E8EF); }
.jpm-game[data-game="trator"] .g-star.is-on { color: var(--yellow, #FFD43B); }

.jpm-game[data-game="trator"] .g-ready { pointer-events: none; align-content: center; gap: 12px; }
.jpm-game[data-game="trator"] .g-howto { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.jpm-game[data-game="trator"] .g-howto-item { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: var(--r-pill, 999px); background: var(--g-glass); color: var(--surface, #fff); font-weight: 700; font-size: clamp(12px, 2.1cqw, 16px); }
.jpm-game[data-game="trator"] .g-key { padding: 3px 9px; border-radius: 8px; background: var(--surface, #fff); color: var(--ink, #172033); font-weight: 900; }
.jpm-game[data-game="trator"] .g-touch-only { display: none; }
.jpm-game[data-game="trator"] .g-count { font-size: clamp(48px, 14cqw, 120px); font-weight: 900; color: var(--surface, #fff); text-shadow: 0 6px 0 rgba(23, 27, 52, .35); line-height: 1; animation: trator-pop .8s ease-out infinite; }
@keyframes trator-pop { from { transform: scale(1.25); opacity: .4; } 30% { transform: scale(1); opacity: 1; } }

/* botões de toque */
.jpm-game[data-game="trator"] .g-touch { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 10px; pointer-events: none; }
.jpm-game[data-game="trator"] .g-touch-group { display: flex; gap: 10px; align-items: flex-end; }
.jpm-game[data-game="trator"] .g-tbtn { pointer-events: auto; width: clamp(52px, 13cqw, 80px); height: clamp(52px, 13cqw, 80px); border: 0; border-radius: 50%; background: rgba(23, 27, 52, .45); color: var(--surface, #fff); display: grid; place-items: center; touch-action: none; font-weight: 900; font-size: clamp(11px, 2cqw, 14px); }
.jpm-game[data-game="trator"] .g-tbtn svg { width: 55%; height: 55%; }
.jpm-game[data-game="trator"] .g-tbtn--action { background: rgba(96, 70, 255, .78); }
.jpm-game[data-game="trator"] .g-tbtn.is-on, .jpm-game[data-game="trator"] .g-tbtn:active { transform: scale(.94); background: rgba(96, 70, 255, .9); }

/* aviso curto no meio da tela (+10, Combo!, Errou) */
.jpm-game[data-game="trator"] .g-toast { position: absolute; left: 50%; top: 22%; z-index: 3; transform: translateX(-50%); padding: .4em 1em; border-radius: var(--r-pill, 999px); background: var(--surface, #fff); color: var(--ink, #172033); font-weight: 900; font-size: clamp(14px, 3cqw, 24px); white-space: nowrap; box-shadow: var(--shadow2, 0 18px 44px rgba(23, 32, 51, .16)); pointer-events: none; animation: trator-toast .9s ease-out forwards; }
.jpm-game[data-game="trator"] .g-toast.is-good { background: var(--green, #46D68C); color: var(--surface, #fff); }
.jpm-game[data-game="trator"] .g-toast.is-bad { background: var(--coral, #FF6868); color: var(--surface, #fff); }
@keyframes trator-toast { from { opacity: 0; transform: translate(-50%, 10px) scale(.9); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 80% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -12px) scale(1); } }

@media (pointer: coarse) {
  .jpm-game[data-game="trator"] .g-touch-only { display: inline-flex; }
}
@container (max-width: 520px) {
  .jpm-game[data-game="trator"] .g-intro { justify-items: center; padding-left: 12px; background: rgba(23, 27, 52, .3); }
  .jpm-game[data-game="trator"] .g-intro .g-card { width: min(92%, 400px); }
}
@media (prefers-reduced-motion: reduce) {
  .jpm-game[data-game="trator"] .g-count, .jpm-game[data-game="trator"] .g-toast { animation: none; }
}
/* ==== fim da base ==== */

/* jogo */
.jpm-game[data-game="trator"] { --g-accent: #2E9C7B; --tr-yellow: #F9C74F; --tr-orange: #F9844A; --tr-green: #43AA8B; }
.jpm-game[data-game="trator"] .g-fill { background: var(--tr-yellow); }
.jpm-game[data-game="trator"] .g-bar { width: clamp(56px, 14cqw, 150px); }
.jpm-game[data-game="trator"] .tr-ico-sm { width: 1.05em; height: 1.05em; }
.jpm-game[data-game="trator"] .tr-route { gap: 5px; }
.jpm-game[data-game="trator"] .tr-level { background: rgba(46, 156, 123, .88); }
.jpm-game[data-game="trator"] .tr-cargo.is-hit { background: var(--coral, #FF6868); animation: trator-shake .45s ease-out; }
.jpm-game[data-game="trator"] .tr-pips { display: inline-flex; gap: 3px; margin-left: 2px; }
.jpm-game[data-game="trator"] .tr-pip { width: .62em; height: .62em; border-radius: 50%; background: var(--tr-yellow); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); transition: transform .2s, background .2s; }
.jpm-game[data-game="trator"] .tr-pip.is-lost { background: transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .45); transform: scale(.8); }
.jpm-game[data-game="trator"] .tr-pip.is-air { transform: translateY(-3px); background: #FFE08A; }
@keyframes trator-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* dica no meio da tela (carregar, pare no celeiro) */
.jpm-game[data-game="trator"] .tr-hint { position: absolute; left: 50%; top: 17cqh; z-index: 3; transform: translateX(-50%); padding: .45em 1.1em; border-radius: var(--r-pill, 999px); background: var(--tr-yellow); color: #3b2a0a; font-weight: 900; font-size: clamp(13px, 2.6cqw, 22px); white-space: nowrap; box-shadow: 0 6px 0 rgba(160, 110, 20, .35), 0 12px 26px rgba(23, 32, 51, .18); pointer-events: none; animation: trator-bob 1s ease-in-out infinite; }
@keyframes trator-bob { 0%, 100% { transform: translate(-50%, 0) scale(1); } 50% { transform: translate(-50%, -4px) scale(1.04); } }

.jpm-game[data-game="trator"] .g-level { margin: 0; padding: .3em 1em; border-radius: var(--r-pill, 999px); background: rgba(46, 156, 123, .92); color: var(--surface, #fff); font-weight: 900; font-size: clamp(14px, 3cqw, 24px); }
.jpm-game[data-game="trator"] .tr-save { margin: -6px 0 12px; font-weight: 800; color: var(--g-accent); }
.jpm-game[data-game="trator"] .g-intro .g-card { border-bottom: 6px solid var(--tr-yellow); }
.jpm-game[data-game="trator"] .g-over .g-card { border-bottom: 6px solid var(--tr-yellow); }
.jpm-game[data-game="trator"] .g-star.is-on { color: var(--tr-yellow); filter: drop-shadow(0 2px 0 rgba(170, 110, 0, .35)); animation: trator-star .5s ease-out backwards; }
.jpm-game[data-game="trator"] .g-star:nth-child(2).is-on { animation-delay: .18s; }
.jpm-game[data-game="trator"] .g-star:nth-child(3).is-on { animation-delay: .36s; }
@keyframes trator-star { from { transform: scale(0) rotate(-40deg); } 70% { transform: scale(1.25) rotate(8deg); } to { transform: scale(1) rotate(0); } }

/* botões de toque: freio à esquerda, ação e acelerador à direita */
.jpm-game[data-game="trator"] .tr-brake { background: rgba(239, 91, 91, .78); }
.jpm-game[data-game="trator"] .tr-gas { background: rgba(46, 156, 123, .88); width: clamp(60px, 15cqw, 96px); height: clamp(60px, 15cqw, 96px); }
.jpm-game[data-game="trator"] .tr-brake.is-on, .jpm-game[data-game="trator"] .tr-brake:active { background: rgba(239, 91, 91, .95); }
.jpm-game[data-game="trator"] .tr-gas.is-on, .jpm-game[data-game="trator"] .tr-gas:active { background: rgba(46, 156, 123, 1); }
.jpm-game[data-game="trator"] .tr-act { position: relative; background: rgba(23, 27, 52, .55); }
.jpm-game[data-game="trator"] .tr-act svg { display: none; width: 50%; height: 50%; margin-top: -10%; }
.jpm-game[data-game="trator"] .tr-act[data-act="load"] .tr-i-load, .jpm-game[data-game="trator"] .tr-act[data-act="horn"] .tr-i-horn, .jpm-game[data-game="trator"] .tr-act[data-act="drop"] .tr-i-drop { display: block; }
.jpm-game[data-game="trator"] .tr-act-label { position: absolute; left: 0; right: 0; bottom: 13%; font-size: clamp(8px, 1.6cqw, 12px); font-weight: 900; line-height: 1; text-align: center; }
.jpm-game[data-game="trator"] .tr-act.is-glow { background: rgba(249, 132, 74, .92); animation: trator-glow 1s ease-in-out infinite; }
@keyframes trator-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(249, 199, 79, .8); } 50% { box-shadow: 0 0 0 8px rgba(249, 199, 79, 0); } }

/* área pequena (celular em pé): HUD compacto e cartões baixos */
@container (max-width: 560px) {
  .jpm-game[data-game="trator"] .g-hud { gap: 5px; padding: 6px 7px; }
  .jpm-game[data-game="trator"] .g-chip { padding: 4px 8px 4px 6px; gap: 4px; font-size: 12px; }
  .jpm-game[data-game="trator"] .tr-pips { display: none; }
  .jpm-game[data-game="trator"] .g-bar { width: 44px; }
  .jpm-game[data-game="trator"] .tr-hint { top: 21cqh; font-size: 12px; }
}
@container (max-height: 330px) {
  .jpm-game[data-game="trator"] .g-howto { display: none; }
  .jpm-game[data-game="trator"] .g-ready { gap: 6px; }
  .jpm-game[data-game="trator"] .g-count { font-size: 56px; }
  .jpm-game[data-game="trator"] .g-screen { padding: 6px; }
  .jpm-game[data-game="trator"] .g-card { padding: 8px 12px; }
  .jpm-game[data-game="trator"] .g-intro .g-card { width: min(80%, 330px); }
  .jpm-game[data-game="trator"] .g-intro .g-text { font-size: 11px; margin-bottom: 8px; }
  .jpm-game[data-game="trator"] .g-title { font-size: 19px; margin: 1px 0 3px; }
  .jpm-game[data-game="trator"] .tr-over .g-kicker, .jpm-game[data-game="trator"] .tr-over .g-best { display: none; }
  .jpm-game[data-game="trator"] .g-stars { font-size: 22px; margin: 0 0 2px; }
  .jpm-game[data-game="trator"] .g-results { margin: 2px 0 6px; gap: 14px; }
  .jpm-game[data-game="trator"] .g-num { font-size: 16px; }
  .jpm-game[data-game="trator"] .g-lbl { font-size: 10px; }
  .jpm-game[data-game="trator"] .g-btn { min-height: 40px; padding: 0 14px; font-size: 13px; }
  .jpm-game[data-game="trator"] .tr-save { margin: -4px 0 6px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .jpm-game[data-game="trator"] .tr-hint, .jpm-game[data-game="trator"] .tr-act.is-glow, .jpm-game[data-game="trator"] .g-star.is-on, .jpm-game[data-game="trator"] .tr-cargo.is-hit { animation: none; }
}
.jpm-game[data-game="trator"] .tr-over .g-row { flex-wrap: nowrap; }
.jpm-game[data-game="trator"] .tr-over .g-btn { padding: 0 18px; }
