/* Fast Reaction Test — professional two-column benchmark */
.rtt-root {
  --bg: rgba(10, 14, 22, 0.75);
  --surface: rgba(14, 20, 32, 0.85);
  --surface2: rgba(20, 28, 44, 0.9);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #c084fc;
  --go: #22c55e;
  --go-bg: #14532d;
  --wait-bg: #422006;
  --early: #7f1d1d;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Inter", ui-monospace, monospace;
  font-family: var(--font);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  color: var(--text);
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 20px 56px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(20px) saturate(1.5);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.rtt-root *, .rtt-root *::before, .rtt-root *::after { box-sizing: border-box; }

.rtt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.rtt-toolbar-title { display: flex; flex-direction: column; gap: 0.2rem; }

.rtt-benchmark-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #93c5fd;
  align-self: flex-start;
}

.rtt-toolbar h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.rtt-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rtt-btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.15s;
}

.rtt-btn:active { transform: scale(0.97); }

.rtt-btn-primary {
  background: var(--accent);
  color: #fff;
}

.rtt-btn-primary:hover { box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4); }

.rtt-btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.rtt-btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.78rem;
}

.rtt-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 900px) {
  .rtt-layout {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.rtt-main {
  padding: 1rem 1.15rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 900px) {
  .rtt-main {
    border-bottom: none;
    border-right: 1px solid var(--border);
  }
}

.rtt-progress-wrap {
  margin-bottom: 0.75rem;
}

.rtt-progress-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}

.rtt-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.35s ease;
}

.rtt-arena {
  min-height: 200px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  padding: 1.5rem 1rem;
  outline: none;
  transition: background 0.06s linear;
  background: var(--surface2);
}

.rtt-arena:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

.rtt-arena[data-phase="idle"] {
  animation: rtt-breathe 2.5s ease-in-out infinite;
}

.rtt-arena[data-phase="waiting"] { background: var(--wait-bg); animation: none; }
.rtt-arena[data-phase="active"] { background: var(--go-bg); box-shadow: inset 0 0 80px rgba(34, 197, 94, 0.2); animation: none; }
.rtt-arena[data-phase="early"] { background: var(--early); animation: none; }
.rtt-arena[data-phase="result"],
.rtt-arena[data-phase="complete"] { background: #1e1b4b; animation: none; }

@keyframes rtt-breathe {
  50% { box-shadow: inset 0 0 40px rgba(59, 130, 246, 0.08); }
}

.rtt-arena-main {
  font-size: clamp(1.2rem, 4vw, 1.65rem);
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}

.rtt-arena-ms {
  font-family: var(--mono);
  font-size: clamp(2rem, 8vw, 3.25rem);
  font-weight: 800;
  margin: 0.25rem 0 0;
  letter-spacing: -0.03em;
}

.rtt-arena-ms.pop {
  animation: rtt-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rtt-pop {
  from { transform: scale(0.85); opacity: 0.5; }
  to { transform: scale(1); opacity: 1; }
}

.rtt-arena-sub {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.rtt-arena-sub kbd {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.rtt-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-top: 1rem;
}

@media (min-width: 480px) {
  .rtt-stats { grid-template-columns: repeat(4, 1fr); }
}

.rtt-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
}

.rtt-stat-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.rtt-stat-value {
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 0.15rem;
}

.rtt-status {
  margin-top: 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.rtt-disclaimer {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}

.rtt-cheer {
  margin-top: 0.65rem;
  padding: 0.45rem 0.75rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  text-align: center;
}

.rtt-cheer:empty { display: none; }
.rtt-cheer.is-wow { background: rgba(34, 197, 94, 0.15); color: #86efac; }

.rtt-finish-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border);
  text-align: center;
}

.rtt-finish-panel.rtt-hidden { display: none; }

.rtt-finish-panel h3 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.rtt-finish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.rtt-side {
  padding: 1rem 1rem 1rem 1.15rem;
  background: rgba(0, 0, 0, 0.15);
  overflow-x: hidden;
}

.rtt-panel {
  margin-bottom: 1.15rem;
}

.rtt-panel:last-child { margin-bottom: 0; }

.rtt-panel-title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Score history — visual high-score style */
.rtt-hs-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.rtt-hs-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.45rem;
  text-align: center;
}

.rtt-hs-pill.is-hero {
  background: linear-gradient(145deg, rgba(34, 197, 94, 0.18), rgba(34, 197, 94, 0.05));
  border-color: rgba(34, 197, 94, 0.35);
}

.rtt-hs-pill.is-slow {
  background: linear-gradient(145deg, rgba(251, 113, 133, 0.12), transparent);
  border-color: rgba(251, 113, 133, 0.25);
}

.rtt-hs-pill-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.rtt-hs-pill-value {
  display: block;
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 0.1rem;
}

.rtt-hs-pill.is-hero .rtt-hs-pill-value {
  color: #4ade80;
}

.rtt-hs-pill.is-slow .rtt-hs-pill-value {
  color: #fb7185;
}

.rtt-hs-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.65rem;
  scrollbar-gutter: stable;
}

.rtt-hs-list::-webkit-scrollbar {
  width: 4px;
}

.rtt-hs-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

.rtt-hs-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.2rem 0.55rem;
  align-items: center;
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.15s, border-color 0.15s;
}

.rtt-hs-item.is-best {
  border-color: rgba(34, 197, 94, 0.45);
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.12), transparent);
}

.rtt-hs-item.is-record {
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35);
}

.rtt-hs-item.tier-fast {
  border-left: 3px solid #22c55e;
}

.rtt-hs-item.tier-mid {
  border-left: 3px solid #eab308;
}

.rtt-hs-item.tier-slow {
  border-left: 3px solid #f43f5e;
}

.rtt-hs-round {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface2);
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.rtt-hs-ms {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.rtt-hs-ms span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: 0.1rem;
}

.rtt-hs-item.tier-fast .rtt-hs-ms { color: #4ade80; }
.rtt-hs-item.tier-mid .rtt-hs-ms { color: #facc15; }
.rtt-hs-item.tier-slow .rtt-hs-ms { color: #fb7185; }

.rtt-hs-meta {
  grid-column: 2;
  font-size: 0.68rem;
  color: var(--muted);
}

.rtt-hs-badges {
  grid-column: 3;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.rtt-hs-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.rtt-hs-badge.best {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.rtt-hs-badge.record {
  background: rgba(250, 204, 21, 0.2);
  color: #fde047;
}

.rtt-hs-badge.fast {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.rtt-hs-badge.slow {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
}

.rtt-hs-bar-wrap {
  grid-column: 1 / -1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.rtt-hs-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.rtt-hs-bar.tier-fast { background: linear-gradient(90deg, #22c55e, #4ade80); }
.rtt-hs-bar.tier-mid { background: linear-gradient(90deg, #ca8a04, #facc15); }
.rtt-hs-bar.tier-slow { background: linear-gradient(90deg, #e11d48, #fb7185); }

.rtt-hs-top {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
}

.rtt-hs-top-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.rtt-hs-top-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rtt-hs-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.rtt-hs-top-row .ms {
  font-weight: 800;
  color: #4ade80;
}

.rtt-history-empty {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  text-align: center;
  padding: 1rem 0.5rem;
}

.rtt-legend {
  list-style: none;
  margin: 0;
  padding: 0 0.35rem 0 0;
}

.rtt-legend li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.28rem 0.1rem 0.28rem 0;
  line-height: 1.35;
}

.rtt-legend li span:last-child {
  flex: 1;
  min-width: 0;
}

.rtt-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rtt-chart {
  width: 100%;
  height: 64px;
  display: block;
}

.rtt-streak-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 99px;
  background: rgba(251, 146, 60, 0.15);
  color: #fdba74;
  margin-bottom: 0.5rem;
}

.rtt-streak-badge:empty { display: none; }

.rtt-footer-tools {
  padding: 0 1.15rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.rtt-selfcheck-out {
  width: 100%;
  margin: 0.35rem 1.15rem 1rem;
  padding: 0.65rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 8px;
  white-space: pre-wrap;
  font-family: var(--mono);
}

.rtt-selfcheck-out.rtt-hidden { display: none; }

.rtt-coach-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.85), rgba(67, 56, 202, 0.65));
  border: 1px solid rgba(129, 140, 248, 0.35);
  font-size: 0.88rem;
  font-weight: 600;
  color: #e0e7ff;
  text-align: center;
}

.rtt-coach-banner.rtt-hidden { display: none; }

.rtt-coach-emoji { font-size: 1.15rem; }

.rtt-toast-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin: 0.4rem 0 0;
  pointer-events: none;
}

.rtt-toast {
  align-self: center;
  padding: 0.45rem 0.75rem;
  background: #312e81;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  animation: rtt-toast-in 0.4s ease;
  display: flex;
  gap: 0.35rem;
}

@keyframes rtt-toast-in {
  from { transform: translateY(-12px); opacity: 0; }
}

.rtt-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

.rtt-confetti i {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -8px;
  animation: rtt-fall 2s ease-in forwards;
}

@keyframes rtt-fall {
  to { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.rtt-toggle-sound {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.rtt-toggle-sound input { accent-color: var(--accent); }

.rtt-hidden { display: none !important; }

.rtt-rating-excellent { color: #4ade80; }
.rtt-rating-very-good { color: #86efac; }
.rtt-rating-good { color: #a3e635; }
.rtt-rating-above { color: #fde047; }
.rtt-rating-average { color: #fbbf24; }
.rtt-rating-below { color: #fb923c; }
