/* 数咕咕网页版 —— 外壳样式。
 *
 * 游戏本体全部画在 canvas 上（和微信小游戏同一份代码），
 * 这里只负责页面外壳、竖屏舞台的缩放，以及 toast / 弹层这些
 * 由 wx-shim 生成的 DOM 元素。
 */

:root {
  --ink: #15324b;
  --muted: #6d8799;
  --page: #f3fafc;
  --surface: #fff;
  --line: #dcecf2;
  --brand: #0b6bd3;
  --cyan: #04b8d8;
  --shadow: 0 18px 44px rgba(21, 76, 121, .16);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 8% 0, #dff6fa 0, transparent 70%),
    radial-gradient(900px 420px at 96% 2%, #e4f3ff 0, transparent 70%),
    var(--page);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* ------------------------------ 顶栏 ------------------------------ */

.play-header {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
}

.play-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: .06em;
}
.play-back span { color: var(--brand); font-size: 22px; line-height: 1; }
.play-back:hover { color: var(--brand); }

.play-title {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

.play-full {
  border: 1px solid #bfddea;
  background: var(--surface);
  color: var(--brand);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.play-full:hover { background: #eaf6fb; }

/* ------------------------------ 主区 ------------------------------ */

.play-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(20px, 4vw, 56px);
  align-items: center;
  padding: 0 clamp(16px, 4vw, 40px) 28px;
}

/*
 * 竖屏舞台。
 *
 * 画布的逻辑尺寸由 wx-shim 固定成 390×844，这里给它一个可用空间，
 * shim 按空间算出缩放比再设 CSS 尺寸。所以舞台只需要「尽量大且居中」。
 */
.play-stage {
  position: relative;
  justify-self: center;
  width: 100%;
  max-width: 420px;
  height: min(844px, calc(100vh - 110px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.ngg-canvas {
  display: block;
  border-radius: 26px;
  box-shadow: var(--shadow);
  background: var(--page);
  /* 画布自己处理点击，别让浏览器的长按菜单和选择插进来 */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* ---- 载入 / 失败提示 ---- */

.play-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--surface);
  border-radius: 26px;
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 24px;
}
.play-loading strong { font-size: 17px; color: var(--ink); }
.play-loading p { margin: 0; line-height: 1.7; }
.play-loading.is-error .play-spinner { display: none; }

.play-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #d8ecf4;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: ngg-spin .8s linear infinite;
}
@keyframes ngg-spin { to { transform: rotate(360deg); } }

/* ------------------------------ 侧栏 ------------------------------ */

.play-side { max-width: 340px; }
.play-side h1 {
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -.04em;
  margin: 0 0 14px;
}
.play-lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.9;
  margin: 0 0 24px;
}

.play-tips, .play-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.play-tips h2 { font-size: 14px; margin: 0 0 12px; }
.play-tips ul { margin: 0; padding-left: 18px; }
.play-tips li {
  font-size: 13px;
  color: var(--muted);
  line-height: 2;
}
.play-tips b { color: var(--ink); }

.play-note p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.9;
  margin: 0 0 10px;
}
.play-note p:last-child { margin-bottom: 0; }
.play-mini { padding-top: 10px; border-top: 1px solid var(--line); }

.play-noscript {
  margin: 40px auto;
  max-width: 520px;
  text-align: center;
  color: var(--muted);
}

/* ------------------------------ shim 生成的浮层 ------------------------------ */

/* toast 和弹层要盖在画布上，所以定位在舞台内 */
.ngg-toast {
  position: absolute;
  left: 50%;
  bottom: 15%;
  transform: translateX(-50%);
  max-width: 78%;
  background: rgba(14, 42, 62, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
  padding: 11px 18px;
  border-radius: 14px;
  text-align: center;
  pointer-events: none;
  z-index: 30;
  animation: ngg-rise .18s ease-out;
}
@keyframes ngg-rise {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.ngg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 38, 56, .42);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 26px;
  z-index: 40;
  padding: 24px;
}

.ngg-modal {
  background: var(--surface);
  border-radius: 22px;
  padding: 24px 22px 18px;
  width: 100%;
  max-width: 300px;
  box-shadow: 0 20px 46px rgba(11, 45, 72, .28);
  text-align: center;
}
.ngg-modal strong { display: block; font-size: 16px; margin-bottom: 10px; }
.ngg-modal p {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.ngg-modal-actions { display: flex; gap: 10px; }

.ngg-btn {
  flex: 1;
  border: 0;
  border-radius: 999px;
  padding: 11px 0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--cyan));
  color: #fff;
  font-family: inherit;
}
.ngg-btn.ghost {
  background: #eef4f8;
  color: var(--muted);
}

/* ------------------------------ 窄屏 ------------------------------ */

@media (max-width: 900px) {
  .play-main {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 26px;
  }
  .play-stage {
    max-width: 100%;
    height: min(844px, calc(100vh - 132px));
  }
  .play-side {
    max-width: 100%;
    justify-self: center;
  }
  .play-side h1 { font-size: 24px; }
}

@media (max-width: 560px) {
  .play-header { height: 52px; padding: 0 14px; }
  .play-title { display: none; }
  .play-main { padding: 0 12px 20px; }
  .play-stage { height: calc(100vh - 92px); }
  /* 手机上画布铺满，圆角和投影反而显得局促 */
  .ngg-canvas { border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .play-spinner { animation: none; }
  .ngg-toast { animation: none; }
}

/* 网页版游戏区：以内容面板呈现，不模拟手机外壳。 */
body{background:#edf7fa}
.play-header{height:66px;width:min(1080px,100%);margin:0 auto;padding:0 24px}
.play-main{width:min(1080px,100%);margin:0 auto;grid-template-columns:minmax(0,1fr) 300px;gap:36px;align-items:center;padding:0 24px 24px}
.play-stage{max-width:460px;height:min(760px,calc(100vh - 112px));background:#e5f3f7;border:1px solid #d2e8ee;border-radius:24px;padding:10px;box-shadow:0 18px 42px rgba(21,76,121,.12)}
.ngg-canvas{border-radius:16px;box-shadow:0 8px 22px rgba(21,76,121,.10)}
.play-loading{inset:10px;border-radius:16px;box-shadow:none}
.play-side{max-width:300px}
.play-side h1{font-size:28px}
.play-lead{font-size:13px;line-height:1.75;margin-bottom:18px}
.play-tips,.play-note{border-radius:16px;padding:15px 17px}
.play-tips li{font-size:12px;line-height:1.8}
.play-note p{font-size:11px;line-height:1.75}
@media(max-width:900px){
  .play-main{grid-template-columns:1fr;gap:16px;padding:0 14px 22px}
  .play-stage{width:min(460px,100%);height:min(760px,calc(100vh - 105px));padding:8px}
  .play-side{display:none}
}
@media(max-width:560px){
  .play-header{height:52px;padding:0 14px}
  .play-main{padding:0 8px 10px}
  .play-stage{height:calc(100vh - 66px);padding:0;border:0;border-radius:0;box-shadow:none;background:transparent}
  .ngg-canvas{border-radius:0;box-shadow:none}
  .play-loading{inset:0;border-radius:0}
}

/* 官网弹窗中的嵌入模式：只保留游戏内容，去掉重复的试玩页头部和说明栏。 */
.embed-mode body{overflow:hidden;background:#edf7fa}
.embed-mode .play-header,.embed-mode .play-side{display:none}
.embed-mode .play-main{display:flex;width:100%;height:100vh;min-height:0;padding:16px;justify-content:center;align-items:center}
.embed-mode .play-stage{width:auto;max-width:none;height:min(844px,calc(100vh - 32px));padding:0;border:0;border-radius:22px;background:transparent;box-shadow:none}
.embed-mode .ngg-canvas{border-radius:20px;box-shadow:0 14px 34px rgba(21,76,121,.13)}
.embed-mode .play-loading{inset:0;border-radius:20px}
@media(max-width:560px){
  .embed-mode .play-main{padding:0}
  .embed-mode .play-stage{height:100vh}
  .embed-mode .ngg-canvas{border-radius:0;box-shadow:none}
  .embed-mode .play-loading{border-radius:0}
}
@media(min-width:561px){
  .embed-mode .play-stage{width:min(450px,calc(100vw - 32px));}
}
@media(max-width:560px){
  .embed-mode .play-stage{width:100%;height:100vh;}
}
