/* ============================================================
   Rhythm Game Styles（节奏敲击 - 品牌蓝透明玻璃风格）
   与打字游戏保持一致：白底、品牌蓝 #2D9CDB、玻璃质感
   ============================================================ */

.rg-page {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 64px));
  padding: 8px 0 40px;
}

/* ===== 玻璃外壳 ===== */
.rg-crt {
  position: relative;
  background: linear-gradient(180deg, #f3faff 0%, #ffffff 100%);
  border: 1px solid #e6e9ed;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 12px 32px rgba(45, 156, 219, 0.08);
}

/* ===== 顶部 HUD ===== */
.rg-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-bottom: 14px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(45, 156, 219, 0.22);
  border-radius: 12px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  color: #6a7684;
}

.rg-hud-group {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.rg-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: #6a7684;
}

.rg-stat strong {
  font-size: 22px;
  font-weight: 700;
  color: #2c3e50;
  font-variant-numeric: tabular-nums;
}

.rg-stat strong#rg-combo {
  color: #2d9cdb;
}

.rg-stat strong#rg-combo.hot {
  color: #f5a623;
  text-shadow: 0 0 12px rgba(245, 166, 35, 0.55);
}

.rg-stat.rg-danger strong {
  color: #e05555;
}

/* 生命值 */
.rg-lives {
  display: flex;
  gap: 5px;
  align-items: center;
}

.rg-life {
  width: 14px;
  height: 14px;
  background: linear-gradient(180deg, #4fb3e8 0%, #2d9cdb 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 2px 6px rgba(45, 156, 219, 0.35);
  border-radius: 4px;
}

.rg-life.lost {
  background: rgba(45, 156, 219, 0.1);
  box-shadow: inset 0 0 0 1px rgba(45, 156, 219, 0.18);
}

/* ===== 控制区 ===== */
.rg-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.rg-diff-label {
  color: #6a7684;
  font-size: 13px;
  letter-spacing: 0.1em;
}

.rg-diff-btn {
  border: 1px solid rgba(45, 156, 219, 0.28);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(243, 250, 255, 0.78) 45%,
    rgba(228, 240, 250, 0.68) 100%
  );
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  color: #2c3e50;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 3px 0 -1px #c3d2de,
    0 4px 0 -1px #9fb4c4,
    0 6px 12px rgba(30, 60, 90, 0.12);
  transition: all 0.15s ease;
}

.rg-diff-btn:hover {
  border-color: rgba(45, 156, 219, 0.55);
  color: #2d9cdb;
}

.rg-diff-btn.active {
  background: linear-gradient(
    180deg,
    rgba(45, 156, 219, 0.85) 0%,
    rgba(45, 140, 204, 0.92) 100%
  );
  color: #ffffff;
  border-color: rgba(45, 156, 219, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 3px 0 -1px #1f7cb0,
    0 4px 0 -1px #1a6a97,
    0 6px 16px rgba(45, 156, 219, 0.35);
}

.rg-btn {
  border: 1px solid rgba(45, 156, 219, 0.35);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.92) 0%,
    rgba(243, 250, 255, 0.78) 45%,
    rgba(228, 240, 250, 0.68) 100%
  );
  color: #2d8bcc;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 9px 24px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 3px 0 -1px #c3d2de,
    0 4px 0 -1px #9fb4c4,
    0 6px 12px rgba(30, 60, 90, 0.12);
  transition: all 0.15s ease;
}

.rg-btn:hover {
  background: linear-gradient(
    180deg,
    rgba(45, 156, 219, 0.85) 0%,
    rgba(45, 140, 204, 0.92) 100%
  );
  color: #ffffff;
  border-color: rgba(45, 156, 219, 0.9);
  transform: translateY(-1px);
}

.rg-sound-btn {
  padding: 8px 12px;
  font-size: 15px;
  line-height: 1;
}

.rg-sound-btn.muted {
  opacity: 0.55;
}

/* ===== 游戏区域 ===== */
.rg-screen {
  position: relative;
  height: 480px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(45, 156, 219, 0.08), transparent 60%),
    linear-gradient(180deg, #f8fcff 0%, #eef6fd 100%);
  border: 1px solid rgba(45, 156, 219, 0.3);
  border-radius: 12px;
  box-shadow:
    inset 0 2px 8px rgba(45, 156, 219, 0.08),
    inset 0 -1px 2px rgba(255, 255, 255, 0.9);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* ===== 四条轨道 ===== */
.rg-lanes {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
}

.rg-lane {
  position: relative;
  flex: 1;
  max-width: 150px;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(45, 156, 219, 0.14);
  border-radius: 10px;
  overflow: hidden;
}

/* 轨道顶部渐隐（音符出现更柔和） */
.rg-lane::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(180deg, #eef6fd 0%, transparent 100%);
  z-index: 1;
  pointer-events: none;
}

/* ===== 判定线 ===== */
.rg-hitline {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 72px;
  height: 3px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(45, 156, 219, 0.7) 15%,
    rgba(45, 156, 219, 0.7) 85%,
    transparent 100%
  );
  box-shadow: 0 0 12px rgba(45, 156, 219, 0.45);
  z-index: 2;
  pointer-events: none;
}

/* ===== 底部键帽 ===== */
.rg-key {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 17px;
  font-weight: 800;
  color: var(--lane-color, #2d9cdb);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(243, 250, 255, 0.8) 100%
  );
  border: 1.5px solid var(--lane-color, #2d9cdb);
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 3px 0 -1px rgba(45, 156, 219, 0.35),
    0 4px 10px rgba(30, 60, 90, 0.12);
  z-index: 3;
  transition: all 0.08s ease;
}

.rg-key.pressed {
  transform: translateX(-50%) translateY(3px) scale(0.96);
  background: var(--lane-color, #2d9cdb);
  color: #ffffff;
  box-shadow: 0 0 16px var(--lane-color, #2d9cdb);
}

/* ===== 掉落音符 ===== */
.rg-note {
  position: absolute;
  top: -52px;
  left: 50%;
  margin-left: -26px;
  width: 52px;
  height: 30px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--lane-color, #2d9cdb) 82%, #ffffff) 0%,
    var(--lane-color, #2d9cdb) 100%
  );
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 3px 10px color-mix(in srgb, var(--lane-color, #2d9cdb) 45%, transparent);
  z-index: 2;
  will-change: transform;
}

/* 兼容不支持 color-mix 的浏览器 */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .rg-note {
    background: var(--lane-color, #2d9cdb);
  }
}

/* ===== 判定文字 ===== */
.rg-judge {
  position: absolute;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  z-index: 4;
  pointer-events: none;
  white-space: nowrap;
  animation: rg-judge 0.6s ease-out forwards;
}

.rg-judge.j-perfect {
  color: #f5a623;
  text-shadow: 0 0 12px rgba(245, 166, 35, 0.6);
  font-size: 17px;
}

.rg-judge.j-great {
  color: #2d9cdb;
  text-shadow: 0 0 10px rgba(45, 156, 219, 0.5);
}

.rg-judge.j-good {
  color: #28a745;
}

.rg-judge.j-miss {
  color: #e05555;
  text-shadow: 0 0 10px rgba(224, 85, 85, 0.4);
}

@keyframes rg-judge {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(6px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1.1);
  }
  35% {
    transform: translateX(-50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-30px) scale(1);
  }
}

/* ===== 粒子 ===== */
.rg-particle {
  position: absolute;
  bottom: 76px;
  left: 50%;
  border-radius: 50%;
  pointer-events: none;
  z-index: 4;
  animation: rg-particle 0.5s ease-out forwards;
}

@keyframes rg-particle {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.3);
  }
}

/* ===== 屏幕震动 ===== */
.rg-screen.rg-shake {
  animation: rg-shake 0.35s ease;
}

@keyframes rg-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ===== 全屏大字（倒计时） ===== */
.rg-big {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 56px;
  font-weight: 800;
  color: #2d9cdb;
  text-shadow:
    0 2px 18px rgba(45, 156, 219, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 6;
  animation: rg-big 0.85s ease-out forwards;
}

@keyframes rg-big {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  75% { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

/* ===== 进度条 ===== */
.rg-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(45, 156, 219, 0.12);
  z-index: 5;
}

.rg-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4fb3e8, #2d9cdb);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(45, 156, 219, 0.5);
  transition: width 0.2s linear;
}

/* ===== 覆盖层 ===== */
.rg-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  text-align: center;
  padding: 24px;
}

.rg-overlay[hidden] {
  display: none;
}

.rg-title {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #2d9cdb;
  text-shadow: 0 2px 12px rgba(45, 156, 219, 0.25);
  margin: 0;
}

.rg-subtitle {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 14px;
  color: #6a7684;
  line-height: 1.9;
  margin: 0;
  max-width: 520px;
}

.rg-subtitle strong {
  color: #2d8bcc;
}

.rg-subtitle .rg-jp { color: #f5a623; font-weight: 700; }
.rg-subtitle .rg-jg { color: #2d9cdb; font-weight: 700; }
.rg-subtitle .rg-jgd { color: #28a745; font-weight: 700; }
.rg-subtitle .rg-jm { color: #e05555; font-weight: 700; }

.rg-best-line {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 14px;
  color: #6a7684;
  margin: 0;
}

.rg-best-line strong {
  color: #f5a623;
  font-size: 18px;
}

.rg-final {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 15px;
  color: #6a7684;
  line-height: 2;
  margin: 0;
}

.rg-final strong {
  color: #2d9cdb;
  font-size: 19px;
}

.rg-final .rg-jp { color: #f5a623; font-weight: 700; }
.rg-final .rg-jg { color: #2d9cdb; font-weight: 700; }
.rg-final .rg-jgd { color: #28a745; font-weight: 700; }
.rg-final .rg-jm { color: #e05555; font-weight: 700; }

/* ===== 评级徽章 ===== */
.rg-rank {
  font-family: 'SF Mono', Monaco, Consolas, monospace;
  font-size: 64px;
  font-weight: 800;
  line-height: 1;
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 4px solid;
  animation: rg-rank 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.rg-rank.rank-S {
  color: #f5a623;
  border-color: #f5a623;
  background: rgba(245, 166, 35, 0.08);
  box-shadow: 0 0 24px rgba(245, 166, 35, 0.35);
}

.rg-rank.rank-A {
  color: #2d9cdb;
  border-color: #2d9cdb;
  background: rgba(45, 156, 219, 0.08);
  box-shadow: 0 0 24px rgba(45, 156, 219, 0.3);
}

.rg-rank.rank-B {
  color: #28a745;
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.08);
}

.rg-rank.rank-C {
  color: #9b59b6;
  border-color: #9b59b6;
  background: rgba(155, 89, 182, 0.08);
}

.rg-rank.rank-D {
  color: #e05555;
  border-color: #e05555;
  background: rgba(224, 85, 85, 0.08);
}

@keyframes rg-rank {
  0% {
    opacity: 0;
    transform: scale(0.3) rotate(-12deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* 闪烁提示 */
.rg-blink {
  animation: rg-blink 1.1s step-end infinite;
}

@keyframes rg-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* ===== 使用说明 ===== */
.rg-usage {
  margin-top: 22px;
  padding: 16px 20px;
  border-left: 3px solid #2d9cdb;
  background: #f8f9fa;
  border-radius: 0 10px 10px 0;
  color: #6a7684;
  font-size: 14px;
  line-height: 1.8;
}

.rg-usage strong {
  color: #2c3e50;
}

/* 底部导航（返回游戏大厅 / 其他游戏） */
.rg-more {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8ee;
  font-size: 13px;
  color: #94a1ae;
}

.rg-more a {
  color: #2d9cdb;
  font-weight: 600;
  text-decoration: none;
}

.rg-more a:hover {
  text-decoration: underline;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .rg-screen {
    height: 400px;
  }

  .rg-lanes {
    gap: 6px;
    padding: 0 8px;
  }

  .rg-key {
    width: 44px;
    height: 34px;
    font-size: 15px;
  }

  .rg-note {
    width: 42px;
    height: 26px;
    margin-left: -21px;
  }

  .rg-title {
    font-size: 26px;
  }

  .rg-big {
    font-size: 42px;
  }

  .rg-hud-group {
    gap: 14px;
  }

  .rg-stat strong {
    font-size: 18px;
  }
}
