/* Direction: Matchbox Label (.bunshin/direction.md). Tokens, base and the shared components.
   Page files (home.css, game.css, list.css, me.css, page.css) only arrange these. */
@font-face { font-family: "Rozha One"; src: url(/fonts/rozha-one-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mukta"; src: url(/fonts/mukta-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Mukta"; src: url(/fonts/mukta-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Mukta"; src: url(/fonts/mukta-latin-800-normal.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  color-scheme: light;
  /* inks */
  --card: #FFFDF8;          /* the card stock, page ground */
  --label: #FFFFFF;         /* a printed label on the sheet */
  --ink: #151515;           /* text and keylines: 18.2:1 on card */
  --ink-soft: #4A4744;      /* secondary text: 9.3:1 on card */
  --vermilion: #E0442B;     /* bands with ink text 5.0:1? no: with white text use --vermilion-d */
  --vermilion-d: #C53A22;   /* white text on it 5.25:1 */
  --vermilion-t: #C53A22;   /* vermilion as text: stamps, errors */
  --turmeric: #F2B705;      /* ink text only: 10.0:1 */
  --indigo: #23307A;        /* white text 11.6:1 */
  --leaf: #1E8C52;          /* ink text 5.0:1 */
  --leaf-d: #187A47;        /* white text 5.3:1 */
  --keyline: 2px solid var(--ink);
  --r: 4px;
  --off: 4px;               /* the hard offset of a printed label's shadow */
  /* type */
  --display: "Rozha One", "Tiro Devanagari Hindi", Georgia, serif;
  --ui: "Mukta", "Noto Sans", system-ui, sans-serif;
  --t-xs: .78rem; --t-sm: .9rem; --t-md: 1rem; --t-lg: 1.2rem; --t-xl: clamp(1.5rem, 1.2rem + 1.4vw, 2rem); --t-2xl: clamp(1.9rem, 1.4rem + 2.6vw, 3rem);
  /* space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --gutter: 16px;
  --max: 1200px;
  /* motion: printed and stamped */
  --press: 120ms cubic-bezier(.2, .7, .3, 1);
  --release: 160ms cubic-bezier(.2, .7, .3, 1);
  --sheet-in: 200ms cubic-bezier(.2, .7, .3, 1);
  --sheet-out: 160ms cubic-bezier(.4, 0, 1, 1);
  --focus: 3px solid var(--indigo);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --card: #151515; --label: #1F1F1F; --ink: #FFFDF8; --ink-soft: #C9C4BC;
    --indigo: #3B4CB0; --focus: 3px solid var(--turmeric); --vermilion-t: #FF7A63;
  }
}
:root[data-theme="dark"] { color-scheme: dark; --card: #151515; --label: #1F1F1F; --ink: #FFFDF8; --ink-soft: #C9C4BC; --indigo: #3B4CB0; --focus: 3px solid var(--turmeric); --vermilion-t: #FF7A63; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--card); color: var(--ink); font: 400 var(--t-md)/1.5 var(--ui); -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
p { margin: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
main { display: block; min-height: 60vh; padding-bottom: var(--s7); }
main:focus { outline: none; }

/* Display type: Rozha One only at 20px and up. The misregistered twin is allowed on H1 and the Today title only. */
.display { font: 400 var(--t-2xl)/1.05 var(--display); letter-spacing: -.01em; }
.twin { position: relative; display: inline-block; }
.twin::before { content: attr(data-twin) / ""; position: absolute; inset: 0; transform: translate(.06em, .06em); color: var(--twin, var(--turmeric)); z-index: -1; pointer-events: none; }
.twin { isolation: isolate; }

/* Header band */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s2) max(var(--gutter), calc((100% - var(--max)) / 2 + var(--gutter))); background: var(--card); border-bottom: var(--keyline); }
.mark { position: relative; display: inline-grid; text-decoration: none; font: 400 1.55rem/1 var(--display); padding: 2px 0; isolation: isolate; }
.mark > span { grid-area: 1 / 1; }
.mark-a { color: var(--vermilion); transform: translate(2px, 2px); z-index: -1; }
.top-nav { display: flex; gap: var(--s2); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: var(--keyline); border-radius: var(--r); background: var(--label);
  box-shadow: 3px 3px 0 var(--ink); text-decoration: none; transition: transform var(--release), box-shadow var(--release); }
.icon-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); transition: transform var(--press), box-shadow var(--press); }

/* Bands: flat ink behind a section title */
.block { margin-top: var(--s6); }
.band { display: inline-block; margin: 0 0 var(--s3); padding: 2px 10px 0; font: 800 var(--t-lg)/1.5 var(--ui); border: var(--keyline); border-radius: var(--r); }
.band a { text-decoration: none; }
.band a::after { content: " \203A" / ""; }
.band.ink-vermilion { background: var(--vermilion-d); color: #fff; }
.band.ink-turmeric { background: var(--turmeric); color: #151515; }
.band.ink-indigo { background: var(--indigo); color: #fff; }
.band.ink-leaf { background: var(--leaf-d); color: #fff; }
.band.ink-ink { background: var(--ink); color: var(--card); }

/* The label: a game. Press = stamp down into place. */
.label { --c: var(--vermilion); position: relative; display: flex; flex-direction: column; text-decoration: none; background: var(--label);
  border: var(--keyline); border-radius: var(--r); box-shadow: var(--off) var(--off) 0 var(--c);
  transition: transform var(--release), box-shadow var(--release); }
.label:active { transform: translate(var(--off), var(--off)); box-shadow: 0 0 0 var(--c); transition: transform var(--press), box-shadow var(--press); }
@media (hover: hover) { .label:hover:not(:active) { box-shadow: calc(var(--off) + 2px) calc(var(--off) + 2px) 0 var(--c); } }
.ink-vermilion { --c: var(--vermilion); } .ink-turmeric { --c: var(--turmeric); } .ink-indigo { --c: var(--indigo); } .ink-leaf { --c: var(--leaf); }
.label-mat { display: block; padding: 6px; border-bottom: var(--keyline); background: var(--c); }
.label-mat img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 2px solid var(--ink); border-radius: 2px; background: color-mix(in srgb, var(--c) 30%, var(--label)); } /* tint while loading */
.label-title { padding: 6px 8px 0; font: 800 var(--t-sm)/1.2 var(--ui); overflow-wrap: anywhere; }
.label-foot { padding: 0 8px 6px; font-size: var(--t-xs); color: var(--ink-soft); }
.label-lg .label-title { font: 400 var(--t-xl)/1.1 var(--display); padding: 8px 10px 0; }
.label-lg .label-foot { padding: 0 10px 10px; font-size: var(--t-sm); }
.label .stamp { position: absolute; right: -8px; top: -10px; }

/* Strip (phone: scrolls sideways with snap; wide: a wrapping sheet) */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 2px 6px 10px 2px; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scroll-padding-inline: var(--gutter); scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip > * { scroll-snap-align: start; }
@media (min-width: 900px) {
  .strip { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); overflow: visible; margin: 0; padding: 2px 6px 10px 2px; }
}

/* Sheet: one large label and small ones, never equal cards */
.sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding-right: 6px; }
.sheet .label-lg { grid-column: span 2; display: grid; grid-template-columns: 46% 1fr; grid-template-rows: auto auto 1fr; }
.sheet .label-lg .label-mat { grid-row: span 3; border-bottom: 0; border-right: var(--keyline); }
.sheet .label-lg .label-title { padding-top: 12px; }
@media (min-width: 640px) { .sheet { grid-template-columns: repeat(4, 1fr); } .sheet .label-lg { grid-row: span 2; display: flex; flex-direction: column; }
  .sheet .label-lg .label-mat { border-right: 0; border-bottom: var(--keyline); } }
@media (max-width: 1099px) { .sheet > :nth-child(n+6) { display: none; } }
@media (min-width: 1100px) { .sheet { grid-template-columns: repeat(6, 1fr); } }

/* Buttons: rectangular printed labels */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 6px 16px; border: var(--keyline); border-radius: var(--r);
  background: var(--label); color: var(--ink); font: 800 var(--t-md)/1 var(--ui); text-decoration: none; box-shadow: 3px 3px 0 var(--ink);
  transition: transform var(--release), box-shadow var(--release); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); transition: transform var(--press), box-shadow var(--press); }
.btn-primary { background: var(--vermilion-d); color: #fff; }
.btn-indigo { background: var(--indigo); color: #fff; }
.btn-turmeric { background: var(--turmeric); color: #151515; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s3); }
.link { font-weight: 600; text-underline-offset: 3px; }

/* The rubber stamp: the only circle. Lands once (180ms), is simply shown afterwards. */
.stamp { display: inline-grid; place-items: center; width: 64px; height: 64px; border: 3px solid var(--vermilion-t); border-radius: 50%; color: var(--vermilion-t);
  background: color-mix(in srgb, var(--label) 70%, transparent); font: 800 .7rem/1 var(--ui); text-align: center; transform: rotate(-8deg); pointer-events: none; }
.stamp > span { width: 52px; height: 52px; display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; padding: 4px; }
.stamp.land { animation: stamp-land 180ms cubic-bezier(.2, .7, .3, 1) both; }
@keyframes stamp-land { from { transform: scale(1.3) rotate(-6deg); opacity: 0; } to { transform: scale(1) rotate(-8deg); opacity: 1; } }

/* Overlays: search sheet, dialogs */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(21, 21, 21, .5); display: flex; align-items: flex-end; justify-content: center; }
.overlay[hidden] { display: none; }
.panel { width: min(640px, 100%); max-height: 88vh; overflow: auto; background: var(--card); border: var(--keyline); border-bottom: 0; border-radius: var(--r) var(--r) 0 0;
  padding: var(--s4) var(--gutter) var(--s6); transform: translateY(0); animation: sheet-in var(--sheet-in) both; }
@media (min-width: 700px) { .overlay { align-items: center; } .panel { border-bottom: var(--keyline); border-radius: var(--r); box-shadow: 6px 6px 0 var(--ink); } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.field { width: 100%; min-height: 48px; padding: 8px 12px; border: var(--keyline); border-radius: var(--r); background: var(--label); color: var(--ink); font: 600 var(--t-lg)/1.2 var(--ui); }
.field:focus-visible { outline: var(--focus); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 10px 16px; border: var(--keyline); border-radius: var(--r); background: var(--turmeric); color: #151515; font-weight: 800; box-shadow: 3px 3px 0 var(--ink); }
.toast[hidden] { display: none; }

/* Ads: collapse to nothing when off; labelled when on */
.ad-slot { margin: var(--s6) auto 0; text-align: center; }
.ad-slot[hidden] { display: none; }
.ad-slot::before { content: "Advertisement"; display: block; font-size: var(--t-xs); color: var(--ink-soft); margin-bottom: 4px; }

/* Footer */
.foot { margin-top: var(--s7); padding: var(--s6) var(--gutter) calc(var(--s6) + env(safe-area-inset-bottom)); border-top: var(--keyline); display: grid; gap: var(--s4); max-width: var(--max); margin-left: auto; margin-right: auto; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { font-weight: 600; text-underline-offset: 3px; }
.foot-free, .foot-name { color: var(--ink-soft); font-size: var(--t-sm); }
.foot-name { font: 400 1.2rem/1 var(--display); color: var(--ink); }

.muted { color: var(--ink-soft); }
.prose { max-width: 68ch; }
.prose p + p { margin-top: var(--s3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* Search sheet */
.search-head { display: flex; gap: var(--s2); align-items: center; }
.search-hint { margin: var(--s3) 0 var(--s2); font-weight: 600; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; padding-right: 6px; }

/* Large sheet label: a printed Play mark fills its free half on phones */
.label-play { display: none; }
.sheet .label-lg .label-play { display: inline-flex; grid-column: 2; align-self: end; justify-self: start; margin: 0 10px 10px; min-height: 36px; padding: 4px 14px; pointer-events: none; }
@media (min-width: 640px) { .sheet .label-lg .label-play { margin-top: 0; } }

/* Header categories on wide screens */
.top-cats { display: none; }
@media (min-width: 900px) {
  .top { gap: var(--s5); }
  .top-cats { display: flex; flex: 1; gap: 6px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
  .top-cats a { display: inline-flex; align-items: center; min-height: 36px; padding: 2px 10px 0; border: 2px solid transparent; border-radius: var(--r); font-weight: 800; text-decoration: none; white-space: nowrap; }
  .top-cats a[aria-current="page"] { border-color: var(--ink); background: var(--turmeric); color: #151515; }
}

/* Hover: a printed label lifts a little off its shadow (pointer devices only) */
@media (hover: hover) {
  .label:hover:not(:active), .btn:hover:not(:active), .icon-btn:hover:not(:active), .coll:hover:not(:active) { transform: translate(-1px, -1px); }
  .btn:hover:not(:active), .icon-btn:hover:not(:active) { box-shadow: 4px 4px 0 var(--ink); }
  .top-cats a:hover { border-color: var(--ink); }
  .foot a:hover, .band a:hover, .faq summary:hover { background: color-mix(in srgb, var(--turmeric) 35%, transparent); }
}

/* Sheets slide down on close */
.panel.closing { animation: sheet-out var(--sheet-out) both; }
@keyframes sheet-out { to { transform: translateY(24px); opacity: 0; } }

/* Round 2 decisions (.bunshin/decisions/round-2.md) */
/* 1. Filled ink bands mean "category" (and the Today label). Other section heads: Rozha with a printed double rule. */
h2.band:not(.band-cat) { display: block; width: fit-content; max-width: 100%; padding: 0 0 6px; background: none; color: var(--ink);
  border: 0; border-bottom: 4px double var(--ink); border-radius: 0; font: 400 var(--t-xl)/1.15 var(--display); }
.band-n { display: inline-block; margin-left: .45em; min-width: 1.7em; padding: 0 .3em; border: 1.5px solid currentColor; border-radius: 3px;
  font: 800 .78em/1.35 var(--ui); text-align: center; vertical-align: .1em; }
/* 4. Label titles in Rozha from 17px; small labels stay Mukta. */
.label-md .label-title { font: 400 1.08rem/1.15 var(--display); padding-top: 8px; }
/* 5. The stamp: ink only, inside the art, one size. */
.stamp { width: 58px; height: 58px; background: transparent; transform: rotate(-10deg); }
.stamp > span { width: 48px; height: 48px; }
.label .stamp { right: 10px; top: 10px; }
.stamp.land { animation-name: stamp-land-2; }
@keyframes stamp-land-2 { from { transform: scale(1.3) rotate(-8deg); opacity: 0; } to { transform: scale(1) rotate(-10deg); opacity: 1; } }
/* 6. The footer is a printed label. */
.foot { margin: var(--s7) var(--gutter) var(--s5); max-width: calc(var(--max) - 2 * var(--gutter)); border: var(--keyline); border-radius: var(--r);
  box-shadow: var(--off) var(--off) 0 var(--indigo); background: var(--label); padding: var(--s5) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom)); }
@media (min-width: 1232px) { .foot { margin-left: auto; margin-right: auto; } }
.foot-name { position: relative; isolation: isolate; width: fit-content; }
.foot-name::before { content: attr(data-twin) / ""; position: absolute; left: .06em; top: .06em; color: var(--vermilion); z-index: -1; }

/* Round 4 */
.stamp { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stamp { mix-blend-mode: normal; } }
:root[data-theme="dark"] .stamp { mix-blend-mode: normal; }
@media (min-width: 900px) and (max-width: 1199px) { .top-cats li:nth-child(n+8) { display: none; } }
.sheet .label-sm .label-title { font: 400 1.08rem/1.15 var(--display); padding-top: 8px; }
/* Section heads one step smaller than page titles, so the double rule reads as structure, not wallpaper */
h2.band:not(.band-cat) { font-size: var(--t-lg); }

/* Ad previews (local or ?ads=preview only): the real size of each slot */
/* Sample ads (local preview only): look like real display creatives, deliberately not in the house style */
.ad-preview .ad-box { position: relative; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 10px;
  padding: 18px; text-align: left; text-decoration: none; background: var(--a-bg); color: var(--a-fg); font-family: system-ui, sans-serif; overflow: hidden; box-sizing: border-box; }
.ad-preview .ad-box .ad-tag { position: absolute; top: 0; right: 0; z-index: 1; padding: 2px 6px; font-size: 10px; background: rgba(255,255,255,.85); color: #444; }
.ad-preview .ad-box .ad-brand { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.ad-preview .ad-box .ad-line { font-size: 22px; font-weight: 700; line-height: 1.15; }
.ad-preview .ad-box .ad-cta { padding: 9px 16px; border-radius: 3px; background: var(--a-btn); color: var(--a-bg); font-weight: 700; font-size: 14px; }
.ad-preview .ad-box.ad-tall { justify-content: flex-end; padding: 28px 22px; }
.ad-preview .ad-box.ad-tall .ad-line { font-size: 32px; }
.ad-preview .ad-box.ad-tall::before { content: ""; position: absolute; inset: 0 0 50% 0; background: radial-gradient(circle at 70% 40%, var(--a-btn) 0 28%, transparent 29%); opacity: .9; }
.ad-preview .ad-box.ad-sky { padding: 22px 12px; }
.ad-preview .ad-box.ad-sky .ad-line { font-size: 20px; }
.ad-preview .ad-box.ad-sky .ad-brand { font-size: 11px; }
.ad-preview .ad-box.ad-wide { flex-direction: row; align-items: center; padding: 10px 20px; gap: 18px; }
.ad-preview .ad-box.ad-wide .ad-line { font-size: 17px; flex: 1; }
.ad-preview .ad-box.ad-wide .ad-cta { flex: none; }
@media (max-width: 600px) { .ad-preview .ad-box.ad-wide { padding: 6px 10px; gap: 8px; } .ad-preview .ad-box.ad-wide .ad-brand { display: none; } .ad-preview .ad-box.ad-wide .ad-line { font-size: 13px; } .ad-preview .ad-box.ad-wide .ad-cta { padding: 6px 10px; font-size: 12px; } }

/* An ad among the game labels: the frame of a 2 by 2 label, always marked Advertisement. Takes no room until it is filled. */
.tile-ad { grid-column: span 2; grid-row: span 2; margin: 0; padding: 6px; display: grid; align-content: center; justify-items: center; align-self: start;
  border: var(--keyline); border-radius: var(--r); background: var(--label); box-shadow: var(--off) var(--off) 0 var(--ink-soft); overflow: hidden; }
.tile-ad[hidden] { display: none; }
/* Phone shelves scroll sideways in one row: no room for a 300x250 there (the home banners cover phones). */
@media (max-width: 899px) { .strip .tile-ad { display: none; } }

/* Footer: follow links and "Ask AI about us" (Admin, Pages and footer) */
.foot-social a { display: inline-block; padding: 2px 10px; border: 2px solid var(--ink); border-radius: var(--r); text-decoration: none; }
.foot-ai { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; font-size: var(--t-sm); }
.foot-ai span { color: var(--ink-soft); }

/* Install button in the header (shown only when the browser offers installing) */
.btn-install { min-height: 40px; padding: 0 12px; font-weight: 800; }
.btn-install[hidden] { display: none; }
@media (max-width: 420px) { .btn-install { padding: 0 8px; font-size: var(--t-sm); } }

/* Marks on a label, printed from real plays only (Hot this week, Most played): a small ink tag on the art, never a pill */
.label-mat { position: relative; }
.mark-tag { position: absolute; left: 0; top: 0; padding: 1px 7px 0; border: 2px solid var(--ink); border-radius: 0 0 var(--r) 0; background: var(--turmeric); color: #151515;
  font: 800 .68rem/1.5 var(--ui); text-transform: uppercase; letter-spacing: .03em; }
.mark-hot { background: var(--vermilion-d); color: #fff; }
/* The newsletter tick box (Me page, and after signing in on a game page) */
.news { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding-top: 8px; font-weight: 800; cursor: pointer; }
.news input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--indigo); flex: none; }
.news-hint { font-size: var(--t-sm); }
/* Desktop: the start sheet holds two full rows of small labels beside the large one */
@media (min-width: 1100px) { .sheet { grid-template-columns: repeat(8, 1fr); } }

.mark-new { background: var(--leaf-d); color: #fff; }
.today-push:empty { display: none; }
.today-push { margin-top: var(--s2); }
/* The site name is long: it steps down on narrow phones so the header stays on one line */
@media (max-width: 420px) { .mark { font-size: 1.22rem; } }
/* Wide screens: the longer name leaves room for every category */
@media (min-width: 900px) { .mark { font-size: 1.32rem; } .top-cats { gap: 2px; } .top-cats a { padding: 2px 8px 0; } }
@media (min-width: 900px) and (max-width: 1199px) { .top-cats li:nth-child(n+7) { display: none; } }
