/* b4.css — giao diện web Bộ 4 thẻ (the.html). */
:root { --y: #F8CF3A; --n: #6C7BD9; --g: #F28C28; --m: #B79BE0; --ink: #3B2A20; --bg: #FFF8E7; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-tap-highlight-color: transparent; }
#app { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; gap: 8px; }
.mbtn, .gear, .sbtn { min-height: 48px; min-width: 48px; border-radius: 24px; border: 3px solid var(--ink); background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; padding: 0 16px; cursor: pointer; }
.gear { padding: 0; width: 48px; font-size: 24px; touch-action: none; }
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 8px 12px; text-align: center; }
.bubble { font-size: clamp(26px, 6vw, 44px); font-weight: 800; }
.sub { min-height: 1.6em; font-size: clamp(20px, 4.5vw, 32px); font-weight: 700; }
.cardrow { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.card { display: inline-block; line-height: 0; }
.card svg { display: block; }
.card.nod svg { animation: nod 1.6s ease-in-out infinite; }
.card.shake svg { animation: shake 1.8s ease-in-out infinite; }
.card.pulse svg { animation: pulse 1.6s ease-in-out infinite; }
@keyframes nod { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.items { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.item svg { width: min(34vw, 190px); height: min(34vw, 190px); }
.items.many .item svg { width: min(22vw, 120px); height: min(22vw, 120px); }
.item.lit { filter: drop-shadow(0 0 8px var(--g)); }
.item.dim { opacity: .35; }
.cover { width: min(26vw, 140px); height: min(26vw, 140px); border-radius: 20px; background: var(--m); border: 4px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 56px; font-weight: 800; color: #fff; }
.groups { display: flex; gap: 20px; width: 100%; justify-content: center; }
.group { flex: 1; max-width: 46%; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-content: center; min-height: 140px; border-radius: 20px; border: 4px dashed transparent; padding: 8px; }
.group.target { border-color: var(--g); background: #fff4dd; }
.group .item svg { width: min(16vw, 76px); height: min(16vw, 76px); }
.btnrow { display: flex; gap: 12px; justify-content: center; padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
.tbtn { min-width: 96px; min-height: 120px; border: 0; background: transparent; padding: 4px; cursor: pointer; border-radius: 20px; }
.tbtn:active { transform: scale(.94); }
.tbtn.off { opacity: .35; }
.remind { display: flex; gap: 14px; justify-content: center; align-items: center; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); opacity: .85; }
.rstat { font-size: 13px; text-align: center; opacity: .75; padding: 0 12px 6px; }
.toast { position: fixed; left: 50%; top: 66px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 20px; font-weight: 700; z-index: 30; }
.overlay { position: fixed; inset: 0; background: rgba(255, 248, 231, .96); display: flex; align-items: center; justify-content: center; z-index: 40; font-size: clamp(26px, 6vw, 44px); font-weight: 800; text-align: center; padding: 20px; cursor: pointer; }
.rest { background: #1F2540; color: #E9E6FF; flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px; }
.parent { position: fixed; inset: 0; background: var(--bg); z-index: 50; overflow: auto; padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); }
.parent h2 { margin: 6px 0 10px; }
.parent table { border-collapse: collapse; width: 100%; font-size: 14px; }
.parent td, .parent th { border: 1px solid #c9b894; padding: 6px; text-align: left; vertical-align: top; }
.parent code { word-break: break-all; background: #fff; padding: 2px 4px; border-radius: 4px; display: inline-block; }
.tabs { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.tabs .sbtn.on { background: var(--y); }
.muted { opacity: .7; font-size: 13px; }
.foot { margin-top: 18px; text-align: center; opacity: .7; font-size: 13px; }
@media (min-width: 700px) { .tbtn { min-width: 120px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
