.page-rhythm-test { background: #101311; }
.page-rhythm-test .site-header {
  position: sticky;
  background: #141814;
  color: var(--paper);
  border-color: #2f372b;
}
.page-rhythm-test .site-header :is(.tools-options, .language-options, .mobile-nav) {
  background: #1c211b;
  color: var(--paper);
  border-color: #2f372b;
}
.page-rhythm-test .site-header :is(.tools-options, .language-options) a:is(:hover, [aria-current]) {
  background: #2f372b;
}
.page-rhythm-test .mobile-nav :is(a, .tools-menu > summary) { border-color: #2f372b; }
.page-rhythm-test .site-header :focus-visible { outline-color: var(--lime); }

.rt-shell {
  --r-panel: #171b16;
  --r-inset: #1f241d;
  --r-line: #313a2c;
  --r-text: #f5f5ed;
  --r-muted: #b6beae;
  --r-accent: #daf666;
  --r-cyan: #72f2d8;
  --r-warn: #f6c966;
  --r-miss: #f06e78;
  color: var(--r-text);
  border-top: 4px solid var(--r-accent);
  min-width: 0;
}
.rt-intro, .rt-workspace, .rt-info { width: min(780px, calc(100% - 24px)); margin-inline: auto; }
.rt-intro { padding: 22px 0 18px; text-align: center; }
.rt-eyebrow { font-size: 11px; letter-spacing: .16em; font-weight: 700; color: var(--r-accent); margin-bottom: 8px; }
.rt-intro h1 { font: 700 clamp(24px, 5vw, 38px)/1.18 var(--sans); margin: 0 0 10px; text-wrap: balance; }
.rt-summary { margin: 0 auto; color: var(--r-muted); font-size: 15px; max-width: 62ch; }
.rt-privacy {
  display: inline-block; margin: 10px auto 0; padding: 5px 12px; border-radius: 100px;
  background: #1e2718; border: 1px solid #3c4d2b; color: #d7eba0; font-size: 12px;
}

.rt-workspace {
  padding: 16px; border-radius: 18px;
  background: linear-gradient(180deg, #181d17, #131713);
  border: 1px solid var(--r-line);
  box-shadow: 0 16px 40px #0007;
}

/* Mode Selector */
.rt-mode-bar {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px;
}
.rt-mode-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 8px 6px; border-radius: 12px;
  background: var(--r-inset); border: 1px solid var(--r-line); color: var(--r-muted); cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.rt-mode-btn strong { font-size: 13.5px; color: var(--r-text); }
.rt-mode-btn span { font-size: 11px; color: var(--r-muted); font-variant-numeric: tabular-nums; }
.rt-mode-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #2f3f1d, #222d16);
  border-color: var(--r-accent);
  box-shadow: 0 0 18px #daf6661c;
}
.rt-mode-btn[aria-pressed="true"] strong { color: var(--r-accent); }
.rt-mode-btn[aria-pressed="true"] span { color: #e2efb9; }

/* Compact Arcade HUD */
.rt-hud {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px;
}
.rt-hud-box {
  padding: 8px 10px; border-radius: 10px; background: var(--r-inset); border: 1px solid var(--r-line);
  display: flex; flex-direction: column; gap: 2px; text-align: center;
}
.rt-hud-box span { font-size: 10.5px; color: var(--r-muted); letter-spacing: .04em; }
.rt-hud-box strong { font-size: 17px; font-variant-numeric: tabular-nums; color: var(--r-text); }
.rt-hud-box strong.is-accent { color: var(--r-accent); }

/* 3D Perspective Rhythm Master Highway Stage */
.rt-stage-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid #3c4a32;
  background: radial-gradient(ellipse at 50% 0%, #26361c 0%, #101410 62%, #0b0e0b 100%);
  box-shadow: inset 0 0 40px #000a, 0 12px 30px #0006;
  margin-bottom: 12px;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.rt-stage-card.is-fever {
  border-color: var(--r-accent);
  box-shadow: inset 0 0 44px #daf66622, 0 0 28px #daf66628;
}
.rt-stage-card.is-drop-zone {
  border-color: var(--r-warn);
  box-shadow: inset 0 0 44px #f6c9661f, 0 0 24px #f6c96622;
}
.rt-stage-canvas {
  display: block;
  width: 100%;
  height: 360px;
  touch-action: manipulation;
  user-select: none;
  cursor: pointer;
}
.rt-stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: radial-gradient(circle at 50% 48%, rgba(16, 20, 16, 0.56), rgba(11, 14, 11, 0.84));
  text-align: center;
  z-index: 2;
}
.rt-stage-overlay[hidden] { display: none !important; }
.rt-overlay-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border-radius: 999px;
  background: #27351a; border: 1px solid #6b883f; color: var(--r-accent);
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em;
}
.rt-overlay-cta {
  display: grid; place-items: center; gap: 4px;
  min-width: min(280px, 92%); padding: 16px 26px; border-radius: 999px;
  background: var(--r-accent); color: #161e0d; border: 0; cursor: pointer;
  box-shadow: 0 10px 28px #daf66644;
  transition: transform .12s ease, filter .15s ease;
}
.rt-overlay-cta strong { font-size: 18px; font-weight: 800; letter-spacing: .04em; }
.rt-overlay-cta span { font-size: 12px; font-weight: 600; opacity: .82; }
.rt-overlay-keys { font-size: 12px; color: #cfd8c2; max-width: 44ch; }

/* 4-Lane Tactile Hit Deck (Rhythm Master style) */
.rt-lane-deck {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 10px; background: #121612; border-top: 1px solid #2a3326;
}
.rt-lane-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 68px; border-radius: 12px;
  background: linear-gradient(180deg, #252c22, #1a2018);
  border: 1.5px solid #3c4835;
  color: var(--r-text);
  touch-action: manipulation; user-select: none; cursor: pointer;
  transition: transform .05s ease, background .06s ease, border-color .06s ease, box-shadow .06s ease;
}
.rt-lane-key kbd {
  font: 800 18px/1 var(--sans); color: var(--r-accent);
}
.rt-lane-key span { font-size: 10.5px; color: var(--r-muted); letter-spacing: .06em; }
.rt-lane-key.is-hit, .rt-lane-key:active {
  transform: translateY(2px) scale(.97);
  background: linear-gradient(180deg, #4b6428, #30411a);
  border-color: var(--r-accent);
  box-shadow: 0 0 18px #daf66655;
}
.rt-lane-key.is-target-now {
  border-color: #82a34a;
  box-shadow: inset 0 0 14px #daf66622;
}

/* Status + Controls Strip */
.rt-action-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.rt-phase-banner {
  font-size: 13px; color: var(--r-muted); min-height: 24px; display: flex; align-items: center; gap: 8px;
}
.rt-phase-banner .is-drop {
  padding: 3px 10px; border-radius: 999px; background: #3b3117; border: 1px solid #8a6d28; color: #fce39a; font-weight: 700; font-size: 12px;
}
.rt-controls-row { display: flex; flex-wrap: wrap; gap: 8px; }
.rt-btn-secondary {
  min-height: 38px; padding: 0 14px; border-radius: 9px; cursor: pointer;
  background: #262c24; border: 1px solid #3f4a3a; color: var(--r-text); font-size: 13px; font-weight: 600;
}
.rt-btn-primary {
  min-height: 38px; padding: 0 16px; border-radius: 9px; cursor: pointer;
  background: var(--r-accent); border: 1px solid var(--r-accent); color: #192110;
  font-size: 13.5px; font-weight: 700;
}
.rt-btn-primary:disabled, .rt-btn-secondary:disabled { opacity: .42; cursor: not-allowed; }

@media (hover: hover) {
  .rt-mode-btn:hover { border-color: #5c6d43; }
  .rt-overlay-cta:hover { filter: brightness(1.06); transform: translateY(-1px); }
  .rt-lane-key:hover { border-color: #6a8048; background: linear-gradient(180deg, #2d3629, #1f261c); }
  .rt-btn-primary:hover:not(:disabled) { filter: brightness(1.06); }
  .rt-btn-secondary:hover:not(:disabled) { background: #31392e; border-color: #586551; }
}

/* 8-Beat Mini Indicator + 32-Beat Timeline */
.rt-beats-strip {
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; margin-bottom: 10px;
}
.rt-beat-cell {
  display: grid; place-items: center; min-height: 34px; border-radius: 7px;
  background: var(--r-inset); border: 1px solid var(--r-line); font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums; color: var(--r-muted);
  transition: transform .06s ease, background .06s ease;
}
.rt-beat-cell.is-accent { border-color: #526336; }
.rt-beat-cell.is-countin { background: #3b4a24; border-color: var(--r-accent); color: #f6fae4; }
.rt-beat-cell.is-active { background: var(--r-accent); color: #192110; transform: scale(1.05); border-color: var(--r-accent); }
.rt-beat-cell.is-silent { border-style: dashed; border-color: #8a7433; }
.rt-beat-cell.is-perfect { box-shadow: inset 0 -3px 0 var(--r-accent); color: var(--r-accent); }
.rt-beat-cell.is-good { box-shadow: inset 0 -3px 0 var(--r-warn); color: var(--r-warn); }
.rt-beat-cell.is-miss { box-shadow: inset 0 -3px 0 var(--r-miss); color: var(--r-miss); }
.rt-beat-cell.is-active:is(.is-perfect, .is-good, .is-miss) { color: #192110; }

.rt-timeline-wrap { margin-top: 2px; }
.rt-timeline-label {
  display: flex; justify-content: space-between; font-size: 11px; color: var(--r-muted); margin-bottom: 5px;
}
.rt-timeline {
  display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 3px; align-items: center;
  height: 38px; padding: 5px 8px; border-radius: 10px; background: var(--r-inset); border: 1px solid var(--r-line);
}
.rt-tick { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; }
.rt-tick::before { content: ''; width: 100%; height: 2px; background: #343d30; border-radius: 2px; }
.rt-tick.is-silent-col::before { background: #6b5e2e; }
.rt-tick i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: transparent;
  left: 50%; transform: translate(-50%, -50%); top: 50%;
}
.rt-tick.is-perfect i { background: var(--r-accent); }
.rt-tick.is-good i { background: var(--r-warn); }
.rt-tick.is-miss i { background: var(--r-miss); top: 50%; width: 5px; height: 5px; opacity: .75; }

/* Results & Shareable Score Card */
.rt-result { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--r-line); }
.rt-result-hero {
  text-align: center; padding: 18px 16px; border-radius: 12px;
  background: linear-gradient(180deg, #252e1d, #1c2219); border: 1px solid #445331;
  margin-bottom: 14px;
}
.rt-tier-pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: #334321; border: 1px solid #6b873e; color: var(--r-accent);
  font-size: 12px; font-weight: 700; letter-spacing: .04em; margin-bottom: 8px;
}
.rt-score-big {
  font: 800 clamp(48px, 11vw, 72px)/1 var(--sans); color: var(--r-accent);
  font-variant-numeric: tabular-nums;
}
.rt-score-big small { font-size: 22px; color: var(--r-muted); font-weight: 600; }
.rt-tendency-note { margin: 8px auto 0; font-size: 14px; color: #e2e8d9; max-width: 50ch; }

.rt-result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.rt-stat {
  padding: 12px; border-radius: 10px; background: var(--r-inset); border: 1px solid var(--r-line);
  display: flex; flex-direction: column; gap: 4px;
}
.rt-stat span { font-size: 11px; color: var(--r-muted); }
.rt-stat strong { font-size: 17px; font-variant-numeric: tabular-nums; color: var(--r-text); }

.rt-share-card-box {
  display: grid; gap: 12px; justify-items: center;
  padding: 14px; border-radius: 12px; background: var(--r-inset); border: 1px solid var(--r-line);
}
.rt-card-preview {
  width: min(320px, 100%); height: auto; border-radius: 12px;
  border: 1px solid #44503a; box-shadow: 0 10px 26px #0006; display: block;
}
.rt-share-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rt-share-status { margin: 0; font-size: 12px; color: var(--r-accent); min-height: 18px; text-align: center; }

/* Info, FAQ & Upsell */
.rt-info { padding: 30px 0 48px; }
.rt-info h2 { font: 700 21px/1.3 var(--sans); margin: 0 0 12px; }
.rt-info ol { padding-left: 20px; margin: 0 0 24px; color: var(--r-muted); display: grid; gap: 8px; }
.rt-faqs { display: grid; gap: 8px; margin-bottom: 24px; }
.rt-faq { border-radius: 10px; background: var(--r-panel); border: 1px solid var(--r-line); padding: 12px 14px; }
.rt-faq summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.rt-faq p { margin: 8px 0 0; font-size: 14px; color: var(--r-muted); }

.rt-app-upsell {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px; border-radius: 12px; background: #212a1b; border: 1px solid #445331; margin-bottom: 20px;
}
.rt-app-upsell h2 { margin: 0 0 6px; font-size: 19px; color: var(--r-accent); }
.rt-app-upsell p { margin: 0; color: #dbe2d0; font-size: 14px; max-width: 52ch; }
.rt-app-upsell .button { flex-shrink: 0; }

.rt-related { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; font-size: 13px; color: var(--r-muted); }
.rt-related a { color: var(--r-accent); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 560px) {
  .rt-workspace { padding: 12px; }
  .rt-hud { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rt-stage-canvas { height: 310px; }
  .rt-lane-deck { gap: 6px; padding: 8px; }
  .rt-lane-key { min-height: 60px; }
  .rt-lane-key kbd { font-size: 16px; }
  .rt-beats-strip { gap: 4px; }
  .rt-beat-cell { min-height: 30px; font-size: 12px; }
  .rt-timeline { gap: 2px; padding: 5px 4px; }
  .rt-tick i { width: 5px; height: 5px; }
}
