:root {
  color-scheme: light;
  --bg: #dfeede;
  --fg: #22303e;
  --muted: #7c8c9b;
  --card: #ffffff;
  --line: #d9e6da;
  --green: #43a047;
  --coral: #ff6b4a;
  --sun: #ffc53d;
  --sky: #2fa8e0;
  --teal: #0fb5a3;
  --pink: #ff8fb2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.45 Vazirmatn, Tahoma, "Segoe UI", -apple-system, system-ui, sans-serif;
  /* The canvas handles its own gestures; the page must not pan or bounce. */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }

/* The 3D canvas fills the panel and bleeds under the device's own chrome. */
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; }

/* Three has no text and no hit-testing, so every control and readout is a DOM
   element sitting over the canvas. The layer itself is transparent to touch;
   only its children take input, so a tap meant for the kid reaches him. */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#hud > * { pointer-events: auto; }

.hud-button, .hud-text { font-weight: 700; }

/* ------------------------------------------------------------ shared bits */
.rk-layer { position: absolute; pointer-events: none; }
.rk-layer > * { pointer-events: auto; }

.rk-icon {
  display: inline-block;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  flex: none;
}

.rk-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 3px 0 rgba(34, 48, 62, 0.13);
  font-weight: 800;
  font-size: 0.95rem;
}

.rk-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(34, 48, 62, 0.15);
  flex: none;
}
.rk-round:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(34, 48, 62, 0.15); }

.rk-primary, .rk-secondary {
  min-height: 52px;
  padding: 10px 22px;
  border-radius: 16px;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16);
}
.rk-primary { background: var(--green); color: #fff; }
.rk-secondary { background: #eef3ee; color: var(--fg); }
.rk-primary:active, .rk-secondary:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.16); }

.rk-inline { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

/* -------------------------------------------------------------- locker HUD */
.rk-top {
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.rk-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.rk-level-chip { gap: 8px; }
.rk-xp-track {
  width: 62px;
  height: 9px;
  border-radius: 999px;
  background: #e6efe7;
  overflow: hidden;
}
.rk-xp-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--pink);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.rk-bars {
  width: min(430px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  padding: 8px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 3px 0 rgba(34, 48, 62, 0.1);
}

.rk-bar { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 800; }
.rk-bar-label { flex: 0 0 52px; }
.rk-bar-track { flex: 1; height: 11px; border-radius: 999px; background: #e6efe7; overflow: hidden; }
.rk-bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.4s ease; }
.rk-bar-value { flex: 0 0 24px; text-align: left; color: var(--muted); font-size: 0.72rem; }

.rk-mood {
  top: 128px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}
.rk-mood-text {
  padding: 6px 16px;
  border-radius: 999px;
  background: #fff;
  font-weight: 800;
  font-size: 0.88rem;
  box-shadow: 0 3px 0 rgba(34, 48, 62, 0.12);
}

.rk-actions {
  left: 8px;
  right: 8px;
  bottom: 26px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.rk-act {
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.rk-act-disc {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
  border: 3px solid transparent;
}
.rk-act:active .rk-act-disc { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2); }
.rk-act.on .rk-act-disc { border-color: #fff; outline: 3px solid var(--fg); }
.rk-act-label {
  font-size: 0.74rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.88);
  padding: 1px 8px;
  border-radius: 999px;
}

/* The speaker in the corner of a screen that has no header row. */
.rk-corner { top: 10px; left: 10px; }

/* ------------------------------------------------------------ select scene */
.rk-title { font-size: 1.5rem; font-weight: 900; text-align: center; text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7); }
.rk-sub { font-weight: 700; color: #4f6475; text-align: center; margin-top: -4px; }

.rk-cards {
  left: 10px;
  right: 10px;
  bottom: 26px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}
.rk-card {
  background: #fff;
  border: 4px solid var(--line);
  border-radius: 20px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 5px 0 rgba(34, 48, 62, 0.12);
}
.rk-card:active { transform: translateY(3px); }
.rk-card.focus { outline: 4px solid var(--fg); outline-offset: 2px; }
.rk-card.sel { background: #eaf7ec; }
.rk-card-name { font-weight: 900; font-size: 1rem; }
.rk-card-tag { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ sheets */
.rk-sheet {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 32, 44, 0.45);
}
.rk-sheet-card {
  width: min(520px, 100%);
  max-height: 86%;
  overflow: auto;
  background: #fff;
  border-radius: 26px 26px 0 0;
  padding: 16px 16px calc(22px + env(safe-area-inset-bottom));
  animation: rk-rise 0.22s ease-out;
}
@keyframes rk-rise { from { transform: translateY(40px); opacity: 0; } }

.rk-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rk-sheet-title { font-size: 1.25rem; font-weight: 900; }
.rk-sheet-close {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #eef3ee;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rk-sheet-text { font-weight: 700; line-height: 1.8; text-align: center; }
.rk-reward { text-align: center; font-weight: 900; color: #c78f0b; margin-top: 6px; }

.rk-food-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rk-food {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 6px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 0 rgba(34, 48, 62, 0.1);
}
.rk-food:active { transform: translateY(3px); }
.rk-food-emoji { font-size: 2.2rem; line-height: 1.2; }
.rk-food-label { font-weight: 900; }
.rk-food-price { font-size: 0.82rem; font-weight: 800; color: #c78f0b; }

.rk-game-list { display: flex; flex-direction: column; gap: 10px; }
.rk-game-row {
  text-align: right;
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background: #fff;
  box-shadow: 0 4px 0 rgba(34, 48, 62, 0.1);
}
.rk-game-name { font-weight: 900; font-size: 1.05rem; }
.rk-game-sub { font-weight: 600; color: var(--muted); font-size: 0.88rem; }
.rk-game-record { font-style: normal; font-weight: 800; color: #c78f0b; font-size: 0.82rem; }

/* ------------------------------------------------------------- mini-games */
.rk-game {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}
.rk-game-card {
  width: min(430px, 100%);
  max-height: 100%;
  overflow: auto;
  background: #fff;
  border-radius: 26px;
  padding: 14px;
  box-shadow: 0 8px 0 rgba(34, 48, 62, 0.1);
}
.rk-game-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rk-game-title { font-size: 1.2rem; font-weight: 900; }
.rk-stats-row { font-weight: 800; color: #c78f0b; margin-bottom: 10px; text-align: center; }

.rk-slide-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  width: min(100%, 52vh);
  aspect-ratio: 1;
  margin: 0 auto;
  padding: 5px;
  border-radius: 18px;
  background: #eef3ee;
}
.rk-tile {
  border-radius: 11px;
  background-size: 300% 300%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6);
  min-height: 0;
}
.rk-tile:active { transform: scale(0.97); }
.rk-tile.empty { background: transparent; box-shadow: none; }

.rk-mem-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  width: min(100%, 50vh);
  margin: 0 auto;
}
.rk-mem-card { perspective: 600px; aspect-ratio: 1; padding: 0; min-height: 0; }
.rk-mem-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.4, 1.4, 0.6, 1);
}
.rk-mem-card.flipped .rk-mem-inner { transform: rotateY(180deg); }
.rk-mem-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.rk-mem-back { background: var(--green); box-shadow: 0 5px 0 #2f7a33; font-size: 1.8rem; }
.rk-mem-front { background: #fff7e0; transform: rotateY(180deg); font-size: 2.3rem; box-shadow: 0 5px 0 #e8d9a8; }
.rk-mem-card.matched .rk-mem-front { background: #dff7e8; box-shadow: 0 5px 0 #9ad8b4; }

.rk-toast {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  transform: translate(-50%, -90px);
  z-index: 40;
  max-width: 92%;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--fg);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  text-align: center;
  transition: transform 0.28s ease;
  pointer-events: none;
}
.rk-toast.on { transform: translate(-50%, 0); }

@media (max-width: 380px) {
  .rk-act { width: 58px; }
  .rk-act-disc { width: 52px; height: 52px; }
  .rk-bar-label { flex-basis: 46px; }
}

@media (max-height: 560px) {
  .rk-mood { display: none; }
  .rk-bars { grid-template-columns: repeat(4, 1fr); }
  .rk-bar { flex-direction: column; align-items: stretch; gap: 2px; }
  .rk-bar-value { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rk-mem-inner, .rk-xp-fill, .rk-bar-fill, .rk-toast, .rk-sheet-card { transition: none; animation: none; }
}


/* -------------------------------------------------------------------- shop */
.rk-shop-top {
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.rk-shop-title {
  flex: 1;
  font-size: 1.3rem;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

.rk-shop {
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -6px 0 rgba(34, 48, 62, 0.08);
  max-width: 640px;
  margin: 0 auto;
}

.rk-tabs { display: flex; gap: 6px; }
.rk-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 14px;
  background: #eef3ee;
  font-weight: 800;
  font-size: 0.74rem;
}
.rk-tab.on { background: var(--sun); box-shadow: 0 3px 0 #c78f0b; }

.rk-shop-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.rk-shop-heading { font-size: 0.9rem; font-weight: 900; color: var(--muted); margin: 6px 2px 6px; }
.rk-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  padding-bottom: 6px;
}

.rk-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: #fff;
  box-shadow: 0 3px 0 rgba(34, 48, 62, 0.1);
}
.rk-item:active { transform: translateY(2px); }
.rk-item.sel { border-color: var(--sky); background: #eaf6fd; }
.rk-item.worn { border-color: var(--green); background: #eaf7ec; }
.rk-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(34, 48, 62, 0.14);
  background: #eef3ee;
}
.rk-item-name { font-size: 0.76rem; font-weight: 800; text-align: center; line-height: 1.25; }
.rk-item-state { font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.rk-item-state.price { color: #c78f0b; }
.rk-item.worn .rk-item-state { color: var(--green); }

.rk-buybar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  min-height: 56px;
  padding: 6px 4px 0;
  border-top: 2px solid var(--line);
}
.rk-buy-text { flex: 1; font-weight: 800; font-size: 0.9rem; color: var(--muted); }
.rk-buybar.on .rk-buy-text { color: var(--fg); }
.rk-buy-button { min-height: 48px; padding: 8px 26px; }
.rk-buy-button.poor { background: #b9c3cc; }
.rk-buy-button[hidden] { display: none; }

@media (max-height: 560px) {
  .rk-shop { height: 58%; }
}

/* ---------------------------------------------------------- season journey */
.rk-level-chip {
  border: 0;
  color: var(--fg);
  cursor: pointer;
}
.rk-level-chip:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.rk-shop-title { font-size: clamp(0.92rem, 4vw, 1.3rem); }
.rk-progress-body {
  max-height: min(70vh, 680px);
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 2px 3px 12px;
}
.rk-progress-summary {
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #e5f4ec, #eef5ff);
  box-shadow: inset 0 0 0 2px rgba(67, 160, 71, 0.12);
}
.rk-progress-current { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 900; }
.rk-progress-distance { margin-top: 6px; color: #40596c; font-size: 0.88rem; font-weight: 800; }
.rk-progress-track { height: 12px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #d8e5de; }
.rk-progress-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #36b88b, #ffc53d); transition: width 0.35s ease; }
.rk-season-list { display: grid; gap: 10px; margin-top: 12px; }
.rk-season-card { padding: 12px; border: 2px solid #e3e9e5; border-radius: 18px; background: #fff; }
.rk-season-card.current { border-color: var(--green); background: #f5fcf6; }
.rk-season-card.locked { background: #f6f7f8; }
.rk-season-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rk-season-name { font-size: 1rem; font-weight: 900; }
.rk-season-range { color: var(--muted); font-size: 0.78rem; font-weight: 800; white-space: nowrap; }
.rk-season-levels { display: grid; grid-template-columns: repeat(6, minmax(28px, 36px)); justify-content: start; gap: 7px; margin: 10px 0; }
.rk-level-node { display: grid; place-items: center; aspect-ratio: 1; border: 2px solid #dce5df; border-radius: 50%; background: #fff; color: #657487; font-size: 0.75rem; font-weight: 900; }
.rk-level-node.done { border-color: #73c493; background: #dff5e6; color: #25683b; }
.rk-level-node.now { border-color: #e1a921; background: #fff0bd; color: #624b10; box-shadow: 0 0 0 2px rgba(255, 197, 61, 0.25); }
.rk-season-detail { display: flex; align-items: flex-start; gap: 7px; margin-top: 6px; color: #394c5b; font-size: 0.82rem; font-weight: 750; line-height: 1.5; }
.rk-season-detail .rk-icon { width: 17px !important; height: 17px !important; margin-top: 2px; }
.rk-season-detail.reward { color: #87620b; }

@media (max-width: 380px) {
  .rk-season-card { padding: 10px; }
  .rk-season-levels { gap: 5px; }
}



/* ------------------------------------------------------------- headball */
.rk-hb-ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.rk-hb-ui > * { pointer-events: auto; }
.rk-hb-header {
  position: absolute;
  z-index: 30;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rk-hb-title { flex: 1; text-align: center; font-size: clamp(1.05rem, 4vw, 1.35rem); font-weight: 900; color: #203b4b; text-shadow: 0 2px #fff; }
.rk-hb-scoreboard {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 66px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(7px, 2.5vw, 16px);
  min-height: 48px;
  padding: 6px 14px;
  border: 3px solid rgba(255,255,255,.82);
  border-radius: 999px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 4px 0 rgba(34,48,62,.16);
  direction: ltr;
  white-space: nowrap;
}
.rk-hb-name { color: #40596c; font-size: .82rem; font-weight: 900; }
.rk-hb-number { min-width: 20px; color: #253746; font-size: 1.15rem; font-weight: 1000; text-align: center; }
.rk-hb-clock { min-width: 44px; padding: 4px 9px; border-radius: 999px; background: #203b4b; color: #fff; font-weight: 900; text-align: center; }
.rk-hb-modal {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 12px 18px;
  background: rgba(18, 37, 49, .42);
  pointer-events: auto;
}
.rk-hb-modal[hidden] { display: none !important; }
.rk-hb-menu-card {
  width: min(440px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px;
  border: 4px solid rgba(255,255,255,.94);
  border-radius: 26px;
  background: #fffaf0;
  box-shadow: 0 8px 0 rgba(23,43,57,.2);
  text-align: center;
}
.rk-hb-menu-title { margin-bottom: 4px; font-size: 1.35rem; font-weight: 1000; }
.rk-hb-menu-copy, .rk-hb-instructions { margin: 6px 0 12px; color: #506678; font-weight: 750; line-height: 1.65; }
.rk-hb-difficulties { display: flex; gap: 7px; margin: 12px 0; }
.rk-hb-difficulty { flex: 1; min-height: 46px; border: 2px solid #dce7df; border-radius: 14px; background: #fff; font-weight: 900; }
.rk-hb-difficulty.on { border-color: #2fa8e0; background: #e5f5fd; color: #155e7d; box-shadow: 0 3px 0 #2fa8e0; }
.rk-hb-mode { width: 100%; margin: 2px 0 8px; }
.rk-hb-start { width: 100%; min-height: 50px; }
.rk-hb-result-score { margin: 8px 0; color: #344c5e; font-size: 1.5rem; font-weight: 1000; direction: ltr; }
.rk-hb-result-actions { display: grid; gap: 9px; margin-top: 16px; }
.rk-hb-controls {
  position: absolute;
  z-index: 8;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  left: 10px;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
.rk-hb-controls[hidden], .rk-hb-player-controls[hidden] { display: none !important; }
.rk-hb-controls.local { justify-content: space-between; }
.rk-hb-player-controls {
  width: min(48%, 210px);
  padding: 7px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 17px;
  background: rgba(28,57,69,.68);
  pointer-events: auto;
}
.rk-hb-pad-label { display: block; margin-bottom: 4px; color: #fff; font-size: .72rem; font-weight: 900; text-align: center; }
.rk-hb-pad-buttons { display: grid; grid-template-columns: repeat(2, minmax(42px, 1fr)); gap: 5px; }
.rk-hb-control {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 44px;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 13px;
  background: #2d8e68;
  box-shadow: 0 3px 0 #176145;
  touch-action: none;
}
.rk-hb-control:active { transform: translateY(2px); box-shadow: 0 1px 0 #176145; }
.rk-hb-player-2 .rk-hb-control { background: #387db5; box-shadow: 0 3px 0 #22547e; }

@media (any-pointer: coarse) {
  .rk-hb-controls:not([hidden]) { display: flex; }
}
@media (max-width: 360px) {
  .rk-hb-controls { right: 6px; left: 6px; gap: 5px; }
  .rk-hb-player-controls { width: 49%; padding: 5px; }
  .rk-hb-pad-buttons { gap: 4px; }
  .rk-hb-control { min-height: 42px; }
  .rk-hb-scoreboard { gap: 6px; padding-inline: 9px; }
  .rk-hb-name { font-size: .72rem; }
}


/* ------------------------------------------------------- friends and team */
.rk-friends-body { display: grid; gap: 12px; }
.rk-friend-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(34, 48, 62, 0.1);
}
.rk-friend-card.column { flex-direction: column; align-items: stretch; }
.rk-friend-mycode { display: grid; gap: 2px; }
.rk-friend-code { font-size: 1.6rem; letter-spacing: 0.22em; direction: ltr; text-align: right; font-weight: 900; color: #155e7d; }
.rk-friend-hint { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.rk-friend-add { display: flex; gap: 8px; }
.rk-friend-input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-align: center;
  direction: ltr;
}
.rk-friend-add-button { min-height: 48px; padding: 8px 18px; }
.rk-team-card { background: #f1fbf6; border-color: #bfe6d0; }
.rk-team-names { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.05rem; }
.rk-team-tally { margin: 0; text-align: center; font-weight: 800; color: #40596c; font-size: 0.88rem; }
.rk-team-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rk-team-actions .rk-primary, .rk-team-actions .rk-secondary { padding: 8px 12px; }
.rk-friend-list { display: grid; gap: 10px; }
.rk-friend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: #fff;
}
.rk-friend-info { display: grid; gap: 2px; min-width: 0; }
.rk-friend-name { font-weight: 900; }
.rk-friend-team { min-height: 44px; padding: 6px 14px; flex: none; }
.rk-friend-badge { flex: none; padding: 4px 12px; border-radius: 999px; background: #dff7e8; color: #1f7a43; font-weight: 900; font-size: 0.82rem; }


/* ------------------------------------------------------------- club + chat */
.rk-club-body { display: grid; gap: 12px; }
.rk-club-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; flex: none; box-shadow: 0 3px 0 rgba(34, 48, 62, 0.18); }
.rk-club-name-input { letter-spacing: 0; direction: rtl; }
.rk-club-preview { display: flex; align-items: center; justify-content: center; gap: 10px; }
.rk-club-choices { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rk-club-choice {
  width: 46px;
  height: 46px;
  border: 3px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rk-club-choice.on { border-color: #2fa8e0; box-shadow: 0 3px 0 #2fa8e0; }
.rk-club-color { border-radius: 50%; }
.rk-club-top { display: flex; align-items: center; gap: 12px; }
.rk-club-top .rk-friend-info { flex: 1; }
.rk-club-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rk-club-stat { display: grid; gap: 2px; padding: 8px 4px; border-radius: 14px; background: #f3f8f5; text-align: center; font-weight: 900; }
.rk-club-tail { display: grid; gap: 4px; justify-items: end; flex: none; }
.rk-club-points { color: #c78f0b; font-size: 0.88rem; }

.rk-chat-pinned { display: grid; gap: 4px; padding: 8px 10px; border-radius: 14px; background: #eefaf6; border: 2px dashed #8fd5bf; }
.rk-chat-unpin { justify-self: start; color: #1f7a63; font-weight: 800; font-size: 0.8rem; text-decoration: underline; }
.rk-chat-list { display: grid; gap: 8px; max-height: 220px; overflow-y: auto; padding: 4px 2px; }
.rk-chat-msg { display: grid; gap: 2px; justify-items: start; position: relative; padding-inline-end: 30px; }
.rk-chat-msg.mine { justify-items: end; }
.rk-chat-msg.pinned { padding-inline-end: 0; }
.rk-chat-from { color: var(--muted); font-size: 0.74rem; font-weight: 800; }
.rk-chat-bubble { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; background: #eef3ee; font-weight: 800; }
.rk-chat-msg.mine .rk-chat-bubble { background: #e5f5fd; }
.rk-chat-bubble.sticker { flex-direction: column; gap: 0; padding: 6px 14px; background: #fff7e0; }
.rk-chat-bubble.sticker .rk-chat-emoji { font-size: 2.2rem; }
.rk-chat-bubble.emoji { background: transparent; padding: 0; }
.rk-chat-bubble.emoji .rk-chat-emoji { font-size: 2.2rem; }
.rk-chat-text { font-size: 0.9rem; }
.rk-chat-pin { position: absolute; top: 18px; inset-inline-end: 0; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eef3ee; opacity: 0.55; }
.rk-chat-pin.on { opacity: 1; background: #c9f0e3; }
.rk-chat-tabs { display: flex; gap: 6px; }
.rk-chat-tab { flex: 1; min-height: 40px; border-radius: 12px; background: #eef3ee; font-weight: 900; }
.rk-chat-tab.on { background: #e5f5fd; color: #155e7d; box-shadow: 0 3px 0 #2fa8e0; }
.rk-chat-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rk-chat-picker.phrase { grid-template-columns: 1fr 1fr; }
.rk-chat-pick { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 6px; border: 3px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 3px 0 rgba(34, 48, 62, 0.1); }
.rk-chat-pick:active { transform: translateY(2px); }
.rk-chat-pick .rk-chat-emoji { font-size: 1.7rem; line-height: 1.2; }
.rk-chat-pick .rk-chat-text { font-size: 0.78rem; font-weight: 800; }


/* ------------------------------------------------------------------ league */
.rk-league-row.mine { border-color: #2fa8e0; background: #f1faff; }
.rk-league-rank { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #dde6e0; color: #fff; font-weight: 900; font-size: 0.85rem; }
.rk-league-row .rk-club-top { gap: 8px; min-width: 0; }
.rk-prize-medal { flex: none; width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 900; box-shadow: 0 3px 0 rgba(34, 48, 62, 0.18); }
.rk-prize-medal.small { width: 24px; height: 24px; font-size: 0.78rem; box-shadow: none; }

.rk-celebrate { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 32, 44, 0.55); pointer-events: auto; overflow: hidden; }
.rk-celebrate-card { position: relative; width: min(420px, 100%); max-height: 100%; overflow-y: auto; display: grid; justify-items: center; gap: 10px; padding: 20px; border: 4px solid #fff; border-radius: 26px; background: #fffaf0; box-shadow: 0 8px 0 rgba(23, 43, 57, 0.2); text-align: center; animation: rk-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.rk-celebrate-card > .rk-icon { animation: rk-trophy 1.2s ease-in-out infinite; }
.rk-celebrate-title { font-size: 1.5rem; font-weight: 1000; }
.rk-celebrate-card .rk-primary { width: 100%; }
.rk-prize-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 16px; background: #fff; border: 3px solid var(--line); text-align: right; }
@keyframes rk-pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes rk-trophy { 0%, 100% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.15); } }
.rk-confetti { position: absolute; inset: 0; pointer-events: none; }
.rk-confetti-piece { position: absolute; top: -14px; width: 10px; height: 16px; border-radius: 3px; animation: rk-fall linear infinite; }
@keyframes rk-fall { to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) {
  .rk-confetti-piece, .rk-celebrate-card > .rk-icon { animation: none; }
}


/* --------------------------------------------------------- pro and the store */
.rk-pro-card { background: #fff8e1; border-color: #f2d27a; }
.rk-pro-crown { flex: none; width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #f0b81f; box-shadow: 0 3px 0 rgba(34, 48, 62, 0.18); }
.rk-name-crown { display: inline-block; vertical-align: middle; margin-inline-start: 5px; }
.rk-buy-product { min-height: 44px; padding: 6px 14px; flex: none; font-size: 0.9rem; }
.rk-pro-card .rk-buy-product { width: 100%; }
.rk-store-mode { text-align: center; }
.rk-gate { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 32, 44, 0.6); }
.rk-gate-card { animation: none; }
.rk-gate-card .rk-friend-input { width: 100%; letter-spacing: 0.1em; }
.rk-gate-card .rk-team-actions { width: 100%; }
.rk-gate-question { font-size: 1.6rem; direction: rtl; }
.rk-sheet.paying { pointer-events: none; opacity: 0.7; }


/* ---------------------------------------------------------- daily challenge */
.rk-streak-card { background: #fff1e8; border-color: #f6c3a6; justify-content: flex-start; }
.rk-streak-flame { flex: none; width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #ff6b4a; box-shadow: 0 3px 0 rgba(34, 48, 62, 0.18); }
.rk-streak-count { font-size: 1.25rem; font-weight: 1000; }
.rk-mission { gap: 8px; }
.rk-mission-icon { flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #2fa8e0; }
.rk-mission.done { background: #f1fbf6; border-color: #bfe6d0; }
.rk-mission.done .rk-mission-icon { background: #43a047; }
.rk-mission .rk-club-top { flex: 1; }
.rk-mission-coins { flex: none; display: inline-flex; align-items: center; gap: 4px; color: #c78f0b; font-weight: 900; }
.rk-mission .rk-progress-track { margin-top: 0; }
.rk-chest-card { align-items: center; text-align: center; }
.rk-chest-card .rk-primary { width: 100%; }
.rk-chest-card .rk-primary:disabled { background: #b9c3cc; box-shadow: 0 5px 0 rgba(0, 0, 0, 0.1); }
.rk-chest-prize { color: #c78f0b; font-size: 1.1rem; font-weight: 1000; animation: rk-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.rk-chest { position: relative; width: 96px; height: 84px; margin-top: 6px; filter: grayscale(0.85) brightness(0.95); }
.rk-chest-card.ready .rk-chest, .rk-chest-card.opened .rk-chest { filter: none; }
.rk-chest-card.ready:not(.opening) .rk-chest { animation: rk-chest-wiggle 1.2s ease-in-out infinite; }
.rk-chest-box { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; border-radius: 6px 6px 12px 12px; background: linear-gradient(#b86a2b, #8f4d1a); border: 4px solid #6e3a12; box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.12); }
.rk-chest-box::after { content: ''; position: absolute; top: -6px; left: 50%; width: 18px; height: 22px; margin-left: -9px; border-radius: 5px; background: #f0b81f; border: 3px solid #a87500; }
.rk-chest-lid { position: absolute; left: -2px; right: -2px; bottom: 44px; height: 32px; border-radius: 40px 40px 4px 4px; background: linear-gradient(#cf8040, #a55b21); border: 4px solid #6e3a12; transform-origin: 0 100%; transition: transform 0.55s cubic-bezier(0.3, 1.5, 0.5, 1); z-index: 1; }
.rk-chest-glow { position: absolute; left: 10%; right: 10%; bottom: 40px; height: 54px; border-radius: 50%; background: radial-gradient(#fff3b0, rgba(255, 220, 90, 0)); opacity: 0; transition: opacity 0.4s; }
.rk-chest-card.opening .rk-chest-lid, .rk-chest-card.opened .rk-chest-lid { transform: rotate(-62deg) translateY(-6px); }
.rk-chest-card.opening .rk-chest-glow, .rk-chest-card.opened .rk-chest-glow { opacity: 1; }
.rk-chest-card.opening .rk-chest { animation: rk-chest-shake 0.3s linear 3; }
@keyframes rk-chest-wiggle { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-3px); } }
@keyframes rk-chest-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) {
  .rk-chest-card.ready:not(.opening) .rk-chest, .rk-chest-card.opening .rk-chest { animation: none; }
}


/* ------------------------------------------------------ records and statistics */
.rk-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rk-stats-grid.two { grid-template-columns: 1fr 1fr; }
.rk-club-stat.good { background: #e6f7ec; color: #1f7a43; }
.rk-club-stat.bad { background: #fdebe6; color: #b6452b; }
.rk-club-stat .rk-friend-hint { font-size: 0.74rem; }
.rk-match-row { justify-content: flex-start; }
.rk-match-badge { flex: none; min-width: 58px; padding: 4px 10px; border-radius: 999px; background: #dde6e0; text-align: center; font-weight: 900; font-size: 0.82rem; color: #40596c; }
.rk-match-row.win .rk-match-badge { background: #dff7e8; color: #1f7a43; }
.rk-match-row.loss .rk-match-badge { background: #fdebe6; color: #b6452b; }
.rk-match-row .rk-friend-name { direction: ltr; text-align: right; }
.rk-best-result > b { direction: ltr; }



/* ------------------------------------------------------------------- medals */
.rk-medal-count { text-align: center; }
.rk-sheet-card:has(.rk-medal-grid) { touch-action: pan-y; overscroll-behavior: contain; }
.rk-medal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rk-medal { display: grid; justify-items: center; align-content: start; gap: 4px; padding: 12px 8px; border: 3px solid var(--line); border-radius: 18px; background: #fffaf0; text-align: center; }
.rk-medal.locked { background: #f1f4f6; }
.rk-medal.locked .rk-medal-name { color: var(--muted); }
.rk-medal-disc { flex: none; width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 rgba(34, 48, 62, 0.18); }
.rk-medal-name { font-weight: 900; }
.rk-medal-coins { font-size: 0.8rem; font-weight: 900; color: #c78f0b; }
.rk-medal.locked .rk-medal-coins { color: var(--muted); }
.rk-medal-pop { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 50%; z-index: 50; display: flex; align-items: center; gap: 12px; width: min(340px, calc(100% - 24px)); padding: 10px 14px; border: 4px solid #fff; border-radius: 22px; background: #fffaf0; box-shadow: 0 6px 0 rgba(23, 43, 57, 0.2); pointer-events: none; transform: translateX(-50%); animation: rk-medal-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.rk-medal-pop.out { opacity: 0; transition: opacity 0.3s; }.rk-medal-pop .rk-medal-disc { animation: rk-trophy 1.2s ease-in-out infinite; }
.rk-medal-pop-text { display: grid; gap: 1px; }
.rk-medal-pop-head { font-size: 0.78rem; font-weight: 900; color: var(--muted); }
.rk-medal-pop-name { font-size: 1.1rem; font-weight: 1000; }
.rk-medal-pop .rk-reward { margin-top: 0; text-align: start; }
@keyframes rk-medal-in { from { transform: translate(-50%, -30px) scale(0.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .rk-medal-pop, .rk-medal-pop .rk-medal-disc { animation: none; }
}



/* ------------------------------------------------------ responsive home layout */
.rk-locker-top {
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  right: auto;
  width: min(560px, calc(100% - 24px));
  gap: 6px;
  transform: translateX(-50%);
}
.rk-primary-row { width: 100%; flex-wrap: nowrap; gap: 8px; }
.rk-primary-row .rk-round { width: 42px; height: 42px; }
.rk-primary-row .rk-chip { min-height: 42px; flex: none; padding-inline: 10px; white-space: nowrap; }
.rk-primary-row .rk-level-chip { gap: 6px; }
.rk-primary-row .rk-xp-track { width: 54px; flex: none; }
.rk-utility-row {
  width: max-content;
  max-width: 100%;
  flex-wrap: nowrap;
  gap: 5px;
  margin-inline: auto;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 2px 0 rgba(34, 48, 62, 0.08);
}
.rk-utility-row .rk-round { width: 40px; height: 40px; }
.rk-locker-top .rk-bars { width: min(540px, 100%); }
.rk-locker-top .rk-mood {
  position: relative;
  inset: auto;
  display: flex;
  width: 100%;
  justify-content: center;
  pointer-events: none;
}
.rk-locker-top .rk-mood-text { padding: 4px 12px; font-size: 0.82rem; }
.rk-actions {
  left: 50%;
  right: auto;
  width: min(430px, calc(100% - 24px));
  bottom: calc(env(safe-area-inset-bottom) + 68px);
  gap: clamp(4px, 1.6vw, 8px);
  transform: translateX(-50%);
}
.rk-act { width: auto; min-width: 0; max-width: 72px; flex: 1 1 0; }
.rk-act-disc { width: 54px; height: 54px; }
.rk-act-label {
  max-width: 100%;
  overflow: hidden;
  padding: 1px 5px;
  font-size: clamp(0.66rem, 2.8vw, 0.78rem);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The sound toggle shares a balanced header with the title on player select. */
.rk-select-top {
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  right: auto;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: start;
  gap: 8px;
  width: min(640px, calc(100% - 24px));
  transform: translateX(-50%);
}
.rk-select-heading { grid-column: 2; min-width: 0; text-align: center; }
.rk-select-spacer { grid-column: 3; grid-row: 1; width: 44px; height: 44px; }
.rk-select-top > .rk-round { grid-column: 1; grid-row: 1; }
.rk-select-heading .rk-title { font-size: clamp(1.15rem, 5.7vw, 1.5rem); line-height: 1.3; }
.rk-select-heading .rk-sub { font-size: clamp(0.82rem, 3.8vw, 1rem); margin-top: 2px; }
.rk-cards { left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 64px); max-width: 600px; gap: 10px; }
.rk-card { padding: 8px 5px; }

/* The focus challenge gives the former face-wash slot a repeatable mini-game. */
.rk-focus-body { display: grid; gap: 12px; text-align: center; }
.rk-focus-copy, .rk-focus-hint { color: #465d6f; font-weight: 750; line-height: 1.65; }
.rk-focus-score { color: #8060c9; font-weight: 900; }
.rk-focus-track {
  position: relative;
  height: 42px;
  margin: 10px 6px;
  overflow: hidden;
  border: 4px solid #e8edf0;
  border-radius: 999px;
  background: linear-gradient(90deg, #e8f2ea, #fff);
}
.rk-focus-target {
  position: absolute;
  inset: 0 auto 0 41%;
  width: 18%;
  border-inline: 3px solid #e6b62d;
  background: rgba(255, 197, 61, 0.42);
}
.rk-focus-target::after { content: '★'; position: absolute; inset: 50% auto auto 50%; color: #d59d12; font-size: 1.25rem; transform: translate(-50%, -55%); }
.rk-focus-marker {
  position: absolute;
  top: 3px;
  left: 5%;
  width: 16px;
  height: 28px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #8a5bd6;
  box-shadow: 0 2px 5px rgba(34, 48, 62, 0.3);
  transform: translateX(-50%);
}
.rk-focus-hit { width: 100%; min-height: 54px; }

@media (max-width: 380px) {
  .rk-primary-row { gap: 4px; }
  .rk-primary-row .rk-round { width: 36px; height: 36px; }
  .rk-primary-row .rk-chip { min-height: 38px; padding-inline: 7px; font-size: 0.86rem; }
  .rk-primary-row .rk-level-chip { gap: 4px; }
  .rk-primary-row .rk-level-chip > .rk-icon { width: 16px !important; height: 16px !important; }
  .rk-primary-row .rk-xp-track { width: 36px; }
  .rk-utility-row { gap: 3px; padding: 4px; }
  .rk-utility-row .rk-round { width: 36px; height: 36px; }
  .rk-act-disc { width: 50px; height: 50px; }
  .rk-cards { gap: 6px; }
  .rk-card { padding: 7px 3px; border-width: 3px; }
  .rk-card-name { font-size: 0.92rem; }
  .rk-card-tag { font-size: 0.67rem; }
}

@media (max-height: 560px) {
  .rk-locker-top { top: calc(env(safe-area-inset-top) + 6px); gap: 4px; width: min(680px, calc(100% - 20px)); }
  .rk-primary-row { gap: 6px; }
  .rk-primary-row .rk-round { width: 36px; height: 36px; }
  .rk-primary-row .rk-chip { min-height: 36px; padding-inline: 8px; }
  .rk-primary-row .rk-xp-track { width: 42px; }
  .rk-utility-row { gap: 4px; padding: 3px; }
  .rk-utility-row .rk-round { width: 36px; height: 36px; }
  .rk-locker-top .rk-bars { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px 8px; padding: 5px 8px; }
  .rk-locker-top .rk-bar { flex-direction: column; align-items: stretch; gap: 2px; font-size: 0.68rem; text-align: center; }
  .rk-locker-top .rk-bar-label { flex: none; text-align: center; }
  .rk-locker-top .rk-bar-value { display: none; }
  .rk-locker-top .rk-bar-track { height: 8px; }
  .rk-locker-top .rk-mood { display: none; }
  .rk-actions { bottom: calc(env(safe-area-inset-bottom) + 22px); }
  .rk-act-disc { width: 48px; height: 48px; }
  .rk-act-label { font-size: 0.68rem; }
  .rk-cards { bottom: calc(env(safe-area-inset-bottom) + 48px); }
  .rk-select-top { top: calc(env(safe-area-inset-top) + 6px); }
}



/* Keep the utility icons visually distinct; the buttons, not a white rail, group them. */
.rk-utility-row { gap: 8px; padding: 0; background: transparent; box-shadow: none; }
@media (max-width: 380px) {
  .rk-utility-row { gap: 3px; }
  .rk-utility-row .rk-round { width: 38px; height: 38px; }
}
@media (max-height: 560px) {
  .rk-utility-row { gap: 6px; }
  .rk-utility-row .rk-round { width: 38px; height: 38px; }
}



/* ---------------------------------------------------------- penalty shootout */
.rk-pen-ui { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.rk-pen-ui > * { pointer-events: auto; }
.rk-pen-header {
  position: absolute; z-index: 30; top: calc(env(safe-area-inset-top) + 10px);
  left: 10px; right: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.rk-pen-title { flex: 1; text-align: center; color: #203b4b; font-size: clamp(1.05rem, 4vw, 1.35rem); font-weight: 900; text-shadow: 0 2px #fff; }
.rk-pen-scoreboard {
  position: absolute; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%);
  display: grid; gap: 4px; width: min(340px, calc(100% - 24px)); padding: 8px 12px;
  border: 3px solid rgba(255,255,255,.85); border-radius: 20px; background: rgba(255,255,255,.94);
  box-shadow: 0 4px 0 rgba(34,48,62,.15);
}
.rk-pen-score-row { display: grid; grid-template-columns: minmax(42px, auto) 1fr 24px; align-items: center; gap: 8px; direction: ltr; }
.rk-pen-name { color: #40596c; font-size: .78rem; font-weight: 900; text-align: right; }
.rk-pen-score { color: #253746; font-size: 1rem; font-weight: 1000; text-align: center; }
.rk-pen-pips { display: flex; justify-content: center; gap: 5px; }
.rk-pen-pip { width: 12px; height: 12px; border: 2px solid #b7c6c0; border-radius: 50%; background: #fff; }
.rk-pen-pip.next { border-color: #e4b226; box-shadow: 0 0 0 2px rgba(255,197,61,.2); }
.rk-pen-pip.goal { border-color: #43a047; background: #43a047; }
.rk-pen-pip.miss { border-color: #e47e67; background: #ffb7a5; }
.rk-pen-round { grid-row: 1 / span 2; grid-column: 3; align-self: center; min-width: 58px; color: #506678; font-size: .66rem; font-weight: 900; text-align: center; direction: rtl; }
.rk-pen-status {
  position: absolute; top: calc(env(safe-area-inset-top) + 166px); left: 50%; transform: translateX(-50%);
  width: min(340px, calc(100% - 28px)); padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.86);
  color: #28495a; font-size: .9rem; font-weight: 900; text-align: center; box-shadow: 0 3px 0 rgba(34,48,62,.1);
}
.rk-pen-modal {
  position: absolute; z-index: 40; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(74px + env(safe-area-inset-top)) 12px calc(18px + env(safe-area-inset-bottom));
  background: rgba(18,37,49,.42); pointer-events: auto;
}
.rk-pen-modal[hidden], .rk-pen-controls[hidden] { display: none !important; }
.rk-pen-menu-card {
  display: grid; gap: 8px; width: min(430px, 100%); max-height: 100%; overflow-y: auto; padding: 20px;
  border: 4px solid rgba(255,255,255,.94); border-radius: 26px; background: #fffaf0;
  box-shadow: 0 8px 0 rgba(23,43,57,.2); text-align: center;
}
.rk-pen-menu-title { font-size: 1.35rem; font-weight: 1000; }
.rk-pen-menu-copy, .rk-pen-instructions { color: #506678; font-weight: 750; line-height: 1.65; }
.rk-pen-difficulties { display: flex; gap: 7px; margin: 5px 0; }
.rk-pen-difficulty { flex: 1; min-height: 46px; border: 2px solid #dce7df; border-radius: 14px; background: #fff; font-weight: 900; }
.rk-pen-difficulty.on { border-color: #2fa8e0; background: #e5f5fd; color: #155e7d; box-shadow: 0 3px 0 #2fa8e0; }
.rk-pen-start { width: 100%; min-height: 50px; }
.rk-pen-result-score { margin: 5px 0; color: #344c5e; font-size: 1.6rem; font-weight: 1000; direction: ltr; }
.rk-pen-league-points { color: #80600b; font-weight: 900; }
.rk-pen-controls {
  position: absolute; z-index: 8; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 12px); left: 10px;
  display: none; width: min(520px, calc(100% - 20px)); margin: 0 auto; padding: 9px;
  border: 2px solid rgba(255,255,255,.82); border-radius: 20px; background: rgba(28,57,69,.82);
  box-shadow: 0 5px 0 rgba(19,45,53,.2); color: #fff; text-align: center;
}
.rk-pen-control-help { margin-bottom: 5px; font-size: .78rem; font-weight: 900; }
.rk-pen-lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rk-pen-lane {
  display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 44px; border: 2px solid rgba(255,255,255,.75);
  border-radius: 13px; background: #eaf5ed; color: #22303e; font-weight: 900; touch-action: manipulation;
}
.rk-pen-lane.on { border-color: #ffc53d; background: #fff0bd; box-shadow: 0 2px 0 #c78f0b; }
.rk-pen-power-row { display: flex; align-items: center; gap: 7px; margin-top: 7px; }
.rk-pen-power-row[hidden] { display: none !important; }
.rk-pen-power-button { flex: none; width: 38px; height: 36px; border-radius: 11px; background: #fff; color: #22303e; font-size: 1.25rem; font-weight: 900; }
.rk-pen-power-track { position: relative; flex: 1; height: 12px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.3); }
.rk-pen-power-fill { display: block; width: 62%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #57d69a, #ffc53d, #ff765b); }
.rk-pen-power-text { flex: none; min-width: 78px; font-size: .72rem; }
.rk-pen-action { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 44px; margin-top: 7px; padding: 6px 12px; border-radius: 13px; font-size: .94rem; }
.rk-pen-action:disabled { opacity: .55; }
.rk-pen-result .rk-pen-menu-card { width: min(360px, 100%); }
.rk-pen-result .rk-secondary { margin-top: 4px; }
@media (any-pointer: coarse) {
  .rk-pen-controls:not([hidden]) { display: block; }
}
@media (max-width: 360px) {
  .rk-pen-scoreboard { width: calc(100% - 18px); padding: 7px 8px; }
  .rk-pen-score-row { gap: 5px; grid-template-columns: minmax(36px, auto) 1fr 20px; }
  .rk-pen-name { font-size: .7rem; }
  .rk-pen-pips { gap: 3px; }
  .rk-pen-pip { width: 10px; height: 10px; }
  .rk-pen-controls { right: 6px; left: 6px; width: calc(100% - 12px); padding: 7px; }
}
@media (max-height: 560px) {
  .rk-pen-controls { bottom: calc(env(safe-area-inset-bottom) + 6px); padding: 6px; }
  .rk-pen-control-help { display: none; }
  .rk-pen-lane { min-height: 38px; }
  .rk-pen-power-row { margin-top: 5px; }
  .rk-pen-action { min-height: 38px; margin-top: 5px; }
  .rk-pen-status { top: calc(env(safe-area-inset-top) + 148px); }
}



/* ---------------------------------------------------------- resumed UI polish */
.rk-chip-button { border: 0; color: var(--fg); cursor: pointer; font: inherit; }
.rk-chip-button:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.rk-rewarded-ad-card { align-items: stretch; background: #f1faff; border-color: #b8dff1; }
.rk-rewarded-ad-button { width: 100%; min-height: 48px; }
.rk-rewarded-ad-button:disabled { color: #64717b; background: #e4e9ec; box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1); cursor: not-allowed; }

/* Keep club and team screens inside the safe viewport while their content scrolls. */
.rk-sheet-card:has(.rk-club-body),
.rk-sheet-card:has(.rk-friends-body) {
  display: flex;
  flex-direction: column;
  max-height: calc(100% - 12px);
  overflow: hidden;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
.rk-sheet-card:has(.rk-club-body) > .rk-sheet-body,
.rk-sheet-card:has(.rk-friends-body) > .rk-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  padding: 2px 3px 14px;
}

/* Larger thumb targets, inset from the home-indicator edge. */
.rk-hb-controls {
  right: 14px;
  left: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  justify-content: flex-start;
  gap: 12px;
}
.rk-hb-controls.local { justify-content: space-between; }
.rk-hb-player-controls { width: min(49%, 220px); padding: 9px; }
.rk-hb-pad-label { margin-bottom: 6px; font-size: .78rem; }
.rk-hb-pad-buttons { gap: 7px; }
.rk-hb-control { min-width: 56px; min-height: 58px; border-radius: 16px; }

/* Child dialogue stays readable even on a short landscape panel. */
.rk-locker-top .rk-mood { max-width: 100%; }
.rk-locker-top .rk-mood-text {
  max-width: 100%;
  padding: 4px 12px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
}
@media (max-width: 360px) {
  .rk-hb-controls { right: 8px; left: 8px; gap: 6px; }
  .rk-hb-player-controls { width: 49%; padding: 7px; }
  .rk-hb-pad-buttons { gap: 5px; }
  .rk-hb-control { min-width: 52px; min-height: 56px; }
}
@media (max-height: 560px) {
  .rk-hb-controls { bottom: calc(env(safe-area-inset-bottom) + 10px); }
  .rk-hb-player-controls { padding: 6px; }
  .rk-hb-control { min-height: 52px; }
  .rk-locker-top .rk-mood { display: flex; }
  .rk-locker-top .rk-mood-text { padding: 2px 8px; font-size: .7rem; }
}



/* ------------------------------------------------------------- sponsor ads */
.rk-sponsor-body { padding: 2px 3px 14px; }
.rk-sponsor-form { display: grid; gap: 12px; padding: 4px 2px 14px; }
.rk-sponsor-intro, .rk-sponsor-note, .rk-sponsor-status, .rk-sponsor-feedback {
  color: #526576;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.7;
}
.rk-sponsor-status { padding: 10px 12px; border-radius: 14px; background: #eef7ee; }
.rk-sponsor-field, .rk-sponsor-gate-label { display: grid; gap: 5px; color: #354a5b; font-size: .88rem; font-weight: 850; }
.rk-sponsor-input {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 2px solid #d9e6da; border-radius: 13px;
  background: #fff; color: #22303e; font: inherit; font-size: .94rem; user-select: text; -webkit-user-select: text;
}
.rk-sponsor-input:focus { outline: 3px solid rgba(47,168,224,.25); border-color: #2fa8e0; }
.rk-sponsor-message { min-height: 82px; resize: vertical; }
.rk-sponsor-file { padding: 8px; font-size: .82rem; }
.rk-sponsor-preview {
  display: grid; place-items: center; min-height: 110px; max-height: 250px; overflow: hidden; padding: 8px;
  border: 2px dashed #b9c9bf; border-radius: 16px; background: #f4f8f4; color: #748394; text-align: center; font-size: .84rem;
}
.rk-sponsor-preview-media { display: block; max-width: 100%; max-height: 230px; object-fit: contain; border-radius: 10px; }
.rk-sponsor-consent { display: flex; align-items: flex-start; gap: 9px; color: #435768; font-size: .82rem; font-weight: 700; line-height: 1.6; }
.rk-sponsor-consent input { flex: none; width: 20px; height: 20px; accent-color: #43a047; }
.rk-sponsor-submit { width: 100%; min-height: 50px; }
.rk-sponsor-submit:disabled { opacity: .55; cursor: not-allowed; }
.rk-sponsor-feedback { min-height: 1.5em; }

.rk-ad-overlay {
  position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(20, 37, 46, .74); pointer-events: auto; touch-action: none;
}
.rk-ad-card {
  display: grid; gap: 10px; width: min(480px, 100%); max-height: 100%; overflow-y: auto; padding: clamp(16px, 4vw, 24px);
  border: 4px solid rgba(255,255,255,.94); border-radius: 28px; background: #fffaf0; color: #22303e;
  box-shadow: 0 10px 0 rgba(10,25,34,.25); text-align: center;
}
.rk-ad-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rk-ad-tag, .rk-ad-timer-label { padding: 4px 10px; border-radius: 999px; background: #eaf2ea; color: #42624b; font-size: .75rem; font-weight: 900; }
.rk-ad-timer-label { background: #fff0bd; color: #765600; }
.rk-ad-visual { display: grid; place-items: center; min-height: 130px; max-height: min(34vh, 260px); overflow: hidden; border-radius: 20px; }
.rk-ad-house-visual { gap: 8px; padding: 15px; background: linear-gradient(145deg, #2e9c61, #73c987); color: #fff; }
.rk-ad-house-ball { display: grid; place-items: center; width: 76px; height: 76px; border: 3px solid rgba(255,255,255,.8); border-radius: 50%; background: rgba(255,255,255,.19); }
.rk-ad-house-title { font-size: clamp(1.1rem, 4vw, 1.45rem); }
.rk-ad-sponsor-visual { background: #eaf0eb; }
.rk-ad-media { display: block; width: 100%; max-height: min(34vh, 260px); object-fit: contain; }
.rk-ad-title { font-size: clamp(1.2rem, 5vw, 1.65rem); font-weight: 1000; }
.rk-ad-copy { color: #4d6170; font-weight: 750; line-height: 1.65; }
.rk-ad-sponsor-name { color: #667787; font-size: .82rem; font-weight: 850; }
.rk-ad-progress { height: 10px; overflow: hidden; border-radius: 999px; background: #e4eae4; }
.rk-ad-progress-fill { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #43a047, #ffc53d); transform: scaleX(0); transform-origin: right; animation: rk-ad-countdown 10s linear forwards; }
.rk-ad-note { color: #697b88; font-size: .8rem; font-weight: 700; }
@keyframes rk-ad-countdown { to { transform: scaleX(1); } }
@media (max-height: 560px) {
  .rk-ad-card { gap: 6px; padding: 12px; }
  .rk-ad-visual { min-height: 88px; }
  .rk-ad-house-ball { width: 54px; height: 54px; }
  .rk-sponsor-form { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .rk-ad-progress-fill { animation-duration: 0.01ms; }
}



/* ----------------------------------------------------------- parent reports */
.rk-parent-report-body { padding: 2px 3px 14px; }
.rk-parent-report { display: grid; gap: 12px; }
.rk-parent-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rk-parent-stat, .rk-parent-card {
  display: grid; gap: 7px; padding: 12px; border: 2px solid #e2ebe2; border-radius: 17px; background: #fff;
  box-shadow: 0 3px 0 rgba(34,48,62,.07);
}
.rk-parent-stat { grid-template-columns: 24px minmax(0, 1fr); align-items: center; }
.rk-parent-stat-label { color: #617383; font-size: .76rem; font-weight: 800; }
.rk-parent-stat strong { grid-column: 1 / -1; color: #263d4d; font-size: 1rem; line-height: 1.45; }
.rk-parent-section-title { color: #30485a; font-size: 1rem; font-weight: 950; }
.rk-parent-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; height: 132px; padding-top: 8px; }
.rk-parent-chart-column { display: grid; grid-template-rows: 1fr auto; gap: 5px; min-width: 0; text-align: center; }
.rk-parent-chart-track { display: flex; align-items: flex-end; height: 100%; overflow: hidden; border-radius: 10px; background: #edf3ed; }
.rk-parent-chart-fill { display: block; width: 100%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: linear-gradient(0deg, #43a047, #95d19a); }
.rk-parent-chart-label { color: #637586; font-size: .68rem; font-weight: 800; }
.rk-parent-field { display: grid; gap: 8px; color: #526576; font-size: .82rem; font-weight: 750; line-height: 1.6; }
.rk-parent-limit { width: 100%; min-height: 46px; padding: 8px 12px; border: 2px solid #d9e6da; border-radius: 13px; background: #fff; color: #22303e; font: inherit; font-weight: 850; }
.rk-parent-limit-reached { padding: 9px 11px; border-radius: 12px; background: #fff3d4; color: #755500; font-size: .83rem; font-weight: 850; line-height: 1.6; }
.rk-parent-purchases { display: grid; gap: 7px; }
.rk-parent-purchase { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: #f3f7f3; color: #344b5c; font-size: .82rem; font-weight: 800; }
.rk-parent-purchase time { flex: none; color: #748392; font-size: .72rem; }
.rk-parent-empty { color: #758493; font-size: .85rem; }
.rk-parent-gate { display: grid; place-items: center; min-height: 260px; }
.rk-parent-gate-card { display: grid; justify-items: center; gap: 12px; width: min(380px, 100%); padding: 20px; border: 3px solid #e1eadf; border-radius: 22px; background: #fff; text-align: center; }
.rk-parent-gate-copy { color: #526576; font-weight: 800; }
.rk-parent-question { color: #263d4d; font-size: 1.1rem; }
.rk-parent-verify { width: 100%; }
@media (max-width: 340px) {
  .rk-parent-stats { gap: 5px; }
  .rk-parent-stat, .rk-parent-card { padding: 9px; }
  .rk-parent-stat strong { font-size: .9rem; }
}
@media (max-width: 360px) {
  .rk-utility-row { gap: 1px; }
  .rk-utility-row .rk-round { width: 34px; height: 36px; }
}



/* More polished cosmetic cards; the live 3D preview remains the main showcase. */
.rk-shop { background: linear-gradient(180deg, #fff 0%, #fbfdfb 100%); }
.rk-item {
  min-height: 112px;
  gap: 5px;
  padding: 9px 6px;
  border-width: 2px;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.rk-item.sel { border-color: #2fa8e0; box-shadow: 0 3px 0 rgba(47, 168, 224, .24), 0 0 0 2px rgba(47, 168, 224, .12); }
.rk-item.worn { border-color: #43a047; box-shadow: 0 3px 0 rgba(67, 160, 71, .2); }
.rk-swatch {
  width: 50px;
  height: 50px;
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(34, 48, 62, .12), inset 0 2px 4px rgba(255, 255, 255, .34);
}
.rk-item-name { font-size: .78rem; }
.rk-item-state { font-size: .73rem; }
.rk-tab { min-height: 54px; transition: background .16s ease, transform .16s ease; }
.rk-tab.on { transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
  .rk-item, .rk-tab { transition: none; }
}
