/* ============================================================
   Trakindo CAT - Find 5 Words  |  shared mobile-first styles
   ============================================================ */

@font-face {
  font-family: 'Knockout';
  src: url('../assets/font/Knockout-Regular.otf') format('opentype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'UniversCn';
  src: url('../assets/font/UniversCnRg.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'UniversCn';
  src: url('../assets/font/UniversCnBold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --gold: #f4a71d;
  --gold-2: #ffcf5c;
  --ink: #0a0d12;
  --line: rgba(244, 167, 29, .85);
  --field-bg: rgba(255, 255, 255, .06);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, .72);
  --app-max: 480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'UniversCn', 'Arial Narrow', Arial, sans-serif;
  color: var(--text);
  background: #000;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* ---- App shell : a centered phone-width column ---- */
.app {
  position: relative;
  min-height: 100dvh;
  max-width: var(--app-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background-color: #04070c;
  background-position: top center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: local;
  overflow: hidden;
}
.app--page1 { background-image: url('../assets/images/bg-page1.jpg'); }
.app--dark  { background-image: url('../assets/images/bg-app.jpg'); }
.app--scroll { overflow: visible; }   /* let the page scroll if content is tall */

.app__inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 26px 0;
}

/* ---- Top logo ---- */
.brand {
  text-align: center;
  padding-top: 6px;
}
.brand img { width: 132px; height: auto; }

/* ---- Headline ---- */
.headline {
  font-family: 'Knockout', 'UniversCn', Arial, sans-serif;
  font-weight: 400;
  line-height: .96;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.headline--xl { font-size: clamp(38px, 12vw, 60px); }
.headline--lg { font-size: clamp(30px, 9vw, 46px); }
.headline .accent { color: var(--gold); }

.header-img { display: block; width: 100%; height: auto; }
.header-img--sm { max-width: 78%; margin: 0 auto; }
.header-img--xs { max-width: 60%; margin: 0 auto; }

.subtitle {
  font-size: clamp(17px, 5vw, 21px);
  color: var(--text);
  text-align: center;
  line-height: 1.15;
  margin-top: 10px;
}
.subtitle .accent { color: var(--gold); }

/* ---- Buttons (image based) ---- */
.btn-img {
  display: block;
  width: 56%;
  max-width: 185px;
  margin: 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-img img { display: block; width: 100%; height: auto; }
.btn-img:active { transform: scale(.95); }
.btn-img:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; }
.btn-img--wide { max-width: 250px; width: 68%; }

.below-btn {
  display: block;
  max-width: 175px;
  width: 54%;
  margin: 10px auto 0;
  height: auto;
}

/* ---- Form fields ---- */
.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--field-bg);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 0 16px;
  height: 58px;
  margin-bottom: 14px;
  backdrop-filter: blur(2px);
}
.field .ico { width: 24px; text-align: center; color: #fff; flex: 0 0 24px; }
.field .ico svg { width: 22px; height: 22px; fill: #fff; }
.field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 19px;
  height: 100%;
}
.field input::placeholder { color: rgba(255, 255, 255, .78); }
.field input:-webkit-autofill {
  -webkit-text-fill-color: #fff;
  transition: background-color 9999s ease-in-out 0s;
}
.field--answer { padding-left: 18px; }
.field--answer input { text-transform: uppercase; }
.field--answer input::placeholder { text-transform: none; }
.field.is-error { border-color: #ff5b5b; }

.answer-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.answer-row .num {
  font-family: 'Knockout', sans-serif;
  font-size: 30px;
  width: 26px;
  text-align: center;
  flex: 0 0 26px;
}
.answer-row .field { margin-bottom: 0; flex: 1; }

/* ---- Find 5 Words screen : stopwatch + compact layout ---- */
.game { display: flex; flex-direction: column; }

.timer {
  align-self: center;                 /* box hugs content & sits centered */
  display: flex;
  flex-direction: column;
  align-items: center;                /* centre both lines horizontally */
  justify-content: center;            /* centre the pair vertically      */
  gap: 2px;
  margin: 12px 0 14px;
  padding: 9px 26px;
  min-width: 190px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(2px);
  text-align: center;
}
.timer__label {
  font-family: 'UniversCn', sans-serif;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 3px;
  color: var(--gold);
}
.timer__value {
  font-family: 'Knockout', 'Courier New', monospace;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.timer--result { margin: 10px 0 2px; }

.answer-row--compact { margin-bottom: 9px; gap: 10px; }
.answer-row--compact .num { font-size: 24px; width: 22px; flex: 0 0 22px; }
.field--compact {
  height: 46px;
  border-radius: 12px;
  margin-bottom: 0;
}
.field--compact input { font-size: 17px; }

/* ---- answer feedback : green (correct) / red (wrong) ---- */
.field--answer.is-correct {
  border-color: #37d27e;
  background: rgba(55, 210, 126, .14);
}
.field--answer.is-wrong {
  border-color: #ff5b5b;
  background: rgba(255, 91, 91, .14);
}
.field--answer.is-correct::after,
.field--answer.is-wrong::after {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Knockout', sans-serif;
  font-size: 19px;
  line-height: 1;
  pointer-events: none;
}
.field--answer.is-correct::after { content: '\2713'; color: #37d27e; }
.field--answer.is-wrong::after   { content: '\2715'; color: #ff5b5b; }
.field--answer.is-correct input,
.field--answer.is-wrong input { padding-right: 20px; }

.check-msg {
  min-height: 15px;
  margin: 8px 0 4px;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.3;
}
.check-msg.is-checking { color: var(--muted); }
.check-msg.is-good { color: #5be08a; font-weight: 700; }
.check-msg.is-bad  { color: #ff9b9b; font-weight: 700; }

.game form { margin-top: 10px; }
.game .actions { padding: 4px 0 18px; }

/* ---- Agree checkbox ---- */
.agree {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 4px 2px 22px;
  font-size: 17px;
  line-height: 1.25;
}
.agree input { display: none; }
.agree .box {
  flex: 0 0 26px;
  width: 26px; height: 26px;
  border: 2px solid var(--line);
  border-radius: 6px;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.agree .box::after {
  content: '';
  width: 13px; height: 13px;
  background: var(--gold);
  border-radius: 2px;
  transform: scale(0);
  transition: transform .12s ease;
}
.agree input:checked + .box::after { transform: scale(1); }
.agree a, .agree .accent { color: var(--gold); text-decoration: none; }

/* ---- Layout helpers ---- */
.stack > * + * { margin-top: 16px; }
.grow { flex: 1; }
.center { text-align: center; }
.actions { padding: 8px 0 26px; }
.mt-auto { margin-top: auto; }

.form-error {
  background: rgba(255, 91, 91, .14);
  border: 1px solid #ff5b5b;
  color: #ffd7d7;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 15px;
  margin-bottom: 14px;
}

.field-hint {
  font-size: 14px;
  margin: 6px 4px 0;
  line-height: 1.3;
}
.field-hint--error { color: #ff9b9b; }

/* ---- Modal (duplicate phone) ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(3px);
}
.modal__card {
  width: 100%;
  max-width: 360px;
  background: #12161d;
  border: 2px solid var(--line);
  border-radius: 20px;
  padding: 26px 22px 22px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .55);
}
.modal__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--gold);
  color: #12161d;
  font-family: 'Knockout', sans-serif;
  font-size: 34px;
  line-height: 52px;
}
.modal__title {
  font-family: 'Knockout', sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  font-size: 26px;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.modal__text { color: var(--muted); font-size: 15px; line-height: 1.4; }
.modal__text strong { color: #fff; }
.modal__actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.mbtn {
  flex: 1;
  display: block;
  padding: 13px 10px;
  border-radius: 12px;
  font-family: 'UniversCn', sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .5px;
  text-transform: uppercase;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.mbtn:active { transform: scale(.97); }
.mbtn--gold  { background: var(--gold); color: #12161d; }
.mbtn--ghost { background: transparent; color: #fff; border: 2px solid var(--line); }
.modal__note { color: var(--muted); font-size: 13px; margin-top: 12px; }

/* ---- Footer ---- */
.footer {
  position: relative;
  z-index: 2;
  padding: 14px 26px 12px;
  text-align: center;
}
.footer img { max-width: 165px; width: 46%; height: auto; }
.footer__bar {
  height: 12px;
  background: var(--gold);
  width: 100%;
}
.app__baseline {
  height: 14px;
  background: var(--gold);
}

/* ---- Result screens ---- */
.result-visual {
  flex: 1;                     /* fill the space between the header/time and the button */
  min-height: 0;
  display: flex;
  align-items: center;        /* -> image vertically centred in that space */
  justify-content: center;
  padding: 14px 0;
}
.result-visual img {
  width: auto;
  height: auto;
  max-width: min(80%, 330px);
  max-height: 100%;
}

/* trophy / result graphic animation */
@keyframes trophy-in {
  0%   { opacity: 0; transform: scale(.5) translateY(24px); }
  65%  { opacity: 1; transform: scale(1.07) translateY(0); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes trophy-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}
@keyframes result-glow {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(244,167,29,.35)); }
  50%      { filter: drop-shadow(0 0 30px rgba(244,167,29,.65)); }
}
.result-visual--winner img {
  animation:
    trophy-in .75s cubic-bezier(.2, .8, .25, 1.2) both,
    trophy-float 3.2s ease-in-out 1s infinite,
    result-glow 3.2s ease-in-out 1s infinite;
}
@keyframes wrong-in {
  0%   { opacity: 0; transform: scale(.4) rotate(-12deg); }
  55%  { opacity: 1; transform: scale(1.12) rotate(6deg); }
  70%  { transform: scale(1) rotate(-4deg); }
  85%  { transform: rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes wrong-pulse {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 70, 70, .25)); }
  50%      { filter: drop-shadow(0 0 26px rgba(255, 70, 70, .55)); }
}
.result-visual--lose img {
  animation:
    wrong-in .7s cubic-bezier(.2, .8, .25, 1.2) both,
    wrong-pulse 2.6s ease-in-out 1s infinite;
}
@media (prefers-reduced-motion: reduce) {
  .result-visual--winner img,
  .result-visual--lose img { animation: none; }
}

/* ---- Winner claim / QR ---- */
.claim {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 26px;
}
.claim__lead {
  color: var(--muted);
  font-size: 16px;
  text-align: center;
  line-height: 1.3;
  margin-bottom: 16px;
  max-width: 260px;
}
.prize-box {
  background: #fff;
  border-radius: 20px;
  padding: 20px 20px 16px;
  text-align: center;
  color: #111;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.prize-box__qr {
  width: 220px;
  height: 220px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prize-box__qr canvas,
.prize-box__qr img { width: 220px !important; height: 220px !important; display: block; }
.prize-box .token {
  font-family: 'Knockout', 'Courier New', monospace;
  letter-spacing: 4px;
  font-size: 24px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e2e2;
  color: #111;
}
.claim-instructions {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  margin-top: 18px;
  line-height: 1.45;
  max-width: 300px;
}
.claim-instructions strong { color: var(--gold); }

/* keep content above the glowing base graphic */
.spacer-glow { min-height: 70px; }
