/* 中文填字 landing page — 书卷墨色 (tokens from the app design system, spec §9) */

:root {
  --bg: #F3EEE3;
  --surface: #FBF8F1;
  --text: #2B2622;
  --muted: #6E655B;
  --line: #D8CFBE;
  --accent: #B5432E;
  --accent-soft: #E8BEB2;
  --cell-border: #C9BFAE;
  --cell-blocked: #3A3532;
  --cell-selected: #EFE3C6;
  --cell-confirmed: #E6DEC9;
  --pending: #9A8F84;
  --ink: #2B2622;
  --ink-2: #3A3532;
  --paper-on-ink: #F3EEE3;
  --muted-on-ink: #BEB2A0;

  --brush: "Ma Shan Zheng", "STKaiti", "KaiTi", serif;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;

  --wrap: 1120px;
  --gutter: 20px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- top bar ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { border-radius: 8px; }
.brand span { font-family: var(--brush); font-size: 24px; line-height: 1; padding-top: 2px; }
.top-nav { display: flex; align-items: center; gap: 22px; font-family: var(--serif); font-size: 15px; }
.top-nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.top-nav a:hover { color: var(--text); }
.top-nav .top-cta {
  color: var(--surface);
  background: var(--accent);
  padding: 6px 16px;
  border-radius: 999px;
}
.top-nav .top-cta:hover { color: var(--surface); filter: brightness(.92); }

/* ---------- hero ---------- */

.hero {
  position: relative;
  padding: 72px 0 96px;
  isolation: isolate;
}
.hero::before {
  /* faint crossword ruling, fading out from the board side */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--cell-border) 45%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--cell-border) 45%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 78% 45%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 80% at 78% 45%, #000 10%, transparent 70%);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 56px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--serif);
  font-size: 17px;
  letter-spacing: .12em;
  color: var(--accent);
}
.kicker::before { content: ""; width: 36px; height: 2px; background: currentColor; }

.title {
  font-family: var(--brush);
  font-weight: 400;
  font-size: clamp(96px, 13vw, 176px);
  line-height: .98;
  letter-spacing: .02em;
  margin: 18px 0 26px -6px;
}
.lede {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 2.1vw, 24px);
  line-height: 1.65;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 26px 0 34px;
}
.tags li {
  font-family: var(--serif);
  font-size: 15px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}
.tags li:last-child { border-color: var(--accent); color: var(--accent); }

.stores { display: flex; flex-wrap: wrap; gap: 12px; }
.store {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 172px;
  padding: 10px 20px 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper-on-ink);
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, background .2s;
}
.store svg { width: 26px; height: 26px; fill: currentColor; flex: none; }
.store span { display: flex; flex-direction: column; font-family: var(--serif); font-size: 19px; font-weight: 700; line-height: 1.15; }
.store small { font-size: 11px; font-weight: 500; letter-spacing: .08em; color: var(--muted-on-ink); }
.store:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(43, 38, 34, .6); background: #1f1b18; }
.store:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- mini board ---------- */

.board-card {
  position: relative;
  justify-self: center;
  width: min(100%, 440px);
  margin: 0;
  padding: 22px 22px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow:
    0 1px 0 var(--line),
    0 30px 60px -30px rgba(43, 38, 34, .45),
    0 12px 24px -16px rgba(43, 38, 34, .25);
  transform: rotate(-1.5deg);
}
.seal {
  position: absolute;
  top: -26px;
  right: -22px;
  width: 78px;
  height: 78px;
  display: grid;
  place-content: center;
  gap: 0;
  background: var(--accent);
  color: var(--surface);
  border-radius: 7px;
  outline: 2px solid var(--surface);
  outline-offset: -7px;
  font-family: var(--brush);
  font-size: 25px;
  line-height: 1.05;
  text-align: center;
  z-index: 2;
  transform: rotate(9deg);
  box-shadow: 0 8px 18px -8px rgba(181, 67, 46, .7);
}

.board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--cell-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--cell-border);
  gap: 1px;
}
.board i {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-style: normal;
}
.board .b { background: var(--cell-blocked); }
.board .c { background: var(--surface); }
.board .h { background: var(--cell-confirmed); }
.board .n { background: var(--cell-confirmed); }
.board .c b {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(20px, 5vw, 30px);
  line-height: 1;
}
.board em {
  position: absolute;
  top: 3px;
  left: 5px;
  font-family: var(--serif);
  font-style: normal;
  font-size: 11px;
  line-height: 1;
  color: var(--pending);
}
.board .t { background: var(--cell-selected); }

.clue {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
}
.clue-no {
  flex: none;
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--surface);
}
.blank { white-space: nowrap; }
.bl { position: relative; display: inline-block; width: 1em; text-align: center; }
.bl::before { content: "□"; color: var(--accent); }
.bl::after {
  content: attr(data-ch);
  position: absolute;
  inset: 0;
  color: var(--accent);
  opacity: 0;
}

.keys {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 14px;
}
.keys kbd {
  width: 34px;
  height: 40px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
}

/* typing loop: J → 家, S → 书, both confirm, reset (9s) */
.t1 { animation: cell1 9s infinite; }
.t2 { animation: cell2 9s infinite; }
.t1 b { animation: glyph1 9s infinite; }
.t2 b { animation: glyph2 9s infinite; }
.k-j { animation: keyj 9s infinite; }
.k-s { animation: keys 9s infinite; }
.bl1::after { animation: glyph1 9s infinite; }
.bl2::after { animation: glyph2 9s infinite; }
.bl1::before { animation: blank1 9s infinite; }
.bl2::before { animation: blank2 9s infinite; }

@keyframes cell1 {
  0%, 24%   { box-shadow: inset 0 0 0 2px var(--accent); background: var(--cell-selected); }
  26%, 48%  { box-shadow: none; background: var(--cell-selected); }
  52%, 90%  { box-shadow: none; background: var(--cell-confirmed); }
  96%, 100% { box-shadow: inset 0 0 0 2px var(--accent); background: var(--cell-selected); }
}
@keyframes cell2 {
  0%, 24%   { box-shadow: none; background: var(--cell-selected); }
  26%, 48%  { box-shadow: inset 0 0 0 2px var(--accent); background: var(--cell-selected); }
  52%, 90%  { box-shadow: none; background: var(--cell-confirmed); }
  96%, 100% { box-shadow: none; background: var(--cell-selected); }
}
@keyframes glyph1 {
  0%, 16%   { opacity: 0; transform: scale(.55); }
  20%, 90%  { opacity: 1; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes glyph2 {
  0%, 38%   { opacity: 0; transform: scale(.55); }
  42%, 90%  { opacity: 1; transform: scale(1); }
  96%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes blank1 { 0%, 16% { opacity: 1; } 20%, 90% { opacity: 0; } 96%, 100% { opacity: 1; } }
@keyframes blank2 { 0%, 38% { opacity: 1; } 42%, 90% { opacity: 0; } 96%, 100% { opacity: 1; } }
@keyframes keyj {
  0%, 11%, 19%, 100% { background: var(--bg); color: var(--text); border-color: var(--line); transform: none; }
  13%, 17%           { background: var(--accent); color: var(--surface); border-color: var(--accent); transform: translateY(1px); }
}
@keyframes keys {
  0%, 33%, 41%, 100% { background: var(--bg); color: var(--text); border-color: var(--line); transform: none; }
  35%, 39%           { background: var(--accent); color: var(--surface); border-color: var(--accent); transform: translateY(1px); }
}

/* ---------- section heads ---------- */

.sec-head { margin-bottom: 44px; }
.sec-kicker {
  font-family: var(--brush);
  font-size: 22px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 10px;
}
.sec-head h2, .scroll-head h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 3.6vw, 40px);
  line-height: 1.25;
  letter-spacing: .02em;
}
.sec-sub { margin-top: 10px; color: var(--muted); font-family: var(--serif); font-size: 17px; }

/* ---------- packs ---------- */

.packs { padding: 88px 0 104px; border-top: 1px solid var(--line); }
.pack-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 2px solid var(--ink);
}
.pack {
  padding: 26px 24px 8px;
  border-right: 1px solid var(--line);
  transition: background .25s;
}
.pack:first-child { padding-left: 0; }
.pack:last-child { border-right: 0; }
.pack-num {
  display: block;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(46px, 5.4vw, 64px);
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: lining-nums;
}
.pack:first-child .pack-num { color: var(--accent); }
.pack-num small { font-size: .32em; font-weight: 500; margin-left: 4px; color: var(--muted); letter-spacing: 0; }
.pack h3 { margin: 18px 0 8px; font-family: var(--serif); font-size: 21px; }
.pack p { color: var(--muted); font-size: 15px; }

/* ---------- screenshot handscroll ---------- */

.scroll {
  background: var(--ink);
  color: var(--paper-on-ink);
  padding: 88px 0 96px;
  position: relative;
}
.scroll-head { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 18px; margin-bottom: 40px; }
.scroll-head .sec-kicker { width: 100%; }
.scroll-head .sec-sub { color: var(--muted-on-ink); margin: 0; font-size: 15px; }
.scroll-head .sec-sub::after { content: " →"; }

.reel {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 6px max(var(--gutter), calc((100vw - var(--wrap)) / 2)) 26px;
  scroll-padding-inline: max(var(--gutter), calc((100vw - var(--wrap)) / 2));
  scrollbar-width: thin;
  scrollbar-color: #5a524b transparent;
  outline: none;
}
.reel::-webkit-scrollbar { height: 6px; }
.reel::-webkit-scrollbar-thumb { background: #5a524b; border-radius: 3px; }
.reel img {
  flex: none;
  width: auto;
  height: min(560px, 64vh);
  aspect-ratio: 600 / 1300;
  border-radius: 18px;
  scroll-snap-align: start;
  box-shadow: 0 0 0 1px rgba(243, 238, 227, .08), 0 24px 40px -24px rgba(0, 0, 0, .8);
  transition: transform .3s ease;
}
.reel img:hover { transform: translateY(-4px); }

/* ---------- features ---------- */

.feats { padding: 96px 0 88px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.feat {
  padding: 28px 26px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 0 var(--line);
}
.feat-glyph {
  display: inline-grid;
  grid-template-columns: 52px 52px;
  gap: 1px;
  margin-bottom: 22px;
  border: 1px solid var(--cell-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--cell-border);
  font-family: var(--serif);
  font-size: 24px;
  line-height: 52px;
  text-align: center;
}
.feat-glyph i { font-style: normal; background: var(--surface); color: var(--pending); }
.feat-glyph span { background: var(--cell-confirmed); color: var(--text); box-shadow: inset 0 0 0 2px var(--accent); }
.feat h3 { font-family: var(--serif); font-size: 20px; margin-bottom: 10px; }
.feat p { color: var(--muted); font-size: 15px; }

/* ---------- closing ---------- */

.closing {
  position: relative;
  padding: 96px 0 112px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
}
.closing::before {
  content: "字";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  font-family: var(--brush);
  font-size: 420px;
  line-height: 1;
  color: color-mix(in srgb, var(--line) 55%, transparent);
  pointer-events: none;
}
.closing-line {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(19px, 2.4vw, 25px);
  line-height: 1.8;
  margin-bottom: 36px;
}
.closing .stores { justify-content: center; }

/* ---------- footer ---------- */

.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--muted); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot-links a { text-decoration: none; }
.foot-links a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- entrance ---------- */

.rise { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--d, 0) * 90ms + 60ms); }
.board-card.rise { animation-name: rise-tilt; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes rise-tilt { from { opacity: 0; transform: translateY(24px) rotate(-1.5deg); } to { opacity: 1; transform: rotate(-1.5deg); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rise { animation: none; }
  .board-card.rise { animation: none; transform: rotate(-1.5deg); }
  .t1, .t2, .t1 b, .t2 b, .k-j, .k-s, .bl::before, .bl::after { animation: none; }
  .t1, .t2 { background: var(--cell-confirmed); }
  .bl::before { opacity: 0; }
  .bl::after { opacity: 1; }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero { padding: 40px 0 72px; }
  .hero-grid { grid-template-columns: 1fr; gap: 56px; }
  .hero::before {
    -webkit-mask-image: radial-gradient(ellipse 90% 50% at 50% 75%, #000 10%, transparent 70%);
    mask-image: radial-gradient(ellipse 90% 50% at 50% 75%, #000 10%, transparent 70%);
  }
  .pack-list { grid-template-columns: repeat(2, 1fr); }
  .pack { padding: 24px 18px 22px; border-bottom: 1px solid var(--line); }
  .pack:first-child { padding-left: 18px; }
  .pack:nth-child(odd) { padding-left: 0; }
  .pack:nth-child(2n) { border-right: 0; }
  .pack:nth-child(n+3) { border-bottom: 0; }
  .feat-grid { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 560px) {
  :root { --gutter: 16px; }
  .top-nav a:not(.top-cta) { display: none; }
  .title { margin-bottom: 20px; }
  .stores { flex-direction: column; align-items: stretch; }
  .store { justify-content: center; }
  .board-card { padding: 16px 14px 14px; transform: none; }
  .board-card.rise { animation-name: rise; }
  .seal { width: 64px; height: 64px; font-size: 21px; top: -20px; right: -6px; }
  .keys kbd { width: 28px; height: 36px; font-size: 15px; }
  .clue { font-size: 15px; }
  .packs, .feats { padding: 64px 0 72px; }
  .pack h3 { font-size: 18px; }
  .scroll { padding: 64px 0 72px; }
  .reel { gap: 14px; }
  .reel img { height: 440px; border-radius: 14px; }
  .closing { padding: 72px 0 88px; }
  .closing::before { font-size: 300px; }
  .closing-line br { display: none; }
}

/* ---------- 简繁切换 + Traditional overrides ---------- */

.top-right { display: flex; align-items: center; gap: 18px; }
.lang {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1;
}
.lang a {
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s, background .2s;
}
.lang a:hover { color: var(--text); }
.lang a[aria-current] { background: var(--ink); color: var(--paper-on-ink); }
.lang a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

html[lang="zh-Hant"] {
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans CJK TC", sans-serif;
}
/* Ma Shan Zheng has no 無/廣 — set the seal in serif on the Traditional page */
html[lang="zh-Hant"] .seal { font-family: var(--serif); font-weight: 700; font-size: 21px; line-height: 1.15; }

@media (max-width: 560px) {
  .top-right { gap: 10px; }
  html[lang="zh-Hant"] .seal { font-size: 17px; }
}
