/* ==============================================================
   凑十消消 · 游戏专属样式
   选择器统一以 .g-make10 / .tm-* 前缀限定
   ============================================================== */

.g-make10 {
  --tm-line: rgba(255, 255, 255, 0.08);
  gap: 10px;
}

/* ------------------------------ 顶部状态 ------------------------------ */

.tm-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}
.tm-hud .badge { font-size: 11px; padding: 4px 10px; }
.tm-score {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tm-combo {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.15s, transform 0.15s;
}
.tm-combo.on { opacity: 1; transform: none; }
.tm-time {
  margin-left: auto;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.tm-progress { flex: none; height: 5px; }
.g-make10.low-time .tm-time { color: #ff7b88; }
.g-make10.low-time .tm-progress > i { background: linear-gradient(90deg, #ff7b88, #ff5c6c); }

/* ------------------------------ 棋盘 ------------------------------ */

.tm-board-wrap { flex: 1; min-height: 0; }
.tm-board {
  width: min(100%, 360px);
  aspect-ratio: 1 / 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 4px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  box-shadow: 0 22px 48px -28px rgba(0, 0, 0, 0.92), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  touch-action: manipulation;
  transition: box-shadow 0.35s ease;
}
.tm-board.done {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ok) 45%, transparent),
    0 22px 48px -28px rgba(0, 0, 0, 0.92);
}

.tm-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  color: #fff8f0;
  overflow: hidden;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.tm-cell:active { transform: scale(0.96); }
.tm-cell.empty {
  background: rgba(255, 255, 255, 0.018);
  border-color: rgba(255, 255, 255, 0.045);
  pointer-events: none;
}

.tm-cell.v1 { background: linear-gradient(155deg, #ffb37a, #c4632c); }
.tm-cell.v2 { background: linear-gradient(155deg, #76e8d2, #2c8878); }
.tm-cell.v3 { background: linear-gradient(155deg, #a7b6ff, #4a5ecb); }
.tm-cell.v4 { background: linear-gradient(155deg, #cfa9ff, #6f43b8); }
.tm-cell.v5 { background: linear-gradient(155deg, #ff9dc9, #b43e79); }
.tm-cell.v6 { background: linear-gradient(155deg, #e7c061, #8a671c); }
.tm-cell.v7 { background: linear-gradient(155deg, #95ec9d, #2f8f4c); }
.tm-cell.v8 { background: linear-gradient(155deg, #93c6ff, #356fa8); }
.tm-cell.v9 { background: linear-gradient(155deg, #ff929c, #a9343f); }

.tm-v {
  position: relative;
  z-index: 1;
  font-family: var(--mono);
  font-size: min(11.5vw, 42px);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.tm-cell.v6 .tm-v { color: #2a1c05; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25); }

.tm-cell.sel {
  z-index: 2;
  box-shadow: 0 0 0 2.5px var(--accent), 0 0 20px color-mix(in srgb, var(--accent) 50%, transparent);
  transform: scale(0.96);
}
.tm-cell.hint {
  z-index: 2;
  animation: tmHint 0.75s ease-in-out infinite alternate;
}
.tm-cell.wrong { animation: tmWrong 0.28s ease both; }
.tm-cell.pop { animation: tmPop 0.2s ease-in both; pointer-events: none; }
.tm-cell.drop { animation: tmDrop 0.15s ease-out both; }

.tm-pop {
  position: absolute;
  left: 50%;
  top: 18%;
  z-index: 3;
  transform: translateX(-50%);
  font-size: 16px;
  font-weight: 800;
  color: #fff4cf;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  animation: tmPopText 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

/* ------------------------------ 工具 ------------------------------ */

.tm-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: none;
}
.tm-tools .btn {
  min-height: 44px;
  gap: 7px;
  font-size: 13px;
}
.tm-tool-i { display: inline-flex; width: 17px; height: 17px; }
.tm-tool-i svg { width: 17px; height: 17px; }
.tm-hint {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.tm-foot {
  flex: none;
  min-height: 18px;
  text-align: center;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.g-make10.shake .tm-board { animation: tmShake 0.3s ease; }

/* ------------------------------ 开始页 ------------------------------ */

.tm-start { gap: 12px; }
.tm-startp { display: flex; flex-direction: column; }
.tm-start .seg-item { min-height: 42px; font-size: 13px; }
.tm-desc {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--faint);
}
.tm-bestinfo { display: flex; flex-direction: column; margin-top: 2px; }
.tm-brow {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 2px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
}
.tm-brow:last-child { border-bottom: 0; }
.tm-brow .n { font-size: 12.5px; color: var(--dim); }
.tm-brow .b { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tm-start-btn { margin-top: 14px; min-height: 48px; }
.tm-foot.hint { margin-top: auto; padding-top: 8px; text-align: center; font-size: 11px; }

/* ------------------------------ 结算 ------------------------------ */

.tm-resultwrap { gap: 12px; }
.tm-result {
  flex: none;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, var(--line));
  background: linear-gradient(165deg,
      color-mix(in srgb, var(--ok) 10%, transparent),
      rgba(255, 255, 255, 0.02));
  padding: 14px var(--pad) 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: tmUp 0.32s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}
.tm-result-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.tm-result-k {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--dim);
  letter-spacing: 0.04em;
}
.tm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
  flex: none;
}
.tm-result-big {
  margin-top: 2px;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.06;
}
.tm-result-unit { font-size: 15px; font-weight: 700; color: var(--dim); margin-left: 4px; }
.tm-result-meta {
  text-align: right;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.tm-best { color: var(--dim); }
.tm-best.new { color: var(--ok); font-weight: 700; }
.tm-rstats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tm-rstat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
}
.tm-rstat b {
  display: block;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.tm-rstat span { font-size: 9.5px; color: var(--faint); }
.tm-result .btn-row .btn { min-height: 44px; }
.tm-result-sub { display: flex; }
.tm-result-sub .btn { flex: 1; }

/* ------------------------------ 动画 ------------------------------ */

@keyframes tmHint {
  from { box-shadow: 0 0 0 2px var(--accent), 0 0 8px color-mix(in srgb, var(--accent) 40%, transparent); }
  to { box-shadow: 0 0 0 3px var(--accent), 0 0 22px color-mix(in srgb, var(--accent) 68%, transparent); }
}
@keyframes tmWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  55% { transform: translateX(5px); }
  80% { transform: translateX(-3px); }
}
@keyframes tmPop {
  0% { transform: scale(1); opacity: 1; }
  55% { transform: scale(1.14); opacity: 1; }
  100% { transform: scale(0.1); opacity: 0; }
}
@keyframes tmDrop {
  from { transform: translateY(calc(var(--fall, 1) * -100%)); }
  to { transform: translateY(0); }
}
@keyframes tmPopText {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.7); }
  25% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -24px) scale(1); }
}
@keyframes tmShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  55% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}
@keyframes tmUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------ 小屏 / 矮屏适配 ------------------------------ */

@media (max-height: 710px) {
  .g-make10 { gap: 8px; }
  .tm-hud { min-height: 26px; }
  .tm-v { font-size: min(11.5vw, 40px); }
  .tm-tools .btn { min-height: 42px; }
  .tm-start { gap: 10px; }
  .tm-start .panel { padding: 12px; }
  .tm-start-btn { margin-top: 10px; }
  .tm-foot.hint { display: none; }
  .tm-result { padding: 12px var(--pad) 13px; gap: 10px; }
  .tm-result-big { font-size: 32px; }
}

@media (max-width: 365px) {
  .g-make10 { gap: 8px; }
  .tm-v { font-size: min(11.8vw, 40px); }
  .tm-cell { border-radius: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .tm-cell.hint { animation: none; box-shadow: 0 0 0 2px var(--accent); }
  .tm-cell.wrong,
  .tm-cell.pop,
  .tm-cell.drop,
  .g-make10.shake .tm-board { animation: none; }
  .tm-result { animation: none; }
}
