/* ChessDoctrine RU Interactive Tools — Precision Architectural Design System
 * Covers: Chess Clock, Rating Converter, Tournament Table, Hub Preview Cards, Print
 */

:root {
  --ru-bg: #ffffff;
  --ru-surface: #f8fafc;
  --ru-surface-2: #f1f5f9;
  --ru-border: #dce5ef;
  --ru-border-strong: #c5d4e4;
  --ru-ink: #1c242c;
  --ru-ink-2: #475569;
  --ru-muted: #64748b;
  --ru-brand: #4577be;
  --ru-brand-hover: #3866a8;
  --ru-brand-soft: #eef4fc;
  --ru-good: #1b733e;
  --ru-good-bg: #eaf7ef;
  --ru-warn: #b86e0c;
  --ru-warn-bg: #fff8ec;
  --ru-bad: #c93b37;
  --ru-bad-bg: #fdf0f0;
  --ru-obsidian: #171d24;
  --ru-obsidian-active: #1c2735;
  --ru-obsidian-border: #2a3441;
  --ru-radius: 12px;
  --ru-radius-sm: 8px;
}

/* =========================================================================
   0. SHARED LAYOUT, COMPACT TOOL INTRO, EDITORIAL RHYTHM & REFINED TABLES
   ========================================================================= */
body[data-tool-page="clock"] .tool-intro,
body[data-tool-page="rating-converter"] .tool-intro,
body[data-tool-page="tournament-table"] .tool-intro {
  padding: 16px 0 14px;
  background: #fff;
  border-bottom: 1px solid var(--ru-border);
}

body[data-tool-page="clock"] .tool-intro h1,
body[data-tool-page="rating-converter"] .tool-intro h1,
body[data-tool-page="tournament-table"] .tool-intro h1 {
  color: var(--ru-ink);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.14;
  margin: 0 0 5px;
}

body[data-tool-page="clock"] .tool-intro .lead,
body[data-tool-page="rating-converter"] .tool-intro .lead,
body[data-tool-page="tournament-table"] .tool-intro .lead {
  color: var(--ru-ink-2);
  font-size: .92rem;
  line-height: 1.48;
  max-width: 74ch;
}

.ru-tool-wrap {
  padding: 16px 0 36px;
}

/* Crisp hairline editorial columns (replaces generic SaaS pill-card grids) */
.ru-editorial-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ru-border);
  margin-top: 26px;
  padding-top: 24px;
}

.ru-editorial-col {
  padding: 0 24px;
  border-left: 1px solid var(--ru-border);
  min-width: 0;
}

.ru-editorial-col:first-child {
  padding-left: 0;
  border-left: 0;
}

.ru-editorial-col:last-child {
  padding-right: 0;
}

.ru-editorial-kicker {
  display: block;
  font-size: .76rem;
  font-weight: 600;
  color: var(--ru-brand);
  margin-bottom: 6px;
}

.ru-editorial-col h3 {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ru-ink);
  letter-spacing: -.01em;
  margin: 0 0 8px;
}

.ru-editorial-col p {
  font-size: .89rem;
  line-height: 1.62;
  color: var(--ru-ink-2);
  margin: 0;
}

.ru-editorial-col p + p {
  margin-top: 8px;
}

/* Quiet inline editorial cross-link (replaces noisy boxed promo banners) */
.ru-inline-note {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 18px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--ru-border);
  font-size: .88rem;
  color: var(--ru-ink-2);
  line-height: 1.5;
}

.ru-inline-note strong {
  color: var(--ru-ink);
  font-weight: 700;
}

.ru-inline-note a {
  color: var(--ru-brand);
  font-weight: 600;
  white-space: nowrap;
}

/* Native hairline tables on our 3 tools */
body[data-tool-page="clock"] .smart-table,
body[data-tool-page="rating-converter"] .smart-table,
body[data-tool-page="tournament-table"] .smart-table {
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius);
  box-shadow: none;
  background: #fff;
  overflow: hidden;
}

body[data-tool-page="clock"] .smart-table thead,
body[data-tool-page="rating-converter"] .smart-table thead,
body[data-tool-page="tournament-table"] .smart-table thead {
  background: var(--ru-surface);
}

body[data-tool-page="clock"] .smart-table thead th,
body[data-tool-page="rating-converter"] .smart-table thead th,
body[data-tool-page="tournament-table"] .smart-table thead th {
  color: var(--ru-ink-2);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
  border-bottom: 1px solid var(--ru-border);
  padding: 11px 16px;
}

body[data-tool-page="clock"] .smart-table tbody td,
body[data-tool-page="rating-converter"] .smart-table tbody td,
body[data-tool-page="tournament-table"] .smart-table tbody td {
  padding: 11px 16px;
  font-size: .9rem;
  color: var(--ru-ink-2);
  border-bottom: 1px solid #edf2f7;
}

body[data-tool-page="clock"] .smart-table tbody tr:nth-child(even) td,
body[data-tool-page="rating-converter"] .smart-table tbody tr:nth-child(even) td,
body[data-tool-page="tournament-table"] .smart-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

body[data-tool-page="clock"] .smart-table tbody tr:hover td,
body[data-tool-page="rating-converter"] .smart-table tbody tr:hover td,
body[data-tool-page="tournament-table"] .smart-table tbody tr:hover td {
  background: #f4f8fc;
}

/* Shared Linear/Apple-style segmented track */
.ru-seg {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 3px;
  background: var(--ru-surface-2);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.ru-seg-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ru-ink-2);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background-color .14s ease, color .14s ease, box-shadow .14s ease;
}

.ru-seg-btn:hover {
  color: var(--ru-ink);
}

.ru-seg-btn.active {
  background: #fff;
  color: var(--ru-ink);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08), 0 0 0 1px rgba(15, 23, 42, .04);
}

/* Quiet architectural button primitives */
.ru-btn {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius-sm);
  background: #fff;
  color: var(--ru-ink);
  font-size: .84rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.ru-btn:hover {
  background: var(--ru-surface);
  border-color: var(--ru-border-strong);
}

.ru-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ru-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.ru-btn-primary {
  background: var(--ru-brand);
  border-color: var(--ru-brand);
  color: #fff;
}

.ru-btn-primary:hover {
  background: var(--ru-brand-hover);
  border-color: var(--ru-brand-hover);
  color: #fff;
}

.ru-btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ru-ink-2);
}

.ru-btn-ghost:hover {
  background: var(--ru-surface-2);
  border-color: transparent;
  color: var(--ru-ink);
}

.ru-btn-danger {
  color: var(--ru-bad);
}

.ru-btn-danger:hover {
  background: var(--ru-bad-bg);
  border-color: #efb9b7;
  color: #a32b27;
}

.ru-btn[aria-pressed="true"] {
  background: var(--ru-brand-soft);
  border-color: #b7d0ec;
  color: #295694;
}

@media (max-width: 820px) {
  .ru-editorial-cols {
    grid-template-columns: 1fr;
    gap: 18px;
    padding-top: 18px;
  }
  .ru-editorial-col {
    padding: 16px 0 0;
    border-left: 0;
    border-top: 1px solid var(--ru-border);
  }
  .ru-editorial-col:first-child {
    padding-top: 0;
    border-top: 0;
  }
}

@media (max-width: 740px) {
  body[data-tool-page="clock"] .tool-intro,
  body[data-tool-page="rating-converter"] .tool-intro,
  body[data-tool-page="tournament-table"] .tool-intro {
    padding: 10px 0 9px;
  }
  body[data-tool-page="clock"] .tool-intro .tools-crumbs,
  body[data-tool-page="rating-converter"] .tool-intro .tools-crumbs,
  body[data-tool-page="tournament-table"] .tool-intro .tools-crumbs {
    margin-bottom: 4px;
    font-size: .74rem;
  }
  body[data-tool-page="clock"] .tool-intro h1,
  body[data-tool-page="rating-converter"] .tool-intro h1,
  body[data-tool-page="tournament-table"] .tool-intro h1 {
    font-size: 1.32rem;
    margin-bottom: 3px;
  }
  body[data-tool-page="clock"] .tool-intro .lead,
  body[data-tool-page="rating-converter"] .tool-intro .lead,
  body[data-tool-page="tournament-table"] .tool-intro .lead {
    font-size: .82rem;
    line-height: 1.38;
  }
  .ru-tool-wrap {
    padding: 10px 0 28px;
  }
}

/* =========================================================================
   1. CHESS CLOCK (shakhmatnye-chasy) — DGT 3000 / Lichess Precision
   ========================================================================= */
.clk-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius);
  background: #fff;
  margin-bottom: 12px;
}

.clk-preset-rail {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.clk-preset-rail::-webkit-scrollbar {
  display: none;
}

.clk-cat-lbl {
  font-size: .71rem;
  font-weight: 600;
  color: var(--ru-muted);
  padding: 0 5px 0 2px;
  white-space: nowrap;
  user-select: none;
}

.clk-sep {
  width: 1px;
  height: 18px;
  background: var(--ru-border);
  margin: 0 5px;
  flex: none;
}

.clk-preset-btn {
  flex: none;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ru-ink);
  font-size: .83rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.clk-preset-btn:hover {
  background: var(--ru-surface-2);
  color: var(--ru-ink);
}

.clk-preset-btn.active {
  background: var(--ru-brand);
  border-color: var(--ru-brand);
  color: #fff;
  font-weight: 700;
}

.clk-topbar-end {
  display: flex;
  align-items: center;
  padding-left: 8px;
  border-left: 1px solid var(--ru-border);
  flex: none;
}

.clk-custom-toggle {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ru-ink-2);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}

.clk-custom-toggle:hover {
  background: var(--ru-surface-2);
  color: var(--ru-ink);
}

.clk-custom-toggle[aria-expanded="true"] {
  background: var(--ru-brand-soft);
  border-color: #b7d0ec;
  color: #295694;
}

.clk-custom-toggle svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/* Custom Time & Odds Drawer */
.clk-custom-panel {
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius);
  background: var(--ru-surface);
  padding: 16px 18px;
  margin-bottom: 12px;
}

.clk-drawer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.clk-drawer-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ru-ink);
}

.clk-mode-seg {
  min-width: min(100%, 420px);
}

.clk-custom-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.clk-custom-panel .field {
  margin-bottom: 0;
}

.clk-custom-panel .field label {
  font-size: .76rem;
  font-weight: 600;
  color: var(--ru-ink-2);
}

.clk-custom-panel .input {
  min-height: 40px;
  padding: 8px 10px;
  font-variant-numeric: tabular-nums;
  border-color: var(--ru-border);
}

.clk-odds-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ru-border);
}

.clk-odds-row .toggle-row {
  min-height: 36px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ru-ink);
  cursor: pointer;
}

.clk-odds-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.clk-odds-chip {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ru-border);
  border-radius: 7px;
  background: #fff;
  color: var(--ru-ink-2);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.clk-odds-chip:hover {
  border-color: var(--ru-brand);
  color: var(--ru-brand);
}

.clk-asym-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.clk-side-box {
  border: 1px solid var(--ru-border);
  border-radius: 10px;
  background: #fff;
  padding: 12px 14px;
}

.clk-side-box h4 {
  font-size: .82rem;
  font-weight: 700;
  color: var(--ru-ink);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.clk-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ru-border);
}

/* Precision Split Clock Instrument (NO nested grey box soup) */
.clk-stage {
  border: 1px solid var(--ru-border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
}

.clk-board-grid {
  display: contents;
}

.clk-pad {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  min-height: 310px;
  padding: 20px 26px 18px;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .16s ease, opacity .16s ease;
  width: 100%;
  text-align: left;
}

/* Precision 4px top active accent bar */
.clk-pad::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  transition: background-color .14s ease;
}

.clk-pad:focus-visible {
  outline: 3px solid var(--ru-brand);
  outline-offset: -3px;
  z-index: 2;
}

.clk-pad-slot-first {
  grid-column: 1;
  grid-row: 1;
}

.clk-pad-slot-second {
  grid-column: 2;
  grid-row: 1;
  border-left: 1px solid var(--ru-border);
}

.clk-pad-white {
  background: #ffffff;
  color: var(--ru-ink);
}

.clk-pad-black {
  background: var(--ru-obsidian);
  color: #f4f7fa;
}

.clk-pad-black.clk-pad-slot-second {
  border-left-color: var(--ru-obsidian-border);
}

/* Subtle resting dim when opponent's clock is running so active side reads in 50ms */
.clk-stage.is-running .clk-pad:not(.is-active) {
  opacity: .72;
}

.clk-pad.is-active::before {
  background: var(--ru-brand);
}

.clk-pad.is-active.clk-pad-white {
  background: #f6faff;
}

.clk-pad.is-active.clk-pad-black {
  background: var(--ru-obsidian-active);
}

.clk-pad.is-active.clk-pad-black::before {
  background: #6ea3ea;
}

.clk-pad.is-low::before {
  background: #d98218;
}

.clk-pad.is-low.clk-pad-white {
  background: #fffaf2;
}

.clk-pad.is-low.clk-pad-black {
  background: #2c2317;
}

.clk-pad.is-critical::before {
  background: #cf3d38;
}

.clk-pad.is-critical.clk-pad-white {
  background: #fff4f3;
}

.clk-pad.is-critical.clk-pad-black {
  background: #33191b;
}

.clk-pad.is-flagged {
  background: #b9322e !important;
  color: #fff !important;
  opacity: 1 !important;
}

.clk-pad.is-flagged::before {
  background: #ff9c98 !important;
}

.clk-pad.is-flagged .clk-meta-row,
.clk-pad.is-flagged .clk-status-txt,
.clk-pad.is-flagged .clk-delay-bar {
  color: rgba(255, 255, 255, .92) !important;
}

.clk-pad-toprow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.clk-side-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

/* Crisp 9px chess-color square (replaces cartoonish circle dots) */
.clk-color-sq {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
  flex: none;
}

.clk-color-sq.w {
  background: #fff;
  border: 1.5px solid #1c242c;
}

.clk-color-sq.b {
  background: #0a0e13;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14);
}

.clk-status-txt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ru-brand);
  min-height: 18px;
}

.clk-pad-black .clk-status-txt {
  color: #8bb9f4;
}

.clk-pad.is-low .clk-status-txt {
  color: #c2720e;
}

.clk-pad.is-low.clk-pad-black .clk-status-txt {
  color: #f4b255;
}

.clk-pad.is-critical .clk-status-txt {
  color: #cf3d38;
}

.clk-pad.is-critical.clk-pad-black .clk-status-txt {
  color: #ff807b;
}

.clk-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.clk-time-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 0;
}

.clk-digits {
  font-size: clamp(3.3rem, 8.2vw, 5.8rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.clk-delay-bar {
  min-height: 20px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ru-brand);
  font-variant-numeric: tabular-nums;
}

.clk-pad-black .clk-delay-bar {
  color: #8bb9f4;
}

.clk-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--ru-muted);
  font-variant-numeric: tabular-nums;
}

.clk-pad-black .clk-meta-row {
  color: #94a3b8;
}

/* Sleek Utility Dock */
.clk-dock {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--ru-surface);
  border-top: 1px solid var(--ru-border);
}

.clk-dock-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  color: var(--ru-muted);
  min-width: 0;
  white-space: nowrap;
}

.clk-dock-info strong {
  color: var(--ru-ink);
  font-weight: 700;
}

.clk-wake-ind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--ru-good);
}

.clk-wake-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a055;
  display: inline-block;
}

.clk-dock-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.clk-tb-btn {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--ru-border);
  border-radius: 8px;
  background: #fff;
  color: var(--ru-ink);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.clk-tb-btn:hover {
  border-color: var(--ru-border-strong);
  background: #f4f7fa;
}

.clk-tb-btn.is-primary {
  background: var(--ru-brand);
  border-color: var(--ru-brand);
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
}

.clk-tb-btn.is-primary:hover {
  background: var(--ru-brand-hover);
  border-color: var(--ru-brand-hover);
  color: #fff;
}

.clk-tb-btn[aria-pressed="true"] {
  background: var(--ru-brand-soft);
  border-color: #b7d0ec;
  color: #295694;
}

.clk-tb-btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.clk-kbd-hint {
  margin-top: 8px;
  font-size: .76rem;
  color: var(--ru-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.clk-kbd-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--ru-border);
  border-radius: 4px;
  background: var(--ru-surface);
  color: var(--ru-ink-2);
  font-family: inherit;
  font-size: .72rem;
  font-weight: 600;
}

/* Tabletop 180° vertical mode: dock cleanly tucked BETWEEN top & bottom clocks */
.clk-stage.is-tabletop {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(210px, 1fr) auto minmax(210px, 1fr);
}

.clk-stage.is-tabletop .clk-pad {
  min-height: 215px;
  border-left: 0;
}

.clk-stage.is-tabletop .clk-pad-slot-first {
  grid-column: 1;
  grid-row: 1;
  transform: rotate(180deg);
}

.clk-stage.is-tabletop .clk-dock {
  grid-column: 1;
  grid-row: 2;
  border-top: 1px solid var(--ru-border);
  border-bottom: 1px solid var(--ru-border);
  justify-content: center;
}

.clk-stage.is-tabletop .clk-dock-info {
  display: none;
}

.clk-stage.is-tabletop .clk-pad-slot-second {
  grid-column: 1;
  grid-row: 3;
  border-left: 0;
}

/* Fullscreen & iOS pseudo-fullscreen */
.clk-stage:fullscreen,
.clk-stage.is-pseudo-fs {
  position: fixed;
  inset: 0;
  z-index: 2147482000;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  border-radius: 0;
  border: 0;
  margin: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

.clk-stage:fullscreen .clk-pad,
.clk-stage.is-pseudo-fs .clk-pad {
  min-height: 0;
  height: 100%;
}

.clk-stage:fullscreen .clk-digits,
.clk-stage.is-pseudo-fs .clk-digits {
  font-size: clamp(3.6rem, 11vw, 7.6rem);
}

.clk-stage.is-tabletop:fullscreen,
.clk-stage.is-tabletop.is-pseudo-fs {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
}

/* Fit all 13 presets cleanly on 1024px–1180px laptops without clipping */
@media (max-width: 1180px) and (min-width: 741px) {
  .clk-cat-lbl {
    font-size: .68rem;
    padding: 0 3px 0 1px;
  }
  .clk-sep {
    margin: 0 3px;
  }
  .clk-preset-btn {
    padding: 0 6px;
    font-size: .79rem;
  }
  .clk-custom-toggle {
    padding: 0 8px;
    font-size: .8rem;
  }
}

/* Mobile (390×844): BOTH clock faces + slim center dock fit ABOVE THE FOLD */
@media (max-width: 740px) {
  .clk-topbar {
    padding: 3px 4px 3px 6px;
    margin-bottom: 8px;
    border-radius: 10px;
  }
  .clk-preset-rail {
    padding-right: 18px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent);
  }
  .clk-cat-lbl {
    display: none;
  }
  .clk-sep {
    height: 14px;
    margin: 0 3px;
  }
  .clk-preset-btn {
    min-height: 40px;
    padding: 0 10px;
    font-size: .82rem;
  }
  .clk-topbar-end {
    padding-left: 5px;
  }
  .clk-custom-toggle {
    min-height: 40px;
    min-width: 40px;
    padding: 0 9px;
    font-size: .8rem;
  }
  .clk-custom-toggle .clk-custom-lbl {
    display: none;
  }

  .clk-stage {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    border-radius: 12px;
  }
  .clk-pad {
    min-height: 196px;
    padding: 14px 18px 12px;
    border-left: 0;
  }
  .clk-pad-slot-first {
    grid-column: 1;
    grid-row: 1;
  }
  .clk-dock {
    grid-column: 1;
    grid-row: 2;
    padding: 6px 8px;
    border-top: 1px solid var(--ru-border);
    border-bottom: 1px solid var(--ru-border);
    justify-content: center;
  }
  .clk-dock-info {
    display: none;
  }
  .clk-dock-actions {
    width: 100%;
    justify-content: space-between;
    gap: 5px;
    flex-wrap: nowrap;
  }
  .clk-tb-btn {
    min-height: 44px;
    padding: 0 10px;
    flex: 0 0 auto;
  }
  .clk-tb-btn.clk-tb-main {
    flex: 1 1 auto;
    padding: 0 12px;
  }
  .clk-tb-btn:not(.clk-tb-main) .clk-tb-lbl {
    display: none;
  }
  .clk-tb-btn:not(.clk-tb-main) {
    width: 42px;
    padding: 0;
  }
  .clk-pad-slot-second {
    grid-column: 1;
    grid-row: 3;
    border-left: 0;
  }
  .clk-time-wrap {
    padding: 6px 0;
  }
  .clk-digits {
    font-size: clamp(3.15rem, 15vw, 4.4rem);
  }
  .clk-kbd-hint {
    display: none;
  }
  .clk-custom-grid,
  .clk-asym-grid {
    grid-template-columns: 1fr;
  }
  .clk-mode-seg {
    min-width: 0;
    width: 100%;
  }
  .clk-mode-seg .ru-seg-btn {
    font-size: .78rem;
    padding: 6px 6px;
  }
}

/* =========================================================================
   2. RATING CONVERTER (konverter-reytingov) — Stripe / Wise Precision
   ========================================================================= */
.rc-frame {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  border: 1px solid var(--ru-border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.rc-controls {
  padding: 22px 22px 20px;
  background: #fafcfe;
  border-right: 1px solid var(--ru-border);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.rc-field {
  display: grid;
  gap: 7px;
}

.rc-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.rc-field-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ru-ink-2);
}

.rc-field-hint {
  font-size: .74rem;
  color: var(--ru-muted);
  font-variant-numeric: tabular-nums;
}

.rc-rating-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 12px;
  align-items: center;
}

/* Precision thin hairline slider */
.rc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(
    90deg,
    var(--ru-brand) 0%,
    var(--ru-brand) var(--rc-pct, 44%),
    #dbe5ef var(--rc-pct, 44%),
    #dbe5ef 100%
  );
  outline: none;
  cursor: pointer;
}

.rc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--ru-brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
  cursor: pointer;
  transition: transform .12s ease;
}

.rc-slider::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}

.rc-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid var(--ru-brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
  cursor: pointer;
}

.rc-num-input {
  width: 100%;
  height: 44px;
  padding: 0 10px;
  font-size: 1.24rem;
  font-weight: 800;
  text-align: center;
  color: var(--ru-ink);
  background: #fff;
  border: 1.5px solid var(--ru-border-strong);
  border-radius: 9px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}

.rc-num-input:focus {
  border-color: var(--ru-brand);
  box-shadow: 0 0 0 3px rgba(69, 119, 190, .14);
}

.rc-quick-chips {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  margin-top: 2px;
}

.rc-chip {
  min-height: 32px;
  padding: 0 4px;
  border: 1px solid var(--ru-border);
  border-radius: 7px;
  background: #fff;
  color: var(--ru-ink-2);
  font-size: .78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.rc-chip:hover {
  border-color: var(--ru-border-strong);
  color: var(--ru-ink);
}

.rc-chip.active {
  background: var(--ru-brand-soft);
  border-color: var(--ru-brand);
  color: #295694;
  font-weight: 700;
}

.rc-pool-note {
  padding: 8px 10px;
  border-left: 2px solid #c98620;
  background: #fdf9f0;
  color: #6b4b16;
  font-size: .78rem;
  line-height: 1.46;
  border-radius: 0 6px 6px 0;
}

.rc-ctrl-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #e6eef5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rc-ctrl-foot .ru-btn {
  flex: 1;
}

/* Right Live Comparison Matrix */
.rc-output {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rc-output-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 22px;
  border-bottom: 1px solid #e6eef5;
}

.rc-output-head h2 {
  font-size: .92rem;
  font-weight: 700;
  color: var(--ru-ink);
  margin: 0;
}

.rc-output-head span {
  font-size: .76rem;
  color: var(--ru-muted);
}

/* 2x2 Hairline Metrics Matrix (NO 4 separate inner bordered boxes!) */
.rc-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rc-cell {
  padding: 18px 22px 17px;
  background: #fff;
  border-bottom: 1px solid #e6eef5;
  min-width: 0;
  transition: background-color .14s ease;
}

.rc-cell:nth-child(odd) {
  border-right: 1px solid #e6eef5;
}

.rc-cell.is-source {
  background: #f6faff;
  box-shadow: inset 3px 0 0 var(--ru-brand);
}

.rc-cell-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.rc-plat-name {
  font-size: .84rem;
  font-weight: 700;
  color: var(--ru-ink-2);
}

.rc-cell.is-source .rc-plat-name {
  color: var(--ru-ink);
}

.rc-src-caption {
  font-size: .72rem;
  font-weight: 600;
  color: var(--ru-brand);
}

.rc-plat-main {
  font-size: 1.62rem;
  font-weight: 800;
  color: var(--ru-ink);
  line-height: 1.12;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}

.rc-cell.is-source .rc-plat-main {
  color: #295694;
}

.rc-plat-main.is-muted {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ru-muted);
}

.rc-plat-rows {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #edf2f7;
  display: grid;
  gap: 3px;
  font-size: .8rem;
  color: var(--ru-muted);
  font-variant-numeric: tabular-nums;
}

.rc-plat-rows div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.rc-plat-rows b {
  font-weight: 600;
  color: var(--ru-ink);
}

/* Integrated Refined Rank / EVSK Bar */
.rc-rank-bar {
  padding: 18px 22px 18px;
  background: #fafcfe;
  flex: 1;
}

.rc-rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.rc-rank-kicker {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--ru-muted);
  margin-bottom: 2px;
}

.rc-rank-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--ru-ink);
  letter-spacing: -.015em;
}

.rc-rank-anchor {
  font-size: .84rem;
  font-weight: 700;
  color: var(--ru-brand);
  font-variant-numeric: tabular-nums;
}

.rc-rank-desc {
  margin: 5px 0 0;
  font-size: .83rem;
  line-height: 1.48;
  color: var(--ru-ink-2);
}

/* Minimalist 4px Hairline Progress Scale (NO rainbow gradient!) */
.rc-scale {
  margin-top: 14px;
}

.rc-scale-track {
  position: relative;
  height: 4px;
  border-radius: 99px;
  background: #e1eaf2;
}

.rc-scale-notches {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.rc-scale-notches i {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 8px;
  background: #c5d3e0;
}

.rc-scale-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: 99px;
  background: var(--ru-brand);
  transition: width .18s ease;
}

.rc-scale-pin {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ru-brand);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px var(--ru-brand);
  transform: translate(-50%, -50%);
  transition: left .18s ease;
}

.rc-scale-labels {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  font-size: .71rem;
  font-weight: 600;
  color: var(--ru-muted);
}

.rc-evsk-footnote {
  margin: 12px 0 0;
  font-size: .76rem;
  line-height: 1.46;
  color: var(--ru-muted);
}

@media (max-width: 920px) {
  .rc-frame {
    grid-template-columns: 1fr;
  }
  .rc-controls {
    border-right: 0;
    border-bottom: 1px solid var(--ru-border);
    padding: 16px;
    gap: 14px;
  }
  .rc-ctrl-foot {
    padding-top: 10px;
  }
}

@media (max-width: 560px) {
  .rc-controls {
    padding: 12px 13px;
    gap: 10px;
  }
  .rc-field {
    gap: 5px;
  }
  .rc-controls .ru-seg-btn {
    min-height: 34px;
    font-size: .79rem;
    padding: 5px 4px;
  }
  .rc-rating-row {
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 10px;
  }
  .rc-num-input {
    height: 38px;
    font-size: 1.08rem;
  }
  .rc-quick-chips {
    gap: 4px;
  }
  .rc-chip {
    min-height: 30px;
    font-size: .74rem;
  }
  .rc-ctrl-foot {
    padding-top: 8px;
  }
  .rc-ctrl-foot .ru-btn {
    min-height: 34px;
    font-size: .78rem;
  }
  .rc-output-head {
    padding: 10px 13px;
  }
  .rc-output-head span {
    display: none;
  }
  /* Keep 2x2 matrix crisp on 390px mobile so all 4 platforms are visible above the fold! */
  .rc-cell {
    padding: 11px 12px;
  }
  .rc-plat-name {
    font-size: .77rem;
  }
  .rc-src-caption {
    font-size: .66rem;
  }
  .rc-plat-main {
    font-size: 1.15rem;
  }
  .rc-plat-main.is-muted {
    font-size: .82rem;
  }
  .rc-plat-rows {
    margin-top: 7px;
    padding-top: 6px;
    font-size: .72rem;
    gap: 2px;
  }
  .rc-rank-bar {
    padding: 14px 13px;
  }
  .rc-scale-labels span:nth-child(2),
  .rc-scale-labels span:nth-child(4) {
    display: none;
  }
}

/* =========================================================================
   3. TOURNAMENT TABLE (turnirnaya-tablitsa) — Linear / Lichess Desk
   ========================================================================= */
.tt-cmdbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 8px 12px;
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius);
  background: #fff;
  margin-bottom: 14px;
}

.tt-title-wrap {
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tt-title-input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ru-ink);
  font-size: .98rem;
  font-weight: 700;
  letter-spacing: -.01em;
  outline: none;
  transition: border-color .14s ease, background-color .14s ease;
}

.tt-title-input:hover {
  background: var(--ru-surface);
  border-color: var(--ru-border);
}

.tt-title-input:focus {
  background: #fff;
  border-color: var(--ru-brand);
  box-shadow: 0 0 0 3px rgba(69, 119, 190, .12);
}

.tt-format-seg {
  flex: 0 0 auto;
}

.tt-format-seg .ru-seg-btn {
  padding: 6px 12px;
  min-height: 34px;
}

.tt-opt-select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--ru-border);
  border-radius: 8px;
  background: var(--ru-surface);
  color: var(--ru-ink);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.tt-opt-select:focus {
  border-color: var(--ru-brand);
}

.tt-cmd-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex-wrap: wrap;
}

.tt-cmd-sep {
  width: 1px;
  height: 20px;
  background: var(--ru-border);
  margin: 0 3px;
}

.tt-cmd-actions .ru-btn {
  min-height: 36px;
  padding: 0 10px;
  font-size: .8rem;
}

/* Split Desk: Left Roster Sidebar + Right Live Tournament Stage */
.tt-desk {
  display: grid;
  grid-template-columns: minmax(264px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tt-roster {
  position: sticky;
  top: 86px;
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius);
  background: #fff;
  overflow: hidden;
}

.tt-roster-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  background: var(--ru-surface);
  border-bottom: 1px solid var(--ru-border);
}

.tt-roster-head-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ru-ink);
  font-size: .88rem;
  font-weight: 700;
  cursor: default;
  text-align: left;
}

.tt-roster-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ru-muted);
  font-variant-numeric: tabular-nums;
}

.tt-roster-chev {
  display: none;
  width: 16px;
  height: 16px;
  color: var(--ru-muted);
  transition: transform .16s ease;
}

.tt-roster-body {
  padding: 12px 12px 10px;
}

.tt-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px 38px;
  gap: 6px;
  margin-bottom: 10px;
}

.tt-add-row .input {
  min-height: 38px;
  padding: 6px 9px;
  font-size: .84rem;
  border-color: var(--ru-border);
}

.tt-add-btn {
  width: 38px;
  min-height: 38px;
  padding: 0;
}

.tt-player-list {
  display: flex;
  flex-direction: column;
  max-height: 430px;
  overflow-y: auto;
  border-top: 1px solid #edf2f7;
}

.tt-player-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 2px;
  border-bottom: 1px solid #edf2f7;
  transition: background-color .1s ease;
}

.tt-player-row:hover {
  background: #fafcfe;
}

.tt-seed-num {
  width: 22px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--ru-muted);
  text-align: center;
  flex: none;
  font-variant-numeric: tabular-nums;
}

.tt-player-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ru-ink);
  font-size: .84rem;
  font-weight: 600;
  padding: 4px 5px;
  outline: none;
}

.tt-player-row input:hover {
  background: var(--ru-surface);
}

.tt-player-row input:focus {
  background: #fff;
  border-color: var(--ru-brand);
}

.tt-player-rtg {
  font-size: .74rem;
  font-weight: 600;
  color: var(--ru-muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

.tt-rm-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  flex: none;
  display: grid;
  place-items: center;
  transition: background-color .12s ease, color .12s ease;
}

.tt-rm-btn:hover {
  background: var(--ru-bad-bg);
  color: var(--ru-bad);
}

.tt-roster-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
}

.tt-roster-link {
  border: 0;
  background: transparent;
  color: var(--ru-brand);
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.tt-roster-link:hover {
  background: var(--ru-brand-soft);
}

.tt-bulk-box {
  margin: 8px 0;
  padding: 10px;
  border: 1px solid var(--ru-border);
  border-radius: 9px;
  background: var(--ru-surface);
}

.tt-bulk-box label {
  display: block;
  font-size: .74rem;
  font-weight: 600;
  color: var(--ru-ink-2);
  margin-bottom: 6px;
}

.tt-bulk-box .textarea {
  min-height: 96px;
  font-size: .82rem;
  padding: 8px 9px;
  margin-bottom: 8px;
}

/* Right Workspace Panels */
.tt-workspace {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.tt-panel {
  border: 1px solid var(--ru-border);
  border-radius: var(--ru-radius);
  background: #fff;
  overflow: hidden;
  min-width: 0;
}

.tt-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 12px 16px;
  background: var(--ru-surface);
  border-bottom: 1px solid var(--ru-border);
}

.tt-panel-head h2 {
  font-size: .94rem;
  font-weight: 700;
  color: var(--ru-ink);
  margin: 0;
}

.tt-panel-head span {
  font-size: .78rem;
  color: var(--ru-muted);
}

/* Cross-table (Berger) — crisp hairline grid */
.tt-scroll-x {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tt-cross-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}

.tt-cross-table th,
.tt-cross-table td {
  border-bottom: 1px solid #e6eef5;
  border-right: 1px solid #e6eef5;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.tt-cross-table th:last-child,
.tt-cross-table td:last-child {
  border-right: 0;
}

.tt-cross-table tbody tr:last-child td {
  border-bottom: 0;
}

.tt-cross-table thead th {
  background: #f5f8fb;
  color: var(--ru-ink-2);
  font-size: .75rem;
  font-weight: 700;
  padding: 9px 6px;
  white-space: nowrap;
  border-bottom: 1px solid var(--ru-border);
}

.tt-cross-table .tt-col-num {
  width: 32px;
  min-width: 32px;
  padding: 6px 4px;
  font-size: .76rem;
  font-weight: 700;
  color: var(--ru-muted);
  background: #fafcfe;
}

.tt-cross-table .tt-col-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  text-align: left;
  padding: 7px 12px;
  font-weight: 600;
  color: var(--ru-ink);
  min-width: 132px;
  max-width: 196px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 2px 0 6px -4px rgba(15, 23, 42, .14);
}

.tt-cross-table thead .tt-col-name {
  background: #f5f8fb;
  z-index: 3;
}

.tt-cross-table .tt-col-stat {
  min-width: 50px;
  padding: 7px 8px;
  font-weight: 700;
  color: var(--ru-ink);
  background: #fafcfe;
}

.tt-cross-table .tt-col-pts {
  color: #295694;
  font-weight: 800;
}

.tt-cross-table .tt-diag {
  background: repeating-linear-gradient(
    -45deg,
    #f6f9fc,
    #f6f9fc 4px,
    #edf2f7 4px,
    #edf2f7 8px
  );
  color: #b0becd;
  font-weight: 600;
  min-width: 42px;
  height: 42px;
}

.tt-cell-btn {
  width: 100%;
  min-width: 42px;
  height: 42px;
  border: 0;
  background: #fff;
  color: #94a3b8;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color .1s ease, color .1s ease;
  font-variant-numeric: tabular-nums;
}

.tt-cell-btn:hover {
  background: var(--ru-brand-soft);
  color: var(--ru-brand);
}

.tt-cell-btn.res-win {
  background: var(--ru-good-bg);
  color: var(--ru-good);
  font-weight: 800;
}

.tt-cell-btn.res-draw {
  background: #eef4fc;
  color: #2b5896;
  font-weight: 700;
}

.tt-cell-btn.res-loss {
  background: var(--ru-bad-bg);
  color: var(--ru-bad);
}

.tt-cell-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 68px;
}

.tt-cell-dual .tt-cell-btn {
  min-width: 34px;
  border-right: 1px solid #edf2f7;
  font-size: .8rem;
}

.tt-cell-dual .tt-cell-btn:last-child {
  border-right: 0;
}

/* Rounds tabs & Pairings */
.tt-round-tabs {
  display: flex;
  gap: 5px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  overflow-x: auto;
  scrollbar-width: none;
}

.tt-round-tabs::-webkit-scrollbar {
  display: none;
}

.tt-round-tab {
  flex: none;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--ru-border);
  border-radius: 7px;
  background: #fff;
  color: var(--ru-ink-2);
  font-size: .81rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tt-round-tab:hover {
  background: var(--ru-surface);
  color: var(--ru-ink);
}

.tt-round-tab.active {
  background: var(--ru-brand);
  border-color: var(--ru-brand);
  color: #fff;
  font-weight: 700;
}

.tt-done-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22a055;
  display: inline-block;
}

.tt-round-tab.active .tt-done-dot {
  background: #b5f0cc;
}

.tt-matches {
  display: flex;
  flex-direction: column;
}

.tt-match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid #edf2f7;
}

.tt-match-row:last-child {
  border-bottom: 0;
}

.tt-match-side {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--ru-ink);
  min-width: 0;
}

.tt-match-side span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-match-side.is-black {
  justify-content: flex-end;
  text-align: right;
}

.tt-color-sq {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}

.tt-color-sq.w {
  background: #fff;
  border: 1.5px solid #334155;
}

.tt-color-sq.b {
  background: #1e293b;
  border: 1.5px solid #1e293b;
}

.tt-vs {
  font-size: .74rem;
  color: #94a3b8;
  text-align: center;
}

.tt-score-btns {
  display: inline-flex;
  border: 1px solid var(--ru-border);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.tt-score-btn {
  min-height: 34px;
  min-width: 42px;
  padding: 0 8px;
  border: 0;
  border-right: 1px solid #e6eef5;
  background: #fff;
  color: var(--ru-ink-2);
  font-size: .79rem;
  font-weight: 700;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background-color .1s ease, color .1s ease;
}

.tt-score-btn:last-child {
  border-right: 0;
  min-width: 32px;
  color: #94a3b8;
}

.tt-score-btn:hover {
  background: var(--ru-surface);
  color: var(--ru-ink);
}

.tt-score-btn.active {
  background: var(--ru-brand);
  color: #fff;
}

.tt-bye-row {
  padding: 10px 16px;
  background: var(--ru-surface);
  border-top: 1px solid #edf2f7;
  font-size: .83rem;
  color: var(--ru-ink-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tt-swiss-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--ru-border);
  background: var(--ru-surface);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.tt-swiss-foot-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Standings Table — understated rank dots, crisp tabular numbers */
.tt-standings {
  width: 100%;
  border-collapse: collapse;
  font-size: .87rem;
  font-variant-numeric: tabular-nums;
}

.tt-standings th,
.tt-standings td {
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
}

.tt-standings thead th {
  background: #f5f8fb;
  color: var(--ru-ink-2);
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
  border-bottom: 1px solid var(--ru-border);
}

.tt-standings tbody tr:hover td {
  background: #fafcfe;
}

.tt-standings tbody tr:last-child td {
  border-bottom: 0;
}

.tt-rank-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  color: var(--ru-ink);
}

.tt-rank-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  background: transparent;
}

.tt-rank-dot.r1 { background: #d49b1a; }
.tt-rank-dot.r2 { background: #8e9eab; }
.tt-rank-dot.r3 { background: #b8733c; }

.tt-pts-strong {
  font-weight: 800;
  color: #295694;
  font-size: .94rem;
}

/* Playoff Bracket with Crisp Connector Lines */
.tt-bracket-wrap {
  padding: 18px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tt-bracket {
  display: flex;
  gap: 28px;
  align-items: stretch;
  min-width: max-content;
}

.tt-br-col {
  display: flex;
  flex-direction: column;
  min-width: 212px;
}

.tt-br-col-title {
  font-size: .76rem;
  font-weight: 700;
  color: var(--ru-muted);
  padding: 0 2px 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--ru-border);
}

.tt-br-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 14px;
}

.tt-br-match {
  position: relative;
  border: 1px solid var(--ru-border-strong);
  border-radius: 9px;
  background: #fff;
  overflow: hidden;
}

/* Subtle horizontal connector stub between bracket columns */
.tt-br-col:not(:last-child) .tt-br-match::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -15px;
  width: 14px;
  height: 1px;
  background: var(--ru-border-strong);
}

.tt-br-col:not(:first-child) .tt-br-match::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -15px;
  width: 14px;
  height: 1px;
  background: var(--ru-border-strong);
}

.tt-br-col:not(:last-child) .tt-br-match,
.tt-br-col:not(:first-child) .tt-br-match {
  overflow: visible;
}

.tt-br-match-inner {
  border-radius: 8px;
  overflow: hidden;
}

.tt-br-slot {
  width: 100%;
  min-height: 40px;
  padding: 7px 11px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  color: var(--ru-ink);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  transition: background-color .1s ease;
}

.tt-br-slot:last-child {
  border-bottom: 0;
}

.tt-br-slot:hover:not(:disabled) {
  background: var(--ru-brand-soft);
}

.tt-br-slot:disabled {
  opacity: .58;
  cursor: default;
}

.tt-br-slot.is-winner {
  background: var(--ru-good-bg);
  color: var(--ru-good);
  font-weight: 700;
}

.tt-br-slot.is-loser {
  color: #94a3b8;
  text-decoration: line-through;
  font-weight: 400;
}

.tt-br-mark {
  font-size: .74rem;
  font-weight: 700;
  color: var(--ru-muted);
  flex: none;
}

.tt-br-slot.is-winner .tt-br-mark {
  color: var(--ru-good);
}

.tt-third-wrap {
  margin-top: 18px;
  max-width: 240px;
}

/* Clean horizontal hairline podium (replaces 3 boxes inside a box) */
.tt-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--ru-border);
  background: var(--ru-surface);
}

.tt-podium-cell {
  padding: 12px 16px;
  border-right: 1px solid var(--ru-border);
  min-width: 0;
}

.tt-podium-cell:last-child {
  border-right: 0;
}

.tt-podium-cell small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .74rem;
  font-weight: 600;
  color: var(--ru-muted);
  margin-bottom: 3px;
}

.tt-podium-cell strong {
  display: block;
  font-size: .92rem;
  font-weight: 700;
  color: var(--ru-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-print-header {
  display: none;
}

/* Tablet & Mobile: Collapsible Roster Bar so live table sits IMMEDIATELY above the fold */
@media (max-width: 960px) {
  .tt-desk {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .tt-roster {
    position: static;
  }
  .tt-roster-head {
    padding: 0;
  }
  .tt-roster-head-btn {
    cursor: pointer;
    min-height: 44px;
    padding: 0 14px;
  }
  .tt-roster-chev {
    display: block;
  }
  .tt-roster.is-collapsed .tt-roster-head {
    border-bottom: 0;
  }
  .tt-roster.is-collapsed .tt-roster-body {
    display: none;
  }
  .tt-roster:not(.is-collapsed) .tt-roster-chev {
    transform: rotate(180deg);
  }
}

@media (max-width: 740px) {
  .tt-cmdbar {
    padding: 8px 10px;
    gap: 7px;
    margin-bottom: 10px;
  }
  .tt-title-wrap {
    flex: 1 1 100%;
  }
  .tt-title-input {
    height: 34px;
    font-size: .92rem;
    padding: 0 4px;
  }
  .tt-format-seg {
    flex: 1 1 auto;
  }
  .tt-format-seg .ru-seg-btn {
    padding: 5px 6px;
    font-size: .78rem;
    min-height: 34px;
  }
  .tt-opt-select {
    height: 36px;
    font-size: .78rem;
    padding: 0 7px;
  }
  .tt-cmd-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    padding-top: 6px;
    border-top: 1px solid #edf2f7;
  }
  .tt-cmd-sep {
    display: none;
  }
  .tt-cmd-actions .ru-btn {
    min-height: 34px;
    padding: 0 8px;
    font-size: .75rem;
    flex: 1 1 auto;
  }
  .tt-cmd-actions .ru-btn svg {
    width: 14px;
    height: 14px;
  }
  .tt-panel-head {
    padding: 10px 12px;
  }
  .tt-panel-head span {
    font-size: .74rem;
  }
  .tt-cross-table .tt-col-name {
    min-width: 112px;
    max-width: 144px;
    padding: 6px 9px;
    font-size: .82rem;
  }
  .tt-cell-btn,
  .tt-cross-table .tt-diag {
    min-width: 38px;
    height: 38px;
  }
  .tt-match-row {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 10px 12px;
  }
  .tt-match-side.is-black {
    justify-content: flex-start;
    text-align: left;
  }
  .tt-vs {
    display: none;
  }
  .tt-score-btns {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
  .tt-score-btn {
    min-height: 38px;
  }
  .tt-podium {
    grid-template-columns: 1fr;
  }
  .tt-podium-cell {
    border-right: 0;
    border-bottom: 1px solid var(--ru-border);
  }
  .tt-podium-cell:last-child {
    border-bottom: 0;
  }
}

/* =========================================================================
   4. HUB PREVIEW VISUALS (/ru/instrumenty/) — Refined Understated Match
   ========================================================================= */
.hub-clock-vis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.hub-clk-mini {
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  position: relative;
  overflow: hidden;
}

.hub-clk-mini.w {
  background: #fff;
  border: 1px solid #c5d6e8;
  border-top: 3px solid var(--ru-brand);
  color: var(--ru-ink);
}

.hub-clk-mini.b {
  background: var(--ru-obsidian);
  border: 1px solid var(--ru-obsidian-border);
  color: #f4f7fa;
}

.hub-clk-mini b {
  display: block;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.hub-clk-mini span {
  display: block;
  font-size: .66rem;
  opacity: .76;
  margin-top: 3px;
}

.hub-conv-vis {
  display: grid;
  gap: 5px;
  width: 100%;
}

.hub-conv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--ru-border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

.hub-conv-row span {
  color: var(--ru-ink-2);
  font-weight: 600;
}

.hub-conv-row b {
  color: var(--ru-ink);
  font-weight: 800;
}

.hub-tt-vis {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ru-border);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}

.hub-tt-vis th,
.hub-tt-vis td {
  border: 1px solid #e6eef5;
  padding: 4px 5px;
  text-align: center;
}

.hub-tt-vis th {
  background: #f4f8fc;
  color: var(--ru-ink-2);
  font-weight: 700;
}

.hub-tt-vis td:first-child {
  text-align: left;
  font-weight: 700;
  color: var(--ru-ink);
  padding-left: 7px;
}

.hub-tt-vis .d {
  background: #f1f5f9;
  color: #94a3b8;
}

.hub-tt-vis .w {
  background: var(--ru-good-bg);
  color: var(--ru-good);
  font-weight: 800;
}

/* =========================================================================
   5. PRINT STYLES (Clean PDF / Paper output)
   ========================================================================= */
@media print {
  header.site-header,
  footer,
  .cdck,
  .cd-search,
  .tool-intro,
  .cd-tools-nav,
  .tt-cmdbar,
  .tt-roster,
  .tt-round-tabs,
  .tt-score-btns,
  .tt-swiss-foot,
  .rc-ctrl-foot,
  #faq,
  #guide,
  .ru-no-print {
    display: none !important;
  }

  body,
  main,
  .tools-main,
  .wrap,
  .ru-tool-wrap,
  .tt-desk,
  .tt-panel,
  .rc-frame {
    display: block !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border-color: #bbb !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .tt-print-header {
    display: block !important;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #222;
  }

  .tt-print-header h2 {
    font-size: 18pt;
    margin: 0 0 4px;
    color: #000;
  }

  .tt-print-header p {
    font-size: 10pt;
    margin: 0;
    color: #444;
  }

  .tt-panel {
    page-break-inside: avoid;
    margin-bottom: 16px !important;
    border: 1px solid #bbb !important;
    border-radius: 0 !important;
  }

  .tt-cross-table .tt-col-name {
    position: static !important;
    box-shadow: none !important;
  }

  .tt-cross-table thead th,
  .tt-standings thead th {
    background: #f0f0f0 !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .tt-cell-btn {
    height: 30px !important;
    min-width: 28px !important;
    font-size: 10pt !important;
    color: #000 !important;
  }

  .tt-scroll-x {
    overflow: visible !important;
  }
}
