/* style.css — giao diện DOM theo art bible: "tem dán" (sticker), viền ink, cạnh trắng */
:root {
  --ink: #3A2740; --cream: #FFF6EA; --dark: #2E2140; --primary: #FF8A5B; --pink: #F7A8C0; --mint: #4FD1A5; --warn: #FF5A5F;
  --peach: #FF9A76; --passion: #FFC93C;
  --f-title: var(--title, var(--font-sans, sans-serif));
  --f-body: var(--paragraph, var(--font-sans, sans-serif));
  --dots: radial-gradient(circle, #FF9A76 2.4px, transparent 3px) 0 0/30px 5px repeat-x,
          radial-gradient(circle, #F7A8C0 2.4px, transparent 3px) 10px 0/30px 5px repeat-x,
          radial-gradient(circle, #FFC93C 2.4px, transparent 3px) 20px 0/30px 5px repeat-x;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #2E2140; overflow: hidden; font-family: var(--f-body); color: var(--ink); overscroll-behavior: none; }
#stage { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100vw, 56.25vh); overflow: hidden; background: #FFE2C8; user-select: none; -webkit-user-select: none; }
input, textarea { user-select: text; -webkit-user-select: text; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#probe { position: absolute; width: 0; height: 0; visibility: hidden; padding-top: env(safe-area-inset-top, 0px); }
.hidden { display: none !important; }
button { font-family: var(--f-title); cursor: pointer; touch-action: manipulation; color: var(--ink); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* màn */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; pointer-events: auto; overflow-y: auto; overflow-x: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 62px) calc(env(safe-area-inset-right, 0px) + 18px) calc(env(safe-area-inset-bottom, 0px) + 18px) calc(env(safe-area-inset-left, 0px) + 18px); animation: fadeIn .35s ease both; }
.screen { touch-action: pan-y; }
.screen::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--dots); z-index: 3; pointer-events: none; }
.screen > * { flex-shrink: 0; }
.screen .grow { flex: 1 1 auto; min-height: 8px; }
.scrim { background: rgba(46,33,64,.62); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .btn::after, .pop { animation: none !important; } .btn { transition: none !important; } }

/* nút */
.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; min-width: 150px; max-width: 100%; padding: 10px 26px;
  border: 3px solid var(--ink); border-radius: 999px; font-size: 19px; font-weight: 800; line-height: 1.15; background: var(--cream); color: var(--ink);
  box-shadow: 0 0 0 3px #fff, 0 6px 0 3px rgba(58,39,64,.35); transition: transform .08s; }
.btn:active:not(:disabled) { transform: translateY(3px) scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--biz-btn, linear-gradient(#FFA477, #FF8A5B 55%, #F2713F)); color: var(--biz-btn-ink, var(--ink)); transform: rotate(-1.5deg); font-size: 20px; }
.btn-primary::before { content: ""; position: absolute; left: 14%; right: 14%; top: 5px; height: 7px; border-radius: 99px; background: rgba(255,255,255,.55); }
.btn-primary.sweep::after { content: ""; position: absolute; top: 0; bottom: 0; width: 34%; left: -50%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); animation: sweep 3.4s ease-in-out infinite; }
@keyframes sweep { 0%, 55% { left: -50%; } 100% { left: 130%; } }
.btn-sec { background: var(--cream); font-size: 17px; min-width: 120px; }
.btn.alt { background: var(--biz-accent, var(--pink)); color: var(--biz-accent-ink, var(--ink)); }
.row { display: flex; gap: 14px; align-items: flex-start; justify-content: center; flex-wrap: wrap; }
.medal { position: absolute; width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream); padding: 0; z-index: 6; display: grid; place-items: center;
  box-shadow: 0 0 0 2px #fff, 0 4px 0 2px rgba(58,39,64,.3); pointer-events: auto; }
.medal svg { width: 24px; height: 24px; }
.medal.lg { position: relative; width: 56px; height: 56px; }
.medal.lg svg { width: 30px; height: 30px; }
.medal:active { transform: translateY(2px); }
.medal-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; max-width: 90px; text-align: center; color: var(--ink); }
.chip { position: absolute; z-index: 6; right: 12px; top: 40%; padding: 10px 18px; min-height: 44px; border: 3px solid var(--ink); border-radius: 999px; background: var(--cream); font-weight: 800; font-size: 15px; box-shadow: 0 0 0 2px #fff; }

/* bảng, ô, thẻ */
.panel { background: rgba(46,33,64,.88); color: var(--cream); border: 2px solid rgba(255,255,255,.85); border-radius: 22px; padding: 22px 18px 18px; width: 100%; max-width: 340px; position: relative; box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.panel::before { content: ""; position: absolute; left: 50%; top: -3px; width: 90px; height: 6px; transform: translateX(-50%); background: var(--dots); border-radius: 4px; }
.panel h2 { margin: 6px 0 12px; font-family: var(--f-title); font-size: 24px; text-align: center; }
.panel .btn { width: 100%; margin-top: 10px; }
.panel p, .panel li { font-size: 16px; line-height: 1.4; margin: 6px 0; }
.panel ul { padding-left: 20px; margin: 8px 0; }
.cell { background: rgba(255,246,234,.1); border: 1px solid rgba(255,246,234,.3); border-radius: 14px; padding: 10px 12px; }
.card { background: var(--cream); border: 2px solid var(--ink); border-radius: 16px; padding: 16px; width: 100%; max-width: 340px; color: var(--ink); box-shadow: 0 0 0 3px #fff, 0 8px 18px rgba(58,39,64,.25); position: relative; }
.kicker { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; opacity: .85; }
.err { color: var(--warn); font-weight: 700; font-size: 15px; min-height: 20px; margin: 6px 0; text-align: center; }
.panel .err { color: #FFB3B5; }
.ok { color: #1f9d77; font-weight: 700; }
.msg { font-size: 15px; font-weight: 700; text-align: center; margin: 8px 0; padding: 8px 12px; border-radius: 12px; background: #fff; border: 2px solid var(--ink); max-width: 340px; }
.msg.bad { border-color: var(--warn); }
.toast { position: absolute; z-index: 20; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 90px); transform: translateX(-50%); max-width: 86%; background: var(--cream); border: 3px solid var(--warn); border-radius: 16px;
  padding: 10px 16px; font-weight: 800; font-size: 15px; text-align: center; pointer-events: auto; }

/* ô nhập */
label.f { display: block; font-weight: 800; font-size: 14px; margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], select, textarea { width: 100%; font-family: var(--f-body); font-size: 16px; padding: 12px 14px; min-height: 48px;
  border: 2.5px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); }
textarea { min-height: 84px; resize: vertical; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 48px; font-size: 16px; font-weight: 600; padding: 4px 0; }
.opt input { width: 24px; height: 24px; accent-color: var(--primary); flex: none; }
.avs { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.av { width: 62px; height: 62px; border-radius: 50%; border: 3px solid var(--ink); background: #FFE3EB; padding: 0; overflow: hidden; display: block; }
.av.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--biz-accent, var(--primary)); background: #FFF3C4; }
.av canvas { width: 100%; height: 100%; display: block; }

/* màn bắt đầu */
.logo { margin-top: 2px; padding: 6px 14px; border: 2.5px dashed var(--ink); border-radius: 999px; background: rgba(255,255,255,.75); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.logo b { font-family: var(--f-title); font-size: 22px; letter-spacing: 0; margin-right: 6px; color: var(--primary); }
.sleeve { position: relative; width: 100%; max-width: 300px; margin: 18px auto 10px; padding: 22px 16px 18px; text-align: center; background: linear-gradient(#EBCB9E, #E0B684); border: 3px solid var(--ink); border-radius: 12px 12px 22px 22px;
  box-shadow: 0 0 0 4px #fff, 0 10px 20px rgba(58,39,64,.3); transform: rotate(-1.2deg); }
.sleeve::before, .sleeve::after { content: ""; position: absolute; left: 14px; right: 14px; height: 7px; background: repeating-linear-gradient(90deg, rgba(58,39,64,.3) 0 3px, transparent 3px 8px); }
.sleeve::before { top: 7px; } .sleeve::after { bottom: 7px; }
.sleeve h1 { margin: 6px 0 4px; font-family: var(--f-title); font-weight: 900; font-size: clamp(30px, 9.4vw, 42px); line-height: 1.05; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); overflow-wrap: anywhere; }
.sleeve .sub { display: inline-block; margin-top: 6px; background: var(--cream); border: 2px solid var(--ink); border-radius: 999px; padding: 5px 14px; font-weight: 800; font-size: 15px; }
.lead { max-width: 300px; text-align: center; font-weight: 700; font-size: 16px; line-height: 1.35; background: rgba(255,246,234,.9); border-radius: 16px; padding: 8px 14px; border: 2px solid var(--ink); margin: 8px 0; }
.small { font-size: 13px; font-weight: 700; }
.linkbtn { background: none; border: 0; text-decoration: underline; font-family: var(--f-body); font-size: 14px; font-weight: 700; min-height: 44px; padding: 6px 10px; }
.turns { font-weight: 800; font-size: 14px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 4px 12px; margin: 10px 0 2px; }
.bgtext { text-shadow: 0 0 6px #fff, 0 0 6px #fff; }

/* màn kết quả */
.resultscr { padding-top: calc(env(safe-area-inset-top, 0px) + 56px); }
.resultscr .kicker { color: #fff; text-shadow: 0 2px 0 var(--ink); }
.rtitle { margin: 4px 0 2px; font-family: var(--f-title); font-weight: 900; font-size: clamp(26px, 8vw, 34px); text-align: center; color: #fff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); overflow-wrap: anywhere; }
.rfinal { color: var(--cream); text-align: center; max-width: 300px; margin-bottom: 10px; text-shadow: 0 1px 0 var(--ink); }
.cupcard { display: flex; gap: 14px; align-items: center; transform: rotate(1deg); }
.cupcard .tname { font-family: var(--f-title); font-weight: 800; font-size: 19px; line-height: 1.2; margin-top: 4px; overflow-wrap: anywhere; }
.scorebox { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 6px; margin: 12px 0 4px; width: 100%; max-width: 340px; background: rgba(46,33,64,.88); color: var(--cream); border-radius: 22px; border: 2px solid rgba(255,255,255,.85); padding: 10px 14px; }
.scorebox .big { font-family: var(--f-title); font-weight: 900; font-size: 54px; line-height: 1; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.scorebox .unit { font-weight: 800; font-size: 20px; opacity: .85; }
.gain { margin-left: 6px; padding: 2px 10px; border-radius: 999px; background: var(--mint); color: var(--ink); font-weight: 800; }
.tealine { max-width: 320px; text-align: center; font-weight: 800; font-size: 16px; line-height: 1.3; background: var(--cream); border: 2px solid var(--ink); border-radius: 14px; padding: 8px 12px; margin-top: 6px; }
.voucher { width: 100%; max-width: 340px; margin: 8px 0; padding: 14px 16px; background: #fff; border: 3px dashed var(--ink); border-radius: 16px; text-align: center; position: relative; box-shadow: 0 0 0 3px #fff; animation: fadeIn .4s both; }
.voucher .vt { font-family: var(--f-title); font-weight: 900; font-size: 20px; margin: 4px 0; overflow-wrap: anywhere; }
.voucher p { margin: 6px 0; font-size: 15px; font-weight: 600; }
.lb { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.lbrow { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.lbrow .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.lbrow b { min-width: 28px; text-align: center; }
.lbrow.me { background: var(--biz-accent, var(--passion)); color: var(--biz-accent-ink, var(--ink)); border-color: #fff; }
.pop { animation: fadeIn .3s both; }

/* ẩn thanh cuộn thô trong khung game, nội dung vẫn cuộn được */
#stage * { scrollbar-width: none; }
#stage ::-webkit-scrollbar { display: none; }
/* ẩn nút CTA (Shop now) SDK chèn vào khung cuối game; khung không còn nút nào khác thì ẩn luôn */
[data-octokit-cta]{display:none!important}[data-octokit-overlay]:not(:has(button:not([data-octokit-cta]))){display:none!important}
/* nhãn nút tròn và link nằm trên nền cảnh: đặt trong thẻ cho dễ đọc */
.medal-wrap { max-width: 120px; }
.medal-wrap span { background: rgba(255,246,234,.94); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 14px; font-weight: 800; line-height: 1.25; }
.linkbtn.bgtext { text-shadow: none; background: rgba(255,246,234,.94); border: 2px solid var(--ink); border-radius: 999px; min-height: 36px; margin-top: 10px; padding: 4px 14px; }
.resultscr .cupcard .kicker { color: var(--ink); text-shadow: none; }
