:root {
  --br-ink: #111827;
  --br-muted: #64748b;
  --br-line: #dce3ea;
  --br-paper: #f7f8f5;
  --br-accent: #ff5c35;
  --br-accent-dark: #d83a17;
  --br-lime: #d8ff62;
  --br-blue: #94c8ff;
}

.br-page {
  min-height: 78vh;
  padding: 2.5rem max(1rem, calc((100vw - 1120px) / 2));
  color: var(--br-ink);
  background:
    linear-gradient(rgba(17, 24, 39, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, .025) 1px, transparent 1px),
    var(--br-paper);
  background-size: 32px 32px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.br-page [hidden] { display: none !important; }

.br-kicker {
  color: #475569;
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.br-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 3.5rem;
  color: var(--br-muted);
  font-size: .9rem;
}

.br-toolbar a { color: var(--br-ink); font-weight: 750; text-decoration: none; }
.br-toolbar a:hover { color: var(--br-accent-dark); }
.br-toolbar-links { display: flex; gap: 1rem; }

.br-hero { max-width: 880px; padding: 3rem 0 4rem; }
.br-hero h1, .counter-intro h1, .typing-heading h1, .hall-heading h1 {
  margin: .35rem 0 1rem;
  font-size: clamp(3rem, 9vw, 7rem);
  font-weight: 950;
  line-height: .92;
  letter-spacing: -.065em;
}
.br-hero p, .counter-intro p, .hall-heading p { color: var(--br-muted); font-size: clamp(1rem, 2vw, 1.3rem); }

.br-game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.br-game-card {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  padding: 2rem;
  border: 1px solid rgba(17, 24, 39, .16);
  border-radius: 24px;
  color: var(--br-ink);
  text-decoration: none;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .08);
  transition: transform .2s ease, box-shadow .2s ease;
}
.br-game-card:hover { color: var(--br-ink); transform: translateY(-5px) rotate(-.25deg); box-shadow: 0 24px 55px rgba(15, 23, 42, .14); }
.br-game-card h2 { margin: .25rem 0 .7rem; font-size: 2rem; font-weight: 900; }
.br-game-card p { max-width: 390px; color: #334155; }
.br-counter-card { background: var(--br-lime); }
.br-typing-card { background: var(--br-blue); }
.br-card-number {
  position: absolute;
  right: -1rem;
  bottom: -3.7rem;
  color: rgba(255,255,255,.58);
  font-size: 14rem;
  font-weight: 950;
  letter-spacing: -.12em;
  line-height: 1;
}
.br-card-arrow { position: absolute; left: 2rem; bottom: 2rem; font-weight: 850; }
.br-hof-banner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin: -1.5rem 0 1.2rem; padding: 1.5rem 1.7rem; border-radius: 20px; background: var(--br-ink); color: white; text-decoration: none; box-shadow: 0 16px 40px rgba(15,23,42,.16); transition: transform .18s ease, box-shadow .18s ease; }
.br-hof-banner:hover { color: white; transform: translateY(-3px); box-shadow: 0 22px 48px rgba(15,23,42,.22); }
.br-hof-banner .br-kicker { color: var(--br-lime); }
.br-hof-banner h2 { margin: .15rem 0 .25rem; font-size: 2rem; font-weight: 900; }
.br-hof-banner p { margin: 0; color: #cbd5e1; }
.br-hof-banner > strong { flex: 0 0 auto; color: var(--br-lime); }

.privacy-strip {
  margin: 2rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: #eff6ff;
  color: #1e3a5f;
  font-size: .92rem;
}

.counter-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr); align-items: stretch; gap: 1.25rem; }
.counter-intro { display: flex; max-width: 850px; flex-direction: column; justify-content: center; }
.counter-hof-column { display: flex; min-width: 0; flex-direction: column; }
.counter-hof-portal {
  display: flex;
  min-height: 100%;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  border-radius: 24px;
  background: var(--br-ink);
  color: white;
  text-decoration: none;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
  transition: transform .18s ease, box-shadow .18s ease;
}
.counter-hof-portal:hover { color: white; transform: translateY(-3px); box-shadow: 0 22px 48px rgba(15, 23, 42, .22); }
.counter-hof-portal > span { color: var(--br-lime); font-size: .68rem; font-weight: 850; letter-spacing: .12em; }
.counter-hof-portal > strong { margin: .45rem 0 .65rem; font-size: clamp(2.6rem, 5vw, 4.8rem); font-weight: 950; line-height: .78; letter-spacing: -.07em; }
.counter-hof-portal > small { color: #cbd5e1; font-size: .85rem; font-weight: 700; }
.counter-my-hof { margin-top: .55rem; color: var(--br-ink); font-size: .82rem; font-weight: 800; text-align: right; }
.counter-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .65fr); gap: 1.25rem; }
.challenge-layout { grid-template-columns: minmax(0, 2fr) minmax(250px, .55fr); }
.duel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; min-width: 0; }
.camera-card, .counter-panel, .result-card, .typing-viewport, .typing-result, .hall-list {
  border: 1px solid var(--br-line);
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 12px 35px rgba(15, 23, 42, .07);
}
.camera-stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 19px 19px 0 0;
  background: #111827;
}
.camera-stage video, .camera-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.camera-stage canvas { pointer-events: none; }
.rival-stage video { transform: none; }
.rival-score-pill {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .45rem .7rem;
  border-radius: 12px;
  background: rgba(17, 24, 39, .84);
  color: white;
  backdrop-filter: blur(7px);
}
.rival-score-pill span { max-width: 120px; overflow: hidden; font-size: .72rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.rival-score-pill strong { color: var(--br-lime); font-size: 1.8rem; line-height: 1; }
.camera-placeholder { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; color: #cbd5e1; }
.placeholder-orbit { display: grid; place-items: center; width: 120px; height: 120px; border: 1px dashed #64748b; border-radius: 50%; color: var(--br-lime); font-size: 3.2rem; font-weight: 950; animation: orbit 12s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; color: white; font-size: clamp(6rem, 16vw, 12rem); font-weight: 950; text-shadow: 0 8px 30px rgba(0,0,0,.4); pointer-events: none; }
.live-pill { position: absolute; top: 1rem; left: 1rem; padding: .45rem .7rem; border-radius: 999px; background: #fff; color: #be123c; font-size: .72rem; font-weight: 900; letter-spacing: .06em; }
.detector-status { display: flex; align-items: center; gap: .55rem; padding: .8rem 1rem; color: var(--br-muted); font-size: .86rem; }
.status-dot { width: .65rem; height: .65rem; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 4px #e2e8f0; }
.detector-status.ready .status-dot { background: #16a34a; box-shadow: 0 0 0 4px #dcfce7; }
.detector-status.busy .status-dot { background: #eab308; box-shadow: 0 0 0 4px #fef9c3; }

.counter-panel { padding: 1.3rem; }
.score-block, .timer-block { display: flex; align-items: end; justify-content: space-between; border-bottom: 1px solid var(--br-line); }
.score-block span, .timer-block span { padding-bottom: 1rem; color: var(--br-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; }
.score-block strong { font-size: 6rem; line-height: 1; letter-spacing: -.08em; }
.timer-block { padding: 1rem 0; }
.timer-block strong { font-size: 2rem; }
.challenge-target { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--br-line); }
.challenge-target span { color: var(--br-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; }
.challenge-target strong { grid-row: 1 / 3; grid-column: 2; color: var(--br-accent-dark); font-size: 2.2rem; line-height: 1; }
.challenge-target a { color: var(--br-ink); font-size: .78rem; font-weight: 750; }
.run-mode { margin: 1rem 0; padding: 0; border: 0; }
.run-mode legend { margin-bottom: .5rem; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.mode-option { display: flex; gap: .7rem; margin-bottom: .55rem; padding: .8rem; border: 1px solid var(--br-line); border-radius: 12px; cursor: pointer; }
.mode-option.active { border-color: #0f172a; background: #f8fafc; box-shadow: inset 3px 0 var(--br-accent); }
.mode-option input { margin-top: .25rem; }
.mode-option span { display: flex; flex-direction: column; }
.mode-option small { margin-top: .15rem; color: var(--br-muted); line-height: 1.35; }
.br-primary, .br-secondary, .typing-restart {
  width: 100%;
  padding: .85rem 1rem;
  border: 1px solid var(--br-ink);
  border-radius: 11px;
  font-weight: 850;
  transition: transform .12s ease, opacity .12s ease;
}
.br-primary { background: var(--br-ink); color: white; }
.br-secondary { margin-top: .6rem; background: white; color: var(--br-ink); }
.br-primary:hover, .br-secondary:hover, .typing-restart:hover { transform: translateY(-2px); }
.br-primary:disabled { cursor: not-allowed; opacity: .42; transform: none; }
.br-button-link { display: inline-block; width: auto; text-align: center; text-decoration: none; }
.br-button-link:hover { color: white; }
.br-text-button { display: block; margin: .7rem auto 0; border: 0; background: transparent; color: var(--br-muted); text-decoration: underline; }
.counter-error { min-height: 1.3rem; margin: .8rem 0 0; color: #b91c1c; font-size: .85rem; }
.run-consent { margin: .65rem .15rem 0; text-align: center; }
.result-card { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 1.25rem; padding: 1.5rem; }
.result-card h2 { margin-top: .4rem; font-weight: 900; }
.recording-review video { width: 100%; max-height: 310px; border-radius: 12px; background: #111827; }
.recording-review p { color: var(--br-muted); font-size: .85rem; }
.recording-review .anonymous-name-field { display: flex; flex-direction: column; gap: .35rem; margin: .8rem 0; }
.anonymous-name-field span { color: var(--br-muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.anonymous-name-field input { width: 100%; padding: .7rem .8rem; border: 1px solid var(--br-line); border-radius: 10px; background: white; color: var(--br-ink); }
.recording-review .subtle a { color: var(--br-accent-dark); font-weight: 750; }
.recording-download { margin-bottom: .7rem; }
.counter-share { grid-column: 1 / -1; padding-top: 1.25rem; border-top: 1px solid var(--br-line); }
.counter-share h3 { margin: 0 0 .75rem; font-size: 1rem; font-weight: 850; text-align: center; }
.counter-share textarea {
  display: block;
  width: 100%;
  min-height: 9.5rem;
  padding: .9rem 1rem;
  resize: vertical;
  border: 1px solid var(--br-line);
  border-radius: 11px;
  background: #f8fafc;
  color: var(--br-ink);
  font: .92rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.counter-share .br-secondary { width: auto; min-width: 180px; margin: .75rem auto 0; display: block; }
.counter-share .subtle { min-height: 1.2rem; margin: .45rem 0 0; text-align: center; }
.typing-share { margin-top: 1.25rem; }
.subtle { color: var(--br-muted); font-size: .82rem; }

.typing-heading { margin: 6rem 0 1.5rem; }
.typing-heading h1 { font-size: clamp(2.8rem, 7vw, 6rem); }
.typing-controls { display: flex; align-items: center; gap: .3rem; color: var(--br-muted); }
.typing-controls span { margin-right: .5rem; font-size: .8rem; }
.typing-controls button { padding: .35rem .65rem; border: 0; border-radius: 7px; background: transparent; color: var(--br-muted); }
.typing-controls button.active { background: var(--br-ink); color: white; }
.typing-stats { display: flex; gap: 2.5rem; margin: 2rem 0 .8rem; }
.typing-stats div { display: flex; flex-direction: column; }
.typing-stats span { color: var(--br-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.typing-stats strong { font-size: 1.7rem; }
.typing-viewport { position: relative; height: 225px; overflow: hidden; padding: 2rem; outline: none; cursor: text; }
.typing-viewport:focus { border-color: #94a3b8; box-shadow: 0 0 0 4px rgba(148, 163, 184, .16); }
.typing-stream { display: flex; flex-wrap: wrap; align-content: flex-start; gap: .55rem 1rem; color: #94a3b8; font: 650 clamp(1.8rem, 4vw, 2.8rem)/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; transition: transform .18s ease; }
.typing-group { display: inline-flex; }
.typing-char { position: relative; }
.typing-char.correct { color: var(--br-ink); }
.typing-char.error { color: #e11d48; text-decoration: underline; text-decoration-thickness: 3px; }
.typing-char.current::before { content: ''; position: absolute; left: -2px; top: .18em; width: 2px; height: 1.1em; border-radius: 2px; background: var(--br-accent); animation: caret .9s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.focus-hint { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(247,248,245,.78); color: #475569; font-weight: 750; backdrop-filter: blur(3px); }
.typing-viewport:focus .focus-hint { display: none; }
.typing-restart { width: auto; margin: 1rem 0; border: 0; background: transparent; color: var(--br-muted); }
.typing-result { margin-top: 1rem; padding: 1.5rem; }
.typing-result h2 { margin: .45rem 0 1.2rem; font-weight: 900; }
.result-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .6rem; }
.result-grid div { padding: 1rem; border-radius: 10px; background: #f1f5f9; }
.result-grid span { display: block; color: var(--br-muted); font-size: .7rem; text-transform: uppercase; }
.result-grid strong { font-size: 1.5rem; }

.hall-heading { max-width: 900px; margin: 5rem 0 3rem; }
.hall-heading h1 { font-size: clamp(3rem, 8vw, 6.5rem); }
.pending-panel { margin-bottom: 1rem; padding: 1rem; border: 1px solid #fde68a; border-radius: 12px; background: #fffbeb; font-size: .88rem; }
.pending-panel a { margin-left: .4rem; color: #92400e; }
.hall-list { overflow: hidden; }
.hall-entry { display: grid; grid-template-columns: 65px 1fr 90px minmax(180px, .7fr); align-items: center; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--br-line); }
.hall-entry:last-child { border-bottom: 0; }
.hall-rank { color: var(--br-muted); font-weight: 800; }
.hall-person { display: flex; flex-direction: column; }
.hall-person span { color: var(--br-muted); font-size: .8rem; }
.hall-score { display: flex; flex-direction: column; font-size: 2rem; line-height: .9; }
.hall-score small { margin-top: .3rem; color: var(--br-muted); font-size: .62rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.hall-actions { display: flex; justify-content: flex-end; gap: .85rem; }
.hall-actions a { color: var(--br-accent-dark); font-size: .84rem; font-weight: 800; text-decoration: none; }
.hall-actions form { margin: 0; }
.hall-delete-link { padding: 0; border: 0; background: transparent; color: #b91c1c; font-size: .84rem; font-weight: 800; }
.hall-delete-link:hover { text-decoration: underline; }
.hall-preview { grid-column: 1 / -1; width: 100%; padding-top: .75rem; border-top: 1px dashed var(--br-line); }
.hall-preview summary { width: fit-content; cursor: pointer; color: var(--br-accent-dark); font-size: .86rem; font-weight: 800; }
.hall-preview summary::marker { color: var(--br-ink); }
.hall-preview-body { display: grid; grid-template-columns: minmax(240px, 420px) minmax(220px, 1fr); align-items: center; gap: 1.2rem; padding: .8rem 0 .25rem; }
.hall-preview video { width: 100%; max-height: 300px; border-radius: 10px; background: #111827; }
.hall-preview-body > div { display: flex; align-items: flex-start; flex-direction: column; gap: .45rem; }
.hall-preview-body > div > strong { font-size: 1.05rem; line-height: 1.35; }
.hall-preview-body > div > span { max-width: 460px; color: var(--br-muted); font-size: .84rem; }
.hall-preview-links { display: flex; flex-wrap: wrap; gap: .9rem; }
.hall-preview-links a { color: var(--br-accent-dark); font-size: .86rem; font-weight: 800; }
.hall-download { display: block; width: fit-content; margin: .45rem 0 0 auto; color: var(--br-ink); font-size: .8rem; font-weight: 750; }
.empty-hall { padding: 4rem 1.5rem; text-align: center; }
.empty-hall strong { font-size: 1.5rem; }
.empty-hall p { color: var(--br-muted); }

.hall-detail-heading { position: relative; display: flex; align-items: end; gap: 1.5rem; margin: 4rem 0 2rem; }
.hall-detail-heading h1 { margin: 0; font-size: clamp(5rem, 14vw, 10rem); font-weight: 950; line-height: .72; letter-spacing: -.09em; }
.hall-detail-heading > div { display: flex; flex-direction: column; padding-bottom: .25rem; }
.hall-detail-heading > div strong { font-size: 1.35rem; }
.hall-detail-heading > div span { color: var(--br-muted); font-size: .85rem; }
.hall-detail-heading .br-kicker { position: absolute; align-self: flex-start; transform: translateY(-2rem); }
.hall-detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .6fr); gap: 1.2rem; }
.hall-evidence-card, .hall-share-card { padding: 1.2rem; border: 1px solid var(--br-line); border-radius: 20px; background: white; box-shadow: 0 12px 35px rgba(15, 23, 42, .07); }
.hall-evidence-card video { width: 100%; max-height: 620px; border-radius: 14px; background: #111827; }
.hall-evidence-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: .8rem; }
.hall-evidence-actions .br-secondary { margin-top: 0; }
.hall-share-card h2 { margin: .4rem 0; font-size: 1.8rem; font-weight: 900; }
.hall-share-card > p { color: var(--br-muted); }
.hall-share-card textarea { width: 100%; padding: .8rem; resize: vertical; border: 1px solid var(--br-line); border-radius: 10px; background: #f8fafc; font: .85rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.hof-delete-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--br-line); }
.br-danger { width: 100%; padding: .75rem 1rem; border: 1px solid #fecaca; border-radius: 10px; background: #fff1f2; color: #b91c1c; font-weight: 800; }
.br-danger:hover { border-color: #ef4444; }
.hof-delete-notice { padding: .9rem 1rem; border: 1px solid #bbf7d0; border-radius: 12px; background: #f0fdf4; color: #166534; }
.my-hall-entry { grid-template-columns: 65px 1fr 90px minmax(220px, .8fr); }

@media (max-width: 780px) {
  .br-game-grid, .counter-hero, .counter-layout, .result-card, .hall-detail-grid { grid-template-columns: 1fr; }
  .duel-grid { grid-template-columns: 1fr; }
  .br-game-card { min-height: 300px; }
  .br-toolbar span { display: none; }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  .hall-entry { grid-template-columns: 45px 1fr 55px; }
  .my-hall-entry { grid-template-columns: 45px 1fr 55px; }
  .hall-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .hall-preview-body { grid-template-columns: 1fr; }
  .hall-detail-heading { align-items: start; flex-direction: column; gap: .6rem; }
  .hall-detail-heading .br-kicker { position: static; transform: none; }
  .typing-viewport { height: 205px; padding: 1.3rem; }
  .br-hof-banner { align-items: flex-start; flex-direction: column; margin-top: -2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
