/* ============================================================
   视觉追踪 — 样式（Chrome 61 基线，专注力·天蓝系）
   约束：无 flex gap / aspect-ratio / clamp() / inset / 逻辑属性 / :has / dvh
   泡泡 = 绝对定位 + left/top（无 transform 依赖，Chrome 61 稳妥）
   ============================================================ */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #e8f4ff;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: #2a3a4a;
  height: var(--app-height, 100vh);
  overflow: hidden;
}

#app-main {
  height: calc(100% - 118px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  min-height: 100%;
}

/* ---------- 头部 ---------- */
.app-header {
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(74, 168, 255, 0.14);
  position: relative;
  z-index: 5;
}

.header-brand {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 16px;
}

.header-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  margin-right: 10px;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: #2a3a4a;
}

.header-ver {
  margin-left: 8px;
  font-size: 12px;
  color: #7a8ea3;
  background: #eef5fb;
  padding: 2px 6px;
  border-radius: 8px;
}

/* ---------- 通用按钮 ---------- */
button {
  font-family: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  min-height: 48px;
  min-width: 48px;
  -webkit-tap-highlight-color: transparent;
}

.btn-checkin {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 14px auto 0;
  padding: 12px 16px;
  background: #4aa8ff;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(74, 168, 255, 0.28);
}

.btn-checkin:active {
  background: #3a97e8;
  -webkit-transform: scale(0.98);
  transform: scale(0.98);
}

.btn-ghost-sm {
  padding: 8px 14px;
  font-size: 13px;
  color: #4aa8ff;
  background: #eef5fb;
  border-radius: 10px;
}

.btn-ghost-sm:active {
  background: #dcebfa;
}

/* ---------- 难度选择页 ---------- */
.page-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin: 22px 0 8px;
}

.home-hint {
  text-align: center;
  color: #7a8ea3;
  font-size: 14px;
  margin-bottom: 18px;
}

.diff-list {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-direction: column;
  flex-direction: column;
}

.diff-btn {
  background: #fff;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 12px;
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  -webkit-align-items: center;
  align-items: center;
  box-shadow: 0 2px 8px rgba(74, 168, 255, 0.1);
  text-align: left;
}

.diff-btn:active {
  background: #f4fafe;
  -webkit-transform: scale(0.99);
  transform: scale(0.99);
}

.diff-head {
  font-size: 16px;
  font-weight: 700;
  color: #2a3a4a;
}

.diff-sub {
  font-size: 12px;
  color: #7a8ea3;
  margin-top: 4px;
  display: block;
}

/* ---------- 游戏页 ---------- */
.topbar {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  margin-bottom: 10px;
}

.level-title {
  font-size: 16px;
  font-weight: 700;
  color: #2a3a4a;
}

.top-timer {
  font-size: 14px;
  color: #e76f51;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.vt-round {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: #4aa8ff;
  margin: 4px 0 8px;
}

.game-status {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #7a8ea3;
  min-height: 22px;
  margin-bottom: 10px;
}

/* 棋盘容器 */
.vt-board {
  position: relative;
  background: #dcebfa;
  border-radius: 16px;
  height: 380px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(74, 168, 255, 0.12);
}

/* 泡泡（绝对定位，left/top 驱动） */
.vt-bubble {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(74, 168, 255, 0.22);
  border: 2px solid #cfe4f7;
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  cursor: pointer;
}

.vt-bubble svg {
  width: 78%;
  height: 78%;
}

/* 目标标记（1.5s 橙色光环 + 轻微放大） */
.vt-bubble.target {
  border-color: #ff9f43;
  box-shadow: 0 0 0 4px rgba(255, 159, 67, 0.45), 0 3px 10px rgba(74, 168, 255, 0.25);
  -webkit-transform: scale(1.12);
  transform: scale(1.12);
}

/* 点对绿闪 / 点错红闪（400ms） */
.vt-bubble.flash-ok {
  border-color: #12b76a;
  box-shadow: 0 0 0 4px rgba(18, 183, 106, 0.5);
  -webkit-transform: scale(1.15);
  transform: scale(1.15);
}

.vt-bubble.flash-wrong {
  border-color: #ff6b6b;
  background: #ffe9e6;
  -webkit-animation: wrongFlash 0.4s ease-out;
  animation: wrongFlash 0.4s ease-out;
}

@-webkit-keyframes wrongFlash {
  0% { background: #ffe9e6; }
  60% { background: #ffc9c4; }
  100% { background: #ffffff; }
}

@keyframes wrongFlash {
  0% { background: #ffe9e6; }
  60% { background: #ffc9c4; }
  100% { background: #ffffff; }
}

/* ---------- 页脚 ---------- */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  box-shadow: 0 -2px 8px rgba(74, 168, 255, 0.1);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
}

.game-footer {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.game-footer .btn-ghost-sm {
  margin: 0 6px;
}

.footer-errors {
  margin-left: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #ff6b6b;
  min-width: 52px;
  text-align: center;
}

/* ---------- 结算浮层 ---------- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 35, 55, 0.55);
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-content: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.overlay-card {
  background: #fff;
  border-radius: 18px;
  padding: 24px 22px 20px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(20, 35, 55, 0.25);
  -webkit-animation: popCard 0.3s ease-out;
  animation: popCard 0.3s ease-out;
}

@-webkit-keyframes popCard {
  0% { -webkit-transform: scale(0.85); transform: scale(0.85); opacity: 0; }
  100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}

@keyframes popCard {
  0% { -webkit-transform: scale(0.85); transform: scale(0.85); opacity: 0; }
  100% { -webkit-transform: scale(1); transform: scale(1); opacity: 1; }
}

.overlay-title {
  font-size: 22px;
  font-weight: 700;
  color: #2a3a4a;
  margin-bottom: 6px;
}

.overlay-sub {
  font-size: 14px;
  color: #7a8ea3;
  margin-bottom: 10px;
}

.summary {
  margin-bottom: 14px;
}

.stars-line {
  font-size: 36px;
  line-height: 1.2;
  color: #f5a623;
  letter-spacing: 4px;
}

.record-badge {
  display: inline-block;
  margin-top: 8px;
  background: #e8faf0;
  color: #12b76a;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}

.checkin-line {
  margin-top: 8px;
  font-size: 13px;
  color: #12b76a;
  font-weight: 600;
}

.overlay-btns {
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  -webkit-justify-content: center;
  justify-content: center;
}

.overlay-btns .btn-main {
  background: #4aa8ff;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 12px;
  margin: 6px 5px;
  box-shadow: 0 4px 12px rgba(74, 168, 255, 0.3);
}

.overlay-btns .btn-ghost {
  background: #eef5fb;
  color: #4aa8ff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 12px;
  margin: 6px 5px;
}

/* ---------- 打卡日历 ---------- */
.calendar {
  background: #ffffff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(74, 168, 255, 0.12);
}

.calendar-grid {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  margin-top: 8px;
}

.calendar-grid > * {
  width: 14.28%;
  padding: 4px;
}

.cal-day {
  width: 100%;
  padding: 8px 0;
  text-align: center;
  font-size: 13px;
  border-radius: 6px;
  color: #7a8ea3;
  background: #f2f7fc;
}

.cal-day.done {
  background: #ff9c1a;
  color: #ffffff;
  font-weight: 700;
}

.cal-day.today {
  outline: 2px solid #4aa8ff;
}

.streak-info {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: #2a3a4a;
}

.streak-info b {
  color: #ff9c1a;
}