/* One More Gambit — 配色取自游戏：夜色护城河、城堡石材、火把青光、王冠金、秘法紫、羊皮纸 */
:root {
  --moat: #0b2330;
  --moat-deep: #071820;
  --moat-lit: #123444;
  --stone: #2e4152;
  --stone-hi: #4d6577;
  --stone-lo: #172431;
  --torch: #67e8e3;
  --gold: #f2b234;
  --gold-hi: #ffd774;
  --arcane: #6c5fb6;
  --parch: #efe3c4;
  --parch-dim: #b7b39f;
  --ink: #1a1410;
  --red: #c8352a;

  --px: "Fusion Pixel 12px Proportional Simplified Chinese", "Segoe UI", system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --wrap: 1180px;
  --u: 6px;            /* 像素网格单位 */
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--moat);
  color: var(--parch);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
html:lang(zh-Hans) body { font-size: 16px; line-height: 1.8; }

img { display: block; max-width: 100%; height: auto; }
a { color: var(--torch); text-underline-offset: 3px; }
a:hover { color: #a6fff9; }
:focus-visible { outline: 3px solid var(--torch); outline-offset: 3px; }

.wrap { width: min(var(--wrap), 100% - 48px); margin-inline: auto; }

/* 像素字体只用整倍字号：12 的倍数才清晰 */
.px { font-family: var(--px); font-weight: 400; letter-spacing: 0; -webkit-font-smoothing: none; font-smooth: never; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h1.px { font-size: 48px; line-height: 60px; }
h2.px { font-size: 36px; line-height: 48px; }
h3.px { font-size: 24px; line-height: 36px; }

.skip { position: absolute; left: 12px; top: -60px; background: var(--gold); color: var(--ink); padding: 8px 14px; z-index: 50; }
.skip:focus { top: 12px; }

/* ---------- 顶栏 ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgb(7 24 32 / .88); backdrop-filter: blur(6px); border-bottom: 3px solid var(--stone-lo); }
.top-row { display: flex; align-items: center; gap: 28px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--parch); text-decoration: none; font-family: var(--px); font-size: 24px; line-height: 1; -webkit-font-smoothing: none; }
.brand:hover { color: var(--gold-hi); }
.brand-mark { width: 32px; height: 32px; image-rendering: pixelated; }
.nav { display: flex; gap: 24px; margin-left: auto; }
.nav a { color: var(--parch-dim); text-decoration: none; font-size: 15px; }
.nav a:hover { color: var(--parch); }
.lang { display: flex; border: 2px solid var(--stone-hi); }
.lang button { appearance: none; border: 0; background: transparent; color: var(--parch-dim); font: 600 14px/1 var(--sans); padding: 9px 12px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--stone-hi); color: var(--parch); }

/* ---------- 按钮：直接用游戏里的九宫格切图 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 0 10px;
  border-style: solid; border-width: 15px; border-image-slice: 5 fill; border-image-width: 15px;
  image-rendering: pixelated;
  font-family: var(--px); font-size: 24px; line-height: 1; -webkit-font-smoothing: none;
  text-decoration: none; cursor: pointer; background: none;
  text-shadow: 0 3px 0 rgb(0 0 0 / .35);
}
.btn-gold { border-image-source: url(../ui/button-primary.png); color: #fff8e2; }
.btn-gold:hover { border-image-source: url(../ui/button-primary-hover.png); color: #fff; }
.btn-gold:active { border-image-source: url(../ui/button-primary-pressed.png); }
.btn-arcane { border-image-source: url(../ui/button-secondary.png); color: #f2eeff; }
.btn-arcane:hover { border-image-source: url(../ui/button-secondary-hover.png); color: #fff; }
.btn-arcane:active { border-image-source: url(../ui/button-secondary-pressed.png); }
.btn:disabled { border-image-source: url(../ui/button-disabled.png); color: #a6a2b8; cursor: not-allowed; text-shadow: none; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.actions.small { margin-top: 18px; }
.actions.small .btn { font-size: 24px; min-height: 48px; border-width: 12px; border-image-width: 12px; }

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  padding: 84px 0 96px;
  background:
    radial-gradient(60% 70% at 78% 40%, rgb(103 232 227 / .10), transparent 70%),
    linear-gradient(var(--moat-deep), var(--moat) 60%);
  overflow: hidden;
}
/* 水面像素波纹 */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(90deg, transparent 0 12px, rgb(103 232 227 / .22) 12px 30px, transparent 30px),
    linear-gradient(90deg, transparent 0 66px, rgb(103 232 227 / .14) 66px 78px, transparent 78px);
  background-size: 168px 6px, 120px 6px;
  background-position: 0 0, 40px 0;
  mask-image: repeating-linear-gradient(transparent 0 66px, #000 66px 72px, transparent 72px 138px);
}
.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 64px; align-items: center; }
.hero-copy h1 { color: #fff6dc; text-shadow: 0 4px 0 #04121a; }
.lede { max-width: 34em; margin: 24px 0 0; color: var(--parch-dim); font-size: 19px; }
html:lang(zh-Hans) .lede { font-size: 17px; }

/* 21 点小桌：石框面板 */
.table { margin: 0; }
.table figcaption { margin-bottom: 18px; }
.table-title { font-size: 24px !important; line-height: 36px !important; color: var(--gold-hi); }
.table figcaption p { margin: 6px 0 0; color: var(--parch-dim); font-size: 15px; max-width: 42em; }

.felt {
  position: relative;
  padding: 24px 24px 26px;
  background:
    radial-gradient(90% 70% at 50% 30%, #2a3e3c, #172826 80%);
  /* 像素石框：三层硬边 */
  box-shadow:
    0 0 0 3px #0b141b,
    0 0 0 9px var(--stone),
    0 0 0 12px #0b141b,
    inset 0 3px 0 rgb(255 255 255 / .06),
    0 18px 0 6px rgb(0 0 0 / .25);
  margin: 12px;
}
.felt[data-state="perfect"] { box-shadow: 0 0 0 3px #0b141b, 0 0 0 9px var(--gold), 0 0 0 12px #0b141b, 0 0 40px 12px rgb(242 178 52 / .35); }
.felt[data-state="bust"] { box-shadow: 0 0 0 3px #0b141b, 0 0 0 9px #7a2a24, 0 0 0 12px #0b141b; }

.hand { list-style: none; margin: 0; padding: 0 0 0 0; display: flex; min-height: 240px; align-items: flex-end; }
.card {
  --s: 2;
  position: relative; flex: none;
  width: calc(92px * var(--s)); height: calc(120px * var(--s));
  margin-right: calc(-56px * var(--s));
  background: url(../ui/card-base.png) 0 0 / 100% 100%;
  image-rendering: pixelated;
  filter: drop-shadow(6px 6px 0 rgb(0 0 0 / .35));
  transform: rotate(calc((var(--i, 0) - 2) * 2deg));
}
.card::after { content: ""; position: absolute; inset: 0; background: url(../ui/frame-white.png) 0 0 / 100% 100%; image-rendering: pixelated; }
.card.q-blue::after { background-image: url(../ui/frame-blue.png); }
.card.q-purple::after { background-image: url(../ui/frame-purple.png); }
.card.q-orange::after { background-image: url(../ui/frame-orange.png); }
.card.q-rainbow::after { background-image: url(../ui/frame-rainbow.png); }
.card .rank {
  position: absolute; left: calc(5px * var(--s)); top: calc(5px * var(--s)); z-index: 1;
  width: calc(43px * var(--s)); height: calc(21px * var(--s));
  display: grid; place-items: center;
  background: url(../ui/rank-back.png) 0 0 / 100% 100%;
  color: var(--ink); font-size: 24px; line-height: 1;
}
.card.red .rank, .card.red .pip { color: var(--red); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 12px; font: 96px/1 var(--px); -webkit-font-smoothing: none; color: #e8dcc0; text-shadow: 0 6px 0 rgb(0 0 0 / .4); }
.card.red .pip { color: #e0574a; }
.card .cost { position: absolute; right: calc(8px * var(--s)); bottom: calc(6px * var(--s)); z-index: 1; color: var(--gold-hi); font-size: 24px; line-height: 1; }
.card.dealt { animation: deal .32s steps(6) both; }
@keyframes deal { from { transform: translate(120px, -60px) rotate(16deg); opacity: 0; } }

.meter { position: relative; height: 18px; margin-top: 26px; background: #0b141b; box-shadow: inset 0 0 0 3px #0b141b, 0 0 0 3px var(--stone-lo); }
.meter-fill { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 18px, var(--gold-hi) 18px 21px); transition: width .25s steps(6); }
.felt[data-state="bust"] .meter-fill { background: repeating-linear-gradient(90deg, #c8352a 0 18px, #e8634f 18px 21px); }
.total { margin: 14px 0 0; font-size: 24px; line-height: 36px; color: var(--parch-dim); }
.total b { font-weight: 400; font-size: 48px; color: #fff6dc; }
.felt[data-state="perfect"] .total b { color: var(--gold-hi); }
.felt[data-state="bust"] .total b { color: #ff8f7d; }
.verdict { margin: 4px 0 0; min-height: 3.3em; color: var(--parch); font-size: 15px; }

/* ---------- 游戏 ---------- */
.game { padding: 96px 0 90px; background: var(--moat-deep); }
.shot { position: relative; margin: 0 12px; box-shadow: 0 0 0 3px #04121a, 0 0 0 12px var(--stone), 0 0 0 15px #04121a, 0 24px 60px rgb(0 0 0 / .5); }
.shot img { width: 100%; image-rendering: auto; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 64px; margin-top: 60px; align-items: start; }
.game-grid p { max-width: 38em; margin: 0 0 16px; color: var(--parch-dim); }
.status { color: var(--torch) !important; font-size: 15px; margin-bottom: 6px !important; }
.game-name { font-size: 48px !important; line-height: 60px !important; color: var(--gold-hi); margin-bottom: 18px !important; text-shadow: 0 4px 0 #04121a; }
.facts { margin: 0; border-top: 3px solid var(--stone); }
.facts div { padding: 14px 0; border-bottom: 3px solid var(--stone-lo); }
.facts dt { color: var(--parch-dim); font-size: 14px; }
.facts dd { margin: 2px 0 0; color: var(--parch); }

/* ---------- 一轮怎么玩 ---------- */
.round { padding: 90px 0; }
.steps { list-style: none; counter-reset: step; margin: 36px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px; }
.steps li { counter-increment: step; position: relative; padding-top: 72px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 54px; height: 54px; display: grid; place-items: center;
  font-family: var(--px); font-size: 36px; line-height: 1; color: var(--ink); -webkit-font-smoothing: none;
  background: var(--gold);
  box-shadow: inset -6px -6px 0 #b8781d, inset 6px 6px 0 var(--gold-hi), 0 0 0 3px #04121a;
}
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 66px; right: -36px; top: 24px; height: 6px; background: repeating-linear-gradient(90deg, var(--stone-hi) 0 12px, transparent 12px 24px); }
.steps h3 { color: #fff6dc; }
.steps p { margin: 8px 0 0; color: var(--parch-dim); }

/* ---------- 联系 ---------- */
.contact { padding: 90px 0 100px; background: var(--moat-deep); }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 620px); gap: 64px; align-items: start; }
.contact-grid p { color: var(--parch-dim); max-width: 30em; margin: 16px 0 0; }
.mails { list-style: none; margin: 0; padding: 0; border-top: 3px solid var(--stone); }
.mails li { display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 18px 0; border-bottom: 3px solid var(--stone-lo); }
.who { color: var(--parch-dim); font-size: 15px; }
.mails a { font-size: 17px; overflow-wrap: anywhere; }
.copy { appearance: none; border: 2px solid var(--stone-hi); background: transparent; color: var(--parch); font: 600 14px/1 var(--sans); padding: 9px 14px; cursor: pointer; }
.copy:hover { background: var(--stone); }

/* ---------- 页脚、提示 ---------- */
.foot { padding: 28px 0 40px; border-top: 3px solid var(--stone-lo); color: var(--parch-dim); font-size: 14px; }
.foot-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60; background: var(--parch); color: var(--ink); padding: 12px 20px; font-size: 15px; box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px rgb(0 0 0 / .35); }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .hero-grid, .game-grid, .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero { padding: 56px 0 72px; }
  .steps { grid-template-columns: 1fr; gap: 36px; }
  .steps li:not(:last-child)::after { display: none; }
}
@media (max-width: 640px) {
  .wrap { width: min(var(--wrap), 100% - 32px); }
  .nav { display: none; }
  .lang { margin-left: auto; }
  .brand { font-size: 24px; }
  h1.px { font-size: 36px; line-height: 48px; }
  h2.px:not(.table-title), .game-name { font-size: 36px !important; line-height: 48px !important; }
  .card { --s: 1.5; }
  .card .pip { font-size: 72px; }
  .hand { min-height: 180px; }
  .felt { padding: 18px 16px 20px; }
  .mails li { grid-template-columns: minmax(0, 1fr) auto; }
  .who { grid-column: 1 / -1; }
  .shot { margin: 0 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .card.dealt { animation: none; }
  .meter-fill { transition: none; }
}
