/* ==========================================================================
   scouter.css — o "Scouter" (brincadeira inspirada em Dragon Ball)
   Desenho próprio: lente verde translúcida com HUD.
   Dígitos: DSEG7 Classic (SIL Open Font License, assets/fonts/DSEG-LICENSE.txt)
   ========================================================================== */

@font-face {
  font-family: "DSEG7";
  src: url("../assets/fonts/DSEG7Classic-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

.scouter-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.scouter-builder {
  display: grid;
  gap: 14px;
  align-content: start;
}

.scouter-builder h3 {
  font-size: 16px;
}

.scouter-builder > p {
  font-size: 13px;
}

.pilot-pick {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--hair);
}

.pilot-pick .field {
  width: 100%;
}

.pilot-pick .field select {
  flex: 1;
  width: 100%;
}

.sc-warning {
  min-height: 18px;
  font-size: 12px;
  color: var(--loss);
}

.sc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- aparelho ---------- */

.scouter {
  --hud: #5dff8f;
  --hud-dim: rgba(93, 255, 143, 0.55);
  --hud-faint: rgba(93, 255, 143, 0.14);
  position: relative;
  padding: 18px 18px 18px 0;
  min-height: 100%;
}

.scouter-lens {
  position: relative;
  height: 100%;
  min-height: 360px;
  border-radius: 22px 70px 22px 22px;
  overflow: hidden;
  border: 1px solid var(--hud-dim);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(93, 255, 143, 0.2), transparent 60%),
    linear-gradient(160deg, rgba(36, 92, 52, 0.55), rgba(8, 30, 16, 0.85));
  box-shadow:
    0 0 0 6px #16161a,
    0 0 0 7px var(--hair-2),
    0 0 40px rgba(93, 255, 143, 0.18),
    inset 0 0 60px rgba(93, 255, 143, 0.12);
  color: var(--hud);
  font-family: "Share Tech Mono", ui-monospace, monospace;
  padding: 18px 22px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 14px;
}

.scouter-arm {
  position: absolute;
  right: 0;
  top: 40px;
  width: 26px;
  height: 120px;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(90deg, #26262b, #34343a);
  border: 1px solid var(--hair-2);
  border-left: 0;
}

.scouter-arm::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hud);
  box-shadow: 0 0 10px var(--hud);
  animation: blink 1.6s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.2;
  }
}

.hud-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--hud-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--hud-faint) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.5;
  pointer-events: none;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: -30%;
  height: 30%;
  background: linear-gradient(180deg, transparent, rgba(93, 255, 143, 0.22), transparent);
  pointer-events: none;
  opacity: 0;
}

.scouter.is-scanning .scan-line {
  opacity: 1;
  animation: scan 1.1s linear infinite;
}

@keyframes scan {
  to {
    top: 100%;
  }
}

.hud-top,
.hud-bottom {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--hud-dim);
}

.targets {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.target {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 26px;
  align-items: center;
  padding: 16px 14px 16px 20px;
  border: 1px solid var(--hud-faint);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
}

.target-art {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: center / cover no-repeat;
  filter: saturate(0.5) brightness(0.9);
  box-shadow: 0 0 0 2px var(--hud-dim);
}

.target-art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(40, 140, 70, 0.35);
  mix-blend-mode: color;
}

.target-art .reticle {
  position: absolute;
  inset: -8px;
  border: 1px dashed var(--hud);
  border-radius: 50%;
  z-index: 1;
}

.scouter.is-scanning .target-art .reticle {
  animation: spin 1.4s linear infinite;
}

/* segunda mira: entra grande e gira até travar no alvo */
.target-art .reticle-2 {
  inset: -14px;
  border: 2px solid transparent;
  border-top-color: var(--hud);
  border-bottom-color: var(--hud);
  border-style: solid;
  opacity: 0;
  transform: scale(1.7) rotate(90deg);
  transition: opacity 0.2s, transform 0.65s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.target.is-locking .reticle-2,
.target.is-locked .reticle-2 {
  opacity: 1;
  transform: none;
}

.target.is-locking .target-art .reticle {
  animation: spin 0.5s linear infinite;
}

.target.is-locked .target-art {
  filter: saturate(0.8) brightness(1);
  box-shadow: 0 0 0 2px var(--hud), 0 0 22px rgba(93, 255, 143, 0.55);
}

.scouter.is-scanning .target.is-locked {
  animation: lock-flash 0.55s ease-out;
}

@keyframes lock-flash {
  0% {
    background: rgba(93, 255, 143, 0.35);
  }
  100% {
    background: rgba(0, 0, 0, 0.18);
  }
}

/* a lente liga piscando */
.scouter.is-booting .scouter-lens {
  animation: boot 0.7s steps(1);
}

@keyframes boot {
  0% {
    opacity: 0.15;
  }
  12% {
    opacity: 1;
  }
  22% {
    opacity: 0.35;
  }
  34% {
    opacity: 1;
  }
  48% {
    opacity: 0.6;
  }
  60% {
    opacity: 1;
  }
}

/* fluxo de dados decorativo */
.hud-stream {
  position: absolute;
  left: 22px;
  bottom: 46px;
  height: 132px;
  width: 72px;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.55;
  color: rgba(93, 255, 143, 0.3);
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
  pointer-events: none;
  display: flex;
  flex-direction: column;
}

.scouter.is-scanning .hud-stream span {
  animation: stream 0.9s linear infinite;
}

@keyframes stream {
  to {
    transform: translateY(-310%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.target-info {
  min-width: 0;
  display: grid;
  gap: 2px;
  font-family: var(--font-ui);
}

.target-info b {
  color: #e9ffef;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target-info small {
  color: var(--hud-dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target-power {
  position: relative;
  display: inline-flex;
  height: 1.1em;
  margin-top: 4px;
  font-family: "DSEG7", "Share Tech Mono", ui-monospace, monospace;
  font-style: italic;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  color: var(--hud);
}

.target-power .odo-ghost {
  left: 0;
  right: auto;
}

.readout {
  position: relative;
  display: grid;
  gap: 4px;
  text-align: right;
}

.readout-label {
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--hud-dim);
}

.readout-value {
  position: relative;
  justify-self: end;
  display: inline-flex;
  height: 1.08em;
  font-family: "DSEG7", "Share Tech Mono", ui-monospace, monospace;
  font-style: italic;
  font-weight: 700;
  font-size: clamp(32px, 5.6vw, 62px);
  line-height: 1;
  color: var(--hud);
  white-space: nowrap;
}

/* LCD: os "8" apagados ao fundo */
.odo-ghost {
  position: absolute;
  right: 0;
  top: 0;
  display: inline-flex;
  color: rgba(93, 255, 143, 0.09);
}

.odo-live {
  position: relative;
  display: inline-flex;
  text-shadow: 0 0 14px rgba(93, 255, 143, 0.65);
}

.odo-col {
  display: inline-block;
  height: 1em;
  overflow: hidden;
  padding: 0 0.06em;
  margin: 0 -0.06em;
}

.odo-strip {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.odo-strip span {
  display: block;
  height: 1em;
  line-height: 1;
}

.odo-sep {
  display: inline-block;
  width: 0.28em;
}

@keyframes odo-spin {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-10em);
  }
}

.odo-error {
  color: #ffd36b;
  text-shadow: 0 0 18px rgba(255, 196, 70, 0.8);
  animation: flicker 0.9s infinite;
}

.readout-tier {
  justify-self: end;
  font-family: "Bangers", var(--font-display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.1;
  color: #e9ffef;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), 0 0 18px rgba(93, 255, 143, 0.35);
  transform-origin: right center;
}

.readout-tier.is-pop {
  animation: tier-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes tier-pop {
  0% {
    opacity: 0;
    transform: scale(0.5) rotate(-4deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.readout-quote {
  font-size: 13px;
  color: var(--hud-dim);
  min-height: 18px;
}

.scouter.is-done .readout-value {
  animation: settle 0.5s var(--ease);
}

@keyframes settle {
  0% {
    transform: scale(1.06);
  }
  100% {
    transform: none;
  }
}

.scouter.is-unstable .readout-value {
  animation: flicker 2.4s infinite;
}

@keyframes flicker {
  0%,
  92%,
  100% {
    opacity: 1;
  }
  94% {
    opacity: 0.35;
  }
  96% {
    opacity: 0.9;
  }
  98% {
    opacity: 0.5;
  }
}

/* sobrecarga e explosão */

.scouter.is-overload .scouter-lens {
  animation: shake 0.12s linear infinite;
  border-color: #ffd36b;
}

.scouter.is-overload .readout-value {
  color: #ffd36b;
  text-shadow: 0 0 22px rgba(255, 196, 70, 0.8);
}

@keyframes shake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(2px, -1px);
  }
  50% {
    transform: translate(-2px, 1px);
  }
  75% {
    transform: translate(1px, 2px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.cracks,
.boom {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.cracks svg {
  width: 100%;
  height: 100%;
}

.cracks path {
  fill: none;
  stroke: rgba(235, 255, 240, 0.85);
  stroke-width: 1.6;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

.boom {
  display: grid;
  place-items: center;
  font-family: "Bangers", var(--font-display);
  font-size: clamp(56px, 10vw, 110px);
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #fff3c4;
  text-shadow: 0 0 30px rgba(255, 190, 60, 0.9);
}

.scouter.is-broken .cracks {
  opacity: 1;
}

.scouter.is-broken .cracks path {
  animation: crack 0.5s ease-out forwards;
}

.scouter.is-broken .boom {
  animation: boom 1.1s ease-out forwards;
}

.scouter.is-broken .scouter-lens {
  background:
    radial-gradient(ellipse at 52% 46%, rgba(255, 214, 120, 0.35), transparent 55%),
    linear-gradient(160deg, rgba(60, 60, 40, 0.6), rgba(14, 14, 10, 0.9));
  border-color: #ffd36b;
}

@keyframes crack {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes boom {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  25% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

/* ---------- painéis ---------- */

.sc-part {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) minmax(0, 1fr) 56px;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--hair);
}

.sc-part-label {
  display: grid;
  min-width: 0;
}

.sc-part-label small {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sc-part-label b {
  font-size: 14px;
  font-weight: 600;
}

.sc-part-label span {
  font-size: 12px;
}

.sc-diverge {
  position: relative;
  height: 14px;
}

.sc-diverge .mid {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 1px;
  background: var(--ink-3);
}

.sc-diverge .fill {
  position: absolute;
  top: 2px;
  height: 10px;
}

.sc-mult {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sc-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sc-scale {
  display: grid;
  gap: 4px;
}

.sc-tier {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.sc-tier b {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.sc-tier small {
  display: block;
  font-size: 11px;
  color: var(--ink-3);
}

.sc-tier.is-current {
  background: rgba(93, 255, 143, 0.08);
  border-color: rgba(93, 255, 143, 0.4);
}

.sc-tier-bar {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}

.sc-tier-bar span {
  display: block;
  height: 100%;
  background: var(--s1);
  border-radius: 0 4px 4px 0;
}

.sc-tier.is-current .sc-tier-bar span {
  background: #5dff8f;
}

.sc-tier-share {
  font-size: 12px;
  text-align: right;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.disclaimer {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(93, 255, 143, 0.3);
  background: rgba(93, 255, 143, 0.06);
  font-size: 13px;
  color: var(--ink-2);
}

.disclaimer b {
  color: var(--ink);
}

@media (max-width: 960px) {
  .scouter-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .scouter {
    padding: 10px 12px 10px 0;
  }

  .scouter-lens {
    padding: 14px;
    border-radius: 18px 44px 18px 18px;
  }

  .targets {
    grid-template-columns: minmax(0, 1fr);
  }

  .target {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 22px;
  }

  .target-art {
    width: 56px;
    height: 56px;
  }

  .sc-part {
    grid-template-columns: minmax(0, 1fr) 56px;
  }

  .sc-part .sc-diverge {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .sc-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .sc-tier {
    grid-template-columns: minmax(0, 1fr) 70px 44px;
  }
}


/* ---------- afinidade conhecida (pódios) ---------- */

.sc-history {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--hair);
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.sc-history h4 {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.sc-history ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  color: var(--ink);
}

.sc-history p {
  font-size: 12px;
}

@media (max-width: 640px) {
  .hud-stream {
    display: none;
  }

  .readout-value {
    font-size: 34px;
  }
}

@media (max-width: 960px) {
  /* no celular o visor vem antes do formulário */
  #scouter-device {
    order: -1;
  }
}

/* ---------- montagem: cabeçalho, aviso, alvos vazios ---------- */

.sc-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sc-sound {
  white-space: nowrap;
}

.sc-warning.is-hint {
  color: var(--ink-3);
}

.target.is-empty .target-art {
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 1px var(--hud-faint);
}

.target.is-empty .target-art::after {
  display: none;
}

.target-q {
  font-family: "Bangers", var(--font-display);
  font-size: 30px;
  color: var(--hud-dim);
}

.target.is-empty .target-info b {
  color: var(--hud-dim);
}

.odo-blank {
  visibility: hidden;
}

.sc-subhead {
  margin: 18px 0 2px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}

.sc-note {
  font-size: 13px;
  padding: 8px 0 4px;
}
