/* cup_page.css — страница Кубка */

.hidden { display: none !important; }


/* ── Hero ─────────────────────────────────────────────── */
.cup-hero {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg,
    color-mix(in oklch, var(--pine) 18%, var(--paper-2)) 0%,
    var(--paper-2) 70%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
}
.cup-hero .mtn-bg {
  position: absolute; inset: 0; opacity: 0.20;
  background:
    radial-gradient(80% 70% at 80% 100%, color-mix(in oklch, var(--pine) 50%, transparent), transparent 60%),
    radial-gradient(60% 50% at 10% 100%, color-mix(in oklch, var(--sunset) 35%, transparent), transparent 55%);
}
.cup-hero .shell {
  position: relative; z-index: 2;
  padding-top: 36px; padding-bottom: 48px;
}
.cup-hero .crumb { font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.cup-hero .crumb a { color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
.cup-hero .crumb a:hover { color: var(--ink); }

.cup-hero .badge-line {
  display: flex; gap: 10px; align-items: center;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--ink-2); letter-spacing: 0.06em; margin-bottom: 12px;
  text-transform: uppercase;
}
.cup-hero .badge-line .b-trophy {
  width: 28px; height: 28px; border-radius: 50%;
  background: color-mix(in oklch, var(--sunset) 18%, var(--card));
  color: var(--sunset);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.cup-hero h1 {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(32px, 5vw, 52px); line-height: 1.05;
  letter-spacing: -0.02em; margin: 0 0 12px;
  color: var(--ink); max-width: 880px;
}
.cup-hero h1 em {
  font-style: italic;
  color: var(--sunset);
  font-weight: 500;
}
.cup-hero .meta-row {
  display: flex; flex-wrap: wrap; gap: 20px;
  font-size: 14px; color: var(--ink-2);
  align-items: center; margin-top: 8px;
}
.cup-hero .meta-row .m-it { display: inline-flex; gap: 8px; align-items: center; }
.cup-hero .meta-row .m-it strong { color: var(--ink); font-weight: 600; }

/* Status pills */
.cup-hero .status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cup-hero .status-pill.planned  { background: var(--paper-2); color: var(--ink-3); border: 1px solid var(--line); }
.cup-hero .status-pill.cancelled { background: color-mix(in oklch, oklch(0.55 0.16 25) 14%, var(--paper)); color: oklch(0.50 0.16 25); text-decoration: line-through; }
.cup-hero .status-pill.in-progress { background: color-mix(in oklch, var(--sunset) 18%, var(--paper)); color: var(--sunset); }
.cup-hero .status-pill.done { background: color-mix(in oklch, var(--pine) 18%, var(--paper)); color: var(--pine); }
.cup-hero .status-pill .pulse {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
  animation: cup-pulse 2s infinite;
}
@keyframes cup-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklch, currentColor 60%, transparent); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ── Stage progress bar ─────────────────────────────── */
.cup-progress {
  display: flex; gap: 6px; align-items: center;
  margin-top: 24px; padding: 14px 18px;
  background: color-mix(in oklch, var(--card) 80%, transparent);
  border: 1px solid var(--line); border-radius: 12px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.stage-tick {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--paper-3);
  position: relative; display: block; text-decoration: none;
  transition: transform .15s, filter .15s;
}
a.stage-tick:hover { transform: translateY(-1px); filter: brightness(1.05); }
.stage-tick.planned  { background: var(--paper-3); }
.stage-tick.done     { background: var(--pine); }
.stage-tick.live {
  background: var(--sunset);
  animation: cup-stage-pulse 1.8s infinite;
}
@keyframes cup-stage-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklch, var(--sunset) 50%, transparent); }
  70%  { box-shadow: 0 0 0 6px color-mix(in oklch, var(--sunset) 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--sunset) 0%, transparent); }
}
.stage-tick .stage-tip {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
.stage-tick.done .stage-tip { color: var(--pine); font-weight: 600; }
.stage-tick.live .stage-tip { color: var(--sunset); font-weight: 600; }
.stage-summary {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase;
  margin-left: 12px; white-space: nowrap;
}
.stage-summary b {
  font-family: var(--font-display); font-weight: 600;
  color: var(--ink); font-size: 16px; margin-right: 4px;
}

/* ── Page tabs ──────────────────────────────────────── */
.cup-tabs-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin: 20px 0 24px;
}
.cup-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px;
}
.cup-tab {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 8px 18px; font-family: var(--font-ui); font-size: 14px; font-weight: 600;
  color: var(--ink-2); border-radius: 999px;
  display: inline-flex; gap: 8px; align-items: center;
  transition: background .15s, color .15s;
}
.cup-tab:hover { color: var(--ink); background: color-mix(in oklch, var(--paper) 60%, transparent); }
.cup-tab.on    { background: var(--ink); color: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* ── Main layout ─────────────────────────────────────── */
.cup-main-layout {
  display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start;
}
@media (max-width: 980px) { .cup-main-layout { grid-template-columns: 1fr; } }
.cup-main { min-width: 0; }

.cup-section {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px 24px; margin-bottom: 20px;
}
.cup-section h2 {
  font-family: var(--font-display); font-weight: 500; font-size: 22px;
  margin: 0 0 14px; letter-spacing: -0.01em;
}
.cup-section .desc { font-size: 15px; line-height: 1.6; color: var(--ink-2); }

/* Stages list */
.cup-stages-list { display: flex; flex-direction: column; gap: 10px; }
.cup-stage {
  display: grid; grid-template-columns: 52px 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px 16px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .12s, background .12s;
}
.cup-stage:hover { border-color: var(--ink-3); }
.cup-stage-num {
  width: 52px; height: 52px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 500; font-size: 26px;
  color: var(--ink); letter-spacing: -0.02em; flex-shrink: 0;
}
.cup-stage-body { min-width: 0; }
.cup-stage-body .title {
  font-family: var(--font-display); font-weight: 500; font-size: 17px;
  color: var(--ink); letter-spacing: -0.01em;
}
.cup-stage-body .meta {
  font-size: 13px; color: var(--ink-3); margin-top: 4px;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.cup-stage-body .meta b { color: var(--ink-2); font-weight: 600; }
.cup-stage-right {
  text-align: right; display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px; flex-shrink: 0;
}
.st-status {
  font-family: var(--font-mono); font-size: 10px;
  padding: 3px 10px; border-radius: 999px;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
}
.st-status.done    { background: color-mix(in oklch, var(--pine) 18%, var(--card)); color: var(--pine); }
.st-status.live    { background: var(--sunset); color: var(--paper); }
.st-status.planned { background: var(--card); color: var(--ink-3); border: 1px solid var(--line); }
.cup-stage-action {
  font-size: 12.5px; padding: 5px 11px;
  display: inline-flex; gap: 6px; align-items: center; text-decoration: none;
  font-family: var(--font-ui); font-weight: 600;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--card); color: var(--ink-2);
  transition: background .12s, color .12s;
}
.cup-stage-action:hover { background: var(--card-2); color: var(--ink); }
.cup-stage-action.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.cup-stage-action.primary:hover { background: var(--ink-2); }
.live-dot {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
  display: inline-block; animation: cup-live-dot 1.6s infinite;
}
@keyframes cup-live-dot {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklch, currentColor 80%, transparent); }
  70%  { box-shadow: 0 0 0 6px color-mix(in oklch, currentColor 0%, transparent); }
  100% { box-shadow: 0 0 0 0 color-mix(in oklch, currentColor 0%, transparent); }
}

/* Aside */
.cup-aside { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px; align-self: start; margin-top: 20px; z-index: 10; }
.cup-aside-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px 20px;
}
.cup-aside-card h3 {
  margin: 0 0 14px; font-family: var(--font-mono); font-size: 10.5px;
  font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.09em;
}
.cup-rules { display: flex; flex-direction: column; gap: 0; }
.cup-rules .rule-row {
  display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.cup-rules .rule-row:last-child { border-bottom: 0; }
.cup-rules .rule-row .k { color: var(--ink-3); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }
.cup-rules .rule-row .v { color: var(--ink); font-weight: 600; font-family: var(--font-display); text-align: right; margin-left: 8px; }

.formula-hint { position: relative; cursor: help; }
.formula-text { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--ink-3); }
.formula-tooltip {
  display: none; position: absolute; bottom: calc(100% + 8px); right: -12px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18);
  z-index: 300; white-space: nowrap;
  max-height: 260px; overflow-y: auto;
}
.formula-tooltip.visible { display: block; }
.ft-head {
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px;
}
.ft-grid { columns: 2; column-gap: 20px; }
.ft-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 3px 0; border-bottom: 1px solid var(--line);
  font-size: 12px; break-inside: avoid;
}
.ft-row:last-child { border-bottom: none; }
.ft-pl { color: var(--ink-3); font-family: var(--font-mono); min-width: 18px; }
.ft-pts { font-weight: 600; color: var(--ink); }

.cup-docs .doc-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--ink); text-decoration: none;
}
.cup-docs .doc-row:last-child { border-bottom: 0; }
.cup-docs .doc-row:hover { color: var(--sunset); }
.cup-docs .doc-ico {
  width: 28px; height: 32px; border-radius: 4px;
  background: color-mix(in oklch, var(--sunset) 14%, var(--paper));
  color: var(--sunset); font-family: var(--font-mono);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cup-docs .doc-lbl { flex: 1; }
.cup-docs .doc-sz { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

.cup-orgs { display: flex; flex-direction: column; gap: 10px; }
.cup-org {
  display: flex; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--paper-2); border-radius: 10px;
}
.cup-org-logo {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 8px;
  overflow: hidden; background: var(--card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ink-3);
}
.cup-org-logo img { width: 100%; height: 100%; object-fit: contain; }
.cup-org .nm { font-size: 13px; color: var(--ink); font-weight: 500; line-height: 1.3; }
.cup-org .sh { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }

/* ── Standings ──────────────────────────────────────── */
.cup-standings-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.cup-standings-head h2 {
  margin: 0; font-family: var(--font-display); font-weight: 500;
  font-size: 22px; letter-spacing: -0.01em;
}
.cup-cat-tabs {
  display: inline-flex; gap: 4px; padding: 3px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px;
}
.cup-cat-tabs button {
  appearance: none; border: 0; background: transparent;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2);
  transition: background .12s, color .12s;
}
.cup-cat-tabs button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.cup-cat-total {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em;
}

/* Cup standings table — extends .results-tbl */
.results-tbl.cup-standings { border-radius: 10px; }
.results-tbl.cup-standings thead th.cup-stage-col {
  text-align: center; font-family: var(--font-mono);
}
.results-tbl.cup-standings thead th.cup-stage-col .cup-stage-city {
  display: block; font-size: 9px; color: var(--ink-4); font-weight: 500; margin-top: 2px;
}
.results-tbl.cup-standings thead th.cup-stage-sub {
  text-align: center; font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-3); font-weight: 600; padding: 6px 8px;
  text-transform: uppercase; letter-spacing: 0.06em;
  background: color-mix(in oklch, var(--card-2) 60%, var(--paper-2));
  border-bottom: 1px solid var(--line);
}
.results-tbl.cup-standings thead th.cup-total-col {
  text-align: right; color: var(--ink-2);
}
.results-tbl.cup-standings td.cup-stage-place,
.results-tbl.cup-standings td.cup-stage-pts {
  text-align: center; font-variant-numeric: tabular-nums; padding: 12px 8px;
}
.results-tbl.cup-standings td.cup-stage-place {
  font-family: var(--font-mono); font-weight: 600; font-size: 14px; color: var(--ink);
}
.results-tbl.cup-standings td.cup-stage-pts {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
}
.results-tbl.cup-standings td.cup-stage-place.zero,
.results-tbl.cup-standings td.cup-stage-pts.zero { color: var(--ink-4); }
.results-tbl.cup-standings td.cup-stage-pts.not-counted {
  color: var(--ink-4); text-decoration: line-through;
}
.results-tbl.cup-standings td.cup-total-cell {
  text-align: right; font-family: var(--font-mono); font-weight: 700;
  font-size: 16px; color: var(--ink);
}
/* Vertical dividers before each stage group and total */
.results-tbl.cup-standings .cup-stage-divider { position: relative; }
.results-tbl.cup-standings .cup-stage-divider::before {
  content: ''; position: absolute;
  left: 0; top: 14%; bottom: 14%; width: 0;
  border-left: 1px dashed var(--line-strong); pointer-events: none;
}
.results-tbl.cup-standings td.cup-total-cell,
.results-tbl.cup-standings th.cup-total-col { position: relative; }
.results-tbl.cup-standings td.cup-total-cell::before,
.results-tbl.cup-standings th.cup-total-col::before {
  content: ''; position: absolute;
  left: 0; top: 14%; bottom: 14%; width: 0;
  border-left: 1px dashed var(--line-strong); pointer-events: none;
}

/* ── Admin management bar ───────────────────────────── */
.cup-admin-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: color-mix(in oklch, var(--sunset) 8%, var(--paper-2));
  border: 1px solid color-mix(in oklch, var(--sunset) 20%, var(--line));
  border-radius: 10px; padding: 12px 16px; margin-bottom: 20px;
}
.cup-admin-bar .admin-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.07em;
  margin-right: 4px;
}

/* responsive */
@media (max-width: 880px) {
  .results-tbl.cup-standings thead th.cup-stage-col,
  .results-tbl.cup-standings thead th.cup-stage-sub,
  .results-tbl.cup-standings tbody td.cup-stage-place,
  .results-tbl.cup-standings tbody td.cup-stage-pts { display: none; }
  .cup-stage { grid-template-columns: 44px 1fr; }
  .cup-stage-right { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
}
@media (max-width: 600px) {
  .cup-tabs-row { flex-direction: column; align-items: flex-start; }
}
