/* ============================================================
   双人游戏厅 · H5 版样式
   与小程序版共用同一套设计语言：深空霓虹
   ============================================================ */

:root {
  --bg: #0b0f1a;
  --bg2: #101627;
  --surface: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.09);
  --line2: rgba(255, 255, 255, 0.16);
  --text: #e9eefb;
  --text2: #9aa7c2;
  --text3: #6b7691;
  --p1: #3ea6ff;
  --p1s: rgba(62, 166, 255, 0.16);
  --p2: #ff5c7c;
  --p2s: rgba(255, 92, 124, 0.16);
  --gold: #ffb020;
  --golds: rgba(255, 176, 32, 0.16);
  --r: 16px;
  --rl: 22px;
  --tabbar-h: 58px;
}

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  overscroll-behavior: none;
}

button { font-family: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
h1, h2, p { margin: 0; }

/* ------------------------------ 背景 */
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(420px 320px at 12% -6%, rgba(79, 124, 255, 0.22), transparent 70%),
    radial-gradient(400px 360px at 96% 104%, rgba(255, 92, 124, 0.18), transparent 70%),
    radial-gradient(520px 400px at 50% 42%, rgba(34, 211, 238, 0.07), transparent 72%),
    linear-gradient(180deg, #0b0f1a 0%, #0a0e18 55%, #0b0f1a 100%);
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.55;
  background-image:
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px);
  background-size: 26px 26px;
}

/* ------------------------------ 框架 */
.app {
  position: fixed; inset: 0; z-index: 1;
  display: flex; flex-direction: column;
  max-width: 560px; margin: 0 auto;
}

.view {
  display: none;
  flex: 1; min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + env(safe-area-inset-top)) 16px 22px;
}
.view.active { display: flex; }
.view.no-scroll { overflow: hidden; }

/* 内容型页面的直接子元素不参与收缩，否则 hero / 卡片会被压扁 */
#view-home > *,
#view-reward > * { flex: 0 0 auto; }

/* 滚动条跟随深色主题（Chrome / Safari） */
.view { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.14) transparent; }
.view::-webkit-scrollbar { width: 4px; height: 4px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
.view::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }

/* ------------------------------ 底部导航 */
.tabbar {
  flex: 0 0 auto;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(16, 22, 39, 0.94);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  color: var(--text3); font-size: 10px; letter-spacing: 0.5px;
  transition: color 0.2s ease;
}
.tab svg { width: 22px; height: 22px; fill: currentColor; }
.tab.active { color: var(--p1); }
.tab.active svg { filter: drop-shadow(0 0 8px rgba(62, 166, 255, 0.55)); }

/* ------------------------------ 通用 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(14px);
}
.sec-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 22px 2px 12px;
}
.sec-title { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--text3); }
.sec-more { font-size: 12px; font-weight: 600; color: var(--p1); }
.sec-more.danger { color: var(--p2); }
.sec-count { font-size: 11px; color: var(--text3); }
.foot { margin-top: 22px; text-align: center; font-size: 10px; color: #47506a; letter-spacing: 1px; }
.tip { margin-top: 10px; text-align: center; font-size: 10px; color: #5d6a85; letter-spacing: 0.5px; }

.btn {
  height: 44px; padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font-size: 14px; font-weight: 700; letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--line2);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.96); opacity: 0.9; }
.btn.primary {
  color: #08111f; border-color: transparent;
  background: linear-gradient(135deg, #6ea8ff, #4f7cff 55%, #7c5cff);
  box-shadow: 0 8px 22px rgba(79, 124, 255, 0.34);
}
.btn.gold {
  color: #241500; border-color: transparent;
  background: linear-gradient(135deg, #ffd579, #ffb020);
  box-shadow: 0 8px 22px rgba(255, 176, 32, 0.3);
}
.btn.ghost { color: var(--text2); background: transparent; }

/* ============================================================
   大厅
   ============================================================ */
.hero {
  position: relative; overflow: hidden;
  padding: 24px 20px 22px;
  border-radius: var(--rl);
  background:
    radial-gradient(230px 160px at 12% 0%, rgba(79, 124, 255, 0.34), transparent 70%),
    radial-gradient(220px 170px at 96% 110%, rgba(255, 92, 124, 0.28), transparent 72%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.11);
  animation: rise 0.5s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}
.hero-tag { font-size: 9px; font-weight: 700; letter-spacing: 4px; color: rgba(255, 255, 255, 0.42); }
.hero-title {
  margin-top: 8px; font-size: 30px; font-weight: 800;
  letter-spacing: 2px; color: #f4f8ff;
  text-shadow: 0 0 26px rgba(79, 124, 255, 0.5);
}
.hero-slogan { margin-top: 8px; font-size: 13px; font-weight: 600; color: #b9c6df; letter-spacing: 1px; }
.hero-sub { margin-top: 5px; font-size: 11px; color: var(--text3); }

/* 游戏卡 */
.games { display: flex; flex-direction: column; gap: 12px; }
.game-card {
  position: relative; height: 116px; overflow: hidden;
  border-radius: var(--r);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex; align-items: center;
  cursor: pointer;
  transition: transform 0.18s ease;
  animation: rise 0.5s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}
.game-card:active { transform: scale(0.98); }
.game-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.game-veil {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(8, 12, 21, 0.94) 0%, rgba(8, 12, 21, 0.72) 52%, rgba(8, 12, 21, 0.12) 100%);
}
.game-info { position: relative; z-index: 2; padding: 0 16px; }
.game-row { display: flex; align-items: center; gap: 8px; }
.game-name { font-size: 21px; font-weight: 800; letter-spacing: 2px; color: #f4f8ff; }
.game-chip {
  padding: 1px 8px; border-radius: 999px; font-size: 9px; font-weight: 700;
  border: 1px solid currentColor; opacity: 0.9;
}
.game-desc { margin-top: 6px; font-size: 11px; color: var(--text2); }
.game-go {
  position: absolute; right: 16px; z-index: 2;
  font-size: 24px; color: rgba(255, 255, 255, 0.4); line-height: 1;
}

/* 战绩 */
.stat-card { padding: 2px 14px; }
.stat-line {
  display: flex; align-items: center; justify-content: space-between;
  height: 44px; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.stat-line:last-child { border-bottom: 0; }
.stat-k { font-size: 12px; color: var(--text2); }
.stat-v { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-v.sm { font-size: 13px; color: #b9c6df; }
.v1 { color: var(--p1); }
.v2 { color: var(--p2); }
.stat-colon { margin: 0 5px; color: #4a5570; font-size: 13px; }

/* 奖惩预览 */
.preview { display: flex; gap: 9px; }
.pv-col { flex: 1; min-width: 0; }
.pv-cap {
  height: 28px; margin-bottom: 6px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
}
.pv-cap.r { color: #ffcf6b; background: rgba(255, 176, 32, 0.14); border: 1px solid rgba(255, 176, 32, 0.26); }
.pv-cap.p { color: #ff9db1; background: rgba(255, 92, 124, 0.14); border: 1px solid rgba(255, 92, 124, 0.26); }
.pv-item {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 10px; margin-bottom: 6px; border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px; font-weight: 600; color: #dbe4f7;
}
.pv-emoji { font-size: 15px; line-height: 1; }

/* 规则 */
.rules { padding: 13px 14px; margin-bottom: 9px; }
.rule-head { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.rule-dot { width: 6px; height: 6px; border-radius: 50%; }
.rule-name { font-size: 13px; font-weight: 700; letter-spacing: 1px; }
.rule-item { display: flex; gap: 5px; margin-top: 5px; font-size: 11.5px; line-height: 1.6; color: #98a5bf; }
.rule-bullet { color: #4a5570; }

/* ============================================================
   五子棋
   ============================================================ */
#view-gomoku { padding: calc(10px + env(safe-area-inset-top)) 14px 12px; align-items: stretch; }

.gm-bar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
}
.gm-side {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: 11px;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.gm-side.on { background: rgba(79, 124, 255, 0.14); box-shadow: inset 0 0 0 1px rgba(79, 124, 255, 0.4); }
.gm-right { justify-content: flex-end; }
.gm-avatar {
  flex: 0 0 31px; width: 31px; height: 31px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.gm-black { color: #cfe2ff; background: radial-gradient(circle at 34% 30%, #5c6e8f, #131a26 70%); border: 1px solid rgba(120, 176, 255, 0.4); }
.gm-white { color: #2a3550; background: radial-gradient(circle at 34% 30%, #fff, #c3cee0 72%); border: 1px solid rgba(255, 255, 255, 0.6); }
.gm-meta { min-width: 0; }
.gm-meta-r { text-align: right; }
.gm-name { font-size: 13px; font-weight: 700; letter-spacing: 0.5px; }
.gm-sub { margin-top: 1px; font-size: 10px; color: #7d8aa4; font-variant-numeric: tabular-nums; }
.gm-mid { display: flex; flex-direction: column; align-items: center; padding: 0 6px; }
.gm-mid span { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: #4f7cff; }
.gm-mid em { font-style: normal; font-size: 9px; color: #5d6a85; }

.gm-status { flex: 0 0 auto; margin-top: 10px; display: flex; align-items: center; gap: 6px; height: 22px; }
.gm-dot { width: 8px; height: 8px; border-radius: 50%; }
.gm-dot.is-black { background: #1b2231; box-shadow: 0 0 0 1.5px rgba(120, 176, 255, 0.7), 0 0 8px rgba(79, 124, 255, 0.6); }
.gm-dot.is-white { background: #f2f6ff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.5), 0 0 8px rgba(255, 255, 255, 0.5); }
.gm-status-text { font-size: 14px; font-weight: 700; letter-spacing: 0.5px; }
.gm-badge {
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; color: #ffcf6b; background: rgba(255, 176, 32, 0.16);
  animation: pulse 2s ease-in-out infinite;
}
.gm-streak { flex: 0 0 auto; margin-top: 3px; font-size: 11px; color: var(--gold); }

.board-wrap {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 8px 0 6px;
}
#gm-canvas {
  display: block; border-radius: 13px;
  background: #2b2119;
  box-shadow:
    0 0 0 1px rgba(255, 205, 140, 0.22),
    0 13px 34px rgba(0, 0, 0, 0.6),
    0 0 28px rgba(255, 176, 32, 0.1);
  touch-action: none;
}

.gm-actions { flex: 0 0 auto; display: flex; gap: 9px; }
.gm-actions .btn { flex: 1; padding: 0 6px; font-size: 13px; }

/* ============================================================
   坦克大战
   ============================================================ */
#view-tank { padding: calc(6px + env(safe-area-inset-top)) 12px 4px; }

.tk-top {
  flex: 0 0 auto; height: 28px;
  display: flex; align-items: center; justify-content: space-between;
}
.tk-target { font-size: 11px; color: #8f9cb8; }
.tk-target b { color: var(--gold); font-size: 13px; font-weight: 800; }
.tk-tools { display: flex; gap: 6px; }
.tk-tools button {
  padding: 3px 10px; border-radius: 999px; font-size: 10px; color: var(--text2);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.tk-tools button:active { opacity: 0.7; transform: scale(0.95); }

.pad { flex: 0 0 auto; }
.pad-head { display: flex; align-items: center; height: 22px; }
.pad-id { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.pad-dot { width: 7px; height: 7px; border-radius: 50%; }
.pad-dot.d1 { background: var(--p1); box-shadow: 0 0 8px rgba(62, 166, 255, 0.8); }
.pad-dot.d2 { background: var(--p2); box-shadow: 0 0 8px rgba(255, 92, 124, 0.8); }
.pad-dots { display: flex; gap: 4px; margin-left: 9px; }
.pad-dots i {
  width: 8px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  transition: background 0.22s ease, box-shadow 0.22s ease;
}
.pad-dots i.on.d1 { background: var(--p1); box-shadow: 0 0 8px rgba(62, 166, 255, 0.9); }
.pad-dots i.on.d2 { background: var(--p2); box-shadow: 0 0 8px rgba(255, 92, 124, 0.9); }
.pad-num { margin-left: auto; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pad-num em { font-style: normal; font-size: 10px; font-weight: 600; color: #5d6a85; }

.pad-body { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 0; }

.dpad {
  position: relative; width: 104px; height: 104px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.1), rgba(255,255,255,0.025) 72%);
  border: 1px solid rgba(255, 255, 255, 0.13);
  touch-action: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.pad-1 .dpad.live { border-color: rgba(62, 166, 255, 0.55); box-shadow: inset 0 0 18px rgba(62,166,255,.28), 0 0 14px rgba(62,166,255,.18); }
.pad-2 .dpad.live { border-color: rgba(255, 92, 124, 0.55); box-shadow: inset 0 0 18px rgba(255,92,124,.28), 0 0 14px rgba(255,92,124,.18); }
.dp-glyph {
  position: absolute; font-size: 12px; line-height: 1; font-style: normal;
  color: rgba(255, 255, 255, 0.28);
  transition: color 0.12s ease, text-shadow 0.12s ease;
}
.g-up { top: 6px; left: 50%; transform: translateX(-50%); }
.g-down { bottom: 6px; left: 50%; transform: translateX(-50%); }
.g-left { left: 7px; top: 50%; transform: translateY(-50%); }
.g-right { right: 7px; top: 50%; transform: translateY(-50%); }
.pad-1 .dp-glyph.hit { color: #9fd8ff; text-shadow: 0 0 10px rgba(62, 166, 255, 0.95); }
.pad-2 .dp-glyph.hit { color: #ffb3c3; text-shadow: 0 0 10px rgba(255, 92, 124, 0.95); }
.dp-core {
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, rgba(255,255,255,0.22), rgba(255,255,255,0.05) 70%);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.fire {
  width: 86px; height: 86px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(140deg, rgba(255,255,255,0.1), rgba(255,255,255,0.028));
  border: 1px solid rgba(255, 255, 255, 0.16);
  touch-action: none;
  transition: transform 0.1s ease;
}
.fire span {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; letter-spacing: 2px;
  transition: box-shadow 0.16s ease;
}
.pad-1 .fire span { color: #061423; background: linear-gradient(140deg, #63c2ff, #3ea6ff); box-shadow: 0 0 16px rgba(62,166,255,.45); }
.pad-2 .fire span { color: #250610; background: linear-gradient(140deg, #ff8fa5, #ff5c7c); box-shadow: 0 0 16px rgba(255,92,124,.45); }
.fire.on { transform: scale(0.92); }
.fire.on span { box-shadow: 0 0 26px rgba(255, 255, 255, 0.65); }

.tk-field {
  flex: 1; min-height: 110px;
  display: flex; align-items: center; justify-content: center;
  position: relative; margin: 3px 0;
}
.canvas-box {
  position: relative; border-radius: 12px; overflow: hidden;
  background: #080c15;
  box-shadow: 0 0 0 1px rgba(79,124,255,.3), 0 0 24px rgba(79,124,255,.12), 0 12px 32px rgba(0,0,0,.6);
}
#tk-canvas { display: block; touch-action: none; }

.field-mask {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 12px;
  background: rgba(6, 10, 18, 0.86);
  backdrop-filter: blur(4px);
  text-align: center;
}
.field-mask.hidden { display: none; }
.fm-title { font-size: 19px; font-weight: 800; letter-spacing: 2px; }
.fm-desc { margin-top: 6px; padding: 0 22px; font-size: 11.5px; line-height: 1.7; color: #8f9cb8; }
.fm-btn {
  margin-top: 16px; height: 42px; padding: 0 30px; border-radius: 999px;
  font-size: 14px; font-weight: 800; letter-spacing: 2px; color: #08111f;
  background: linear-gradient(135deg, #6ea8ff, #4f7cff 55%, #7c5cff);
  box-shadow: 0 8px 22px rgba(79, 124, 255, 0.42);
}
.fm-btn:active { transform: scale(0.96); }

/* ============================================================
   奖惩中心
   ============================================================ */
.rw-hero {
  padding: 22px 20px; border-radius: var(--rl); overflow: hidden;
  background:
    radial-gradient(220px 160px at 90% 0%, rgba(255, 176, 32, 0.3), transparent 70%),
    radial-gradient(200px 160px at 6% 100%, rgba(255, 92, 124, 0.26), transparent 72%),
    linear-gradient(160deg, rgba(255,255,255,0.09), rgba(255,255,255,0.025));
  border: 1px solid rgba(255, 255, 255, 0.11);
}
.rw-hero-tag { font-size: 9px; font-weight: 700; letter-spacing: 3px; color: rgba(255,255,255,.42); }
.rw-hero-title { margin-top: 7px; font-size: 26px; font-weight: 800; letter-spacing: 2px; text-shadow: 0 0 24px rgba(255,176,32,.4); }
.rw-hero-sub { margin-top: 6px; font-size: 12px; color: var(--text2); letter-spacing: 1px; }

.roll-card { margin-top: 14px; padding: 11px 12px 14px; }
.roll-tabs { display: flex; padding: 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); }
.roll-tab {
  flex: 1; height: 34px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: #7d8aa4;
  transition: color 0.24s ease, background 0.24s ease, box-shadow 0.24s ease;
}
.roll-tab i { font-style: normal; font-size: 9px; opacity: 0.7; }
.roll-tab.on-r { color: #241500; font-weight: 800; background: linear-gradient(135deg, #ffd579, #ffb020); box-shadow: 0 5px 16px rgba(255,176,32,.32); }
.roll-tab.on-p { color: #250610; font-weight: 800; background: linear-gradient(135deg, #ff8fa5, #ff5c7c); box-shadow: 0 5px 16px rgba(255,92,124,.32); }

.roll-box {
  height: 168px; margin: 12px 0;
  border-radius: 16px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(180px 130px at 50% 40%, rgba(79,124,255,.16), transparent 72%),
    rgba(0, 0, 0, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.13);
}
.roll-inner { width: 100%; padding: 0 18px; text-align: center; }
.roll-emoji { display: block; font-size: 38px; line-height: 1.15; }
.roll-title { display: block; margin-top: 8px; font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.roll-desc { display: block; margin-top: 6px; font-size: 11.5px; line-height: 1.6; color: #98a5bf; }
.roll-badge {
  display: inline-block; margin-bottom: 6px; padding: 1px 10px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.is-r .roll-badge { color: #ffcf6b; background: rgba(255, 176, 32, 0.18); }
.is-p .roll-badge { color: #ff9db1; background: rgba(255, 92, 124, 0.18); }
.is-r .roll-title { text-shadow: 0 0 18px rgba(255, 176, 32, 0.55); }
.is-p .roll-title { text-shadow: 0 0 18px rgba(255, 92, 124, 0.55); }
.is-idle .roll-idle-ico { display: block; font-size: 34px; opacity: 0.5; }
.is-idle .roll-idle-txt { display: block; margin-top: 8px; font-size: 12px; color: var(--text3); letter-spacing: 1px; }
.is-roll { animation: shake 0.12s linear infinite; }
.is-settle { animation: settle 0.5s cubic-bezier(0.22, 0.9, 0.24, 1) both; }

.roll-btn {
  width: 100%; height: 48px; border-radius: 999px;
  font-size: 16px; font-weight: 800; letter-spacing: 4px;
  transition: transform 0.16s ease, opacity 0.16s ease;
}
.roll-btn.is-r { color: #241500; background: linear-gradient(135deg, #ffd579, #ffb020); box-shadow: 0 9px 26px rgba(255,176,32,.34); }
.roll-btn.is-p { color: #250610; background: linear-gradient(135deg, #ff8fa5, #ff5c7c); box-shadow: 0 9px 26px rgba(255,92,124,.34); }
.roll-btn:active { transform: scale(0.97); }
.roll-btn.off { opacity: 0.55; }

.pool { display: flex; flex-wrap: wrap; justify-content: space-between; }
.pool-item {
  width: 48.4%; margin-bottom: 9px; padding: 11px 10px;
  display: flex; gap: 7px; align-items: flex-start;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
.pool-item.reward { border-color: rgba(255,176,32,.2); background: linear-gradient(150deg, rgba(255,176,32,.1), rgba(255,255,255,.03)); }
.pool-item.punishment { border-color: rgba(255,92,124,.2); background: linear-gradient(150deg, rgba(255,92,124,.1), rgba(255,255,255,.03)); }
.pool-emoji { font-size: 17px; line-height: 1.2; }
.pool-body { flex: 1; min-width: 0; }
.pool-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pool-name { font-size: 13px; font-weight: 700; }
.pool-lv { padding: 0 5px; border-radius: 999px; font-size: 9px; font-weight: 700; }
.lv-mild { color: #6ee7b7; background: rgba(52, 211, 153, 0.16); }
.lv-medium { color: #ffcf6b; background: rgba(255, 176, 32, 0.16); }
.lv-heavy { color: #ff9db1; background: rgba(255, 92, 124, 0.18); }
.pool-desc { display: block; margin-top: 5px; font-size: 10.5px; line-height: 1.55; color: #8b98b3; }

.hist-card { padding: 2px 12px; }
.hist-row { padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.hist-row:last-child { border-bottom: 0; }
.hist-top { display: flex; align-items: center; gap: 6px; }
.hist-time { font-size: 10px; color: var(--text3); font-variant-numeric: tabular-nums; }
.hist-tag { padding: 0 7px; border-radius: 999px; font-size: 9.5px; color: var(--text2); background: rgba(255,255,255,.08); }
.hist-win { font-size: 10px; font-weight: 700; color: var(--p1); }
.hist-items { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.hist-pill { padding: 3px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; }
.hist-pill.reward { color: #ffcf6b; background: rgba(255, 176, 32, 0.13); }
.hist-pill.punishment { color: #ff9db1; background: rgba(255, 92, 124, 0.13); }
.empty { padding: 34px 0; text-align: center; }
.empty-ico { display: block; font-size: 28px; opacity: 0.5; }
.empty-txt { display: block; margin-top: 8px; font-size: 12px; color: var(--text3); }

/* ============================================================
   奖惩弹窗
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 900; display: none; align-items: flex-end; justify-content: center; }
.modal.open { display: flex; }
.modal-mask { position: absolute; inset: 0; background: rgba(4, 7, 14, 0.72); opacity: 0; transition: opacity 0.28s ease; }
.modal.open .modal-mask { opacity: 1; }
.modal-sheet {
  position: relative; width: 100%; max-width: 560px;
  padding: 6px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: linear-gradient(180deg, #182034 0%, #101627 62%, #0d1220 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 -15px 40px rgba(0, 0, 0, 0.6);
  transform: translateY(102%);
  transition: transform 0.36s cubic-bezier(0.22, 0.9, 0.24, 1);
}
.modal.open .modal-sheet { transform: translateY(0); }
.sheet-bar { width: 36px; height: 4px; border-radius: 999px; margin: 4px auto 12px; background: rgba(255,255,255,.18); }
.sheet-head { padding: 0 4px 10px; }
.sheet-head h2 { font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.sheet-head p { margin-top: 4px; font-size: 12px; color: #8f9cb8; }
.sheet-list { max-height: 46vh; overflow-y: auto; }
.m-card {
  position: relative; overflow: hidden;
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 12px; margin-bottom: 9px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: pop 0.44s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}
.m-card::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.m-card.reward { background: linear-gradient(135deg, rgba(255,176,32,.16), rgba(255,255,255,.04)); border-color: rgba(255,176,32,.32); }
.m-card.reward::after { background: linear-gradient(180deg, #ffd579, #ffb020); }
.m-card.punishment { background: linear-gradient(135deg, rgba(255,92,124,.16), rgba(255,255,255,.04)); border-color: rgba(255,92,124,.32); }
.m-card.punishment::after { background: linear-gradient(180deg, #ff9db1, #ff5c7c); }
.m-emoji {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.1);
}
.m-body { flex: 1; min-width: 0; }
.m-row { display: flex; align-items: center; gap: 6px; }
.m-name { font-size: 16px; font-weight: 700; letter-spacing: 0.5px; }
.m-tag { padding: 1px 7px; border-radius: 999px; font-size: 9px; font-weight: 700; }
.m-tag.reward { color: #ffcf6b; background: rgba(255,176,32,.2); }
.m-tag.punishment { color: #ff9db1; background: rgba(255,92,124,.2); }
.m-desc { margin-top: 5px; font-size: 12px; line-height: 1.55; color: #a9b5cd; }
.m-owner { margin-top: 6px; font-size: 10.5px; color: #6f7c96; letter-spacing: 0.5px; }
.sheet-note {
  margin: 2px 4px 10px; padding: 8px 10px; border-radius: 9px;
  font-size: 11px; color: #ffcf6b;
  background: rgba(255, 176, 32, 0.1); border: 1px solid rgba(255, 176, 32, 0.22);
}
.sheet-actions { display: flex; gap: 9px; padding-top: 2px; }
.sheet-actions .btn { flex: 1; height: 46px; }

/* ============================================================
   动画
   ============================================================ */
@keyframes rise {
  0% { opacity: 0; transform: translateY(14px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes pop {
  0% { opacity: 0; transform: translateY(12px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes settle {
  0% { opacity: 0; transform: scale(0.82) rotateX(46deg); }
  62% { opacity: 1; transform: scale(1.05) rotateX(0deg); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateY(0) scale(1); opacity: 1; }
  50% { transform: translateY(-3px) scale(0.97); opacity: 0.72; }
}
@keyframes pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* 矮屏适配：压缩操作区，把空间让给棋盘 / 战场 */
@media (max-height: 680px) {
  .dpad { width: 88px; height: 88px; }
  .fire { width: 74px; height: 74px; }
  .fire span { width: 56px; height: 56px; font-size: 12px; }
  .pad-body { padding-top: 0; }
}

@media (min-width: 561px) {
  .app { box-shadow: 0 0 60px rgba(0, 0, 0, 0.6); }
}
