:root {
  --pink: #0a8fe0;
  --pink-d: #0571bd;
  --violet: #0b3a80;
  --violet-d: #082c63;
  --ink: #06265a;
  --yellow: #ffcc00;
  --yellow-d: #dba800;
  --paper: #eaf4fc;
  --white: #fff;
  --line: #cfe3f3;
  --mut: #4a6285;
  --bad: #c5283d;
  --font: "Sofia Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --script: "Dancing Script", cursive;
  --u: min(1vw, .5625vh);
  --gutter: calc(var(--u) * 4);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--violet);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
#app { height: 100dvh; }
.sprite { position: absolute; width: 0; height: 0; }
h1, h2, p { margin: 0; }

.screen { display: none; height: 100%; flex-direction: column; min-height: 0; }
.screen.active { display: flex; animation: enter .26s ease-out; }
.screen.solid { background: var(--violet); }
.screen.center { align-items: center; justify-content: center; text-align: center; gap: calc(var(--u) * 3); padding: var(--gutter); }
@keyframes enter { from { opacity: 0; } }

/* Topo e painel */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: calc(var(--u) * 3) var(--gutter); min-height: calc(var(--u) * 13); flex: none; }
.logo { display: block; height: max(58px, calc(var(--u) * 9.4)); width: auto; }
.sheet { flex: 1; min-height: 0; background: var(--paper); border-radius: calc(var(--u) * 4.5) calc(var(--u) * 4.5) 0 0; padding: var(--gutter); display: flex; flex-direction: column; gap: calc(var(--u) * 3); }
.heading { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: calc(var(--u) * 2.5); flex: none; }
.title { font-size: max(34px, calc(var(--u) * 7.4)); font-weight: 900; line-height: 1; text-transform: uppercase; color: var(--violet); text-wrap: balance; }
.title.light { color: var(--white); }
.script { font-family: var(--script); font-weight: 700; font-size: max(28px, calc(var(--u) * 5.4)); line-height: 1.1; color: var(--pink-d); }
.script.light { color: var(--white); }
.lead { font-size: max(21px, calc(var(--u) * 3.3)); font-weight: 500; line-height: 1.25; color: var(--mut); }
.lead.light { color: var(--white); }
.fine { font-size: max(16px, calc(var(--u) * 2)); font-weight: 500; line-height: 1.3; color: #dcecfa; }
.fine.dark { color: var(--mut); }
.error { color: var(--bad); font-size: 22px; font-weight: 700; min-height: 1.3em; }

/* Botoes */
.cta, .outline { appearance: none; border: 0; cursor: pointer; font-family: var(--font); font-weight: 900; text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; gap: .55em; }
.cta { background: var(--yellow); color: var(--ink); border-radius: calc(var(--u) * 1.6); box-shadow: 0 7px 0 var(--yellow-d); min-height: max(76px, calc(var(--u) * 11)); padding: 0 calc(var(--u) * 5); font-size: max(26px, calc(var(--u) * 4.6)); transition: transform .1s ease, box-shadow .1s ease; }
.cta:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--yellow-d); }
.cta svg { width: 1.6em; height: 1em; }
.cta.huge { width: 100%; min-height: max(92px, calc(var(--u) * 16)); font-size: max(32px, calc(var(--u) * 6.6)); }
.outline { background: rgba(255, 255, 255, .12); color: var(--white); border: 3px solid rgba(255, 255, 255, .4); border-radius: calc(var(--u) * 1.4); min-height: max(64px, calc(var(--u) * 7.6)); padding: 0 calc(var(--u) * 3); font-size: max(21px, calc(var(--u) * 3)); }
.outline:active { background: rgba(255, 255, 255, .24); }
.outline svg { width: .9em; height: .9em; }
.outline.wide { min-height: max(76px, calc(var(--u) * 11)); }
.cta:focus-visible, .outline:focus-visible, .choice:focus-visible, .theme-card:focus-visible { outline: 4px solid var(--pink); outline-offset: 3px; }

/* Barra inferior */
.dock { flex: none; background: var(--ink); color: var(--white); display: flex; align-items: center; justify-content: space-between; gap: calc(var(--u) * 3); padding: calc(var(--u) * 3) var(--gutter) calc(var(--u) * 3.6); }
.dock .cta { flex: 1; }
.dock .outline.wide { flex: 0 1 40%; }
.total { display: flex; flex-direction: column; line-height: 1; gap: 4px; }
.total span { font-size: max(17px, calc(var(--u) * 2.4)); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #cfe3f5; }
.total strong { font-size: max(40px, calc(var(--u) * 7)); font-weight: 900; font-variant-numeric: tabular-nums; }
.timer { font-size: max(22px, calc(var(--u) * 3.4)); font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; flex: 1; }

/* Tela inicial */
.attract { background: var(--pink); overflow: hidden; }
.attract-top { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: calc(var(--u) * 2.5); padding: calc(var(--u) * 4) var(--gutter) 0; }
.hero-logo { margin: 0; flex: none; height: calc(var(--u) * 52); display: flex; justify-content: center; }
.hero-logo img { height: 100%; width: auto; display: block; filter: drop-shadow(0 8px 14px rgba(6, 38, 90, .35)); }
.attract-strips { position: relative; flex: 1; min-height: 0; width: 100%; margin-top: calc(var(--u) * 2); }
.attract-strips canvas { position: absolute; top: 0; left: 50%; height: 100%; width: auto; border-radius: 6px; box-shadow: 0 16px 36px rgba(6, 38, 90, .45); }
.attract-strips canvas:nth-child(1) { transform: translateX(-132%) rotate(-11deg) scale(.86); }
.attract-strips canvas:nth-child(2) { transform: translateX(-50%); z-index: 2; }
.attract-strips canvas:nth-child(3) { transform: translateX(32%) rotate(11deg) scale(.86); }
.wave { display: block; width: 100%; height: calc(var(--u) * 13); flex: none; margin-top: calc(var(--u) * -7); position: relative; z-index: 3; }
.wave-fill { fill: var(--violet); }
.wave-line { fill: none; stroke: var(--yellow); stroke-width: 8; vector-effect: non-scaling-stroke; }
.attract-bottom { flex: none; background: var(--violet); margin-top: -1px; position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; text-align: center; gap: calc(var(--u) * 2.6); padding: calc(var(--u) * 1) calc(var(--u) * 8) calc(var(--u) * 5); }
.attract-bottom .script { color: var(--white); font-size: max(36px, calc(var(--u) * 8)); }

/* Temas */
.theme-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: calc(var(--u) * 4.5) calc(var(--u) * 2.4); padding-top: calc(var(--u) * 2.5); }
.theme-card { appearance: none; border: 0; padding: 0; background: var(--white); border-radius: calc(var(--u) * 2.2); box-shadow: 0 8px 22px rgba(11, 58, 128, .14); display: flex; flex-direction: column; min-height: 0; cursor: pointer; font-family: var(--font); color: var(--ink); text-align: left; }
.theme-card:active { transform: scale(.975); }
.theme-art { position: relative; flex: 1; min-height: 0; border-radius: calc(var(--u) * 2.2) calc(var(--u) * 2.2) 0 0; }
.theme-art canvas { position: absolute; left: 50%; top: calc(var(--u) * -2.2); height: calc(100% + var(--u) * 1); width: auto; transform: translateX(-50%) rotate(-4deg); border-radius: 4px; box-shadow: 0 8px 18px rgba(6, 38, 90, .4); }
.theme-info { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(var(--u) * 1.6) calc(var(--u) * 1.8); }
.theme-name { font-size: max(24px, calc(var(--u) * 3.9)); font-weight: 900; text-transform: uppercase; line-height: 1; color: var(--violet); }
.go { flex: none; display: inline-grid; place-items: center; width: max(52px, calc(var(--u) * 7)); height: max(52px, calc(var(--u) * 7)); border-radius: calc(var(--u) * 1.3); background: var(--yellow); color: var(--ink); }
.go svg { width: 62%; height: 42%; }

/* Camera */
.capture { background: var(--ink); }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; border-radius: 0 0 calc(var(--u) * 4.5) calc(var(--u) * 4.5); }
#video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: calc(var(--u) * 42); line-height: 1; color: var(--yellow); text-shadow: 0 8px 0 var(--ink); pointer-events: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.fire { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.capture-hint { font-size: max(24px, calc(var(--u) * 4.2)); font-weight: 800; text-transform: uppercase; line-height: 1.05; }
.shots { display: flex; gap: 10px; flex: none; }
.shots span { width: max(46px, calc(var(--u) * 6.4)); height: max(46px, calc(var(--u) * 6.4)); border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: max(22px, calc(var(--u) * 3.2)); background: rgba(255, 255, 255, .14); color: var(--white); }
.shots span.on { background: var(--yellow); color: var(--ink); }

/* Revisao */
.review-area { flex: 1; min-height: 0; display: flex; justify-content: center; }
.strip-view { height: 100%; width: auto; max-width: 100%; border-radius: 6px; box-shadow: 0 14px 34px rgba(6, 38, 90, .32); }

/* Escolha */
.choices { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); gap: calc(var(--u) * 3.4); }
.choice { position: relative; appearance: none; border: 0; padding: 0; background: var(--white); border-radius: calc(var(--u) * 2.6); box-shadow: 0 8px 22px rgba(11, 58, 128, .14); display: flex; min-height: 0; overflow: hidden; cursor: pointer; font-family: var(--font); color: var(--ink); text-align: left; }
.choice:active { transform: scale(.985); }
.choice-art { flex: 0 0 36%; display: grid; place-items: center; color: var(--white); }
.choice-art svg { width: 46%; height: 46%; }
.choice-art.digital { background: var(--violet); }
.choice-art.printed { background: var(--pink); }
.choice-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: calc(var(--u) * 1.5); padding: calc(var(--u) * 3); }
.choice-title { font-size: max(30px, calc(var(--u) * 5.6)); font-weight: 900; text-transform: uppercase; line-height: 1; color: var(--violet); }
.choice-text { font-size: max(20px, calc(var(--u) * 3)); font-weight: 500; line-height: 1.2; color: var(--mut); }
.choice-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: calc(var(--u) * 1); }
.choice-price { font-size: max(38px, calc(var(--u) * 7.4)); font-weight: 900; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.badge { position: absolute; top: calc(var(--u) * 1.8); left: calc(var(--u) * 1.8); background: var(--yellow); color: var(--ink); border-radius: calc(var(--u) * 1); padding: .3em .6em; font-size: max(18px, calc(var(--u) * 2.5)); font-weight: 900; text-transform: uppercase; }
.choice[disabled] { cursor: not-allowed; box-shadow: none; }
.choice[disabled] .choice-art { background: #a9a3c4; }
.choice[disabled] .go, .choice[disabled] .badge { display: none; }
.choice[disabled] .choice-title, .choice[disabled] .choice-price { color: var(--mut); }

/* QR Code */
.qr-area { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(var(--u) * 4); }
.qr-card { background: var(--white); border-radius: calc(var(--u) * 3); padding: calc(var(--u) * 2); box-shadow: 0 12px 30px rgba(11, 58, 128, .18); width: min(100%, 44dvh); aspect-ratio: 1; flex: none; }
.qr-card img { width: 100%; height: 100%; display: block; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 1.8); }
.steps li { counter-increment: step; display: flex; align-items: center; gap: calc(var(--u) * 1.8); font-size: max(23px, calc(var(--u) * 3.8)); font-weight: 700; color: var(--ink); }
.steps li::before { content: counter(step); flex: none; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--violet); color: var(--white); font-weight: 900; }
.done-copy { display: flex; flex-direction: column; align-items: center; text-align: center; gap: calc(var(--u) * 1.4); max-width: 34em; }

/* Carregando e impressao */
.spinner { width: 92px; height: 92px; border-radius: 50%; border: 10px solid rgba(255, 255, 255, .22); border-top-color: var(--yellow); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.printer { position: relative; width: min(60vw, 340px); height: min(46dvh, 340px); }
.slot { position: absolute; inset: 0 0 auto; height: 34px; border-radius: 17px; background: var(--ink); z-index: 2; }
.paper { position: absolute; top: 16px; left: 50%; width: 38%; height: 92%; margin-left: -19%; background: var(--white); border: 8px solid var(--yellow); border-radius: 4px; transform-origin: top; animation: feed 2.4s ease-in-out infinite; }
@keyframes feed { from { transform: translateY(-92%); } 70%, to { transform: translateY(0); } }

/* Configuracao */
.pair { display: flex; gap: 14px; flex-wrap: wrap; }
.pair input { flex: 1 1 280px; min-height: 76px; border-radius: 14px; border: 3px solid var(--line); background: var(--white); color: var(--ink); font: 600 24px var(--font); padding: 0 18px; user-select: text; -webkit-user-select: text; }
.pair input:focus-visible { outline: 3px solid var(--violet); }

.offline { position: fixed; inset: 0; z-index: 10; background: var(--violet); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; padding: var(--gutter); }

@media (orientation: landscape) {
  :root { --u: min(.68vw, 1.08vh); }
  .attract { flex-direction: row; background: var(--violet); }
  .attract-top { flex: 1 1 62%; background: var(--pink); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); grid-template-rows: auto minmax(0, 1fr); align-items: center; padding: calc(var(--u) * 4); column-gap: calc(var(--u) * 3); }
  .hero-logo { grid-column: 1; grid-row: 1 / 3; height: auto; min-width: 0; }
  .hero-logo img { width: 100%; height: auto; max-height: 84dvh; object-fit: contain; }
  .attract-strips { grid-column: 2; grid-row: 1 / 3; height: 100%; margin: 0; }
  .attract-strips canvas:nth-child(1), .attract-strips canvas:nth-child(3) { display: none; }
  .attract-strips canvas:nth-child(2) { top: 3%; height: 94%; transform: translateX(-50%) rotate(5deg); }
  .wave { display: none; }
  .attract-bottom { flex: 1 1 38%; justify-content: center; padding: calc(var(--u) * 5); }
  .cta.huge { font-size: max(26px, calc(var(--u) * 3.9)); padding: 0 calc(var(--u) * 2); white-space: nowrap; }
  .theme-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); }
  .theme-info .go { display: none; }
  .theme-info { justify-content: center; }
  .choices { grid-template-rows: minmax(0, 1fr); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qr-area { flex-direction: row; gap: calc(var(--u) * 8); }
  .qr-card { width: auto; height: min(100%, 52dvh); }
  .done-copy { align-items: flex-start; text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  .screen.active { animation: none; }
  .paper { animation: none; }
  .spinner { animation-duration: 3s; }
}
