:root {
  --go-red: #e2001a;
  --go-red-dark: #b30015;
  --go-yellow: #ffd200;
  --go-green: #00a651;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --error: #d7001c;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink);
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; position: relative; overflow: hidden; }
.screen.active { display: flex; animation: fadeIn .45s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ================= Màn 1: GO! ================= */
.welcome {
  flex-direction: column;
  background:
    radial-gradient(circle at 15% 85%, rgba(255,210,0,.25) 0 120px, transparent 121px),
    radial-gradient(circle at 90% 20%, rgba(255,255,255,.12) 0 160px, transparent 161px),
    linear-gradient(160deg, var(--go-red) 0%, var(--go-red-dark) 100%);
  color: #fff;
}
.marquee {
  background: #111; color: var(--go-yellow);
  font-family: "Roboto Mono", monospace; font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; padding: 8px 0;
  border-bottom: 4px solid var(--go-yellow);
  text-shadow: 0 0 6px rgba(255,210,0,.7);
}
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 18s linear infinite; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

.welcome-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px 20px 90px; gap: 18px; max-width: 640px; margin: 0 auto; width: 100%;
}
.logo {
  background: #fff; border-radius: 28px; padding: 14px 28px 10px;
  display: flex; flex-direction: column; align-items: center; line-height: 1;
  box-shadow: 0 10px 0 rgba(0,0,0,.18); transform: rotate(-4deg);
}
.logo-small { color: var(--go-green); font-weight: 800; font-size: 18px; letter-spacing: 1px; }
.logo-go { color: var(--go-red); font-weight: 900; font-size: 64px; font-style: italic; letter-spacing: -2px; }

.typing {
  font-size: clamp(24px, 6.5vw, 40px); font-weight: 900; line-height: 1.25; margin: 8px 0 0;
  min-height: 2.6em; text-shadow: 0 3px 0 rgba(0,0,0,.2);
}
.typing::after { content: "▍"; color: var(--go-yellow); animation: blink .8s steps(1) infinite; }
.typing.done::after { display: none; }
@keyframes blink { 50% { opacity: 0; } }

.sub { font-size: 19px; font-weight: 600; margin: 0; opacity: 0; transform: translateY(10px); transition: .6s; }
.sub.show { opacity: 1; transform: none; }

.btn {
  border: 0; border-radius: 999px; padding: 15px 30px; font-weight: 800; font-size: 18px;
  transition: transform .15s, box-shadow .15s, opacity .3s;
}
.btn:active { transform: translateY(3px); }
.btn-yes {
  background: var(--go-yellow); color: var(--go-red-dark);
  box-shadow: 0 6px 0 #c9a400; opacity: 0; pointer-events: none;
}
.btn-yes.show { opacity: 1; pointer-events: auto; animation: wiggle 1.6s ease-in-out infinite 0.5s; }
@keyframes wiggle { 0%,100% { transform: rotate(0) scale(1); } 10% { transform: rotate(-4deg) scale(1.05); } 20% { transform: rotate(4deg) scale(1.05); } 30% { transform: rotate(0) scale(1); } }

.cart-runner { position: absolute; bottom: 18px; left: -60px; font-size: 40px; animation: cart 7s linear infinite; }
@keyframes cart { to { left: 110%; } }

/* ================= Màn câu hỏi ================= */
.question { align-items: center; justify-content: center; padding: 24px 16px; }
.bg { position: absolute; inset: 0; z-index: 0; }

/* Mỗi theme: ảnh thật (nếu có trong img/) nằm trên, SVG minh hoạ ở dưới làm dự phòng */
.question[data-theme="hygiene"] .bg {
  background:
    url(img/hygiene.jpg) center / cover no-repeat,
    url(img/hygiene.svg) 0 0 / 130px auto repeat,
    linear-gradient(160deg, #e6f3ff, #c6e2ff);
}
.question[data-theme="salt"] .bg {
  background:
    url(img/salt.jpg) center / cover no-repeat,
    url(img/salt.svg) 0 0 / 140px auto repeat,
    linear-gradient(160deg, #f1f5fb, #d5e2f3);
}
.question[data-theme="tweezers"] .bg {
  background:
    url(img/tweezers.jpg) center / cover no-repeat,
    url(img/tweezers.svg) 0 0 / 180px auto repeat,
    linear-gradient(160deg, #fdeef3, #f6d3df);
}
.question[data-theme="receipt"] .bg {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 12px, transparent 12px 24px),
    #3a3f47;
}

.card {
  position: relative; z-index: 1; width: 100%; max-width: 460px;
  background: rgba(255,255,255,.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 24px; padding: 24px 20px 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.q-meta { font-size: 13px; font-weight: 800; color: var(--go-red); letter-spacing: .5px; text-transform: uppercase; }
.q-title { font-size: 23px; line-height: 1.3; margin: 8px 0 18px; font-weight: 900; }

.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: #fff; border: 2px solid #e4e4e8; border-radius: 14px; cursor: pointer;
  font-weight: 600; font-size: 17px; transition: border-color .15s, background .15s, transform .1s;
}
.opt:active { transform: scale(.98); }
.opt.selected { border-color: var(--go-red); background: #fff1f2; }
.letter {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: #f0f0f3; font-weight: 800; font-size: 14px; color: var(--muted);
}
.opt.selected .letter { background: var(--go-red); color: #fff; }
.opt input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-weight: 600; color: var(--ink); padding: 2px 0;
}
.opt input::placeholder { color: #b3b3ba; font-weight: 400; font-style: italic; }

.btn-next {
  width: 100%; margin-top: 18px; background: var(--go-red); color: #fff; box-shadow: 0 5px 0 var(--go-red-dark);
}
.btn-next:disabled { background: #d4d4d8; box-shadow: 0 5px 0 #b4b4ba; cursor: not-allowed; }

.error {
  margin-top: 16px; display: flex; align-items: center; gap: 10px;
  background: #ffe8ea; border: 2px solid var(--error); color: var(--error);
  border-radius: 14px; padding: 12px 12px 12px 14px; font-weight: 800; font-size: 15px; line-height: 1.35;
  animation: fadeIn .25s ease;
}
.error[hidden] { display: none; }
.error span { flex: 1; }
.error span::before { content: "⛔ "; }
.btn-mini {
  flex: none; border: 0; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700;
  background: #fff; color: var(--muted); border: 1px solid #e0b4b9;
}
.shake { animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* --- theme hoá đơn --- */
.question[data-theme="receipt"] .card {
  font-family: "Roboto Mono", monospace; background: #fffdf6; border-radius: 4px 4px 0 0;
  padding-top: 28px; padding-bottom: 30px; backdrop-filter: none;
  box-shadow: 0 25px 40px rgba(0,0,0,.35);
}
.question[data-theme="receipt"] .card::before {
  content: "BIGC GO! — HOÁ ĐƠN BÁN LẺ\A ------------------------------\A Thu ngân: Người làm web\A Quầy: 01\A Khách: Nguyễn Phương Anh B\A ------------------------------";
  white-space: pre; display: block; text-align: center; font-size: 12px; color: #555; margin-bottom: 12px; line-height: 1.5;
}
.question[data-theme="receipt"] .card::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  background: conic-gradient(from -45deg at 50% 0, #fffdf6 90deg, transparent 0) 0 0 / 20px 14px repeat-x;
}
.question[data-theme="receipt"] .q-meta { color: #555; text-align: center; }
.question[data-theme="receipt"] .q-title { font-family: "Roboto Mono", monospace; font-size: 19px; text-align: center; border-bottom: 2px dashed #bbb; padding-bottom: 14px; }
.question[data-theme="receipt"] .opt { border-radius: 4px; border-style: dashed; font-family: "Roboto Mono", monospace; font-size: 15px; background: transparent; }
.question[data-theme="receipt"] .opt.selected { background: #fff3c4; border-color: #333; border-style: solid; }
.question[data-theme="receipt"] .opt.selected .letter { background: #333; }
.question[data-theme="receipt"] .btn-next { border-radius: 4px; background: #222; box-shadow: 0 5px 0 #000; }
.question[data-theme="receipt"] .btn-next:disabled { background: #d4d4d8; box-shadow: 0 5px 0 #b4b4ba; }
.question[data-theme="receipt"] .error { border-radius: 4px; }

/* ================= Màn cuối ================= */
.ending {
  align-items: center; justify-content: center; padding: 32px 24px;
  background: linear-gradient(170deg, #fff7f0 0%, #ffe9ef 100%);
}
.ending-text {
  position: relative; z-index: 1; max-width: 520px; margin: 0;
  font-size: clamp(20px, 5.4vw, 27px); line-height: 1.6; font-weight: 600; color: #4a3a3f; text-align: center;
}
.deer { display: inline-block; width: 1.3em; height: 1.3em; vertical-align: -0.3em; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-8deg); } }
.floaties { position: absolute; inset: 0; pointer-events: none; }
.floaties img { position: absolute; bottom: -40px; opacity: .7; animation: float linear infinite; }
@keyframes float { to { transform: translateY(-115vh) rotate(25deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sub, .btn-yes { opacity: 1; pointer-events: auto; transform: none; }
}
