/* common.css — 全局基础（对应小程序 app.wxss + page 样式）
   换算：小程序 750rpx 设计稿，网页按 1rpx ≈ 0.5px；容器最大宽 480px 居中 */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 关键：作者样式里 display:flex/block 会盖过 [hidden] 的 UA 默认隐藏，
   统一强制 hidden 属性生效（否则初始弹窗/浮层/图标会穿透显示并遮挡点击） */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: #0a1628;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* 手机铺满；PC 居中成"手机宽度" */
.page-wrap {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* 通用金色主按钮（可点击态：金橙渐变 + 深蓝字） */
.btn-gold {
  background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
  color: #0a1628;
  font-weight: 700;
  font-size: 16px;
  border: none;
  border-radius: 8px;
  height: 44px;
  line-height: 44px;
  text-align: center;
  width: 100%;
  padding: 0;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.25);
}
.btn-gold:active { opacity: 0.85; transform: scale(0.97); }
.btn-gold:disabled,
.btn-gold.is-disabled {
  background: #243a5c !important;
  color: rgba(255, 255, 255, 0.65) !important;
  box-shadow: none;
  cursor: not-allowed;
}

/* 通用弹窗遮罩 */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 999;
  overflow-y: auto;
  padding: 24px 0;
  box-sizing: border-box;
}
.modal-card {
  background: #111f38;
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 12px;
  padding: 20px 16px;
  width: 85%;
  max-width: 400px;
  margin: auto 0;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #FFD700;
  text-align: center;
  margin: 0 0 14px;
}
.btn-close {
  background: rgba(255, 215, 0, 0.1);
  color: #FFD700;
  font-size: 14px;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 6px;
  margin-top: 14px;
  height: 36px;
  line-height: 36px;
  width: 100%;
}
.btn-close:active { background: rgba(255, 215, 0, 0.2); }

/* 轻量 toast（居中黑底胶囊） */
.toast {
  position: fixed;
  left: 50%;
  top: 42%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 10000;
  max-width: 80%;
  text-align: center;
  line-height: 1.5;
  pointer-events: none;
}

/* confirm 弹窗 */
.confirm-card {
  background: #111f38;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 12px;
  padding: 22px 18px 16px;
  width: 82%;
  max-width: 360px;
}
.confirm-title { font-size: 17px; font-weight: 700; color: #FFD700; margin-bottom: 10px; }
.confirm-content { font-size: 15px; color: rgba(255,255,255,0.82); line-height: 1.65; margin-bottom: 18px; white-space: pre-wrap; }
.confirm-btns { display: flex; gap: 12px; }
.confirm-btns button {
  flex: 1; height: 40px; border-radius: 8px; font-size: 15px; font-weight: 700; border: none;
}
.confirm-cancel { background: rgba(255,255,255,0.08); color: rgba(255,228,181,0.85); border: 1px solid rgba(255,255,255,0.2) !important; }
.confirm-ok { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); color: #0a1628; }

/* loading 遮罩 */
.loading-mask {
  position: fixed; inset: 0;
  background: rgba(5, 15, 30, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; z-index: 999;
}
.loading-icon { font-size: 40px; animation: tk-wait-pulse 1.5s ease-in-out infinite; }
.loading-text { font-size: 16px; color: #FFD700; font-weight: 600; }
@keyframes tk-wait-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ============================================================
   语言选择层（四入口共用组件，见 js/i18n.js）
   ============================================================ */
.tk-lang-layer {
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(10, 18, 40, 0.92);
  backdrop-filter: blur(6px);
  opacity: 1; transition: opacity 0.2s ease;
}
.tk-lang-layer.hide { opacity: 0; pointer-events: none; }
.tk-lang-panel {
  position: relative;
  width: 100%; max-width: 420px;
  padding: 28px 22px 18px;
  border-radius: 18px;
  background: linear-gradient(160deg, #16274d 0%, #0e1830 100%);
  border: 1px solid rgba(212, 160, 23, 0.45);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  text-align: center;
}
.tk-lang-skip {
  position: absolute; top: 8px; right: 10px;
  width: 34px; height: 34px; line-height: 1;
  font-size: 22px; color: #9fb0cc;
  background: transparent; border: 0; border-radius: 50%;
  cursor: pointer;
}
.tk-lang-skip:hover, .tk-lang-skip:active { color: #fff; background: rgba(255, 255, 255, 0.08); }
.tk-lang-title {
  font-size: 15px; color: #FFD700; font-weight: 600;
  line-height: 1.5; margin-bottom: 4px;
}
.tk-lang-hint {
  font-size: 13px; color: #8ea2c4; margin-bottom: 18px;
}
.tk-lang-list { display: flex; flex-direction: column; gap: 12px; }
.tk-lang-card {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(212, 160, 23, 0.35);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.tk-lang-card:hover, .tk-lang-card:active {
  background: rgba(212, 160, 23, 0.15);
  border-color: #FFD700;
}
.tk-lang-card.active { border-color: #FFD700; background: rgba(212, 160, 23, 0.18); }
.tk-lang-self { font-size: 21px; font-weight: 700; color: #fff; }
.tk-lang-native { font-size: 13px; color: #9fb0cc; }
.tk-lang-foot {
  margin-top: 16px; font-size: 11px; line-height: 1.6; color: #6f82a5;
}
body.tk-lang-open { overflow: hidden; }

/* 首页常驻语言按钮 */
.lang-toggle {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 34px; padding: 0 12px;
  font-size: 14px; font-weight: 600; color: #FFD700;
  background: rgba(10, 18, 40, 0.62);
  border: 1px solid rgba(212, 160, 23, 0.5);
  border-radius: 999px;
  cursor: pointer; white-space: nowrap;
}
.lang-toggle:active { background: rgba(212, 160, 23, 0.22); }
/* 安全宽度：无论语言自称多长，按钮都不会超出容器右缘被裁切 */
.lang-toggle { max-width: calc(100% - 24px); }
.lang-toggle > span { min-width: 0; }
.lang-toggle > span:last-child { overflow: hidden; text-overflow: ellipsis; }
html[dir="rtl"] .lang-toggle { right: auto; left: 12px; }
html[dir="rtl"] .tk-lang-skip { right: auto; left: 10px; }
html[dir="rtl"] body, html[dir="rtl"] .tk-lang-panel { text-align: right; }
html[dir="rtl"] .tk-lang-title { text-align: center; }

/* 棋盘与棋子方向锁定：RTL 下绝不镜像 */
html[dir="rtl"] #holesTop, html[dir="rtl"] #holesBottom,
html[dir="rtl"] #kazanTop, html[dir="rtl"] #kazanBottom,
html[dir="rtl"] .board { direction: ltr; }

/* RTL：方向性箭头随文字方向翻转，避免「›」在左侧仍指右 */
html[dir="rtl"] .mode-arrow,
html[dir="rtl"] .hero-cta-arrow,
html[dir="rtl"] .rules-arrow { transform: scaleX(-1); }
html[dir="rtl"] .rules-arrow.open { transform: rotate(90deg); }

/* ============================================================
   新疆哈萨克语（阿拉伯字母）专用字体 —— 锁定不回落
   字体文件：fonts/kazakh-soft-baspaqaniq.ttf、fonts/kaznet.ttf
   ============================================================ */
@font-face {
  font-family: 'TK Kazakh Arab';
  src: url('../fonts/kazakh-soft-baspaqaniq.ttf') format('truetype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'TK Kazakh Arab Alt';
  src: url('../fonts/kaznet.ttf') format('truetype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
/* 品牌标题第一行（阿拉伯字母哈萨克文）专用字体：fonts/kazakh-naqis.ttf */
@font-face {
  font-family: 'TK Kazakh Naqis';
  src: url('../fonts/kazakh-naqis.ttf') format('truetype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
/* 第一行标题在所有语言模式下都锁定 Naqis 字体，不随语言回落 */
.title-ar,
.splash-title-ar,
.hero-ar {
  font-family: 'TK Kazakh Naqis', 'TK Kazakh Arab', 'TK Kazakh Arab Alt', serif !important;
}
html[lang="kk-Arab"] body,
html[lang="kk-Arab"] body *:not(i):not(.qumalaq-stone):not(.kazan-stone):not(.brand-cn):not(.title-ar):not(.splash-title-ar):not(.hero-ar) {
  font-family: 'TK Kazakh Arab', 'TK Kazakh Arab Alt', 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji' !important;
}
.tk-lang-self[dir="rtl"],
.tk-lang-native {
  unicode-bidi: isolate;
}
