/* Rally against Watson — game frame. Inside the frame the game speaks IBM (Carbon Gray 100,
   IBM Plex, IBM blue court); outside it the page keeps its own system. */
.rg {
  --rg-ui: #161616; --rg-ui-2: #262626; --rg-edge: #393939; --rg-fg: #f4f4f4; --rg-dim: #c6c6c6;
  --rg-watson: #78a9ff; --rg-you: #fa1556; --rg-court: #0f62fe;
  --rg-font: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --rg-mono: 'IBM Plex Mono', ui-monospace, monospace;
  position: relative;
  width: min(100%, calc((100svh - 300px) * 4 / 3));
  min-width: min(100%, 320px);
  margin: 0 auto;
  color: var(--rg-fg);
  font-family: var(--rg-font);
  background: var(--rg-ui);
  border: 1px solid var(--rg-edge);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .75), 0 14px 28px -14px rgba(0, 0, 0, .6);
}
.rg ::selection { background: var(--rg-court); color: #fff; }

/* bar: logo · score · tools */
.rg-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--rg-edge); }
.rg-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.rg-logo { width: 54px; height: auto; display: block; color: #fff; flex: none; }
.rg-event { font: 400 .8125rem/1 var(--rg-font); letter-spacing: .02em; color: var(--rg-dim); white-space: nowrap; padding-left: 14px; border-left: 1px solid var(--rg-edge); }
.rg-event b { font-weight: 600; color: var(--rg-fg); }
.rg-score { display: flex; align-items: center; gap: 14px; font-variant-numeric: tabular-nums; }
.rg-side { display: flex; align-items: center; gap: 10px; }
.rg-name { font: 600 .75rem/1 var(--rg-font); letter-spacing: .12em; text-transform: uppercase; color: var(--rg-dim); }
.rg-pts { min-width: 2ch; font: 600 2rem/1 var(--rg-mono); letter-spacing: -.02em; }
.rg-watson .rg-pts { color: var(--rg-watson); text-align: right; }
.rg-you .rg-pts { color: var(--rg-you); }
.rg-dash { width: 14px; height: 2px; background: var(--rg-edge); }
.rg-tools { display: flex; justify-content: flex-end; gap: 4px; }
.rg-icon { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--rg-fg); cursor: pointer; transition: background-color .15s ease; }
.rg-icon svg { width: 20px; height: 20px; }
.rg-icon:hover:not(:disabled) { background: var(--rg-ui-2); }
.rg-icon:disabled { color: var(--rg-dim); opacity: .35; cursor: default; }
.rg-icon:focus-visible, .rg-btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }

/* stage: the court */
.rg-stage { position: relative; aspect-ratio: 4 / 3; background: var(--rg-court); overflow: hidden; outline: none; touch-action: pan-y; }
.rg.is-live .rg-stage { touch-action: none; cursor: none; }
.rg.is-live.has-card .rg-stage { cursor: auto; }
.rg-stage:focus-visible { box-shadow: inset 0 0 0 2px #fff; }
.rg-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.rg-layer { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0, 29, 108, .28); }
.rg-layer[hidden] { display: none; }
.rg-card {
  width: min(100%, 440px); padding: 28px 28px 24px; text-align: left;
  background: rgba(22, 22, 22, .9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 2px solid var(--rg-you);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .7);
  animation: rg-in .42s cubic-bezier(.16, 1, .3, 1) both;
}
@keyframes rg-in { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.rg-title { margin: 0; font: 600 clamp(1.625rem, 3.6vw, 2.5rem)/1.05 var(--rg-font); letter-spacing: -.02em; color: #fff; text-wrap: balance; }
.rg-sub { margin: 12px 0 0; font: 400 .9375rem/1.5 var(--rg-font); color: var(--rg-dim); max-width: 38ch; text-wrap: pretty; }
.rg-actions { display: flex; flex-wrap: wrap; gap: 1px; margin-top: 22px; }
.rg-btn {
  min-height: 48px; padding: 0 56px 0 16px; border: 0; border-radius: 0; cursor: pointer;
  font: 400 .9375rem/1 var(--rg-font); letter-spacing: .01em; text-align: left;
  background: #393939; color: #fff; transition: background-color .15s ease;
}
.rg-btn:hover { background: var(--rg-ui-2); }
.rg-btn.is-primary { background: var(--rg-you); color: #0a0a0b; font-weight: 600; }
.rg-btn.is-primary:hover { background: var(--rg-fg); }

.rg-toast {
  position: absolute; left: 50%; top: 16px; margin: 0; padding: 9px 14px; transform: translate(-50%, -8px); opacity: 0;
  font: 400 .8125rem/1.2 var(--rg-font); color: #fff; background: rgba(22, 22, 22, .92); white-space: nowrap;
  border-left: 1px solid var(--rg-watson);
  transition: opacity .25s ease, transform .35s cubic-bezier(.16, 1, .3, 1); pointer-events: none;
}
.rg-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* foot: how to play · live stats */
.rg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--rg-edge); font: 400 .8125rem/1.4 var(--rg-font); color: var(--rg-dim); }
.rg-foot p { margin: 0; }
.rg-how b { color: var(--rg-fg); font-weight: 600; }
.rg kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; margin: 0 1px; font: 500 .75rem/1 var(--rg-mono); color: var(--rg-fg); background: var(--rg-ui-2); border: 1px solid var(--rg-edge); border-bottom-width: 2px; }
.rg-meta { display: flex; gap: 18px; font-variant-numeric: tabular-nums; }
.rg-meta b { color: var(--rg-fg); font: 500 .8125rem/1 var(--rg-mono); }
.rg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* fullscreen: the frame becomes the screen, the court letterboxes */
.rg.is-full { width: 100vw; height: 100vh; max-width: none; display: flex; flex-direction: column; border: 0; box-shadow: none; background: #000; }
.rg.is-full .rg-bar, .rg.is-full .rg-foot { background: var(--rg-ui); }
.rg.is-full .rg-stage { flex: 1 1 auto; aspect-ratio: auto; width: min(100vw, calc((100vh - 130px) * 4 / 3)); max-height: calc(100vw * 3 / 4); margin: auto; }

@media (max-width: 700px) {
  .rg { width: 100%; }
  .rg-bar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 8px 8px 8px 12px; }
  .rg-name { letter-spacing: .08em; }
  .rg-side { flex-direction: column; gap: 4px; }
  .rg-watson { flex-direction: column-reverse; }
  .rg-event { display: none; }
  .rg-logo { width: 46px; }
  .rg-score { justify-content: center; gap: 10px; }
  .rg-pts { text-align: center !important; }
  .rg-icon { width: 44px; height: 44px; }
  .rg-foot { padding: 10px 12px; }
  .rg-alt { display: none; }
  .rg-card { padding: 18px 18px 16px; }
  .rg-actions { margin-top: 16px; }
  .rg-sub { font-size: .875rem; }
}
.rg-how-touch { display: none; }
@media (pointer: coarse) { .rg-how-fine { display: none; } .rg-how-touch { display: inline; } }
@media (prefers-reduced-motion: reduce) { .rg-card { animation: none; } .rg-toast { transition: none; } }
