/* 还能再挤挤：项目自己的样式。尺寸用 --u（画面宽的百分之一，竖画面）；字号和按钮边长的下限由 shell.js 算好写进变量。 */
:root {
  --bg: #cdd7da;
  --surface: #f1f5f6;
  --surface-2: #dbe4e7;
  --field: #ffffff;
  --bar: #3f484d;
  --disc: #d3e4ea;
  --ink: #263238;
  --ink-2: #51636b;
  --ink-3: #8aa0a8;
  --line: #3f484d;
  --accent: #7fa7b4;
  --on-dark: #e3eff3;
  --page: #dfe6e8;
  --btn-dark: #4f656d;
  --btn-light: #d3e4ea;
}

html,
body {
  background: #7d8c93;
}

#app {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
}

.frame {
  position: absolute;
  top: 0;
  background: var(--page);
}

.frame:not(.is-ready) {
  visibility: hidden;
}

/* ---------- 标题栏 ---------- */
.titlebar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--header-h);
  background: var(--bar);
  color: var(--on-dark);
}

.title-text {
  margin: 0;
  font-weight: var(--title-weight);
  font-size: var(--fs-title);
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
  color: var(--on-dark);
}

/* 重新开始：固定在左上角，大小和位置对称于中 / EN */
.sbtn.title-restart {
  position: absolute;
  left: 8px;
  top: 50%;
  margin-top: -15px;
}

/* 中 / EN：固定在右上角，小而扁，没有阴影；点击区靠伪元素扩到 44 像素 */
.lang {
  position: absolute;
  right: 8px;
  top: 50%;
  margin-top: -11px;
  height: 22px;
}

.lang::before {
  content: '';
  position: absolute;
  left: -8px;
  right: -8px;
  top: -11px;
  bottom: -11px;
}

.lang-pill {
  display: flex;
  height: 22px;
  border: 1px solid #9fb8c1;
  border-radius: 6px;
  overflow: hidden;
}

.lang-half {
  display: flex;
  align-items: center;
  padding: 0 5px;
  font-size: 12px;
  line-height: 1;
  color: #c4d9e0;
}

.lang-half.is-on {
  background: var(--btn-light);
  color: #34454c;
}

/* ---------- 小钮：高 30、宽 34，没有阴影 ---------- */
.sbtn {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  max-width: 48px;
  height: 30px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--btn-dark);
  color: var(--on-dark);
  touch-action: manipulation;
}

.sbtn::before {
  content: '';
  position: absolute;
  left: -5px;
  right: -5px;
  top: -7px;
  bottom: -7px;
}

.sbtn-ico {
  display: block;
  width: 18px;
  height: 18px;
}

.sbtn-ico .icon,
.sbtn-ico svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sbtn-text {
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.ring-focus:focus-visible {
  box-shadow: none;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 页面 ---------- */
.page-body {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: 0;
}

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  --toast-top: 40px;
  touch-action: none;
}

.row-a {
  flex: none;
  display: flex;
  align-items: center;
  height: calc(var(--u) * 12.5);
  min-height: 46px;
  justify-content: space-between;
  padding: 0 calc(var(--u) * 2.4) 0 calc(var(--u) * 2.4);
}

.tools {
  display: flex;
  align-items: center;
}

/* 还剩几只：关卡牌和按钮之间的一行字 */
.left {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 calc(var(--u) * 2);
  font-size: 13px;
  font-weight: var(--title-weight);
  line-height: 1.2;
  text-align: center;
  color: var(--ink);
}

.tools .sbtn + .sbtn {
  margin-left: calc(var(--u) * 2);
}

/* 关卡牌：右边和下边一道深色线，点开选关 */
.level-card {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 calc(var(--u) * 2.4);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}

.level-card::before {
  content: '';
  position: absolute;
  left: 0;
  right: -6px;
  top: -7px;
  bottom: -7px;
}

.level-card-text {
  font-size: 13px;
  font-weight: var(--title-weight);
  line-height: 1.2;
  white-space: nowrap;
}

/* 屋顶区：中间一大块，屋顶区 100u × 62u，居中 */
.roof-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
}

.roof-zone {
  z-index: 3;
  touch-action: none;
  position: absolute;
  left: 0;
  top: 50%;
  width: calc(var(--u) * 100);
  height: calc(var(--u) * 62);
  margin-top: calc(var(--u) * -31);
}

.roof-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.roof-shadow {
  position: absolute;
  pointer-events: none;
  mix-blend-mode: multiply;
}

.gull-img {
  display: block;
  max-width: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.gull-flip {
  -webkit-transform: scaleX(-1);
  transform: scaleX(-1);
}

.gull-placed,
.gull-ghost,
.gull-drag {
  position: absolute;
}

.gull-ghost {
  opacity: 0.5;
  z-index: 400;
}

.level-lock {
  display: block;
  width: calc(var(--u) * 5.4);
  height: calc(var(--u) * 5.4);
  min-width: 16px;
  min-height: 16px;
  margin-top: 3px;
}

.level-lock svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- 队列 ---------- */
.queue {
  position: relative;
  flex: none;
  height: calc(var(--u) * 38);
}

.strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--u) * 9);
  border: 1.5px solid #1a2124;
  border-radius: 0;
  background: #232a2e;
}

.slots {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  justify-content: flex-start;
  align-items: flex-end;
  padding: 0 0 calc(var(--u) * 4.2) calc(var(--u) * 4.5);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.slots::after {
  content: '';
  flex: none;
  width: calc(var(--u) * 4.5);
  height: 1px;
}

.slots::-webkit-scrollbar {
  height: 5px;
}

.slots::-webkit-scrollbar-thumb {
  background: var(--accent);
}

.slot + .slot {
  margin-left: calc(var(--u) * 3.2);
}

.slot {
  position: relative;
  flex: none;
  touch-action: pan-x;
}

.slot.is-hint .gull-img {
  -webkit-animation: hint-pulse 0.7s ease-in-out 4 alternate;
  animation: hint-pulse 0.7s ease-in-out 4 alternate;
}

@-webkit-keyframes hint-pulse {
  from { opacity: 1; }
  to { opacity: 0.35; }
}

@keyframes hint-pulse {
  from { opacity: 1; }
  to { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .slot.is-hint .gull-img {
    -webkit-animation: none;
    animation: none;
    opacity: 0.55;
  }
}

/* ---------- 星星 ---------- */
.stars {
  display: flex;
  align-items: center;
  justify-content: center;
}

.star {
  display: block;
  width: calc(var(--u) * 11);
  height: calc(var(--u) * 11);
  margin: 0 calc(var(--u) * 0.8);
}

.star svg {
  width: 100%;
  height: 100%;
  fill: #c3ced2;
  stroke: #c3ced2;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.star.is-on svg {
  fill: #e3b341;
  stroke: #e3b341;
}

/* ---------- 弹窗 ---------- */
.modal {
  border: 1.5px solid var(--ink);
  border-radius: 0;
}

.modal-head {
  min-height: calc(var(--u) * 14);
  padding: calc(var(--u) * 3) calc(var(--u) * 5);
}

.modal-body {
  padding: calc(var(--u) * 4) calc(var(--u) * 5);
}

.modal-foot {
  padding: calc(var(--u) * 3) calc(var(--u) * 5) calc(var(--u) * 4);
}

.modal-foot .btn {
  margin-left: calc(var(--u) * 3);
}

.modal-title {
  font-size: var(--fs-modal-title);
  font-weight: var(--title-weight);
}

.modal-result .modal-body {
  text-align: center;
}

.result-count {
  margin: calc(var(--u) * 3) 0 calc(var(--u) * 5);
  font-size: var(--fs-title);
  font-weight: var(--title-weight);
  line-height: 1.25;
}

.result .star {
  width: calc(var(--u) * 12);
  height: calc(var(--u) * 12);
  margin: 0 calc(var(--u) * 1.5);
}

.result {
  padding-bottom: calc(var(--u) * 2);
}

.modal-result .modal-foot .btn {
  padding: 0 calc(var(--u) * 1);
}

/* 图鉴 */
.modal-codex {
  height: calc(var(--u) * 130);
}

.modal-codex .modal-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.codex {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.codex-progress {
  flex: none;
  margin: 0 0 calc(var(--u) * 3);
  font-size: var(--fs-body);
  color: var(--ink-2);
}

.codex-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: calc(var(--u) * 2.5);
  align-content: start;
  padding-bottom: calc(var(--u) * 2);
}

.codex-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(var(--u) * 2.5) calc(var(--u) * 1);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
}

.codex-pic {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: calc(var(--u) * 20);
}

.codex-cell.is-on {
  background: #c3dbe3;
}

.codex-name {
  margin-top: calc(var(--u) * 1.5);
  font-size: var(--fs-body);
  line-height: 1.25;
  text-align: center;
}

.codex-cell.is-unseen .codex-name {
  color: var(--ink-2);
}

/* 海鸥介绍 */
.gull-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gull-card-pic {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: calc(var(--u) * 40);
  height: calc(var(--u) * 34);
}

.gull-card-name {
  margin: calc(var(--u) * 3) 0 0;
  font-size: var(--fs-title);
  font-weight: var(--title-weight);
  line-height: 1.25;
}

.gull-card-foot {
  display: flex;
  justify-content: center;
  margin-top: calc(var(--u) * 3);
}

.gull-card-effect {
  margin: calc(var(--u) * 3) 0 0;
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink-2);
}

/* 广告位 */
.modal-ad .modal-body {
  text-align: center;
}

.ad-text {
  margin: calc(var(--u) * 3) 0 calc(var(--u) * 5);
  font-size: var(--fs-modal-title);
  font-weight: var(--title-weight);
  line-height: 1.25;
}

.ad-bar {
  display: block;
  height: calc(var(--u) * 3);
  border: 1.5px solid var(--ink);
  background: var(--btn-light);
}

.ad-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--bar);
  transition-property: width;
  transition-timing-function: linear;
}

/* 选关 */
.modal-levels .modal-body {
  padding: calc(var(--u) * 3.5);
}

@media (orientation: landscape) and (max-height: 520px) {
  .modal-levels {
    width: 330px;
  }
}

.levels-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-gap: calc(var(--u) * 1.6);
}

.level-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(var(--u) * 13);
  min-height: 44px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--btn-light);
  color: var(--ink);
}

.level-cell .stars {
  margin-top: calc(var(--u) * 0.8);
}

.level-cell .star {
  width: calc(var(--u) * 3.6);
  height: calc(var(--u) * 3.6);
  margin: 0 calc(var(--u) * 0.4);
}

.level-num {
  font-size: var(--fs-name);
  font-weight: var(--title-weight);
  line-height: 1.1;
}

.level-cell.is-now {
  background: var(--bar);
  color: var(--on-dark);
}

.level-cell.is-now .star:not(.is-on) svg {
  fill: #66767d;
  stroke: #66767d;
}

.level-cell.is-locked {
  background: #e4ecee;
  color: var(--ink-3);
}

.level-endless {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin-top: calc(var(--u) * 2);
  padding: calc(var(--u) * 2) calc(var(--u) * 2);
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--btn-light);
  color: var(--ink);
}

.level-endless-name {
  font-size: var(--fs-name);
  font-weight: var(--title-weight);
  line-height: 1.2;
}

.level-endless-note {
  display: flex;
  align-items: center;
  margin-top: calc(var(--u) * 1);
  font-size: var(--fs-body);
  line-height: 1.3;
}

.level-endless-note .level-lock {
  margin: 0 calc(var(--u) * 1) 0 0;
}

.level-endless.is-now {
  background: var(--bar);
  color: var(--on-dark);
}

.level-endless.is-locked {
  background: #e4ecee;
  color: var(--ink-3);
}

/* 哐哐工作室标注在弹窗里：不随图鉴格子滚动；字号不小于 11 像素（shell.js 算好），第二行和链接平时排在一行，窄到放不下时链接换到下一行 */
.modal .credit {
  flex: none;
  text-align: left;
}

.modal .credit-text {
  font-size: var(--fs-credit);
}

.modal .credit-row {
  flex-wrap: wrap;
  white-space: normal;
}
