/* 节奏点击 · 样式（.g-rhythm 前缀） */

.g-rhythm {
  padding-left: 12px;
  padding-right: 12px;
  gap: 10px;
}
.g-rhythm .rt-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ---------------- 初始界面 ---------------- */
.g-rhythm .rt-idle {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 9px;
  padding: 20px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  text-align: center;
  overflow-y: auto;
}
.g-rhythm .rt-idle-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  font-size: 32px;
  font-weight: 900;
  color: #0b2812;
  background: linear-gradient(150deg, var(--accent), var(--accent2));
  box-shadow: 0 12px 30px -12px var(--accent), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.g-rhythm .rt-idle-title { font-size: 21px; font-weight: 800; }
.g-rhythm .rt-idle-desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
  max-width: 30em;
  margin: 0 auto;
}
.g-rhythm .rt-label { font-size: 10.5px; letter-spacing: 0.14em; color: var(--faint); margin-top: 2px; }
.g-rhythm .rt-seg .seg { width: 100%; }
.g-rhythm .rt-bpm-desc { font-size: 11.5px; color: var(--dim); min-height: 17px; }
.g-rhythm .rt-bests { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; }
.g-rhythm .rt-best-chip {
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.g-rhythm .rt-best-chip.on {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.g-rhythm .rt-rule { font-size: 11px; line-height: 1.6; color: var(--faint); }
.g-rhythm .rt-rule b { color: var(--accent); font-weight: 700; }
.g-rhythm .rt-resume { margin-top: 0; }

/* ---------------- 进行中 ---------------- */
.g-rhythm .rt-play {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.g-rhythm .stat-v.hot { color: var(--accent); }
.g-rhythm .stat-v.low { color: var(--err); animation: rtPulse 0.9s ease-in-out infinite; }
@keyframes rtPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.g-rhythm .rt-bpm-badge {
  align-self: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  border-radius: 999px;
  padding: 4px 12px;
  flex: none;
}
.g-rhythm .rt-main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  position: relative;
}
.g-rhythm .rt-ring {
  width: clamp(170px, 52vw, 220px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 255, 255, 0.09), transparent 52%),
    radial-gradient(circle at 50% 60%, rgba(126, 231, 135, 0.1), rgba(10, 14, 22, 0.9) 72%);
  box-shadow: inset 0 3px 24px rgba(0, 0, 0, 0.6), 0 22px 44px -24px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s cubic-bezier(0.3, 1.5, 0.4, 1), box-shadow 0.12s ease, border-color 0.12s ease;
  flex: none;
}
.g-rhythm .rt-ring.beat {
  transform: scale(1.06);
  border-color: color-mix(in srgb, var(--accent) 65%, transparent);
  box-shadow:
    0 0 0 10px color-mix(in srgb, var(--accent) 10%, transparent),
    0 0 60px 6px color-mix(in srgb, var(--accent) 48%, transparent),
    inset 0 3px 24px rgba(0, 0, 0, 0.5);
}
.g-rhythm .rt-ring-inner {
  width: 66%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}
.g-rhythm .rt-ring-text {
  font-size: clamp(26px, 8vw, 36px);
  font-weight: 900;
  color: var(--dim);
  letter-spacing: 0.06em;
}
.g-rhythm .rt-ring.beat .rt-ring-text { color: var(--accent); }

.g-rhythm .rt-tap {
  width: clamp(140px, 42vw, 164px);
  aspect-ratio: 1;
  min-width: 140px;
  min-height: 140px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.4), transparent 46%),
    linear-gradient(160deg, var(--accent), var(--accent2));
  color: #071d10;
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 16px 34px -14px color-mix(in srgb, var(--accent) 70%, transparent),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
  touch-action: manipulation;
  flex: none;
}
.g-rhythm .rt-tap:active {
  transform: scale(0.94);
  box-shadow: 0 8px 18px -10px color-mix(in srgb, var(--accent) 60%, transparent), inset 0 2px 10px rgba(0, 0, 0, 0.25);
}

.g-rhythm .rt-feedback {
  min-height: 19px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--faint);
  text-align: center;
}
.g-rhythm .rt-feedback.ok { color: var(--ok); font-weight: 700; }
.g-rhythm .rt-feedback.warn { color: var(--warn); font-weight: 600; }
.g-rhythm .rt-feedback.bad { color: #ff8b96; }

.g-rhythm .rt-float-box {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 3;
}
.g-rhythm .rt-float {
  position: absolute;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.04em;
  animation: rtFloat 0.62s ease-out forwards;
}
.g-rhythm .rt-float.ok { color: var(--ok); text-shadow: 0 0 20px rgba(62, 207, 142, 0.6); }
.g-rhythm .rt-float.warn { color: var(--warn); text-shadow: 0 0 18px rgba(255, 176, 32, 0.5); }
.g-rhythm .rt-float.bad { color: #ff8b96; text-shadow: 0 0 18px rgba(255, 92, 108, 0.5); }
@keyframes rtFloat {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  22% { opacity: 1; transform: translate(-50%, -55%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}

.g-rhythm .rt-progress { height: 6px; flex: none; }
.g-rhythm .rt-progress > i { transition: width 0.12s linear; }

/* 准备阶段 */
.g-rhythm .rt-play.rt-ready { align-items: center; }
.g-rhythm .rt-ring.ready { animation: rtReady 0.5s ease-in-out infinite alternate; }
@keyframes rtReady {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}
.g-rhythm .rt-ready-text { font-size: 14px; color: var(--dim); font-weight: 600; }

/* ---------------- 结算 ---------------- */
.g-rhythm .rt-result {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 16px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background:
    radial-gradient(110% 70% at 50% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%),
    linear-gradient(165deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  text-align: center;
  overflow-y: auto;
}
.g-rhythm .rt-result-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--dim);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
}
.g-rhythm .rt-result-badge.record {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: 0 0 20px -8px var(--accent);
}
.g-rhythm .rt-result-k { font-size: 11.5px; color: var(--faint); }
.g-rhythm .rt-result-score { display: flex; align-items: baseline; gap: 4px; margin-top: -2px; }
.g-rhythm .rt-score-n {
  font-size: 60px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(130deg, #dcffe4, var(--accent) 55%, var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent));
}
.g-rhythm .rt-score-k { font-size: 14px; color: var(--faint); }
.g-rhythm .rt-result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.g-rhythm .rt-result-grid .stat { background: rgba(255, 255, 255, 0.04); }
.g-rhythm .rt-result-grid .stat.good .stat-v { color: var(--ok); }
.g-rhythm .rt-result-grid .stat.warn .stat-v { color: var(--warn); }
.g-rhythm .rt-result-grid .stat.bad .stat-v { color: #ff8b96; }
.g-rhythm .rt-result-actions { display: flex; gap: 8px; width: 100%; margin-top: 2px; }
.g-rhythm .rt-result-actions .btn { flex: 1; min-height: 46px; }

@media (max-height: 700px) {
  .g-rhythm .rt-idle-icon { width: 52px; height: 52px; font-size: 26px; border-radius: 16px; }
  .g-rhythm .rt-rule { display: none; }
  .g-rhythm .rt-play { gap: 7px; }
  .g-rhythm .rt-ring { width: clamp(150px, 44vw, 180px); }
  .g-rhythm .rt-tap { width: 140px; height: 140px; min-width: 140px; min-height: 140px; font-size: 25px; }
  .g-rhythm .rt-score-n { font-size: 50px; }
}
