/* Ghép Đôi — giao diện kiểu sách hướng dẫn lắp gạch. Màu lấy từ bảng màu nhựa trong js/bricks.js. */
:root {
  --red: #c91a09; --red2: #e8402d; --dred: #8e110a; --yellow: #f2cd37; --blue: #0055bf; --azure: #078bc9; --green: #4b9f4a;
  --ink: #1c2328; --ink2: #3c4652; --mute: #6b7785; --paper: #fbfaf6; --manual: #dfe9f3; --callout: #d4e6f6; --white: #f2f3ef;
  --h: "Baloo 2", system-ui, sans-serif; --b: "Nunito", system-ui, sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px); --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--manual); color: var(--ink); font-family: var(--b); overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- nút hình viên gạch ---------- */
.brick-btn {
  --c: var(--red); --fg: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 11px 22px 13px; margin-top: 10px; border: 0; border-radius: 6px;
  background: var(--c); color: var(--fg); font: 800 18px/1 var(--h); letter-spacing: .01em; text-decoration: none; cursor: pointer;
  box-shadow: inset 0 -5px 0 rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.3), 0 4px 0 rgba(0,0,0,.2), 0 10px 22px rgba(0,0,0,.16);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.brick-btn::before {
  content: ''; position: absolute; left: 8px; right: 8px; top: -8px; height: 9px; pointer-events: none;
  background: radial-gradient(ellipse 9px 8px at 50% 100%, var(--c) 94%, transparent 100%) 0 0 / 26px 9px space no-repeat;
  filter: brightness(1.07);
}
.brick-btn:hover { filter: brightness(1.06); }
.brick-btn:active { transform: translateY(3px); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.3), 0 1px 0 rgba(0,0,0,.2), 0 4px 10px rgba(0,0,0,.14); }
.brick-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.brick-btn.big { min-height: 56px; padding: 14px 30px 16px; font-size: 22px; }
.brick-btn.yellow { --c: var(--yellow); --fg: var(--ink); }
.brick-btn.blue { --c: var(--blue); }
.brick-btn.green { --c: var(--green); }
.brick-btn.ghost { --c: #ffffff; --fg: var(--ink); }
.brick-btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- màn chờ ---------- */
.loader { position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--manual); transition: opacity .6s; }
.loader.out { opacity: 0; pointer-events: none; }
.ld-brick { position: relative; width: 84px; height: 56px; border-radius: 6px; background: var(--red); box-shadow: inset 0 -7px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.3); animation: ld 1.1s cubic-bezier(.3,.1,.4,1.4) infinite; }
.ld-brick i { position: absolute; top: -10px; width: 16px; height: 11px; border-radius: 8px 8px 2px 2px; background: var(--red2); }
.ld-brick i:nth-child(1) { left: 6px; } .ld-brick i:nth-child(2) { left: 26px; } .ld-brick i:nth-child(3) { left: 46px; } .ld-brick i:nth-child(4) { left: 64px; }
@keyframes ld { 0% { transform: translateY(-26px); } 55% { transform: translateY(0); } 100% { transform: translateY(0); } }
.ld-t { margin: 6px 0 0; font: 800 20px var(--h); color: var(--ink); }
.ld-bar { width: 200px; height: 10px; border-radius: 5px; background: #fff; overflow: hidden; box-shadow: inset 0 0 0 2px var(--ink); }
.ld-bar i { display: block; height: 100%; width: 5%; background: var(--yellow); transition: width .3s; }

/* ---------- sân khấu ---------- */
.stage { position: fixed; inset: 0; overflow: hidden; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.stage canvas:active { cursor: grabbing; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.fail { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; font: 700 18px/1.5 var(--b); }

/* thanh trên */
.hud { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: calc(12px + var(--st)) calc(16px + var(--sr)) 0 calc(16px + var(--sl)); pointer-events: none; z-index: 10; }
.hud > * { pointer-events: auto; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--ink); background: #fff; padding: 6px 14px 7px; border-radius: 10px; box-shadow: 0 3px 0 rgba(0,0,0,.12), 0 8px 18px rgba(0,0,0,.1); }
.brand b { font: 800 20px/1 var(--h); color: var(--red); }
.brand span { font: 700 12px/1.2 var(--b); color: var(--mute); }
.hud-btns { display: flex; gap: 8px; }
.hb { display: inline-flex; align-items: center; gap: 6px; height: 44px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: #fff; color: var(--ink); cursor: pointer; font: 800 15px var(--h); box-shadow: 0 3px 0 rgba(0,0,0,.12), 0 8px 18px rgba(0,0,0,.1); }
.hb svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 0; flex: none; }
.hb svg .w, .hb svg .x { fill: none; stroke-width: 2; stroke-linecap: round; }
.hb svg .x { display: none; }
.hb.muted svg .w { display: none; } .hb.muted svg .x { display: inline; }
.hb .pl { display: none; } .hb.paused .pa { display: none; } .hb.paused .pl { display: inline; }
.hb[data-open-invite] svg path { fill: none; stroke-width: 2; stroke-linejoin: round; }
.hb.strong { background: var(--red); color: #fff; }
.hb[aria-pressed="true"][data-fast] { background: var(--yellow); }
.hb span { white-space: nowrap; }
.hb:not(.strong) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hb:focus-visible, .nb:focus-visible, .bags button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

/* bìa hộp */
.cover { position: absolute; left: 0; top: 0; bottom: 0; width: min(440px, 42vw); display: flex; flex-direction: column; justify-content: center; padding: 90px 24px 40px calc(40px + var(--sl)); opacity: 0; pointer-events: none; transform: translateX(-16px); transition: opacity .5s, transform .5s; z-index: 5; }
.cover.on { opacity: 1; pointer-events: auto; transform: none; }
.cv-kicker { margin: 0; font: 700 15px var(--b); color: var(--ink2); }
.cv-kicker b { font-family: var(--h); }
.cv-title { margin: 2px 0 6px; font: 800 clamp(52px, 7vw, 84px)/.95 var(--h); color: var(--red); letter-spacing: -.01em; text-shadow: 0 4px 0 rgba(0,0,0,.08); }
.cv-sub { margin: 0 0 12px; font: 600 18px/1.5 var(--b); color: var(--ink2); }
.cv-sub b { color: var(--ink); }
.cv-btns { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.cv-hint { margin: 18px 0 0; font: 700 13px var(--b); color: var(--mute); }

/* trang hướng dẫn */
.step { position: absolute; left: calc(20px + var(--sl)); top: calc(78px + var(--st)); max-width: min(560px, 44vw); opacity: 0; transform: translateY(-8px); transition: opacity .35s, transform .35s; pointer-events: none; z-index: 4; }
.step.on { opacity: 1; transform: none; }
.st-bag { display: inline-block; margin: 0; padding: 4px 10px 5px; border-radius: 6px; background: var(--ink); color: #fff; font: 800 14px/1 var(--h); }
.st-no { margin: 2px 0 0; line-height: .9; }
.st-no b { font: 800 clamp(58px, 7.5vw, 98px)/.9 var(--h); color: var(--ink); }
.st-no small { margin-left: 4px; font: 800 24px var(--h); color: var(--mute); }
.st-label { margin: 2px 0 10px; font: 800 17px/1.3 var(--b); color: var(--ink2); }
.callout { display: flex; flex-wrap: wrap; gap: 4px 8px; width: max-content; max-width: 100%; padding: 8px 12px 6px; border: 2px solid var(--ink); border-radius: 10px; background: var(--callout); box-shadow: 0 4px 0 rgba(28,35,40,.14); }
.callout:empty { display: none; }
.part { display: flex; flex-direction: column; align-items: center; width: 62px; animation: pop .35s cubic-bezier(.3,.1,.4,1.5) both; }
.part:nth-child(2) { animation-delay: .05s; } .part:nth-child(3) { animation-delay: .1s; } .part:nth-child(4) { animation-delay: .15s; } .part:nth-child(5) { animation-delay: .2s; } .part:nth-child(6) { animation-delay: .25s; } .part:nth-child(n+7) { animation-delay: .3s; }
.part canvas { width: 62px; height: 62px; }
.part b { margin-top: -4px; font: 800 15px/1 var(--h); color: var(--ink); }
.part.fig { width: 70px; } .part.fig canvas { width: 70px; height: 70px; }
.part.more { justify-content: center; font: 800 18px var(--h); color: var(--ink2); width: 40px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* chú thích cảnh diễn */
.caption { position: absolute; left: calc(20px + var(--sl)); bottom: calc(96px + var(--sb)); width: min(500px, calc(100vw - 40px)); padding: 14px 18px 16px; border-radius: 14px; background: rgba(255,255,255,.93); box-shadow: 0 4px 0 rgba(0,0,0,.12), 0 14px 34px rgba(0,0,0,.18); opacity: 0; transform: translateY(14px); transition: opacity .6s, transform .6s; pointer-events: none; z-index: 4; }
.caption.on { opacity: 1; transform: none; transition-delay: .4s; }
.cap-year { display: inline-block; margin: 0; padding: 3px 10px 4px; border-radius: 5px; background: var(--red); color: #fff; font: 800 16px/1 var(--h); box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.cap-title { margin: 6px 0 4px; font: 800 clamp(24px, 2.8vw, 32px)/1.1 var(--h); color: var(--ink); }
.cap-lines p { margin: 0; font: 600 17px/1.5 var(--b); color: var(--ink2); opacity: 0; transform: translateY(6px); transition: opacity .7s, transform .7s; }
.caption.on .cap-lines p { opacity: 1; transform: none; transition-delay: var(--d); }

/* bong bóng lời thoại */
.bubble { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity .25s; z-index: 6; }
.bubble.on { opacity: 1; }
.bubble span { position: absolute; bottom: 16px; left: 0; transform: translateX(-50%); white-space: nowrap; padding: 8px 15px 9px; border: 2.5px solid var(--ink); border-radius: 18px; background: #fff; color: var(--ink); font: 800 19px/1.1 var(--h); box-shadow: 0 4px 0 rgba(0,0,0,.18); animation: pop .3s cubic-bezier(.3,.1,.4,1.6) both; }
.bubble span::after { content: ''; position: absolute; left: 50%; bottom: -10px; width: 15px; height: 15px; background: #fff; border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: translateX(-50%) rotate(45deg); }

/* hoàn thành */
.finale { position: absolute; left: 50%; top: calc(74px + var(--st)); transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); text-align: center; pointer-events: none; z-index: 4; }
.finale > * { opacity: 0; transform: translateY(-10px); transition: opacity .5s, transform .5s cubic-bezier(.3,.1,.4,1.4); }
.finale.on.done .fn-done, .finale.on.done .fn-sub { opacity: 1; transform: none; }
.finale.on.guest .fn-guest, .finale.on.guest .brick-btn { opacity: 1; transform: none; pointer-events: auto; }
.finale.on.guest .brick-btn { transition-delay: .6s; }
.fn-done { margin: 0; font: 800 clamp(44px, 6vw, 70px)/1 var(--h); color: var(--red); text-shadow: 0 3px 0 #fff, 0 -2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 0 8px 20px rgba(0,0,0,.18); }
.fn-sub { margin: 4px 0 0; font: 800 16px var(--b); color: var(--ink2); }
.fn-guest { display: inline-block; margin: 14px 0 0; padding: 8px 16px; border-radius: 12px; background: #fff; font: 800 clamp(18px, 2.2vw, 24px)/1.25 var(--h); color: var(--ink); box-shadow: 0 4px 0 rgba(0,0,0,.12); }
.finale .brick-btn { display: flex; margin: 18px auto 0; width: max-content; }

/* điều hướng dưới */
.nav { position: absolute; left: 50%; bottom: calc(14px + var(--sb)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: 0 3px 0 rgba(0,0,0,.1), 0 10px 26px rgba(0,0,0,.14); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 10; transition: opacity .4s; }
.nb { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.nb svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.nb:hover { background: #eef1f4; }
.bags { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.bags button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 52px; height: 44px; border: 0; border-radius: 6px; background: #e5e9ec; color: var(--ink); cursor: pointer; box-shadow: inset 0 -3px 0 rgba(0,0,0,.08); }
.bags b { font: 800 17px/1 var(--h); }
.bags span { font: 700 11px/1 var(--b); color: var(--mute); }
.bags button.done { background: #cfe5cf; }
.bags button.on { background: var(--red); color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.bags button.on span { color: #ffd9d4; }
.pg { position: absolute; right: -96px; bottom: 6px; margin: 0; font: 700 13px var(--b); color: var(--mute); white-space: nowrap; }
.pg b { font: 800 18px var(--h); color: var(--ink); }
html[data-kind="cover"] .nav, html[data-kind="open"] .nav { opacity: 0; pointer-events: none; }
html[data-kind="cover"] .hud-btns .hb:not(.strong), html[data-kind="open"] .hud-btns .hb:not(.strong) { opacity: .0; pointer-events: none; }

/* chuyển cảnh gạch rơi */
.wipe { position: fixed; inset: 0; z-index: 40; overflow: hidden; display: none; pointer-events: none; }
.wipe.show { display: block; pointer-events: auto; }
.wipe i { position: absolute; width: var(--bw); height: var(--bh); border-radius: 3px; background: var(--c); box-shadow: inset 0 -6px 0 rgba(0,0,0,.2), inset 0 3px 0 rgba(255,255,255,.28), inset -3px 0 0 rgba(0,0,0,.08); transform: translateY(calc(-100vh - 120%)); transition: transform .5s cubic-bezier(.35,.05,.45,1.12) var(--d); }
.wipe i::before { content: ''; position: absolute; left: 4%; right: 4%; top: calc(var(--bh) * -.2); height: calc(var(--bh) * .22); background: radial-gradient(ellipse 58% 100% at 50% 100%, var(--c) 96%, transparent 100%) 0 0 / 25% 100% repeat-x; filter: brightness(1.08); }
.wipe.in i { transform: none; }
.wipe.out i { transform: translateY(calc(100vh + 120%)); transition: transform .55s cubic-bezier(.55,0,.85,.4) var(--d2); }

/* ---------- thiệp: trang cuối sách hướng dẫn ---------- */
.invite { position: fixed; inset: 0; z-index: 50; background: rgba(28,35,40,.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .4s; }
.invite.on { opacity: 1; }
.inv-scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; padding: calc(28px + var(--st)) 16px calc(28px + var(--sb)); }
.sheet { position: relative; max-width: 720px; margin: 0 auto; padding: 34px clamp(20px, 5vw, 56px) 30px; border-radius: 18px; background: var(--paper); box-shadow: 0 6px 0 rgba(0,0,0,.15), 0 30px 80px rgba(0,0,0,.35); transform: translateY(40px); transition: transform .5s cubic-bezier(.3,.1,.3,1.15); overflow: hidden; }
.invite.on .sheet { transform: none; }
.sheet::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 150px; background: linear-gradient(var(--manual), rgba(223,233,243,0)); pointer-events: none; }
.sheet > * { position: relative; }
.close { position: absolute; right: 12px; top: 12px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: #fff; font: 800 28px/1 var(--h); cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.1); z-index: 2; }
.sh-head { text-align: center; }
.sh-step { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 18px; padding: 5px 12px 6px; border-radius: 8px; background: var(--ink); color: #fff; font: 800 15px/1 var(--h); }
.sh-step b { color: var(--yellow); }
.kicker { margin: 0; font: 800 15px var(--b); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.kicker b { color: var(--red); }
.kicker:focus { outline: none; }
.lead { margin: 8px 0 4px; font: 600 18px/1.5 var(--b); color: var(--ink2); }
.names { margin: 6px 0 0; font: 800 clamp(40px, 7vw, 64px)/1 var(--h); color: var(--red); }
.names span { display: block; }
.names i { display: block; margin: 4px 0 2px; font: italic 800 .62em/1 var(--b); color: var(--ink2); }
.couple { display: flex; justify-content: center; gap: 6px; margin: 4px 0 6px; min-height: 10px; }
.couple img { width: 92px; height: auto; filter: drop-shadow(0 6px 8px rgba(0,0,0,.18)); }
.xi { display: grid; place-items: center; width: 64px; height: 64px; margin: 16px auto 0; border-radius: 8px; background: var(--red); color: #f1c453; font: 900 40px/1 "Noto Serif SC", "SimSun", serif; box-shadow: inset 0 -5px 0 rgba(0,0,0,.2), 0 4px 0 rgba(0,0,0,.12); }

.when { display: grid; grid-template-columns: auto 1fr; gap: 18px 24px; align-items: center; margin: 34px 0 0; }
.date-tile { padding: 16px 20px 14px; border-radius: 10px; background: var(--yellow); text-align: center; box-shadow: inset 0 -6px 0 rgba(0,0,0,.14), inset 0 3px 0 rgba(255,255,255,.35), 0 4px 0 rgba(0,0,0,.12); }
.day { margin: 0; font: 800 16px var(--h); color: var(--ink2); text-transform: uppercase; letter-spacing: .06em; }
.date { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; }
.date b { font: 800 76px/.9 var(--h); color: var(--ink); }
.date span { text-align: left; font: 800 18px/1.15 var(--h); color: var(--ink); }
.lunar { margin: 6px 0 0; font: 700 13px var(--b); color: var(--ink2); }
.sched { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sched li { display: grid; grid-template-columns: 34px 72px 1fr; align-items: center; gap: 10px; padding: 8px 12px; border: 2px solid var(--ink); border-radius: 10px; background: var(--callout); }
.sched .n { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; font: 800 16px var(--h); }
.sched b { font: 800 22px var(--h); }
.sched li > span:last-child { font: 700 17px var(--b); }

.where { margin: 34px 0 0; text-align: center; }
.where h2 { margin: 0; font: 800 28px/1.15 var(--h); }
.where p { margin: 4px 0 6px; font: 600 17px var(--b); color: var(--ink2); }
.btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; }
.fam { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 34px 0 0; text-align: center; }
.fam h3 { margin: 0 0 4px; font: 800 15px var(--h); text-transform: uppercase; letter-spacing: .08em; color: var(--red); }
.fam p { margin: 0; font: 700 17px/1.5 var(--b); }

.cd { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 460px; margin: 34px auto 0; }
.cd p { margin: 0; padding: 12px 4px 10px; border-radius: 8px; background: var(--ink); color: #fff; text-align: center; box-shadow: inset 0 -5px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.12); }
.cd b { display: block; font: 800 32px/1 var(--h); }
.cd span { font: 700 13px var(--b); color: #b9c2cc; }
.cd .cd-done { display: none; grid-column: 1 / -1; font: 800 22px var(--h); }
.cd.done p { display: none; } .cd.done .cd-done { display: block; }

.reply { margin: 40px 0 0; padding: 26px clamp(16px, 4vw, 28px) 24px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; }
.reply h2 { margin: 0; text-align: center; font: 800 34px/1 var(--h); color: var(--red); }
.reply .sub { margin: 6px 0 18px; text-align: center; font: 600 16px var(--b); color: var(--ink2); }
.rsvp { display: grid; gap: 16px; }
fieldset { margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; font: 800 15px var(--b); color: var(--ink2); }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice label { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: grid; place-items: center; min-height: 60px; padding: 10px; border-radius: 8px; background: #e5e9ec; text-align: center; font: 800 18px/1.15 var(--h); box-shadow: inset 0 -5px 0 rgba(0,0,0,.1); transition: background .15s, color .15s, transform .15s; }
.choice .c-yes input:checked + span { background: var(--green); color: #fff; transform: translateY(-2px); }
.choice .c-no input:checked + span { background: var(--ink2); color: #fff; transform: translateY(-2px); }
.choice input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.field { display: grid; gap: 6px; }
.field > span { font: 800 15px var(--b); color: var(--ink2); }
.field small { font-weight: 600; color: var(--mute); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; font: 600 16px var(--b); }
.field input:focus, .field textarea:focus { outline: 3px solid var(--yellow); outline-offset: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: inline-block; padding: 10px 16px; border-radius: 8px; background: #e5e9ec; font: 800 16px var(--h); box-shadow: inset 0 -4px 0 rgba(0,0,0,.08); }
.chips input:checked + span { background: var(--azure); color: #fff; }
.chips input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 46px; height: 46px; border: 0; border-radius: 8px; background: var(--yellow); font: 800 24px var(--h); cursor: pointer; box-shadow: inset 0 -4px 0 rgba(0,0,0,.14); }
.stepper input { width: 72px; text-align: center; }
.err { margin: 0; padding: 10px 12px; border-radius: 8px; background: #fde2df; color: var(--dred); font: 700 15px var(--b); }
.send { justify-self: center; }
.demo { margin: 0; font: 600 13px/1.5 var(--b); color: var(--mute); text-align: center; }
.thanks { text-align: center; padding: 10px 0; }
.thanks h3 { margin: 0; font: 800 28px var(--h); color: var(--green); }
.thanks p { font: 600 17px/1.5 var(--b); }
.sh-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 30px 0 0; }
.pgno { margin: 18px 0 0; text-align: right; font: 700 13px var(--b); color: var(--mute); }
.credits { max-width: 720px; margin: 16px auto 0; text-align: center; font: 600 13px/1.5 var(--b); color: rgba(255,255,255,.8); }
html.invite-open .hud, html.invite-open .nav { opacity: 0; pointer-events: none; }

/* ---------- điện thoại dọc ---------- */
@media (orientation: portrait) and (max-width: 1100px), (max-width: 560px) {
  .brand span { display: none; }
  .hb.strong span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cover { top: auto; width: auto; right: 0; padding: 70px 20px calc(24px + var(--sb)); justify-content: flex-end; text-align: center; align-items: center; transform: translateY(16px); background: linear-gradient(to top, rgba(244,239,230,.97) 62%, rgba(244,239,230,0)); }
  .cover.on { transform: none; }
  .cv-sub { font-size: 16px; }
  .cv-btns { justify-content: center; }
  .step { left: calc(14px + var(--sl)); right: 14px; max-width: none; top: calc(68px + var(--st)); }
  .st-no b { font-size: 52px; }
  .st-label { font-size: 15px; margin-bottom: 6px; }
  .callout { gap: 2px 4px; padding: 6px 8px 4px; }
  .part { width: 48px; } .part canvas { width: 48px; height: 48px; } .part b { font-size: 13px; }
  .part.fig { width: 54px; } .part.fig canvas { width: 54px; height: 54px; }
  .caption { left: 12px; right: 12px; width: auto; bottom: calc(80px + var(--sb)); padding: 12px 14px 14px; }
  .cap-lines p { font-size: 15px; }
  .nav { gap: 2px; padding: 4px; }
  .bags { gap: 4px; }
  .bags button { width: 44px; }
  .pg { display: none; }
  .bubble span { font-size: 16px; padding: 6px 12px 7px; }
  .when { grid-template-columns: 1fr; }
  .date-tile { justify-self: center; }
  .choice { grid-template-columns: 1fr; }
}
/* điện thoại ngang (thấp) */
@media (orientation: landscape) and (max-height: 520px) {
  .hud { padding-top: calc(8px + var(--st)); }
  .brand span { display: none; }
  .step { top: calc(60px + var(--st)); }
  .st-no b { font-size: 44px; }
  .part { width: 44px; } .part canvas { width: 44px; height: 44px; }
  .caption { bottom: calc(70px + var(--sb)); padding: 10px 14px; width: min(420px, 50vw); }
  .cap-title { font-size: 22px; } .cap-lines p { font-size: 14px; }
  .cover { padding-top: 60px; }
  .cv-title { font-size: 48px; }
  .cv-sub { font-size: 15px; }
  .finale { top: calc(54px + var(--st)); }
  .nav { bottom: calc(8px + var(--sb)); }
}
@media (pointer: coarse) { .nb, .hb { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .part, .bubble span { animation: none; } .wipe i { transition-duration: .01s; } }
