/* Tô màu */
body[data-scene="to-mau"] { --sky1: #FF8FB3; --sky2: #FFE7F0; }

/* cả trò chơi nằm gọn trong phần màn hình còn lại dưới thanh trên: không bao giờ phải cuộn trang */
.gk { --cr: 56px; --sm: 62px; position: relative; width: 100%; height: calc(var(--vh) - var(--bar) - 35px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 236px; }
.gk-gal, .gk-paint { height: 100%; display: flex; flex-direction: column; gap: 8px; }
.gk button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.gk button > * { pointer-events: none; }
.gk .gk-btn { width: 56px; height: 56px; border-width: 4px; }
.gk .gk-btn svg { width: 26px; height: 26px; }

/* ----- nét vẽ chung của mọi bức tranh -----
   Mặc định đặt trên thẻ <svg> để thừa kế xuống: chi tiết nào tự mang fill/stroke thì thuộc tính của nó thắng. */
.gk-art { display: block; fill: none; stroke: #1E2A5E; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; overflow: hidden; }
.gk-art [data-c] { fill: #fff; stroke: #1E2A5E; stroke-width: 3; }
.gk-art text:not([fill]) { fill: #1E2A5E; stroke: none; }

/* ----- phòng tranh ----- */
.gk-tabs { flex: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.gk-tab { --c: var(--yellow); min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 4px 2px; border-radius: 18px;
  background: color-mix(in srgb, var(--c) 22%, #fff); border: 3px solid #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 55%, #000); font-weight: 800; font-size: .78rem; line-height: 1.02; text-align: center; transition: transform .1s; }
.gk-tab .emo { font-size: 26px; }
.gk-tab[aria-pressed="true"] { background: var(--c); outline: 3px solid var(--navy); outline-offset: 1px; transform: translateY(-2px); }
.gk-tab:active { transform: translateY(2px); }

.gk-pager { flex: 1 1 0; min-height: 0; display: grid; align-items: center; gap: 8px;
  grid-template: "grid grid grid" minmax(0, 1fr) "prev dots next" auto / auto minmax(0, 1fr) auto; }
.gk-grid { grid-area: grid; align-self: stretch; min-height: 0; display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 3), minmax(0, 1fr)); }
.gk-pgprev { grid-area: prev; } .gk-pgnext { grid-area: next; }
.gk-dots { grid-area: dots; display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.gk-dots i { width: 13px; height: 13px; border-radius: 50%; background: #fff; opacity: .75; }
.gk-dots i.on { background: var(--yellow); opacity: 1; box-shadow: 0 0 0 3px var(--navy); }
.gk-card { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: 5px 5px 0; background: #fff; border: 3px solid #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 5px 0 rgba(30, 42, 94, .22), 0 9px 12px rgba(30, 42, 94, .14); animation: gk-in .3s both; transition: transform .08s; }
.gk-card:active { transform: translateY(4px) scale(.98); }
.gk-card .gk-art { flex: 1 1 0; min-height: 0; width: 100%; height: 0; }
.gk-name { flex: none; font-weight: 800; font-size: .95rem; line-height: 1.55; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gk-isdone { border-color: var(--yellow); }
.gk-done { position: absolute; top: 2px; left: 2px; width: 30px; height: 30px; display: grid; place-items: center; background: #fff; border-radius: 50%; box-shadow: 0 2px 0 rgba(30, 42, 94, .25); }
.gk-done svg { width: 24px; height: 24px; }
.gk-empty { grid-column: 1 / -1; grid-row: 1 / -1; align-self: center; text-align: center; background: #fff; border-radius: 24px; padding: 20px; font-weight: 800; box-shadow: var(--lift); }

/* ----- màn tô ----- */
.gk-top { flex: none; display: flex; align-items: center; gap: 8px; }
.gk-title { flex: 1; min-width: 0; text-align: center; font-weight: 800; font-size: clamp(1.15rem, 5.2vw, 1.8rem); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px .12em; }
.gk-stage { flex: 1 1 0; min-width: 0; min-height: 0; container-type: size; display: grid; place-items: center; }
.gk-paper { position: relative; width: min(100cqw, calc(100cqh * 4 / 3)); aspect-ratio: 4 / 3; background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 0 0 5px #fff, 0 12px 0 rgba(30, 42, 94, .16);
  touch-action: none; -webkit-user-select: none; user-select: none; cursor: crosshair; }
.gk-paper .gk-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.gk-paper .gk-art [data-c] { pointer-events: visiblePainted; transition: fill .16s; }
.gk-paper .gk-art .gk-pop { animation: gk-pop .32s ease-out; }
.gk-mark { position: absolute; width: 2px; height: 2px; margin: -1px 0 0 -1px; pointer-events: none; }
.gk-mark.hinted { outline: none !important; box-shadow: none !important; }
/* mảng đang được gợi ý: nhấp nháy vàng, viền cam dày (viền sáng mặc định của .hinted không hợp với hình SVG) */
.gk-paper .gk-art .hinted, .gk-paper .gk-art .gk-glow { outline: none !important; box-shadow: none !important; stroke: #FF9F1C; stroke-width: 6; animation: gk-hint .6s ease-in-out infinite alternate; }
.gk-rip { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; border: 6px solid var(--c); box-shadow: 0 0 0 2px rgba(30, 42, 94, .35), inset 0 0 0 2px rgba(30, 42, 94, .35); pointer-events: none; animation: gk-rip .5s ease-out forwards; }

.gk-pal { flex: none; display: grid; grid-template-columns: repeat(5, var(--cr)); justify-content: space-evenly; align-content: center; gap: 8px 0; }
.gk-crayon, .gk-bulb { position: relative; width: var(--cr); height: var(--cr); border-radius: 50%; border: 4px solid #fff; transition: transform .1s; }
.gk-crayon { background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .55) 0 12%, transparent 13%), var(--c); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 1.5px rgba(30, 42, 94, .3); }
.gk-crayon[aria-pressed="true"] { transform: scale(1.12); outline: 4px solid var(--navy); outline-offset: 1px; z-index: 1; }
.gk-crayon[aria-pressed="true"]::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font: 800 1.5rem/1 var(--font-ui); color: var(--navy);
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 4px #fff, 0 0 5px #fff; }
.gk-crayon.hinted, .gk-crayon.gk-glow { border-radius: 50%; animation: gk-wiggle .5s ease-in-out infinite; z-index: 2; }
.gk-crayon.gk-glow { outline: 6px solid var(--yellow); outline-offset: 3px; box-shadow: 0 0 0 9px rgba(255, 210, 63, .45), 0 0 22px 9px rgba(255, 210, 63, .8); }
.gk-bulb { display: grid; place-items: center; background: #fff; box-shadow: 0 4px 0 rgba(30, 42, 94, .25), 0 0 0 1.5px rgba(30, 42, 94, .3); font-size: calc(var(--cr) * .5); }
.gk-crayon:active, .gk-bulb:active { transform: translateY(2px); }

.gk-bot { flex: none; display: flex; align-items: center; gap: 8px; }
.gk-sample { position: relative; flex: none; height: var(--sm); aspect-ratio: 4 / 3; padding: 0; background: #fff; border: 3px solid #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 0 rgba(30, 42, 94, .25), 0 0 0 1.5px rgba(30, 42, 94, .3); }
.gk-sample .gk-art { width: 100%; height: 100%; }
.gk-sample span { position: absolute; left: 0; right: 0; bottom: 0; padding: 1px 0; background: rgba(30, 42, 94, .8); color: #fff; font-weight: 800; font-size: .68rem; line-height: 1.25; text-align: center; white-space: nowrap; }
.gk-clear, .gk-next { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 2px 8px; border-radius: 999px; font-weight: 800; font-size: 1.05rem; line-height: 1.05; }
.gk-clear { background: #fff; border: 3px solid color-mix(in srgb, var(--blue) 40%, #fff); box-shadow: 0 4px 0 rgba(30, 42, 94, .22); }
.gk-clear.gk-armed { background: var(--red); border-color: #fff; color: #fff; font-size: .92rem; }
.gk-next { --c: var(--green); visibility: hidden; background: var(--c); border: 4px solid #fff; color: #fff; text-shadow: var(--outline); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 60%, #000); }
.gk-next.gk-on { visibility: visible; animation: gk-pulse .8s ease-in-out infinite; }
.gk-next.hinted { border-radius: 999px; }
.gk-clear:active, .gk-next:active { transform: translateY(3px); }

/* tranh mẫu phóng to */
.gk-zoom { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 16px; background: rgba(30, 42, 94, .6); }
.gk-zoomcard { width: min(100%, 760px, calc((var(--vh) - 130px) * 4 / 3)); padding: 8px 8px 6px; background: #fff; border-radius: 26px; box-shadow: var(--lift); animation: gk-in .25s both; pointer-events: none; }
.gk-zoomcard .gk-art { width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 18px; }
.gk-zoomrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 0; }
.gk-zoomname { min-width: 0; font-weight: 800; font-size: 1.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gk-close { flex: none; min-height: 56px; padding: 2px 22px; border-radius: 999px; background: var(--green); border: 4px solid #fff; color: #fff; text-shadow: var(--outline); font-weight: 800; font-size: 1.2rem; box-shadow: 0 5px 0 color-mix(in srgb, var(--green) 60%, #000); }

/* ----- cỡ màn hình ----- */
@media (max-height: 700px) { .gk { --cr: 50px; --sm: 56px; } .gk-pal { gap: 6px 0; } .gk-tab { min-height: 56px; } .gk-tab .emo { font-size: 22px; } }
@media (min-height: 780px) and (max-aspect-ratio: 5/4) { .gk { --cr: 60px; --sm: 100px; } .gk-pal { gap: 10px 0; } .gk-gal, .gk-paint { gap: 10px; } }
@media (min-width: 700px) and (min-height: 700px) {
  .gk { --cr: 64px; --sm: 96px; }
  .gk-tab { flex-direction: row; gap: 8px; font-size: 1.05rem; } .gk-tab .emo { font-size: 30px; }
  .gk-name { font-size: 1.1rem; } .gk-sample span { font-size: .8rem; }
  .gk-clear, .gk-next { font-size: 1.25rem; min-height: 64px; }
}
@media (min-width: 700px) and (min-height: 700px) and (max-aspect-ratio: 5/4) { .gk-pal { grid-template-columns: repeat(8, var(--cr)); } }
/* màn hình ngang: tranh bên trái, bút sáp và nút bên phải; phòng tranh có mũi tên hai bên */
@media (min-aspect-ratio: 5/4) {
  .gk-paint { display: grid; gap: 8px 14px; grid-template: "stage top" auto "stage pal" minmax(0, 1fr) "stage bot" auto / minmax(0, 1fr) clamp(290px, 40%, 380px); }
  .gk-stage { grid-area: stage; } .gk-top { grid-area: top; flex-wrap: wrap; justify-content: space-between; } .gk-pal { grid-area: pal; } .gk-bot { grid-area: bot; }
  .gk-title { order: 5; flex: 1 1 100%; }
  .gk-pager { grid-template: "prev grid next" minmax(0, 1fr) ". dots ." auto / auto minmax(0, 1fr) auto; }
  .gk-tab { flex-direction: row; gap: 6px; font-size: .95rem; }
}
@media (min-aspect-ratio: 5/4) and (max-height: 560px) {
  .gk-title, .gk-dots { display: none; }
  .gk-tab { min-height: 50px; }
  .gk-name { font-size: .85rem; line-height: 1.4; }
}

@keyframes gk-in { from { transform: scale(.86); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes gk-pop { 0% { stroke-width: 3; } 40% { stroke-width: 9; } 100% { stroke-width: 3; } }
@keyframes gk-rip { from { transform: scale(.25); opacity: 1; } to { transform: scale(1.5); opacity: 0; } }
@keyframes gk-hint { from { fill: #fff; } to { fill: #FFE46B; } }
@keyframes gk-wiggle { 0%, 100% { transform: rotate(-9deg) scale(1.12); } 50% { transform: rotate(9deg) scale(1.2); } }
@keyframes gk-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .gk-card, .gk-zoomcard, .gk-next.gk-on, .gk-crayon.hinted, .gk-crayon.gk-glow, .gk-paper .gk-art .gk-pop { animation: none; } .gk-rip { display: none; } }

/* ---------- wave 5: polish ---------- */
/* nút về phòng tranh: hình hai bức tranh kèm chữ "Đổi tranh" */
.gk .gk-back { --c: var(--pink); flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-width: 70px; height: 56px; padding: 1px 6px 3px; border-radius: 18px;
  background: color-mix(in srgb, var(--c) 78%, #fff); border: 4px solid #fff; color: var(--navy); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 60%, #000), 0 9px 12px rgba(30, 42, 94, .22); transition: transform .08s, box-shadow .08s; }
.gk .gk-back:active { transform: translateY(4px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 60%, #000); }
.gk-backico { display: grid; place-items: center; }
.gk .gk-back svg { display: block; width: 28px; height: 28px; }
.gk .gk-back b { font: 800 .72rem/1.05 var(--font-ui); white-space: nowrap; }
/* màn hình ngang: đủ chỗ cho hình và chữ nằm cạnh nhau */
@media (min-aspect-ratio: 5/4) { .gk .gk-back { flex-direction: row; gap: 7px; padding: 2px 12px; } .gk .gk-back b { font-size: .95rem; } }

/* ---------- wave 7: hình khối (3D) ---------- */
/* thẻ nhóm tranh: phím nổi, phím đang chọn có vành trắng và cạnh dày hơn */
.gk-tab { background: linear-gradient(rgba(255, 255, 255, .9), rgba(255, 255, 255, .68)), var(--c);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .9), inset 0 -4px 0 rgba(30, 42, 94, .07), 0 4px 0 rgba(0, 0, 0, .34), 0 4px 0 var(--c), 0 8px 10px rgba(30, 42, 94, .2); }
.gk-tab .emo { font-size: 30px; filter: drop-shadow(0 2px 0 rgba(30, 42, 94, .2)); }
.gk-tab[aria-pressed="true"] { outline: 0; background: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 55%), var(--c);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), inset 0 -4px 0 rgba(0, 0, 0, .13), 0 0 0 3px #fff, 0 6px 0 3px rgba(30, 42, 94, .4), 0 12px 12px rgba(30, 42, 94, .25); }

/* phòng tranh: mỗi tranh mẫu là một tờ giấy dán băng dính, hơi nghiêng, có tờ nữa lót dưới và bóng đổ */
.gk-grid { padding: 8px 4px 4px; }
.gk-card { padding: 6px 6px 0; border: 0; border-radius: 7px; overflow: visible; background: linear-gradient(180deg, #FFFFFC, #FAF6EA);
  box-shadow: 0 0 0 1px rgba(120, 100, 70, .3), 3px 4px 0 0 #F1ECDD, 3px 4px 0 1px rgba(120, 100, 70, .3), 5px 12px 12px rgba(30, 42, 94, .3);
  transform: rotate(var(--gk-r, 0deg)); animation: gk-in3 .3s backwards; }
.gk-card:nth-child(4n+1) { --gk-r: -1.3deg; --gk-t: #FF9EC4; } .gk-card:nth-child(4n+2) { --gk-r: .9deg; --gk-t: #8CC8FF; }
.gk-card:nth-child(4n+3) { --gk-r: -.6deg; --gk-t: #FFD84D; } .gk-card:nth-child(4n) { --gk-r: 1.4deg; --gk-t: #8FE3A8; }
.gk-card:active { transform: rotate(var(--gk-r, 0deg)) translateY(3px) scale(.98); }
.gk-card::before { content: ""; position: absolute; z-index: 1; left: 50%; top: -7px; width: 34%; max-width: 72px; height: 14px; pointer-events: none; opacity: .93; transform: translateX(-50%) rotate(-2.5deg);
  background: linear-gradient(90deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0) 72%, rgba(255, 255, 255, .35)), repeating-linear-gradient(45deg, rgba(255, 255, 255, .28) 0, rgba(255, 255, 255, .28) 5px, rgba(255, 255, 255, 0) 5px, rgba(255, 255, 255, 0) 10px), var(--gk-t, #FFD84D);
  box-shadow: 0 2px 3px rgba(30, 42, 94, .26); }
.gk-card .gk-art { border-radius: 3px; }
.gk-isdone { box-shadow: 0 0 0 3px var(--yellow), 3px 4px 0 2px #F1ECDD, 3px 4px 0 3px rgba(120, 100, 70, .3), 5px 12px 12px rgba(30, 42, 94, .3); }
.gk-done { top: 6px; left: 6px; }
.gk-dots i { background: radial-gradient(circle at 35% 28%, #fff 0, #DCE4F6 100%); box-shadow: 0 2px 2px rgba(30, 42, 94, .25); opacity: .9; }
.gk-dots i.on { background: radial-gradient(circle at 35% 28%, #FFF6C4 0, var(--yellow) 60%); }
@keyframes gk-in3 { from { transform: scale(.86) rotate(0deg); opacity: 0; } }

/* màn tô: tờ tranh nằm trên một xấp giấy đặt trên bàn (mép tờ dưới ló ra, bóng đổ) */
.gk-stage { box-sizing: border-box; padding: 6px 13px 20px 6px; }
.gk-paper { border-radius: 5px; background: #FFFEFA;
  box-shadow: 0 0 0 5px #FFFEFA, 0 0 0 6px rgba(120, 100, 70, .42), 4px 7px 0 4px #F4EFE1, 4px 7px 0 5px rgba(120, 100, 70, .36), 7px 13px 0 3px #EAE3D0, 7px 13px 0 4px rgba(120, 100, 70, .3), 8px 24px 20px rgba(30, 42, 94, .34); }

/* bút sáp thật: thân trụ có vệt sáng dọc, băng giấy quấn quanh, đầu bút vát nhọn; cây đang cầm thì nhô lên và có viền sáng */
.gk-crayon { z-index: 0; border: 0; border-radius: 12px; background: none; box-shadow: none; }
.gk-crayon::before { content: ""; position: absolute; left: 16%; bottom: 4%; width: 68%; height: 100%; border-radius: 0 0 6px 6px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .3) 0, rgba(0, 0, 0, 0) 20%, rgba(255, 255, 255, .55) 32%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, .1) 76%, rgba(0, 0, 0, .36) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 43%, rgba(0, 0, 0, .34) 43%, rgba(0, 0, 0, .34) 46%, rgba(255, 255, 255, .3) 46%, rgba(255, 255, 255, .3) 84%, rgba(0, 0, 0, .34) 84%, rgba(0, 0, 0, .34) 87%, rgba(0, 0, 0, 0) 87%),
    var(--c);
  -webkit-clip-path: polygon(50% 0, 63% 3%, 76% 25%, 100% 29%, 100% 100%, 0 100%, 0 29%, 24% 25%, 37% 3%);
  clip-path: polygon(50% 0, 63% 3%, 76% 25%, 100% 29%, 100% 100%, 0 100%, 0 29%, 24% 25%, 37% 3%); }
.gk-crayon::after, .gk-crayon[aria-pressed="true"]::after { content: ""; position: absolute; z-index: -1; top: auto; right: auto; left: 12%; bottom: -1%; display: block; width: 76%; height: 17%; border-radius: 50%; text-shadow: none;
  background: radial-gradient(ellipse at center, rgba(30, 42, 94, .42) 0, rgba(30, 42, 94, 0) 70%); }
.gk-crayon[aria-pressed="true"] { outline: 0; transform: translateY(-12%) scale(1.16); filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 2px #fff) drop-shadow(0 0 3px rgba(30, 42, 94, .95)); }
.gk-crayon.hinted, .gk-crayon.gk-glow { border-radius: 14px; }
.gk-crayon.gk-glow { outline: 0; box-shadow: none; filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 7px var(--yellow)) drop-shadow(0 0 7px var(--orange)); }
.gk-bulb { background: radial-gradient(circle at 34% 24%, #fff 0, #FFF8DA 55%, #FFE89C 100%); box-shadow: inset 0 -4px 0 rgba(160, 100, 0, .14), 0 4px 0 #D6AE45, 0 8px 10px rgba(30, 42, 94, .24); font-size: calc(var(--cr) * .6); }

/* hàng nút dưới: tờ tranh mẫu nhỏ, hai phím nổi có hình 3D (🔄 tô lại, ➡️ tranh khác) */
.gk-sample { border: 4px solid #FFFEFA; border-radius: 6px; transform: rotate(-2deg);
  box-shadow: 0 0 0 1px rgba(120, 100, 70, .32), 3px 4px 0 #F1ECDD, 3px 4px 0 1px rgba(120, 100, 70, .3), 4px 9px 10px rgba(30, 42, 94, .3); }
.gk-sample:active { transform: rotate(-2deg) translateY(2px); }
.gk-clear, .gk-next { display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform .08s; }
.gk-clear { border: 3px solid #fff; background: linear-gradient(#fff, #E6ECFB); box-shadow: inset 0 -4px 0 rgba(30, 42, 94, .1), 0 4px 0 #AEBBDD, 0 8px 10px rgba(30, 42, 94, .22); }
.gk-clear::before, .gk-next::after { content: ""; flex: none; width: 34px; height: 34px; background: url(../img/g3-lam-lai.png) center / contain no-repeat; filter: drop-shadow(0 2px 0 rgba(30, 42, 94, .22)); }
.gk-next::after { background-image: url(../img/g3-mui-ten-phai.png); }
.gk-clear.gk-armed { background: linear-gradient(#FF7A84, #F2404E); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), inset 0 -4px 0 rgba(120, 0, 20, .22), 0 4px 0 #A82634, 0 8px 10px rgba(30, 42, 94, .26); }
.gk-clear.gk-armed::before { display: none; }
.gk-next { background: linear-gradient(rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, .1)), var(--c);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14), 0 5px 0 rgba(0, 0, 0, .38), 0 5px 0 var(--c), 0 10px 12px rgba(30, 42, 94, .25); }
.gk-close { background: linear-gradient(rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, .1)), var(--green); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .14), 0 5px 0 #247A40, 0 10px 12px rgba(30, 42, 94, .25); }
@media (max-width: 420px) { .gk-clear::before, .gk-next::after { width: 28px; height: 28px; } .gk-clear, .gk-next { gap: 5px; } }
@media (min-aspect-ratio: 5/4) and (min-height: 600px) { .gk { --cr: 62px; } } /* màn ngang cao: cột bên phải còn rộng, bút to hơn */

/* nút về phòng tranh (🖼️ hình 3D) và nút tròn sang tranh trước / sau: mặt vồng bóng, cạnh dày */
.gk .gk-back { background: linear-gradient(rgba(255, 255, 255, .55), rgba(255, 255, 255, .16)), var(--c);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7), inset 0 -4px 0 rgba(0, 0, 0, .1), 0 5px 0 rgba(0, 0, 0, .36), 0 5px 0 var(--c), 0 9px 12px rgba(30, 42, 94, .22); }
.gk .gk-back:active { box-shadow: 0 1px 0 rgba(0, 0, 0, .36), 0 1px 0 var(--c); }
.gk .gk-back img.emo { display: block; width: 32px; height: 32px; filter: drop-shadow(0 2px 0 rgba(30, 42, 94, .22)); }
.gk .gk-btn { background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, .8) 0, rgba(255, 255, 255, 0) 40%), linear-gradient(rgba(255, 255, 255, .22), rgba(150, 80, 0, .16)), var(--c);
  box-shadow: inset 0 -4px 0 rgba(150, 80, 0, .22), 0 5px 0 #C58A00, 0 10px 12px rgba(30, 42, 94, .26); }
.gk .gk-btn:active { box-shadow: inset 0 -2px 0 rgba(150, 80, 0, .22), 0 1px 0 #C58A00; }
.gk .gk-btn svg { fill: #fff; stroke: #A86A00; stroke-width: 1.4; stroke-linejoin: round; paint-order: stroke; overflow: visible; filter: drop-shadow(0 2px 0 rgba(120, 70, 0, .5)); }
@media (prefers-reduced-motion: reduce) { .gk-card { animation: none; } .gk-clear, .gk-next { transition: none; } }

/* ---------- wave 6: compat (trình duyệt cũ) ---------- */
/* Bản dự phòng cho máy cũ của các luật phía trên (giải thích ở cuối css/style.css); sửa luật gốc thì sửa luôn dòng tương ứng ở đây. */
/* chưa có color-mix(): các luật ở khối "wave 7" (thẻ nhóm, bút sáp, nút) không dùng color-mix nên chỉ còn giữ màu chữ đậm */
@supports not (color: color-mix(in srgb, red, blue)) {
  .gk-tab { --ck: var(--k-yellow); }
  .gk-next { --ck: var(--k-green); }
  .gk .gk-back { --ck: var(--k-pink); }
}
/* chưa có đơn vị cqw/cqh, @container */
@supports not (width: 1cqw) {
  .gk-stage { --cq: size; contain: size; }
  .gk-paper { width: min(calc(100 * var(--cqw)), calc(calc(100 * var(--cqh)) * 4 / 3)); }
}
