/* 猜拳 — a jade table, bone cards, one vermilion accent. Phone first; the CA rail hangs on the side at every width. */
:root {
  --jade: #5f7d76; --jade-deep: #4b665f; --jade-line: #6f8d86;
  --bone: #f3eee2; --bone-2: #e6dfcf; --ink: #15201e; --ink-2: #3c4a47;
  --verm: #ff5b3a; --back: #1e2b29; --mute: #c9d6d1;
  --cjk: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --disp: "ZCOOL QingKe HuangYou", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --railw: 50px;
}
* { box-sizing: border-box; }
html { background: var(--jade); }
body {
  margin: 0; background: var(--jade); color: var(--bone); font: 400 15px/1.55 var(--cjk);
  padding: 0 calc(var(--railw) + 10px) 0 14px; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; cursor: pointer; }
a { color: inherit; }
.cq-mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.cq-dim { opacity: .6; font-weight: 400; }
.cq-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- the CA rail: fixed to the right edge, the address set vertically ---------- */
.cq-rail {
  position: fixed; z-index: 30; right: 6px; top: 50%; transform: translateY(-50%);
  width: var(--railw); display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 10px 0; background: var(--back); color: var(--bone); border-radius: 26px;
  box-shadow: 0 10px 28px rgba(10, 20, 18, .45), inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.cq-rail-k { writing-mode: vertical-rl; font-size: 11px; letter-spacing: .3em; color: var(--verm); font-weight: 700; }
.cq-rail-addr {
  writing-mode: vertical-rl; font: 500 11.5px/1 var(--mono); letter-spacing: .02em; user-select: all;
  color: var(--bone); max-height: 340px; word-break: break-all;
}
.cq-rail-addr[data-live="0"] { font-family: var(--cjk); letter-spacing: .15em; color: var(--mute); }
.cq-rail-copy {
  writing-mode: vertical-rl; border: 0; border-radius: 16px; padding: 10px 6px; background: var(--verm); color: #fff;
  font-weight: 700; font-size: 13px; letter-spacing: .2em;
}
.cq-rail-copy:disabled { background: #3a4a47; color: var(--mute); cursor: default; }
.cq-rail-copy[data-done="1"] { background: var(--bone); color: var(--ink); }
.cq-rail-gmgn { writing-mode: vertical-rl; font: 500 10px var(--mono); color: var(--mute); text-decoration: none; letter-spacing: .1em; }

/* ---------- mast ---------- */
.cq-room { max-width: 1200px; margin: 0 auto; }
.cq-felt { padding-top: 14px; }
.cq-mast { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.cq-name { margin: 0; font: 400 34px/1 var(--disp); letter-spacing: .06em; color: var(--bone); }
.cq-tick { font: 500 12px var(--mono); color: var(--mute); }
.cq-tbl { margin-left: auto; font-weight: 700; font-size: 13px; }
.cq-phase { font: 500 12px var(--mono); padding: 3px 9px; border-radius: 999px; background: var(--back); color: var(--bone); }
.cq-phase[data-stage="throw"] { background: var(--verm); color: #fff; }
.cq-phase[data-stage="show"] { background: var(--bone); color: var(--ink); }

/* ---------- the sweep: who took the last table ---------- */
.cq-sweep {
  margin-top: 12px; display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; align-items: center;
  padding: 12px 14px; border-radius: 18px; background: var(--bone); color: var(--ink);
  box-shadow: 0 14px 26px -12px rgba(10, 20, 18, .5);
}
.cq-sweep-win {
  width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; color: var(--verm);
  background: linear-gradient(145deg, #fff, var(--bone-2)); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .08), 0 6px 12px rgba(0, 0, 0, .15);
}
.cq-sweep-win .cq-g { width: 44px; height: 44px; }
.cq-sweep-txt { display: flex; flex-direction: column; min-width: 0; }
.cq-sweep-kick { font-size: 12px; color: var(--ink-2); }
.cq-sweep-head { font: 900 20px/1.25 var(--cjk); }
.cq-sweep-head em { font-style: normal; color: var(--verm); }
.cq-sweep-sub { font-size: 12.5px; color: var(--ink-2); }
.cq-sweep-pile { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cq-sweep-pile:empty { display: none; }
.cq-mini { width: 26px; height: 34px; border-radius: 6px; display: grid; place-items: center; background: #fff; color: var(--ink); box-shadow: 0 2px 4px rgba(0, 0, 0, .18); }
.cq-mini .cq-g { width: 18px; height: 18px; }
.cq-mini.won { background: var(--verm); color: #fff; }
.cq-mini.lost { opacity: .45; transform: rotate(-8deg); }
.cq-mini.seal { background: var(--back); color: var(--verm); font-size: 11px; font-weight: 900; }
.cq-arrow { font-weight: 900; color: var(--verm); padding: 0 4px; }
.cq-sweep.flash { animation: cqflash 1.2s ease; }
@keyframes cqflash { 0% { box-shadow: 0 0 0 0 var(--verm); } 40% { box-shadow: 0 0 0 8px rgba(255, 91, 58, .35); } 100% { box-shadow: 0 14px 26px -12px rgba(10, 20, 18, .5); } }

/* ---------- the table: a stack of hand cards in 3D ---------- */
.cq-deck {
  margin-top: 14px; padding: 18px 12px 14px; border-radius: 24px;
  background: radial-gradient(120% 90% at 50% 0%, var(--jade-line), var(--jade-deep) 70%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .12), inset 0 -18px 30px rgba(0, 0, 0, .18);
  perspective: 900px;
}
.cq-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 10px; transform: rotateX(14deg); transform-origin: 50% 100%;
}
.cq-card { position: relative; aspect-ratio: 5 / 7; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2, .8, .2, 1); }
.cq-card .f, .cq-card .b {
  position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 10px 14px -6px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.cq-card .b {
  background:
    repeating-linear-gradient(45deg, rgba(255, 91, 58, .22) 0 3px, transparent 3px 9px),
    repeating-linear-gradient(-45deg, rgba(255, 91, 58, .22) 0 3px, transparent 3px 9px), var(--back);
  color: var(--bone);
}
.cq-card .b i { font-style: normal; font: 400 22px var(--disp); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--verm); color: #fff; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.cq-card .f { background: linear-gradient(160deg, #fff, var(--bone) 55%, var(--bone-2)); color: var(--ink); transform: rotateY(180deg); }
.cq-card .f .cq-g { width: 56%; height: auto; aspect-ratio: 1; }
.cq-card .f b { font-size: 12px; }
.cq-card .who { font: 500 9.5px var(--mono); opacity: .75; }
.cq-card.up { transform: rotateY(180deg); }
.cq-card.win { transform: rotateY(180deg) translateZ(30px) translateY(-6px); }
.cq-card.win .f { box-shadow: 0 0 0 3px var(--verm), 0 18px 22px -8px rgba(0, 0, 0, .55); }
.cq-card.win .f .cq-g { color: var(--verm); }
.cq-card.lose { transform: rotateY(180deg) translateY(10px) scale(.9); opacity: .5; }
.cq-card.lose .f::after { content: "被扫走"; position: absolute; bottom: 8%; font-size: 10px; font-weight: 900; color: #fff; background: var(--ink); padding: 1px 6px; border-radius: 4px; }
.cq-card.me .b, .cq-card.me .f { box-shadow: 0 0 0 2px var(--bone), 0 10px 14px -6px rgba(0, 0, 0, .45); }
.cq-card.slot { border: 2px dashed rgba(243, 238, 226, .35); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: rgba(243, 238, 226, .55); font: 500 12px var(--mono); }
.cq-card.slot.next { border-color: var(--verm); color: var(--bone); background: rgba(255, 91, 58, .12); animation: cqbreath 1.8s ease-in-out infinite; font-family: var(--cjk); font-weight: 700; text-align: center; padding: 4px; line-height: 1.3; }
@keyframes cqbreath { 50% { box-shadow: 0 0 0 6px rgba(255, 91, 58, .18); } }
.cq-card.more { display: grid; place-items: center; border-radius: 10px; background: rgba(0, 0, 0, .18); color: var(--bone); font-weight: 700; }
.cq-live { margin: 16px 2px 0; font-size: 15px; line-height: 1.6; color: var(--bone); }
.cq-live b { color: #fff; font-weight: 900; background: rgba(255, 91, 58, .85); padding: 0 5px; border-radius: 4px; }

/* ---------- the action ---------- */
.cq-act { margin-top: 14px; padding: 14px; border-radius: 20px; background: var(--back); }
.cq-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cq-pk {
  border: 0; border-radius: 14px; padding: 10px 4px 8px; background: #2c3b38; color: var(--bone);
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-weight: 700;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .3); transition: transform .15s, background .15s;
}
.cq-pk .cq-g { width: 36px; height: 36px; }
.cq-pk[aria-checked="true"] { background: var(--bone); color: var(--ink); transform: translateY(-3px); box-shadow: 0 0 0 3px var(--verm); }
.cq-pk:disabled { opacity: .45; cursor: default; }
.cq-go {
  margin-top: 12px; width: 100%; border: 0; border-radius: 16px; padding: 15px; font-weight: 900; font-size: 16px;
  background: var(--verm); color: #fff; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .2);
}
.cq-go:disabled { background: #3a4a47; color: var(--mute); cursor: default; box-shadow: none; }
.cq-act-foot { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--mute); }
.cq-who { border: 1px solid rgba(243, 238, 226, .3); background: transparent; color: var(--bone); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; }
.cq-claim { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--bone); color: var(--ink); font-weight: 700; }

/* ---------- side column: tape, past tables, rules ---------- */
.cq-side { margin-top: 16px; display: flex; flex-direction: column; gap: 14px; }
.cq-side > section { background: var(--bone); color: var(--ink); border-radius: 18px; padding: 14px; }
.cq-h { margin: 0 0 8px; font: 900 15px var(--cjk); }
.cq-tape { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.cq-tape li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 6px 0; border-top: 1px dashed #d4ccb9; font-size: 13px; line-height: 1.45; }
.cq-tape li:first-child { border-top: 0; }
.cq-tape .t-at { font: 500 11px var(--mono); color: var(--ink-2); padding-top: 2px; }
.cq-tape .t-w { font-family: var(--mono); font-size: 11.5px; }
.cq-tape li.t-win { color: var(--ink); font-weight: 700; }
.cq-tape li.t-win .t-at { color: var(--verm); }
.cq-tape li.t-new { animation: cqprint .8s ease; }
@keyframes cqprint { from { background: rgba(255, 91, 58, .22); transform: translateY(-4px); } to { background: transparent; transform: none; } }
.cq-tape li.tape-empty { color: var(--ink-2); }
.cq-past-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.cq-past-card { flex: 0 0 auto; min-width: 92px; border-radius: 12px; padding: 8px; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .1); font-size: 12px; }
.cq-past-card .cq-g { width: 24px; height: 24px; color: var(--verm); display: block; }
.cq-past-card b { display: block; font-size: 13px; }
.cq-past-card.empty { color: var(--ink-2); min-width: 0; flex: 1; }
.cq-steps { margin: 0; padding-left: 20px; font-size: 13.5px; }
.cq-steps li { margin: 4px 0; }
.cq-steps b { margin-right: 6px; color: var(--verm); }
.cq-eg { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #fff; border-left: 4px solid var(--verm); font-size: 13px; }
.cq-eg p { margin: 3px 0; }
.cq-eg-k { font-weight: 900; font-size: 12px; color: var(--verm); }

/* ---------- footer ---------- */
.cq-foot { max-width: 1200px; margin: 18px auto 0; padding: 16px 0 30px; border-top: 1px solid rgba(243, 238, 226, .2); font-size: 12px; color: var(--mute); }
.cq-foot-row { display: flex; gap: 8px; align-items: baseline; margin: 4px 0; flex-wrap: wrap; }
.cq-foot-row > span { flex: 0 0 auto; }
.cq-foot-row code { color: var(--bone); min-width: 0; }
.cq-links { gap: 14px; }
.cq-foot-note { margin: 10px 0 0; }

.cq-pop { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: var(--bone); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 80vw; box-shadow: 0 8px 20px rgba(0, 0, 0, .35); }
.cq-veil { position: fixed; inset: 0; z-index: 50; background: rgba(10, 18, 16, .6); display: grid; place-items: center; }
.cq-veil-card { background: var(--bone); color: var(--ink); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 240px; }
.cq-veil-card button { border: 0; border-radius: 10px; padding: 10px; background: #fff; }

/* ---------- 720–1000: wider measure, bigger cards ---------- */
@media (min-width: 700px) {
  body { padding: 0 calc(var(--railw) + 26px) 0 28px; font-size: 16px; }
  .cq-name { font-size: 46px; }
  .cq-cards { grid-template-columns: repeat(6, 1fr); gap: 16px 14px; }
  .cq-sweep { grid-template-columns: 84px 1fr auto; padding: 16px 20px; }
  .cq-sweep-win { width: 84px; height: 84px; }
  .cq-sweep-win .cq-g { width: 58px; height: 58px; }
  .cq-sweep-head { font-size: 26px; }
  .cq-sweep-pile { grid-column: auto; max-width: 260px; justify-content: flex-end; }
  .cq-live { font-size: 17px; }
  .cq-side { display: grid; grid-template-columns: 1fr 1fr; }
  .cq-side .cq-tape-box, .cq-side .cq-how { grid-column: 1 / -1; }
}

/* ---------- ≥ 1000: the rail moves to the left edge and widens; table + action left, tape + rules right ---------- */
@media (min-width: 1000px) {
  :root { --railw: 0px; }
  body { padding: 0 32px 0 268px; }
  .cq-rail {
    left: 24px; right: auto; width: 214px; align-items: stretch; padding: 18px; gap: 12px; border-radius: 22px;
  }
  .cq-rail-k, .cq-rail-addr, .cq-rail-copy, .cq-rail-gmgn { writing-mode: horizontal-tb; }
  .cq-rail-k { letter-spacing: .2em; font-size: 12px; }
  .cq-rail-addr { font-size: 13px; line-height: 1.5; max-height: none; }
  .cq-rail-copy { padding: 11px; letter-spacing: .3em; }
  .cq-rail-gmgn { text-align: center; }
  .cq-room { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .cq-felt { padding-top: 26px; }
  .cq-side { margin-top: 26px; display: flex; position: sticky; top: 16px; }
  .cq-name { font-size: 60px; }
  .cq-cards { grid-template-columns: repeat(6, 1fr); }
  .cq-sweep-head { font-size: 30px; }
  .cq-tape { max-height: 360px; }
  .cq-foot { margin-left: auto; }
}
@media (min-width: 1400px) {
  .cq-cards { gap: 20px 18px; }
  .cq-live { font-size: 18px; }
}
