/* PELAGIC — 小游戏
   时空穿越是一个普通的白底界面；付款 = 热敏纸账单小票；方块 = 一台掌机。 */

/* ── 遮罩 ───────────────────────────────────────────────── */
.overlay{
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(.8rem, 3vw, 2rem);
  background: rgba(2,10,18,.36);
  backdrop-filter: blur(8px) saturate(.95);
  -webkit-backdrop-filter: blur(8px) saturate(.95);
  animation: ov-in .25s ease;
}
.overlay[hidden]{ display: none; }
@keyframes ov-in{ from{ opacity: 0 } to{ opacity: 1 } }

.overlay__sheet{
  width: min(48rem, 100%);
  max-height: min(94vh, 58rem);
  display: flex; flex-direction: column;
  border-radius: 18px; overflow: hidden;
  background: #111920;
  color: var(--ink);
  box-shadow: 0 40px 100px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.07);
}
.overlay__sheet[data-game="blocks"]{ background: #121a22; width: min(42rem, 100%); }

.overlay__bar{
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem .95rem .85rem 1.35rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.overlay__title{
  margin: 0;
  font: 600 .8rem var(--mono); letter-spacing: .16em; text-transform: uppercase;
  color: rgba(243,236,224,.88);
}
[data-lang="ja"] .overlay__title,
[data-lang="zh"] .overlay__title{ letter-spacing: .06em; font-size: .95rem; }
.overlay__close{
  appearance: none; border: 0; cursor: pointer; flex: none;
  width: 2.1rem; height: 2.1rem; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.08); color: var(--ink); font-size: .9rem;
  transition: background-color .18s ease;
}
.overlay__close:hover{ background: rgba(255,255,255,.18); }
.overlay__body{ position: relative; padding: clamp(1rem, 3vw, 1.8rem); overflow: auto; }

/* ── 按钮：实心胶囊，三种 ───────────────────────────────── */
.btn{
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font: 600 .9rem var(--mono); letter-spacing: .02em; white-space: nowrap;
  padding: .8em 1.45em; border-radius: 999px;
  transition: background-color .18s ease, transform .1s ease;
}
.btn:active{ transform: translateY(1px); }
.btn--light{ background: var(--ink); color: #0b1a28; }
.btn--light:hover{ background: #fff; }
.btn--signal{ background: var(--signal); color: #141007; }
.btn--signal:hover{ background: #ffd35c; }
.btn--ghost{ background: rgba(255,255,255,.08); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.btn--ghost:hover{ background: rgba(255,255,255,.16); }
.btn--sm{ padding: .6em 1.1em; font-size: .8rem; }

@keyframes pop-in{ from{ opacity: 0; transform: translateY(6px) scale(.97) } to{ opacity: 1; transform: none } }

/* ── 时空穿越：白底、系统字体、四个大按钮，就是一个普通 App 的界面 ── */
.overlay__sheet[data-game="timetravel"]{
  --sys: system-ui, -apple-system, "Segoe UI", sans-serif;
  width: min(30rem, 100%);
  background: #fff; color: #17191c;
}
.overlay__sheet[data-game="timetravel"] .overlay__bar{ border-bottom-color: #ececef; }
.overlay__sheet[data-game="timetravel"] .overlay__title{
  font: 700 1.1rem/1.2 var(--sys); letter-spacing: 0; text-transform: none; color: #17191c;
}
.overlay__sheet[data-game="timetravel"] .overlay__close{ background: #f1f2f4; color: #17191c; }
.overlay__sheet[data-game="timetravel"] .overlay__close:hover{ background: #e4e6e9; }

.tt{ display: flex; flex-direction: column; font-family: var(--sys); }
.tt__list{ list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.tt__item{
  appearance: none; border: 0; cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: .9rem;
  padding: 1.1rem 1.1rem 1.1rem 1.3rem; border-radius: 14px;
  background: #f3f4f6; color: inherit; font: inherit; text-align: left;
  transition: background-color .15s ease, transform .1s ease;
}
.tt__item:hover{ background: #e8eaed; }
.tt__item:active{ transform: scale(.99); }
.tt__item:focus-visible, .tt__btn:focus-visible{ outline: 2px solid #1a73e8; outline-offset: 2px; }
.tt__dest{ flex: 1; font-size: 1.3rem; font-weight: 700; }
.tt__price{ display: inline-flex; align-items: center; gap: .35em; font-size: 1.05rem; font-weight: 600; color: #1e8e3e; }
.tt__price--vip{ color: #17191c; }
.tt__price .ico-lock{ width: .8em; height: .95em; color: #c98f00; }
.tt__chev{ flex: none; width: .5rem; height: .9rem; color: #a0a4ab; }

.tt--prep, .tt--lock, .tt--done{ align-items: center; text-align: center; padding: .4rem 0 .2rem; }
.tt__going{ margin: .4rem 0 0; font-size: 1.05rem; color: #5f6368; }
.tt__count{
  margin: .2rem 0 1.1rem; line-height: 1.1;
  font-size: clamp(2.6rem, 9vw, 3.6rem); font-weight: 700; font-variant-numeric: tabular-nums;
}
.tt__bar{ width: 100%; height: 10px; border-radius: 999px; background: #eceef1; overflow: hidden; }
.tt__bar i{ display: block; width: 0; height: 100%; border-radius: inherit; background: #1a73e8; }
.tt__icon{ display: grid; place-items: center; width: 3.6rem; height: 3.6rem; margin: .6rem 0 1rem; border-radius: 50%; }
.tt__icon svg{ width: 1.6rem; height: 1.6rem; }
.tt__icon--lock{ background: #fff4d6; color: #c98f00; }
.tt__icon--ok{ background: #e6f4ea; color: #1e8e3e; }
.tt__msg{ margin: 0; font-size: 1.3rem; font-weight: 700; line-height: 1.4; text-wrap: balance; word-break: auto-phrase; }
.tt__done{ margin: 0; font-size: 2rem; font-weight: 700; }

.tt__actions{ display: flex; flex-direction: column; gap: .55rem; width: min(18rem, 100%); margin-top: 1.5rem; }
.tt__btn{
  appearance: none; border: 0; cursor: pointer; border-radius: 999px; padding: .95em 1.4em;
  font: 700 1rem/1.2 var(--sys); white-space: nowrap;
  transition: background-color .15s ease, transform .1s ease;
}
.tt__btn:active{ transform: translateY(1px); }
.tt__btn--pay{ background: #f5c542; color: #17191c; }
.tt__btn--pay:hover{ background: #ffd35c; }
.tt__btn--plain{ background: #f1f2f4; color: #3c4043; }
.tt__btn--plain:hover{ background: #e4e6e9; }
.tt__btn--dark{ background: #17191c; color: #fff; }
.tt__btn--dark:hover{ background: #33363c; }
/* 跳过按钮先占着位置但看不见，1.2 秒后再出现，下面的「取消」不会被挤得跳一下 */
.tt__skip{ visibility: hidden; }
.tt__skip.is-on{ visibility: visible; animation: pop-in .35s ease; }

/* ── 付款：热敏纸账单小票（两个游戏共用） ──────────────── */
.pay{
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(.8rem, 3vh, 2rem);
  background: rgba(2,10,18,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  overflow: auto;
  animation: pop-in .25s ease;
}
.pay__paper{ margin: auto; width: min(23.5rem, 100%); filter: drop-shadow(0 24px 40px rgba(0,0,0,.45)); }
/* 上下锯齿边：用遮罩在纸边上咬出一排半圆 */
.pay__card{
  position: relative;
  display: flex; flex-direction: column; gap: .8rem;
  padding: 1.9rem clamp(1.2rem, 4vw, 1.7rem) 1.5rem;
  background: #f6f3ea; color: #16181b; font-family: var(--mono);
  -webkit-mask:
    radial-gradient(circle 6px at 50% 0, #0000 96%, #000) 0 0 / 16px 51% repeat-x,
    radial-gradient(circle 6px at 50% 100%, #0000 96%, #000) 0 100% / 16px 51% repeat-x;
          mask:
    radial-gradient(circle 6px at 50% 0, #0000 96%, #000) 0 0 / 16px 51% repeat-x,
    radial-gradient(circle 6px at 50% 100%, #0000 96%, #000) 0 100% / 16px 51% repeat-x;
}
.pay__brand{ text-align: center; font-size: 1rem; font-weight: 600; letter-spacing: .42em; text-indent: .42em; }
.pay__stamp{ text-align: center; font-size: .7rem; color: #6d6f73; margin-top: -.45rem; }
.pay__rule{ border: 0; border-top: 1.5px dashed #b9b3a6; margin: .1rem 0; }
.pay__total{ display: flex; align-items: baseline; justify-content: space-between; }
.pay__totalLabel{ font-size: .78rem; letter-spacing: .2em; }
.pay__amount{ font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.pay__field{ display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 0; }
.pay__field > span{ font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: #5f6368; }
.pay__field input{
  font: 500 .96rem var(--mono); min-width: 0;
  padding: .6em .7em; border: 1.5px solid #cfc8b8; border-radius: 8px;
  background: #fffdf8; color: #16181b;
}
.pay__field input:focus-visible{ outline: none; border-color: #16181b; }
.pay__row{ display: flex; gap: .7rem; }
.pay__submit{
  margin-top: .3rem; appearance: none; border: 0; cursor: pointer;
  border-radius: 999px; padding: .85em 1rem;
  background: var(--signal); color: #141007; font: 600 1rem var(--mono);
  transition: background-color .18s ease;
}
.pay__submit:hover{ background: #ffd35c; }
.pay__submit.is-busy{ background: #e2ddd0; color: #7a7d82; cursor: progress; }
.pay__error{ margin: 0; font-size: .84rem; line-height: 1.5; color: #b3261e; }
.pay__error[hidden]{ display: none; }
.pay__foot{
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  padding-top: .75rem; border-top: 1.5px dashed #b9b3a6;
}
.pay__cancel{ appearance: none; background: none; border: 0; padding: .3em 0; cursor: pointer; font: 500 .85rem var(--mono); color: #5f6368; }
.pay__cancel:hover{ color: #16181b; text-decoration: underline; }
.pay__code{ display: flex; align-items: center; gap: .4rem; }
.pay__code input{
  font: 500 .82rem var(--mono); letter-spacing: .12em; width: 6.4rem;
  padding: .42em .55em; border: 1.5px solid #d8d2c4; border-radius: 6px;
  background: #fffdf8; color: #16181b;
}
.pay__code button{ appearance: none; border: 0; padding: 0; cursor: pointer; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: #cfc9bc; }
.pay__code button:hover{ background: #bdb6a7; }
.pay__done{
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem;
  background: rgba(2,10,18,.88); color: var(--signal); font: 600 1.15rem var(--mono);
}
.pay__done p{ margin: 0; }
.pay__tick{ width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; background: var(--signal); color: #141007; font-size: 1.4rem; }

/* ── 方块：一台掌机 ─────────────────────────────────────── */
.bl{ display: flex; gap: clamp(1rem, 3vw, 2rem); align-items: stretch; justify-content: center; }
.bl__boardWrap{
  position: relative; flex: none; padding: 6px; border-radius: 12px;
  background: #070b0f;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}
.bl__board{ display: block; border-radius: 7px; }
.bl__side{ display: flex; flex-direction: column; gap: 1.15rem; min-width: 8.5rem; }
.bl__stat{ display: flex; flex-direction: column; gap: .3rem; }
.bl__statLabel{ font: 500 .66rem var(--mono); letter-spacing: .18em; text-transform: uppercase; color: rgba(243,236,224,.5); }
[data-lang="ja"] .bl__statLabel,
[data-lang="zh"] .bl__statLabel{ letter-spacing: .08em; font-size: .76rem; }
.bl__statValue{ font: 600 1.6rem var(--mono); letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.bl__nextBox{ display: inline-flex; width: max-content; padding: .55rem .7rem; border-radius: 8px; background: #070b0f; box-shadow: inset 0 1px 4px rgba(0,0,0,.6); }
.bl__next{ display: block; }

.keys{ display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .45rem .7rem; font: 500 .72rem var(--mono); color: rgba(243,236,224,.6); }
.keys__caps{ display: flex; gap: .25rem; }
kbd{
  display: inline-grid; place-items: center; min-width: 1.7em; height: 1.7em; padding: 0 .35em;
  border-radius: 5px; font: 600 .76rem var(--mono); color: var(--ink);
  background: linear-gradient(#2a333c, #1c232a);
  box-shadow: 0 2px 0 #0a0e12, inset 0 1px 0 rgba(255,255,255,.08);
}
.kbd--wide{ padding: 0 .7em; font-size: .64rem; letter-spacing: .06em; }

/* 侧栏右下角的常驻购买入口：金色长条 + 价格 */
.bl__buy{
  margin-top: auto; align-self: flex-end;
  display: inline-flex; align-items: center; gap: .65rem;
  appearance: none; border: 0; cursor: pointer;
  padding: .6rem .95rem; border-radius: 999px;
  background: #070b0f; color: var(--signal); font: 600 1rem var(--mono);
  box-shadow: inset 0 0 0 1.5px rgba(245,197,66,.55);
  animation: pop-in .35s ease;
  transition: background-color .2s ease, box-shadow .2s ease;
}
.bl__buy:hover{ background: #0f151b; box-shadow: inset 0 0 0 1.5px var(--signal); }
.bl__buy[hidden]{ display: none; }
.bl__buyPiece{ display: flex; gap: 1px; }
.bl__buyPiece i{ width: 9px; height: 9px; border-radius: 1px; background: linear-gradient(180deg, rgba(255,255,255,.34) 0 18%, transparent 18%), #ffd35c; }

.bl__touch{ display: none; gap: .5rem; margin-top: 1rem; }
.bl__touch button{
  flex: 1; appearance: none; border: 0; cursor: pointer; padding: .8em 0; border-radius: 12px;
  font: 600 1.15rem var(--mono); color: var(--ink);
  background: linear-gradient(#26303a, #1a2129); box-shadow: 0 3px 0 #0a0e12;
}
.bl__touch button:active{ transform: translateY(2px); box-shadow: 0 1px 0 #0a0e12; }

/* 弹窗不压黑棋盘，只把后面的方块模糊掉 */
.bl__veil{
  position: absolute; inset: 6px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; padding: .6rem;
  background: rgba(7,11,15,.16);
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
}
.bl__veil[hidden]{ display: none; }
/* 卡片可以比棋盘宽（手机上棋盘很窄），居中往两边溢出，按钮就不会被挤成竖条 */
.offer{
  flex: none;
  width: min(21rem, max(100%, 17.5rem), calc(100vw - 2.5rem));
  padding: 1.3rem 1.1rem 1.1rem; border-radius: 16px; text-align: center;
  background: #141c24;
  box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.08);
  animation: pop-in .3s ease;
}
.offer__piece{ display: flex; justify-content: center; gap: 3px; margin-bottom: 1rem; }
.offer__piece i{
  width: clamp(22px, 5.4vw, 30px); aspect-ratio: 1; border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,.34) 0 16%, transparent 16%), #ffd35c;
  box-shadow: 0 0 20px rgba(255,211,92,.45);
}
.offer__title{ margin: 0 0 1.1rem; font: 600 clamp(1.3rem, 3.2vw, 1.75rem) var(--mono); line-height: 1.25; color: #fff8ee; }
.offer__row{ display: flex; gap: .55rem; }
.offer__btn{ flex: 1 1 auto; white-space: nowrap; appearance: none; border: 0; cursor: pointer; border-radius: 999px; padding: .85em 1em; font: 600 .95rem var(--mono); }
.offer__btn--ghost{ background: rgba(255,255,255,.1); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.offer__btn--ghost:hover{ background: rgba(255,255,255,.18); }
.offer__btn--gold{ background: var(--signal); color: #141007; font-size: 1.15rem; }
.offer__btn--gold:hover{ background: #ffd35c; }
.offer__btn--light{ background: var(--ink); color: #0b1a28; }
.offer__btn--light:hover{ background: #fff; }
.offer__btn:disabled{ opacity: .5; cursor: default; }

/* 结束：分数 + （困难模式）填名字上榜 */
.over__score{ margin: -.5rem 0 1.1rem; font: 600 2.1rem var(--mono); letter-spacing: .06em; font-variant-numeric: tabular-nums; color: var(--ink); }
.over__form{ display: flex; flex-direction: column; gap: .65rem; }
.over__name{
  appearance: none; width: 100%; box-sizing: border-box; border: 0;
  padding: .8em 1em; border-radius: 12px;
  background: #070b0f; color: var(--ink);
  font: 600 1.05rem var(--mono); letter-spacing: .04em; text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
}
.over__name::placeholder{ color: rgba(243,236,224,.35); }
.over__name:focus{ outline: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.over__err{ margin: 0; font: 500 .82rem var(--mono); color: #f0a79d; }
.over__err:empty{ display: none; }

/* ── 方块：开始界面 ─────────────────────────────────────── */
.blm{
  display: flex; flex-direction: column; align-items: center; gap: 1.7rem;
  padding: clamp(1.2rem, 5vh, 2.8rem) 0 clamp(.8rem, 3vh, 1.6rem);
}
.blm__fish{ display: block; filter: drop-shadow(0 12px 18px rgba(0,0,0,.4)); animation: blm-bob 3.4s ease-in-out infinite; }
@keyframes blm-bob{ 50%{ transform: translateY(-6px) rotate(-1.5deg) } }
.blm__mode{
  display: flex; padding: 4px; border-radius: 999px;
  background: #070b0f; box-shadow: inset 0 1px 4px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.07);
}
.blm__mode button{
  appearance: none; border: 0; cursor: pointer; background: none;
  min-width: 6.6em; padding: .6em 1.2em; border-radius: 999px;
  font: 600 .9rem var(--mono); color: rgba(243,236,224,.55);
  transition: background-color .18s ease, color .18s ease;
}
.blm__mode button:hover{ color: var(--ink); }
.blm__mode button[aria-pressed="true"]{
  background: linear-gradient(#2a333c, #1f272f); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 2px 6px rgba(0,0,0,.45);
}
.blm__actions{ display: flex; flex-direction: column; gap: .65rem; width: min(16rem, 100%); }
.blm__actions .btn{ padding: .95em 1.4em; font-size: 1rem; }
/* 「新游戏」按住 1 秒是剧本局：手机上长按不要弹菜单、不要选中文字 */
.blm__new{ -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }

/* ── 方块：排行榜 ───────────────────────────────────────── */
.lb{ display: flex; flex-direction: column; gap: 1.1rem; width: min(26rem, 100%); margin: 0 auto; padding: .3rem 0 .2rem; }
.lb__head{ display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.lb__title{ margin: 0; font: 600 1.4rem var(--mono); color: #fff8ee; }
.lb__chip{
  padding: .38em .85em; border-radius: 999px;
  font: 600 .75rem var(--mono); letter-spacing: .1em; text-transform: uppercase;
  background: rgba(212,121,110,.16); color: #f0a79d; box-shadow: inset 0 0 0 1px rgba(212,121,110,.35);
}
[data-lang="ja"] .lb__chip, [data-lang="zh"] .lb__chip{ letter-spacing: .04em; }
.lb__list{
  list-style: none; margin: 0; padding: .45rem; border-radius: 12px;
  background: #070b0f; box-shadow: inset 0 2px 8px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
}
/* 行高写死：中日文名字会换成别的字体，不固定的话每行高矮不一 */
.lb__row{
  display: grid; grid-template-columns: 2.6ch minmax(0, 1fr) auto; gap: 1rem; align-items: center;
  height: 2.6rem; padding: 0 .8rem; border-radius: 8px;
  font: 600 1rem/1 var(--mono); color: var(--ink);
}
.lb__row + .lb__row{ box-shadow: 0 -1px 0 rgba(255,255,255,.04); }
.lb__rank{ color: rgba(243,236,224,.38); font-variant-numeric: tabular-nums; }
.lb__row:nth-child(-n+3) .lb__rank{ color: rgba(243,236,224,.8); }
.lb__name{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb__score{ font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.lb__row.is-me, .lb__row.is-me .lb__rank{ color: var(--signal); }
.lb__row.is-me{ background: rgba(245,197,66,.12); box-shadow: inset 0 0 0 1px rgba(245,197,66,.35); }
.lb__gap{ padding: .1rem 0; text-align: center; letter-spacing: .3em; color: rgba(243,236,224,.3); }
.lb__note{ padding: 2.6rem 1rem; text-align: center; font: 500 .95rem var(--mono); color: rgba(243,236,224,.5); }
.lb__note--wait{ letter-spacing: .3em; animation: pulse 1.2s ease-in-out infinite; }
.lb__actions{ display: flex; justify-content: center; gap: .6rem; }

/* ── 大屏 / 投影：时空穿越和小票整体放大，教室后排也看得清 ── */
@media (min-width: 1200px) and (min-height: 760px){
  .overlay__sheet[data-game="timetravel"]{ zoom: 1.25; }
  .pay__paper{ zoom: 1.15; }
}

/* ── 手机 ───────────────────────────────────────────────── */
@media (max-width: 640px){
  .bl{ flex-direction: column; align-items: center; }
  .bl__side{ flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem; min-width: 0; }
  .bl__statValue{ font-size: 1.2rem; }
  .keys{ display: none; }
  .bl__buy{ margin-top: 0; align-self: center; }
  .bl__touch{ display: flex; width: 100%; }
  .pay__code input{ width: 5.4rem; }
}

@media (prefers-reduced-motion: reduce){
  .overlay, .tt__skip.is-on, .offer, .pay, .bl__buy{ animation: none; }
  .blm__fish, .lb__note--wait{ animation: none; }
}
