/* Ring Kit design system.
   Apple-style system look: grouped grey ground, white rounded cards, system font, tinted and filled buttons.
   Layouts: phone (< 700px), iPad portrait (700-1099px), iPad landscape and laptop (1100px+). */

:root {
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --card-2: #F7F7FA;
  --label: #1C1C1E;
  --label-2: #3A3A3C;
  --muted: #6E6E73;
  --faint: #8E8E93;
  --sep: rgba(60, 60, 67, 0.16);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.2);
  --blue: #0063D1;
  --blue-tint: rgba(0, 99, 209, 0.1);
  --red: #D70015;
  --red-tint: #FFE5E7;
  --side-blue: #0063D1;
  --side-blue-tint: #E3EEFF;
  --green: #248A3D;
  --green-tint: #E5F5EA;
  --green-ink: #1B7A35;
  --orange: #C93400;
  --orange-tint: #FFF4E5;
  --amber-ink: #8A4B00;
  --amber-tint: #FFF1D6;
  --purple-ink: #5B2DB3;
  --purple-tint: #EEE7FF;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
  --bar: rgba(249, 249, 251, 0.88);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not(.rk-force-light) {
    --bg: #000000;
    --card: #1C1C1E;
    --card-2: #2C2C2E;
    --label: #FFFFFF;
    --label-2: #E5E5EA;
    --muted: #98989F;
    --faint: #8E8E93;
    --sep: rgba(84, 84, 88, 0.6);
    --fill: rgba(118, 118, 128, 0.24);
    --fill-2: rgba(118, 118, 128, 0.36);
    --blue: #3D9BFF;
    --blue-tint: rgba(10, 132, 255, 0.18);
    --red: #FF6961;
    --red-tint: rgba(255, 69, 58, 0.18);
    --side-blue: #64A8FF;
    --side-blue-tint: rgba(10, 132, 255, 0.18);
    --green: #30D158;
    --green-tint: rgba(48, 209, 88, 0.16);
    --green-ink: #30D158;
    --orange: #FF9F0A;
    --orange-tint: rgba(255, 159, 10, 0.16);
    --amber-ink: #FFD60A;
    --amber-tint: rgba(255, 214, 10, 0.14);
    --purple-ink: #BF9BFF;
    --purple-tint: rgba(191, 90, 242, 0.18);
    --shadow: none;
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
    --bar: rgba(22, 22, 24, 0.88);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.rk {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); text-wrap: balance; }
.rk-num { font-variant-numeric: tabular-nums; }
.rk-muted { color: var(--muted); }
.rk-small { font-size: 13px; }
.rk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* loading */
.rk-boot { min-height: 100vh; display: grid; place-items: center; }
.rk-spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fill-2); border-top-color: var(--muted); animation: rk-spin 0.9s linear infinite; }
@keyframes rk-spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- buttons */
.rk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0;
  font-size: 16px; font-weight: 600; white-space: nowrap;
  background: var(--fill); color: var(--label);
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
}
.rk-btn:active { transform: scale(0.97); }
.rk-btn[disabled] { opacity: 0.45; pointer-events: none; }
.rk-btn-filled { background: var(--blue); color: #fff; }
.rk-btn-tinted { background: var(--blue-tint); color: var(--blue); }
.rk-btn-plain { background: transparent; color: var(--blue); padding: 0 8px; }
.rk-btn-danger { background: var(--red-tint); color: var(--red); }
.rk-btn-green { background: var(--green); color: #fff; }
.rk-btn-dark { background: var(--label); color: var(--bg); }
.rk-btn-sm { min-height: 34px; padding: 0 14px; font-size: 14px; }
.rk-btn-lg { min-height: 54px; padding: 0 26px; font-size: 17px; }
.rk-btn-block { width: 100%; }
.rk-icon-btn { width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; }

/* ---------------------------------------------------------------- cards, lists */
.rk-card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.rk-card-pad { padding: 18px 20px; }
.rk-list { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.rk-list-head { padding: 14px 18px 8px; font-size: 13px; font-weight: 600; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.rk-list-head h2 { font-size: 20px; color: var(--label); letter-spacing: -0.02em; }
.rk-row {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 18px;
  border-top: 0.5px solid var(--sep); width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-bottom: 0;
}
.rk-list > .rk-row:first-child, .rk-list > .rk-list-head + .rk-row { border-top: 0.5px solid var(--sep); }
.rk-list > .rk-row:first-child { border-top: 0; }
button.rk-row:active, a.rk-row:active { background: var(--fill); }
a.rk-row { color: inherit; }
.rk-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rk-row-title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-chev { color: var(--faint); flex: none; }
.rk-section-title { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 6px 6px; text-transform: none; }

.rk-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--fill); color: var(--label-2); }
.rk-chip-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.rk-chip-green { background: var(--green-tint); color: var(--green-ink); }
.rk-chip-blue { background: var(--blue-tint); color: var(--blue); }
.rk-chip-amber { background: var(--amber-tint); color: var(--amber-ink); }
.rk-chip-red { background: var(--red-tint); color: var(--red); }
.rk-chip-purple { background: var(--purple-tint); color: var(--purple-ink); }

.rk-badge { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--fill); color: var(--label-2); }
.rk-tag { width: 30px; height: 30px; border-radius: 9px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.rk-tag-sparring { background: var(--red-tint); color: var(--red); }
.rk-tag-forms { background: var(--side-blue-tint); color: var(--side-blue); }
.rk-tag-weapons { background: var(--purple-tint); color: var(--purple-ink); }

.rk-progress { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.rk-progress > i { display: block; height: 100%; border-radius: 3px; background: var(--label); transition: width 0.4s ease; }
.rk-progress-green > i { background: var(--green); }

/* ---------------------------------------------------------------- forms */
.rk-field { display: flex; flex-direction: column; gap: 6px; }
.rk-field > span { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 4px; }
.rk-input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 0;
  background: var(--card); font-size: 16px; box-shadow: inset 0 0 0 1px var(--sep);
}
.rk-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--blue); }
select.rk-input { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238E8E93' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
textarea.rk-input { min-height: 120px; resize: vertical; line-height: 1.4; }
.rk-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rk-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 699px) { .rk-grid-2, .rk-grid-3 { grid-template-columns: minmax(0, 1fr); } }

.rk-switch { position: relative; width: 51px; height: 31px; flex: none; }
.rk-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.rk-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--fill-2); transition: background 0.2s ease; }
.rk-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.16); transition: transform 0.2s ease; }
.rk-switch input:checked + span { background: #34C759; }
.rk-switch input:checked + span::after { transform: translateX(20px); }
.rk-switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; }

.rk-check { width: 26px; height: 26px; flex: none; accent-color: var(--blue); }

.rk-seg { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--fill); }
.rk-seg button { min-height: 32px; padding: 0 16px; border: 0; border-radius: 8px; background: transparent; font-size: 14px; font-weight: 500; white-space: nowrap; }
.rk-seg button[aria-pressed="true"] { background: var(--card); font-weight: 600; box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 0 1px rgba(0,0,0,0.05); }
.rk-seg-block { display: flex; }
.rk-seg-block button { flex: 1; }

.rk-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.rk-pill { min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--sep); background: var(--card); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.rk-pill[aria-pressed="true"] { background: var(--blue); color: #fff; border-color: var(--blue); }

.rk-error { padding: 12px 14px; border-radius: 12px; background: var(--red-tint); color: var(--red); font-size: 15px; font-weight: 500; }
.rk-note { padding: 12px 14px; border-radius: 12px; background: var(--fill); color: var(--label-2); font-size: 14px; }

/* ---------------------------------------------------------------- sheets and toasts */
.rk-sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.32); display: flex; align-items: center; justify-content: center; padding: 24px; animation: rk-fade 0.18s ease; }
.rk-sheet { width: min(620px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; background: var(--bg); border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; animation: rk-rise 0.22s ease; }
.rk-sheet-wide { width: min(880px, 100%); }
.rk-sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; min-height: 56px; padding: 8px 12px; background: var(--bar); border-bottom: 0.5px solid var(--sep); }
.rk-sheet-head h2 { font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-sheet-head > :first-child { justify-self: start; }
.rk-sheet-head > :last-child { justify-self: end; }
.rk-sheet-body { overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; -webkit-overflow-scrolling: touch; }
@media (max-width: 699px) {
  .rk-sheet-backdrop { align-items: flex-end; padding: 0; padding-top: 40px; }
  .rk-sheet, .rk-sheet-wide { width: 100%; max-height: 100%; border-radius: 16px 16px 0 0; }
  .rk-sheet-body { padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
}
@keyframes rk-fade { from { opacity: 0; } }
@keyframes rk-rise { from { transform: translateY(24px); opacity: 0; } }

.rk-toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: rgba(28, 28, 30, 0.92); color: #fff; font-size: 15px; font-weight: 500; box-shadow: var(--shadow-lg); animation: rk-rise 0.2s ease; text-align: center; }
.rk-has-tabs .rk-toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

/* ---------------------------------------------------------------- app shell (director) */
.rk-app { min-height: 100vh; display: flex; }
.rk-side {
  width: 260px; flex: none; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 12px 18px max(12px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 2px; background: var(--bar); border-right: 0.5px solid var(--sep);
}
.rk-brand { display: flex; align-items: center; gap: 10px; padding: 4px 12px 16px; font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.rk-mark { width: 30px; height: 30px; border-radius: 8px; background: #1C1C1E; display: inline-flex; align-items: center; justify-content: center; gap: 3px; flex: none; }
.rk-mark i { width: 7px; height: 14px; border-radius: 2px; background: #FF453A; }
.rk-mark i + i { background: #0A84FF; }
.rk-nav { min-height: 40px; padding: 0 12px; border-radius: 10px; display: flex; align-items: center; gap: 12px; color: var(--label); font-size: 15px; border: 0; background: none; width: 100%; text-align: left; }
.rk-nav svg { color: var(--muted); flex: none; }
.rk-nav[aria-current="page"] { background: var(--blue-tint); color: var(--blue); font-weight: 600; }
.rk-nav[aria-current="page"] svg { color: var(--blue); }
.rk-nav .rk-count { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 500; }
.rk-side-foot { margin-top: auto; padding: 12px; border-radius: 14px; background: var(--card); display: flex; flex-direction: column; gap: 4px; }

.rk-main { flex: 1; min-width: 0; padding: calc(24px + env(safe-area-inset-top, 0px)) max(32px, env(safe-area-inset-right, 0px)) 48px 32px; display: flex; flex-direction: column; gap: 20px; }
.rk-page { width: 100%; max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.rk-titlebar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.rk-titlebar > div:first-child { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rk-titlebar h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.rk-eyebrow { font-size: 15px; color: var(--muted); }
.rk-back { display: inline-flex; align-items: center; gap: 2px; font-size: 16px; color: var(--blue); background: none; border: 0; padding: 0; min-height: 32px; align-self: flex-start; }

.rk-tabs { display: none; }

/* iPad portrait: slimmer sidebar */
@media (max-width: 1099px) {
  .rk-side { width: 220px; }
  .rk-main { padding-left: 24px; padding-right: max(24px, env(safe-area-inset-right, 0px)); }
}
/* phone: tab bar instead of sidebar */
@media (max-width: 699px) {
  .rk-side { display: none; }
  .rk-main { padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); gap: 16px; }
  .rk-titlebar h1 { font-size: 30px; }
  .rk-tabs {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: var(--bar); border-top: 0.5px solid var(--sep); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .rk-tabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; justify-content: center; color: var(--faint); font-size: 10px; font-weight: 500; }
  .rk-tabs button[aria-current="page"] { color: var(--blue); font-weight: 600; }
}

/* ---------------------------------------------------------------- director pieces */
.rk-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; }
.rk-stats > div:first-child { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rk-stat-row { display: flex; gap: 24px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.rk-stat-row b { color: var(--label); font-weight: 600; }

.rk-need { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 18px; border-top: 0.5px solid var(--sep); }
.rk-need-main { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rk-need-main b { font-size: 15px; font-weight: 600; }
.rk-need-main span { font-size: 14px; color: var(--muted); }
.rk-need-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.rk-rings { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.rk-ring { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.rk-ring-head { display: flex; align-items: center; gap: 10px; }
.rk-ring-head b { font-size: 17px; }
.rk-ring-now { display: flex; flex-direction: column; gap: 2px; min-height: 44px; }
.rk-ring-now .rk-row-title { font-size: 17px; font-weight: 600; white-space: normal; }
.rk-vs { color: var(--faint); font-weight: 400; padding: 0 4px; }
.rk-red { color: var(--red); }
.rk-blue { color: var(--side-blue); }
.rk-ring-actions { display: flex; gap: 8px; }
.rk-ring-actions .rk-btn:first-child { flex: 1; }

.rk-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rk-table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.rk-table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 500; padding: 8px 12px; }
.rk-table td { padding: 12px; border-top: 0.5px solid var(--sep); vertical-align: middle; }
.rk-table th:first-child, .rk-table td:first-child { padding-left: 18px; }
.rk-table th:last-child, .rk-table td:last-child { padding-right: 18px; }
.rk-table tr.rk-click { cursor: pointer; }
.rk-table tr.rk-click:active td { background: var(--fill); }

.rk-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rk-search { flex: 1 1 240px; min-width: 0; position: relative; }
.rk-search input { padding-left: 38px; min-height: 40px; border-radius: 10px; background: var(--fill); box-shadow: none; }
.rk-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }

/* bracket */
.rk-bracket-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
.rk-bracket { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 20px; min-width: min-content; }
.rk-bracket-col { display: flex; flex-direction: column; gap: 10px; }
.rk-bracket-col > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.rk-bracket-col > div { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 12px; }
.rk-match { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; border: 0; padding: 0; text-align: left; width: 100%; }
.rk-match-live { outline: 2px solid var(--green); box-shadow: 0 10px 30px rgba(36, 138, 61, 0.16); }
.rk-match-meta { display: flex; justify-content: space-between; gap: 8px; padding: 7px 14px 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.rk-match-live .rk-match-meta { color: var(--green-ink); }
.rk-match-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 0.5px solid var(--sep); }
.rk-match-row .rk-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rk-match-row .rk-row-main { gap: 0; }
.rk-match-row .rk-row-title { font-size: 15px; }
.rk-match-row .rk-row-sub { font-size: 12px; }
.rk-match-row b { font-size: 17px; font-variant-numeric: tabular-nums; }
.rk-lose { opacity: 0.5; }
.rk-win .rk-row-title, .rk-win b { font-weight: 700; }

.rk-place { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-top: 0.5px solid var(--sep); }
.rk-place-1 .rk-badge { background: #FFE8A3; color: #6B4A00; }
.rk-place-2 .rk-badge { background: #E5E5EA; color: #3A3A3C; }
.rk-place-3 .rk-badge, .rk-place-4 .rk-badge { background: #F3DCC8; color: #6E3A10; }

.rk-empty { padding: 40px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.rk-empty b { color: var(--label); font-size: 20px; font-family: var(--font-display); }
.rk-empty p { margin: 0; max-width: 420px; }

.rk-qr { background: #fff; padding: 12px; border-radius: 14px; display: inline-flex; }
.rk-qr svg { display: block; }

/* setup */
.rk-steps { margin: 0; padding: 0; list-style: none; display: flex; align-items: center; gap: 10px; font-size: 14px; flex-wrap: wrap; }
.rk-steps li { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.rk-steps li i { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-size: 12px; font-weight: 600; background: var(--fill-2); color: var(--label-2); }
.rk-steps li[aria-current="step"] { color: var(--label); font-weight: 600; }
.rk-steps li[aria-current="step"] i { background: var(--blue); color: #fff; }
.rk-steps li.rk-done i { background: var(--green); color: #fff; }
.rk-steps hr { width: 24px; border: 0; border-top: 1px solid var(--sep); margin: 0; }
.rk-setup { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
@media (max-width: 1099px) { .rk-setup { grid-template-columns: minmax(0, 1fr); } }
.rk-setup-foot { display: flex; justify-content: flex-end; gap: 12px; position: sticky; bottom: 0; padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
@media (max-width: 699px) { .rk-has-tabs .rk-setup-foot { bottom: calc(66px + env(safe-area-inset-bottom, 0px)); } }

/* ---------------------------------------------------------------- scorekeeper */
.rk-ring-screen { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
:root.rk-force-light body { background: #F2F2F7; }
.rk-kbar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 60px; padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--bar); border-bottom: 0.5px solid var(--sep); position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.rk-kbar-title { display: flex; flex-direction: column; min-width: 0; }
.rk-kbar-title b { font-size: 17px; }
.rk-kbar-title span { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-kbar-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.rk-sync { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.rk-sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.rk-sync.rk-waiting i { background: #FF9F0A; }
.rk-sync.rk-offline i { background: var(--red); }

.rk-kgrid { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 340px minmax(0, 1fr); grid-template-areas: "red mid blue"; gap: 16px; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); align-items: stretch; }
.rk-kside { grid-area: red; background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rk-kside-blue { grid-area: blue; }
.rk-kside-head { display: contents; }
.rk-kside .rk-pts { margin-top: auto; }
.rk-kmid { grid-area: mid; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.rk-kwho { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rk-avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; }
.rk-kwho > div { min-width: 0; display: flex; flex-direction: column; }
.rk-kwho small { font-size: 13px; font-weight: 600; }
.rk-kwho b { font-size: 22px; letter-spacing: -0.02em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-kwho span { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-score { font-family: var(--font-display); font-size: clamp(110px, 15vw, 196px); font-weight: 700; line-height: 0.86; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.rk-pens { display: flex; align-items: center; gap: 10px; font-size: 15px; flex-wrap: wrap; }
.rk-pens > span:first-child { color: var(--muted); }
.rk-pips { display: inline-flex; gap: 6px; }
.rk-pips i { width: 12px; height: 12px; border-radius: 50%; background: var(--fill-2); }
.rk-pens .rk-chip { margin-left: auto; height: 28px; font-size: 13px; }
.rk-pts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rk-pt { position: relative; min-height: 112px; border-radius: 22px; border: 0; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform 0.08s ease, filter 0.15s; touch-action: manipulation; }
.rk-pt:active { transform: scale(0.96); filter: brightness(0.92); }
.rk-pt b { font-size: 44px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.rk-pt span { font-size: 15px; font-weight: 600; }
.rk-pt kbd { position: absolute; top: 9px; right: 13px; font: 600 12px var(--font); opacity: 0.75; }
.rk-pt[disabled] { opacity: 0.35; pointer-events: none; }
.rk-fouls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rk-foul { min-height: 64px; border-radius: 18px; border: 0; background: var(--fill); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px; touch-action: manipulation; }
.rk-foul:active { background: var(--fill-2); }
.rk-foul b { font-size: 16px; font-weight: 600; }
.rk-foul span { font-size: 12px; color: var(--muted); text-align: center; }
.rk-foul[disabled] { opacity: 0.4; pointer-events: none; }

.rk-clock { background: var(--card); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.rk-clock-warn { background: var(--orange-tint); }
.rk-clock-top { display: flex; justify-content: space-between; font-size: 15px; gap: 8px; }
.rk-clock-time { font-family: var(--font-display); font-size: clamp(72px, 9vw, 116px); font-weight: 200; line-height: 0.95; letter-spacing: -0.04em; text-align: center; font-variant-numeric: tabular-nums; }
.rk-clock-warn .rk-clock-time { color: var(--orange); }
.rk-clock .rk-progress { height: 4px; }
.rk-clock-warn .rk-progress > i { background: var(--orange); }
.rk-start { min-height: 60px; border-radius: 999px; border: 0; font-size: 19px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--green); color: #fff; touch-action: manipulation; }
.rk-start.rk-running { background: var(--fill-2); color: var(--label); }
.rk-hint { text-align: center; font-size: 12px; color: var(--muted); }
.rk-lead { padding: 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.rk-lead-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rk-lead-top b { font-size: 16px; }
.rk-lead-steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.rk-lead-steps i { height: 8px; border-radius: 4px; background: var(--fill); }
.rk-undo { width: 100%; min-height: 60px; border-radius: 20px; border: 0; background: var(--card); box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; padding: 0 18px; text-align: left; }
.rk-undo > span { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rk-undo b { color: var(--blue); font-size: 16px; }
.rk-undo small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rk-undo kbd { font: 500 12px var(--font); color: var(--faint); }
.rk-undo[disabled] { opacity: 0.5; }
.rk-log { flex: 1; min-height: 120px; overflow: hidden; }
.rk-log .rk-row { min-height: 40px; padding: 8px 16px; font-size: 15px; }
.rk-log .rk-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.rk-result { padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.rk-result .rk-avatar { width: 56px; height: 56px; }
.rk-result h2 { font-size: 36px; letter-spacing: -0.03em; }
.rk-knext { display: flex; align-items: center; gap: 18px; margin: 0 max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); padding: 12px 12px 12px 22px; min-height: 72px; flex-wrap: wrap; }
.rk-knext > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rk-knext > div:first-child { flex: 1 1 260px; }
.rk-judges { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.rk-judge { display: grid; grid-template-columns: 74px repeat(8, minmax(0, 1fr)); gap: 6px; align-items: center; }
.rk-judge > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.rk-vote { min-height: 44px; border-radius: 10px; border: 0; background: var(--fill); font-size: 14px; font-weight: 600; padding: 0; }
.rk-vote[aria-pressed="true"].rk-v-red { background: var(--red); color: #fff; }
.rk-vote[aria-pressed="true"].rk-v-blue { background: var(--side-blue); color: #fff; }
.rk-vote[aria-pressed="true"].rk-v-none { background: var(--label); color: var(--bg); }

/* iPad portrait: clock across the top, sides below */
@media (max-width: 1099px) {
  .rk-kgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "mid mid" "red blue"; }
  .rk-kmid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; }
  .rk-kmid > .rk-clock, .rk-kmid > .rk-result { align-self: stretch; }
  .rk-kmid .rk-log { display: none; }
  .rk-kmid > .rk-clock, .rk-kmid > .rk-result { grid-row: span 2; }
  .rk-score { font-size: clamp(96px, 16vw, 150px); }
  .rk-pt { min-height: 104px; }
}
/* phone: everything stacked, red then clock then blue */
@media (max-width: 699px) {
  .rk-kgrid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "mid" "red" "blue"; gap: 12px; padding: 12px; }
  .rk-kmid { display: flex; flex-direction: column; }
  .rk-kside { padding: 16px; gap: 12px; border-radius: 22px; }
  .rk-kside-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .rk-kside .rk-pts { margin-top: 0; }
  .rk-score { font-size: 72px; flex: none; }
  .rk-pt { min-height: 84px; border-radius: 18px; }
  .rk-pt b { font-size: 34px; }
  .rk-pt kbd { display: none; }
  .rk-foul { min-height: 56px; }
  .rk-clock { padding: 14px 16px; border-radius: 22px; }
  .rk-clock-time { font-size: 76px; }
  .rk-lead, .rk-hint { display: none; }
  .rk-kbar .rk-seg { display: none; }
  .rk-judge { grid-template-columns: 56px repeat(8, minmax(0, 1fr)); gap: 4px; }
  .rk-vote { font-size: 12px; min-height: 40px; }
}

/* forms scoring */
.rk-forms { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
@media (max-width: 1099px) { .rk-forms { grid-template-columns: minmax(0, 1fr); } }
.rk-form-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-top: 0.5px solid var(--sep); }
.rk-form-row.rk-active { background: var(--blue-tint); }
.rk-score-in { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.rk-score-in input { width: 84px; min-height: 48px; text-align: center; font-size: 20px; font-variant-numeric: tabular-nums; padding: 8px; }
.rk-score-in .rk-total { min-width: 64px; text-align: right; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
@media (max-width: 699px) {
  .rk-form-row { grid-template-columns: 28px minmax(0, 1fr); }
  .rk-score-in { grid-column: 1 / -1; justify-content: stretch; }
  .rk-score-in input { flex: 1; width: auto; }
}

/* ---------------------------------------------------------------- TV display */
body.rk-tv { background: #000; color: #fff; overflow: hidden; }
.rk-tvs { height: 100vh; display: flex; flex-direction: column; gap: 2vh; padding: 3vh 2.2vw; }
.rk-tv-top { display: flex; justify-content: space-between; align-items: center; gap: 2vw; font-size: 2.6vh; color: rgba(235,235,245,0.6); }
.rk-tv-top b { color: #fff; font-size: 3.6vh; letter-spacing: -0.02em; }
.rk-tv-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.62fr) minmax(0, 1fr); gap: 1.6vw; }
.rk-tv-side { border-radius: 4.6vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6vh; padding: 2vh 1.5vw; min-width: 0; text-align: center; }
.rk-tv-red { background: #E0242E; }
.rk-tv-blue { background: #0A6CFF; }
.rk-tv-side small { font-size: 2.6vh; font-weight: 600; opacity: 0.85; }
.rk-tv-side b { font-size: 6vh; letter-spacing: -0.02em; line-height: 1.1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-tv-side span { font-size: 2.8vh; opacity: 0.85; }
.rk-tv-side .rk-tv-score { font-family: var(--font-display); font-size: 34vh; font-weight: 700; line-height: 0.9; letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.rk-tv-pens { display: flex; gap: 1.2vh; align-items: center; min-height: 4vh; }
.rk-tv-pens i { width: 2.2vh; height: 2.2vh; border-radius: 50%; background: rgba(255,255,255,0.3); }
.rk-tv-pens i.on { background: #fff; }
.rk-tv-pens em { font-style: normal; margin-left: 1vh; height: 3.6vh; padding: 0 1.6vh; border-radius: 999px; background: #FFD60A; color: #1C1C1E; font-size: 2vh; font-weight: 700; display: inline-flex; align-items: center; }
.rk-tv-mid { background: #1C1C1E; border-radius: 4.6vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; padding: 2vh 1vw; text-align: center; min-width: 0; }
.rk-tv-pill { height: 4.6vh; padding: 0 2vh; border-radius: 999px; background: rgba(118,118,128,0.24); font-size: 2.3vh; font-weight: 600; display: inline-flex; align-items: center; }
.rk-tv-pill.warn { background: #FF9F0A; color: #1C1C1E; }
.rk-tv-clock { font-family: var(--font-display); font-size: 17vh; font-weight: 200; line-height: 0.95; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.rk-tv-clock.warn { color: #FF9F0A; }
.rk-tv-muted { font-size: 2.2vh; color: rgba(235,235,245,0.6); }
.rk-tv-bottom { height: 9vh; border-radius: 3vh; background: #1C1C1E; display: flex; align-items: center; gap: 2vw; padding: 0 1vh 0 3vh; font-size: 2.6vh; }
.rk-tv-bottom .rk-qr { padding: 0.6vh; border-radius: 1.2vh; }
.rk-tv-bottom .rk-qr svg { width: 7.2vh; height: 7.2vh; }
.rk-tv-forms { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.6vw; }
.rk-tv-panel { background: #1C1C1E; border-radius: 4vh; padding: 3vh; display: flex; flex-direction: column; gap: 1.2vh; min-width: 0; overflow: hidden; }
.rk-tv-panel h2 { font-size: 3.4vh; }
.rk-tv-line { display: flex; justify-content: space-between; gap: 2vh; font-size: 3vh; padding: 1vh 0; border-top: 1px solid rgba(84,84,88,0.6); }
.rk-tv-line b { font-variant-numeric: tabular-nums; }
@media (max-aspect-ratio: 1/1) {
  .rk-tv-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto 1fr; }
  .rk-tv-score { font-size: 18vh; }
  .rk-tv-clock { font-size: 10vh; }
}

/* ---------------------------------------------------------------- parents: live and register */
.rk-public { min-height: 100vh; }
.rk-pwrap { width: 100%; max-width: 980px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; }
.rk-pcols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.rk-pcols > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 799px) { .rk-pcols { grid-template-columns: minmax(0, 1fr); } }
.rk-livecard { background: #1C1C1E; color: #fff; border-radius: 26px; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.rk-livecard .rk-muted { color: rgba(235,235,245,0.7); }
.rk-livebadge { height: 22px; padding: 0 8px; border-radius: 999px; background: #30D158; color: #0B2E14; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.rk-livebadge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #0B2E14; animation: rk-pulse 1.6s ease infinite; }
@keyframes rk-pulse { 50% { opacity: 0.3; } }
.rk-livescore { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; }
.rk-livescore > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rk-livescore > div:last-child { align-items: flex-end; text-align: right; }
.rk-livescore small { font-size: 12px; font-weight: 600; }
.rk-livescore b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.rk-livescore strong { font-family: var(--font-display); font-size: 52px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.rk-livescore strong span { color: rgba(235,235,245,0.35); font-weight: 300; }
.rk-ptabs { display: none; }
@media (max-width: 799px) {
  .rk-ptabs {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: var(--bar); border-top: 0.5px solid var(--sep); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
  .rk-ptabs button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; justify-content: center; color: var(--faint); font-size: 10px; font-weight: 500; }
  .rk-ptabs button[aria-current="page"] { color: var(--blue); font-weight: 600; }
  .rk-pseg { display: none; }
}
.rk-paybar { position: sticky; bottom: 0; padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 75%, transparent); display: flex; flex-direction: column; gap: 8px; }

/* message and home pages */
.rk-message, .rk-home { max-width: 640px; margin: 0 auto; padding: 64px 20px; display: flex; flex-direction: column; gap: 14px; }
.rk-message h1, .rk-home h1 { font-size: 32px; letter-spacing: -0.03em; }
.rk-message p { color: var(--muted); font-size: 17px; margin: 0; }
.rk-home header { display: flex; flex-direction: column; gap: 6px; }
.rk-home header p { margin: 0; color: var(--muted); font-size: 17px; }
.rk-home-list { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.rk-home-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 18px; border-top: 0.5px solid var(--sep); }
.rk-home-row:first-child { border-top: 0; }
.rk-home-row > div:first-child { flex: 1 1 240px; display: flex; flex-direction: column; gap: 2px; }
.rk-home-row span { font-size: 14px; color: var(--muted); }
.rk-home-actions { display: flex; gap: 8px; }
.rk-home-foot { text-align: center; font-size: 15px; }
