:root {
  --client-main: #2ca5ff;
  --client-main-hover: #55b7ff;
  --client-dark: #0d59a2;
  --ink: #0b0e11;
  --panel: #11151a;
  --panel-soft: rgba(17, 21, 26, 0.72);
  --steel: #5b6670;
  --mist: #c9d2d8;
  --paper: #f4f6f7;
  --good: #2bd66f;
  --warning: #ffb020;
  --danger: #ff6b63;
  --shield-size: 84px;
  --meteor-size: 46px;
  --core-size: 70px;
  --page-gutter: clamp(18px, 3vw, 42px);
  --safe-top: max(16px, env(safe-area-inset-top));
  --safe-right: max(16px, env(safe-area-inset-right));
  --safe-bottom: max(16px, env(safe-area-inset-bottom));
  --safe-left: max(16px, env(safe-area-inset-left));
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: "Sora", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(44, 165, 255, 0.48);
  outline-offset: 3px;
}

#app {
  position: relative;
  width: 100%;
  height: var(--app-height, 100dvh);
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(44, 165, 255, 0.08), transparent 34%),
    radial-gradient(ellipse at 50% 10%, rgba(44, 165, 255, 0.045), transparent 46%),
    linear-gradient(180deg, #080b0e 0%, #0b0f14 54%, #10151d 100%);
}

#app::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 44px 44px;
  content: "";
  mask-image: radial-gradient(circle at center, #000, transparent 82%);
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Conexão */
.connection-status {
  position: absolute;
  top: var(--safe-top);
  left: 50%;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(620px, calc(100vw - 32px));
  padding: 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(17, 21, 26, 0.94);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  color: var(--mist);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: none;
}

.connection-status.offline {
  border-color: rgba(255, 176, 32, 0.48);
  color: #ffe0a3;
}

.connection-status.pending {
  border-color: rgba(44, 165, 255, 0.48);
  color: #bfe3ff;
}

.connection-status.synced {
  border-color: rgba(43, 214, 111, 0.48);
  color: #b9f6d0;
}

.connection-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

/* HUD */
#hud {
  position: absolute;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding:
    calc(21px + env(safe-area-inset-top))
    calc(var(--page-gutter) + env(safe-area-inset-right))
    18px
    calc(var(--page-gutter) + env(safe-area-inset-left));
  pointer-events: none;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
}

.brand img {
  display: block;
  width: clamp(86px, 8vw, 138px);
  max-height: 54px;
  object-fit: contain;
  object-position: left center;
}

.stat-row {
  display: flex;
  align-items: flex-start;
  gap: clamp(22px, 3vw, 42px);
}

.stat {
  min-width: 100px;
  color: var(--mist);
  text-align: right;
}

.stat .label {
  font-size: 10px;
  line-height: 1.25;
  letter-spacing: 1.45px;
  text-transform: uppercase;
  opacity: 0.68;
  white-space: nowrap;
}

.stat .value {
  color: var(--paper);
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.05;
}

.lives {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 8px;
}

.life-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--client-main);
  box-shadow: 0 0 10px rgba(44, 165, 255, 0.74);
}

.life-dot.lost {
  border: 1.5px solid var(--steel);
  background: transparent;
  box-shadow: none;
}

#timerWrap {
  position: absolute;
  inset: 0 0 auto;
  z-index: 41;
  height: calc(5px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, 0.055);
}

#timerBar {
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--client-dark), var(--client-main));
  transform: scaleX(1);
  transform-origin: left;
  transition: background 0.25s ease;
  will-change: transform;
}

/* Campo */
#field {
  position: absolute;
  inset: 0;
  z-index: 10;
  overflow: hidden;
  touch-action: none;
}

.core {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: flex;
  width: var(--core-size);
  height: var(--core-size);
  margin-top: calc(var(--core-size) / -2);
  margin-left: calc(var(--core-size) / -2);
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #1c2430, #0c1014);
  box-shadow: 0 0 36px rgba(44, 165, 255, 0.06);
}

.core::after {
  position: absolute;
  inset: -14px;
  border: 1px dashed rgba(91, 102, 112, 0.54);
  border-radius: 50%;
  content: "";
}

.core-glyph {
  width: 42%;
  height: 42%;
  border: 5px solid var(--steel);
  border-radius: 50%;
  opacity: 0.62;
}

#shield {
  position: absolute;
  z-index: 30;
  display: flex;
  width: var(--shield-size);
  height: var(--shield-size);
  margin-top: calc(var(--shield-size) / -2);
  margin-left: calc(var(--shield-size) / -2);
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  filter: drop-shadow(0 8px 22px rgba(44, 165, 255, 0.42));
  will-change: left, top;
}

.shield-img {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

#shield .pulse {
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(44, 165, 255, 0.56);
  border-radius: 50%;
  animation: pulse 1.6s ease-out infinite;
}

#shield.hit .pulse {
  border-color: #fff;
}

#shield.block .pulse {
  animation-duration: 0.4s;
}

@keyframes pulse {
  0% { opacity: 0.9; transform: scale(0.85); }
  100% { opacity: 0; transform: scale(1.25); }
}

.meteor {
  position: absolute;
  z-index: 20;
  width: var(--meteor-size);
  height: var(--meteor-size);
  margin-top: calc(var(--meteor-size) / -2);
  margin-left: calc(var(--meteor-size) / -2);
  will-change: left, top, transform, opacity;
}

.meteor img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.meteor.popping {
  animation: pop 0.25s forwards;
}

@keyframes pop {
  to { opacity: 0; transform: scale(1.6); }
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  overflow-x: hidden;
  overflow-y: auto;
  align-items: center;
  justify-content: center;
  padding:
    max(74px, calc(28px + env(safe-area-inset-top)))
    max(24px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  background:
    radial-gradient(circle at 50% 42%, rgba(44, 165, 255, 0.055), transparent 32%),
    rgba(5, 8, 11, 0.93);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.overlay-brand {
  position: absolute;
  top: calc(22px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  pointer-events: none;
}

.overlay-brand img {
  display: block;
  width: clamp(86px, 8vw, 138px);
  margin: 0 auto;
  object-position: center;
}

.card {
  position: relative;
  width: min(700px, 100%);
  margin: auto;
  padding: clamp(26px, 3vw, 44px);
  color: var(--paper);
  text-align: center;
}

.start-card {
  width: min(820px, 100%);
}

.compact-card {
  width: min(620px, 100%);
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--client-main);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 15px;
  font-size: clamp(34px, 4.4vw, 58px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -1.2px;
  text-wrap: balance;
}

.compact-title {
  font-size: clamp(28px, 3.4vw, 44px);
}

.sub {
  max-width: 670px;
  margin: 0 auto 30px;
  color: var(--mist);
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.58;
  text-wrap: pretty;
}

.photo-copy {
  max-width: 540px;
  margin-bottom: 20px;
}

.operator-preview {
  display: block;
  width: clamp(120px, 12vw, 166px);
  height: clamp(120px, 12vw, 166px);
  margin: 0 auto 28px;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(44, 165, 255, 0.45));
}

.action-stack {
  display: flex;
  width: min(340px, 100%);
  margin: 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 11px;
}

button.cta,
button.cta-secondary,
button.cta-tertiary {
  width: 100%;
  min-height: 54px;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button.cta {
  border: 0;
  background: var(--client-main);
  box-shadow: 0 12px 32px rgba(44, 165, 255, 0.34);
  color: #fff;
  font-size: clamp(16px, 1.5vw, 18px);
  font-weight: 800;
  letter-spacing: 0.2px;
}

button.cta:hover {
  background: var(--client-main-hover);
  box-shadow: 0 14px 36px rgba(44, 165, 255, 0.42);
}

button.cta-secondary {
  border: 1.5px solid rgba(201, 210, 216, 0.42);
  background: rgba(255, 255, 255, 0.02);
  color: var(--paper);
  font-size: 15px;
  font-weight: 700;
}

button.cta-secondary:hover {
  border-color: rgba(244, 246, 247, 0.76);
  background: rgba(255, 255, 255, 0.045);
}

button.cta-tertiary {
  min-height: 42px;
  padding: 8px 20px;
  border: 0;
  background: transparent;
  color: rgba(201, 210, 216, 0.68);
  font-size: 13px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
}

button.cta-tertiary:hover {
  color: var(--paper);
}

button.cta:active,
button.cta-secondary:active,
button.cta-tertiary:active {
  transform: scale(0.97);
}

button.cta:disabled,
button.cta-secondary:disabled {
  background: var(--steel);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
}

.back-button {
  position: absolute;
  top: 0;
  left: 0;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: rgba(201, 210, 216, 0.78);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.back-button:hover {
  color: var(--paper);
}

.score-final {
  margin: 8px 0 4px;
  color: #fff;
  font-size: clamp(64px, 8vw, 96px);
  font-weight: 800;
  line-height: 1;
}

.score-final small {
  display: block;
  margin-top: 9px;
  color: var(--mist);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
}

/* Câmera */
.capture-card {
  width: min(600px, 100%);
  text-align: center;
}

.cam-frame {
  position: relative;
  width: clamp(230px, 29vw, 320px);
  margin: 0 auto 18px;
  overflow: hidden;
  aspect-ratio: 1;
  border: clamp(4px, 0.55vw, 6px) solid var(--client-main);
  border-radius: 50%;
  background: #000;
  box-shadow: 0 12px 36px rgba(44, 165, 255, 0.32);
}

.cam-frame video,
.cam-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cam-frame video {
  transform: scaleX(-1);
}

.cam-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--steel);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

.cam-status {
  min-height: 18px;
  margin-bottom: 16px;
  color: var(--mist);
  font-size: 12px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  opacity: 0.8;
}

.cam-actions {
  display: flex;
  width: min(480px, 100%);
  margin: 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 11px;
}

.cam-actions button {
  width: auto;
  min-width: 210px;
}

/* Formulário */
.form-card {
  width: min(680px, 100%);
  text-align: left;
}

.form-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 14px 0 26px;
}

.form-header h1 {
  margin: 0 0 3px;
  font-size: 28px;
  letter-spacing: -0.6px;
}

.form-header p {
  margin: 0;
  color: var(--mist);
  font-size: 13px;
  opacity: 0.76;
}

.mini-preview {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid var(--client-main);
  border-radius: 50%;
}

.mini-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--mist);
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  opacity: 0.78;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.045);
  color: var(--paper);
  font-size: 16px;
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
}

.form-group input:focus {
  border-color: var(--client-main);
  background: rgba(44, 165, 255, 0.045);
}

.form-group input[aria-invalid="true"] {
  border-color: rgba(255, 107, 99, 0.72);
}

.form-group input::placeholder {
  color: var(--steel);
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 19px 0 21px;
  color: var(--mist);
  font-size: 13px;
  line-height: 1.5;
  touch-action: manipulation;
}

.consent input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--client-main);
}

.field-error {
  min-height: 14px;
  margin-top: -10px;
  margin-bottom: 12px;
  color: #ff9b94;
  font-size: 12px;
}

.form-submit {
  width: 100%;
}

.success-icon {
  display: flex;
  width: 88px;
  height: 88px;
  margin: 0 auto 24px;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--good);
  border-radius: 50%;
  background: rgba(43, 214, 111, 0.12);
  color: var(--good);
}

.success-icon svg {
  width: 40px;
  height: 40px;
}

/* Ranking */
.ranking-card {
  width: min(760px, 100%);
}

.ranking-card h1 {
  margin-bottom: 8px;
}

.ranking-status {
  min-height: 18px;
  margin-bottom: 18px;
  color: var(--mist);
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.8;
}

.ranking-list {
  max-height: min(50dvh, 520px);
  margin-bottom: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  text-align: left;
  touch-action: pan-y;
}

.rank-item {
  display: flex;
  min-height: 68px;
  align-items: center;
  gap: 15px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.rank-item:nth-child(1) {
  border-color: rgba(44, 165, 255, 0.42);
  background: rgba(44, 165, 255, 0.14);
}

.rank-item:nth-child(2) {
  background: rgba(201, 210, 216, 0.065);
}

.rank-item:nth-child(3) {
  background: rgba(255, 176, 32, 0.065);
}

.rank-pos {
  width: 34px;
  flex: 0 0 auto;
  color: var(--mist);
  font-size: 18px;
  font-weight: 800;
  text-align: center;
}

.rank-item:nth-child(1) .rank-pos {
  color: var(--client-main);
}

.rank-photo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: #1c2430;
  object-fit: cover;
}

.rank-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-score {
  flex: 0 0 auto;
  color: var(--paper);
  font-size: 19px;
  font-weight: 800;
}

.rank-empty {
  padding: 32px 12px;
  color: var(--steel);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

/* Tablets */
@media (min-width: 600px) and (max-width: 1366px) {
  :root {
    --shield-size: clamp(92px, 9vw, 112px);
    --meteor-size: clamp(50px, 5vw, 62px);
    --core-size: clamp(76px, 7.5vw, 94px);
  }

  .brand img,
  .overlay-brand img {
    width: clamp(104px, 11vw, 150px);
    max-height: 62px;
  }

   .overlay-brand {
    position: absolute;
    top: calc(22px + env(safe-area-inset-top));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 2;

    display: flex;
    justify-content: center;
    align-items: center;
    width: max-content;

    pointer-events: none;
  }

  .overlay-brand img {
    display: block;
    width: clamp(104px, 11vw, 150px);
    max-height: 62px;
    margin: 0 auto;
    object-fit: contain;
  }

  .stat {
    min-width: 112px;
  }

  .stat .label {
    font-size: 11px;
  }

  .life-dot {
    width: 14px;
    height: 14px;
  }

  .start-card {
    width: min(720px, 100%);
  }

  .capture-card {
    width: min(580px, 100%);
  }

  .form-card {
    width: min(700px, 100%);
  }

  .ranking-card {
    width: min(780px, 100%);
  }
}

/* Celulares */
@media (max-width: 599px) {
  :root {
    --shield-size: clamp(74px, 21vw, 86px);
    --meteor-size: clamp(40px, 11.5vw, 46px);
    --core-size: clamp(62px, 18vw, 72px);
    --page-gutter: 14px;
  }

  #hud {
    display: grid;
    grid-template-columns: clamp(54px, 16vw, 66px) minmax(0, 1fr);
    align-items: start;
    gap: 0 10px;
    padding:
      calc(12px + env(safe-area-inset-top))
      calc(12px + env(safe-area-inset-right))
      20px
      calc(12px + env(safe-area-inset-left));
    background: linear-gradient(180deg, rgba(6, 9, 13, 0.94) 0%, rgba(6, 9, 13, 0.56) 72%, transparent 100%);
  }

  #hud .brand {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    justify-self: start;
    padding-top: 2px;
  }

  #hud .brand img {
    width: clamp(52px, 15vw, 64px);
    max-height: 42px;
  }

  .stat-row {
    grid-column: 2;
    grid-row: 1;
    display: grid;
    grid-template-columns: minmax(82px, 1fr) minmax(70px, auto);
    align-items: start;
    justify-self: stretch;
    gap: clamp(10px, 3vw, 18px);
    width: 100%;
  }

  .stat {
    min-width: 0;
  }

  .stat .label {
    min-height: 22px;
    font-size: clamp(8px, 2.35vw, 10px);
    line-height: 1.25;
    letter-spacing: 0.75px;
    white-space: normal;
  }

  .stat .value {
    font-size: clamp(27px, 8.5vw, 34px);
    line-height: 1;
  }

  .lives {
    gap: 6px;
    margin-top: 7px;
  }

  .life-dot {
    width: clamp(10px, 3vw, 12px);
    height: clamp(10px, 3vw, 12px);
  }

  .connection-status {
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 11px;
  }

  .overlay {
    align-items: center;
    padding:
      max(68px, calc(20px + env(safe-area-inset-top)))
      max(16px, env(safe-area-inset-right))
      max(22px, env(safe-area-inset-bottom))
      max(16px, env(safe-area-inset-left));
  }

  .overlay-brand {
  top: calc(18px + env(safe-area-inset-top));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

  .overlay-brand img {
    width: clamp(72px, 22vw, 94px);
    max-height: 42px;
  }

  .card {
    width: 100%;
    max-width: 480px;
    padding: clamp(16px, 3.6vh, 30px) 2px;
  }

  .start-card {
    max-width: 460px;
  }

  .operator-preview {
    width: clamp(90px, 27vw, 118px);
    height: clamp(90px, 27vw, 118px);
    margin-bottom: 19px;
  }

  .eyebrow {
    margin-bottom: 10px;
    font-size: 10px;
    letter-spacing: 2px;
  }

  h1 {
    margin-bottom: 12px;
    font-size: clamp(30px, 9.2vw, 40px);
    letter-spacing: -0.8px;
  }

  .compact-title {
    font-size: clamp(25px, 7.4vw, 33px);
  }

  .sub {
    max-width: 420px;
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.5;
  }

  .action-stack {
    width: min(100%, 360px);
  }

  button.cta,
  button.cta-secondary {
    min-height: 52px;
  }

  .back-button {
    top: -10px;
    left: -6px;
  }

  .cam-frame {
    width: min(66vw, 258px);
    margin-bottom: 14px;
  }

  .cam-status {
    margin-bottom: 12px;
    font-size: 10px;
    letter-spacing: 1px;
  }

  .cam-actions {
    width: min(100%, 360px);
    flex-direction: column;
    gap: 9px;
  }

  .cam-actions button {
    width: 100%;
    min-width: 0;
  }

  .form-card {
    max-width: 520px;
  }

  .form-header {
    margin: 18px 0 18px;
  }

  .form-header h1 {
    font-size: 23px;
  }

  .mini-preview {
    width: 54px;
    height: 54px;
  }

  .form-group {
    margin-bottom: 13px;
  }

  .form-group input[type="text"],
  .form-group input[type="tel"],
  .form-group input[type="email"] {
    min-height: 50px;
    padding: 12px 14px;
  }

  .consent {
    gap: 10px;
    margin: 15px 0 18px;
    font-size: 11.5px;
    line-height: 1.45;
  }

  .consent input[type="checkbox"] {
    width: 21px;
    height: 21px;
  }

  .ranking-card {
    max-width: 520px;
  }

  .ranking-card h1 {
    font-size: clamp(29px, 8.4vw, 38px);
  }

  .ranking-status {
    margin-bottom: 12px;
  }

  .ranking-list {
    max-height: min(55dvh, 520px);
    margin-bottom: 18px;
  }

  .rank-item {
    min-height: 60px;
    gap: 9px;
    padding: 8px 9px;
  }

  .rank-pos {
    width: 24px;
    font-size: 16px;
  }

  .rank-photo {
    width: 42px;
    height: 42px;
  }

  .rank-name {
    font-size: 13px;
  }

  .rank-score {
    font-size: 17px;
  }

  .score-final {
    font-size: clamp(56px, 18vw, 74px);
  }
}

@media (max-width: 380px) {
  #hud {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 0 7px;
    padding-right: calc(9px + env(safe-area-inset-right));
    padding-left: calc(9px + env(safe-area-inset-left));
  }

  .stat-row {
    grid-template-columns: minmax(88px, 1fr) minmax(68px, auto);
    gap: 7px;
  }

  .stat .label {
    font-size: 8.2px;
    letter-spacing: 0.45px;
  }

  .stat .value {
    font-size: 26px;
  }

  .life-dot {
    width: 9px;
    height: 9px;
  }

  .operator-preview {
    width: 84px;
    height: 84px;
  }

  h1 {
    font-size: 28px;
  }
}

/* Alturas reduzidas e celular/tablet em paisagem */
@media (max-height: 720px) {
  .overlay {
    align-items: flex-start;
    padding-top: max(62px, calc(14px + env(safe-area-inset-top)));
  }

  .overlay-brand {
    top: calc(12px + env(safe-area-inset-top));
  }

  .card {
    padding-top: 16px;
    padding-bottom: 18px;
  }

  .operator-preview {
    width: 92px;
    height: 92px;
    margin-bottom: 14px;
  }

  .eyebrow {
    margin-bottom: 8px;
  }

  h1 {
    margin-bottom: 9px;
    font-size: clamp(28px, 5.3vh, 42px);
  }

  .sub {
    margin-bottom: 17px;
    font-size: 14px;
    line-height: 1.42;
  }

  button.cta,
  button.cta-secondary {
    min-height: 48px;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .cam-frame {
    width: min(31vh, 230px);
    margin-bottom: 10px;
  }

  .cam-status {
    margin-bottom: 9px;
  }

  .form-header {
    margin-bottom: 15px;
  }

  .form-group {
    margin-bottom: 11px;
  }

  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="tel"] {
    min-height: 46px;
    padding: 10px 13px;
  }

  .consent {
    margin: 12px 0 14px;
    font-size: 11.5px;
  }

  .ranking-list {
    max-height: min(43dvh, 370px);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --shield-size: 70px;
    --meteor-size: 40px;
    --core-size: 60px;
  }

  #hud {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding:
      calc(9px + env(safe-area-inset-top))
      calc(14px + env(safe-area-inset-right))
      10px
      calc(14px + env(safe-area-inset-left));
  }

  #hud .brand img {
    width: 60px;
    max-height: 34px;
  }

  .stat-row {
    display: flex;
    width: auto;
    margin-left: auto;
    gap: 18px;
  }

  .stat .label {
    min-height: auto;
    font-size: 8px;
    white-space: nowrap;
  }

  .stat .value {
    font-size: 24px;
  }

  .overlay {
    padding-top: max(52px, calc(10px + env(safe-area-inset-top)));
  }

  .overlay-brand img {
    width: 72px;
  }

  .start-card {
    display: grid;
    max-width: 720px;
    grid-template-columns: 128px minmax(0, 1fr);
    grid-template-areas:
      "preview eyebrow"
      "preview title"
      "preview copy"
      "preview actions";
    align-items: center;
    column-gap: 26px;
    text-align: left;
  }

  .start-card .operator-preview {
    grid-area: preview;
    width: 118px;
    height: 118px;
    margin: 0;
  }

  .start-card .eyebrow { grid-area: eyebrow; }
  .start-card h1 { grid-area: title; }
  .start-card .sub {
    grid-area: copy;
    margin-right: 0;
    margin-left: 0;
  }

  .start-card .action-stack {
    grid-area: actions;
    width: min(310px, 100%);
    margin: 0;
  }

  .ranking-list {
    max-height: 40dvh;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  #btnFullscreen {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
