/* Вынесено из tema/rankedin_new/tournament_info.tpl — 20261108, 1:1 без изменений.
   Правки стилей теперь только здесь, в tpl CSS не возвращать. */

/* === source: tournament_info.tpl (строки 181–492) === */

  /* ═══ Карточка-контейнер (общий ритм) ═══ */
  .tournament-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
  }
  .t-card-title {
    font-family: var(--pr-font-heading, Manrope, Inter, system-ui, sans-serif);
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px;
  }

  /* ═══ Hero ═══ */
  .tournament-hero {
    display: flex;
    gap: 24px;
    align-items: stretch;
  }
  .tournament-hero-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .tournament-hero-top { display: flex; align-items: flex-start; gap: 16px; }

  .hero-logo {
    flex: 0 0 195px;
    width: 195px;
    height: 260px;
    border-radius: var(--r-md);
    border: 1px solid var(--surface-border);
    background: var(--surface-hover);
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
  }
  .hero-logo:hover {
    border-color: rgba(13, 148, 136, 0.4);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  }
  .hero-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    cursor: zoom-in;
  }
  .hero-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
  }
  .hero-logo:hover .hero-logo-img {
    transform: scale(1.02);
  }
  .hero-logo-ph {
    width: 100%;
    height: 100%;
    border-radius: var(--r-md);
    background: var(--surface-hover);
    color: var(--text-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .hero-logo-ph span { font-size: 48px; line-height: 1; }

  .hero-info { flex: 1; min-width: 0; }
  .hero-title {
    font-family: var(--pr-font-heading, Manrope, Inter, system-ui, sans-serif);
    font-size: 21px; font-weight: 700; line-height: 1.25;
    margin: 0 0 8px;
  }
  .hero-title a { color: var(--text); text-decoration: none; }
  .hero-title a:hover { color: var(--teal); }
  .hero-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
    color: var(--text-muted); font-size: 14px;
  }
  .hero-meta .sep { opacity: .45; }

  .share {
    display: inline-flex; align-items: center; gap: 6px; width: fit-content;
    background: var(--surface-hover); border: 1px solid var(--surface-border); color: var(--text-muted);
    font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer;
    line-height: 1.4;
    transition: var(--transition);
    white-space: nowrap;
  }
  .share:hover { border-color: var(--teal); color: var(--teal); background: var(--surface); }

  /* ═══ Чипы статуса ═══ */
  .chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
    line-height: 1.4;
  }
  .chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
  .chip-open { background: var(--good-bg); color: var(--good-text); }
  .chip-warn { background: var(--warn-bg); color: var(--warn-text); }
  .chip-closed { background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--surface-border); }

  /* ═══ Join-box ═══ */
  .join {
    width: 270px; flex-shrink: 0;
    border: 1px solid var(--surface-border); border-radius: var(--r-lg);
    background: var(--surface-hover);
    padding: 16px; text-align: center;
    display: flex; flex-direction: column; gap: 12px; justify-content: center;
  }
  .join .chip { align-self: center; }
  .join-count { font-size: 13px; color: var(--text-muted); }
  .join-count-inner { margin: 0; }
  .join-count strong {
    display: block; font-family: var(--pr-font-ui, Inter, system-ui, sans-serif);
    font-size: 34px; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 4px;
  }
  .join .divider { height: 1px; background: var(--surface-border); margin: 2px 0; }

  .btn-join {
    display: inline-block; text-align: center; text-decoration: none; width: 100%;
    background: linear-gradient(135deg, var(--teal), var(--teal-light)); color: #fff;
    border: none; border-radius: 12px; padding: 13px 20px;
    font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 14px var(--teal-glow-lg);
    transition: var(--transition);
  }
  .btn-join:hover { color: #fff; text-decoration: none; filter: brightness(1.06); }
  .join-in { display: inline-flex; align-items: center; gap: 10px; justify-content: center; }
  .join-leave { font-size: 13px; color: var(--text-muted); text-decoration: none; }
  .join-leave:hover { color: var(--teal); text-decoration: underline; }
  .join-closed { font-size: 14px; color: var(--text-muted); margin: 0; }
  .join-closed span { font-weight: 600; color: var(--text); }

  /* Запись через форму заявки (категории закрыты, но форма опубликована) */
  .join-form-box { display: flex; flex-direction: column; gap: 10px; }
  .join-form-text {
    font-size: 13px; line-height: 1.45; color: var(--text); font-weight: 600; margin: 0;
  }
  .join-form-deadline { font-size: 11.5px; color: var(--text-subtle); margin: -2px 0 0; }
  .btn-join-form { padding: 11px 16px; font-size: 14px; }
  /* Альтернативная ссылка под основной кнопкой (прямой набор + форма) */
  .join-form-alt { font-size: 12.5px; color: var(--text-subtle); margin: 0; }
  .join-form-alt a { color: var(--teal); font-weight: 600; text-decoration: none; }
  .join-form-alt a:hover { text-decoration: underline; }
  .join-note { font-size: 12px; color: var(--text-subtle); display: none; }

  /* ═══ О турнире в Hero ═══ */
  .hero-about {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--surface-border);
  }
  .hero-about-title {
    font-family: var(--pr-font-heading, Manrope, Inter, system-ui, sans-serif);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-subtle);
    margin: 0 0 6px;
  }
  .t-about-text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
    max-width: 68ch;
    margin: 0 0 8px;
    white-space: pre-line; /* переносы строк из textarea сохраняются */
  }
  .hero-about .t-fact-prize {
    display: inline-flex;
    flex-direction: column;
    padding: 8px 14px;
    border: 1px solid var(--surface-border);
    border-radius: var(--r-md);
    background: var(--surface-hover);
    margin-top: 4px;
  }
  .hero-about .t-fact-prize .k {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-subtle);
    font-weight: 600;
  }
  .hero-about .t-fact-prize .v {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
    color: var(--text);
  }

  /* ═══ Детали турнира ═══ */
  .t-info-table { width: 100%; border-collapse: collapse; }
  .t-info-table th, .t-info-table td { padding: 12px 8px; border-bottom: 1px solid var(--surface-border); text-align: left; vertical-align: top; }
  .t-info-table th { width: 220px; color: var(--text-subtle); font-size: 13px; font-weight: 600; white-space: nowrap; }
  .t-info-table td { font-size: 14px; color: var(--text); }
  .t-info-table tr:last-child th, .t-info-table tr:last-child td { border-bottom: none; }
  .t-info-table a { color: var(--teal); text-decoration: none; }
  .t-info-table a:hover { text-decoration: underline; }

  /* ═══ Сетка деталей: админ-сайдбар справа только когда он есть ═══ */
  .tournament-details-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
  .tournament-details-grid:has(.tournament-details-sidebar) { grid-template-columns: 1fr 280px; }
  .tournament-details-main { margin-bottom: 0; }

  .tournament-logo-placeholder {
    width: 80px; height: 80px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .tournament-sidebar-logo-placeholder {
    width: 160px; height: 160px;
    margin: 0 auto 16px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .tournament-logo-placeholder,
  .tournament-sidebar-logo-placeholder {
    background: var(--surface-hover);
    border: 2px dashed var(--surface-border);
    color: var(--text-muted);
  }
  .tournament-logo-placeholder .noimg-icon,
  .tournament-sidebar-logo-placeholder .noimg-icon {
    width: 40px; height: 40px;
  }
  .tournament-sidebar-logo-placeholder span {
    font-size: 64px; line-height: 1;
  }

  .img-placeholder-sm {
    width: 24px; height: 24px;
    background: var(--surface-hover);
    border: 1px solid var(--surface-border);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-right: 6px;
  }
  .img-placeholder-sm .noimg-icon {
    width: 14px; height: 14px;
    color: var(--text-muted);
  }

  .noimg-icon { display: block; flex-shrink: 0; }

  .category-schedule-item {
    padding: 4px 0;
    font-size: 13px;
    color: var(--text);
  }
  .category-schedule-item strong {
    color: var(--text);
  }

  #admin_search_results .player-search-list {
    max-height: 280px;
  }

  /* Главная кнопка «футер» админ-панели — ярко-красная, чтобы не промахнуться */
  .btn-admin-home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: var(--r-md);
    padding: 10px 16px;
    font-family: var(--pr-font-ui, Inter, system-ui, sans-serif);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    transition: var(--transition);
  }
  .btn-admin-home:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(239, 68, 68, 0.5);
  }
  .btn-admin-home .admin-home-arrow {
    width: 16px; height: 16px;
    flex-shrink: 0;
  }

  /* Панель админки над блоком деталей и управления */
  #tournament-adminbar-slot:not(:empty) {
    margin-bottom: 20px;
  }
  #tournament-adminbar-slot .admin-bar-host,
  .tournament-hero + .admin-bar-host {
    margin-bottom: 20px;
  }

  /* Быстрые переходы админ-сайдбара — фирменные зеленые кнопки (teal) под дизайн сайта */
  .admin-quick-nav { display: flex; flex-direction: column; gap: 8px; }
  .btn-admin-nav {
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    border: 1px solid rgba(13, 148, 136, 0.4);
    color: #fff !important;
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-family: var(--pr-font-ui, Inter, system-ui, sans-serif);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: 0 3px 10px var(--teal-glow);
    text-decoration: none;
    transition: var(--transition);
  }
  .btn-admin-nav:hover {
    background: linear-gradient(135deg, var(--teal-light), var(--teal));
    border-color: var(--teal);
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--teal-glow-lg);
  }
  .btn-admin-nav:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px var(--teal-glow);
  }
  [data-theme="dark"] .btn-admin-nav {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    border-color: rgba(45, 212, 191, 0.35);
    color: #fff !important;
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.3);
  }
  [data-theme="dark"] .btn-admin-nav:hover {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    border-color: var(--teal);
    color: #fff !important;
    box-shadow: 0 6px 16px var(--teal-glow-lg);
  }

  @media (max-width: 900px) {
    .tournament-hero { flex-direction: column; }
    .hero-logo {
      flex: 0 0 180px;
      width: 180px;
      height: 240px;
    }
    .join { width: 100%; }
    .tournament-details-grid,
    .tournament-details-grid:has(.tournament-details-sidebar) { grid-template-columns: 1fr; }
  }
  @media (max-width: 640px) {
    .tournament-hero-top {
      flex-direction: column;
      align-items: center;
      gap: 16px;
    }
    .hero-logo {
      flex: 0 0 auto;
      width: 100%;
      max-width: 210px;
      height: 270px;
      margin: 0 auto;
    }
    .hero-info {
      width: 100%;
    }
    .hero-meta {
      justify-content: flex-start;
    }
    .t-info-table th { width: auto; white-space: normal; }
    .t-info-table th, .t-info-table td { display: block; width: 100%; }
    .t-info-table th { padding-bottom: 2px; border-bottom: none; }
    .t-info-table td { padding-top: 2px; padding-bottom: 14px; }
  }
  @media (max-width: 380px) {
    .hero-logo {
      max-width: 180px;
      height: 235px;
    }
  }

/* Compact timing inside the existing registration card. */
.tournament-hero .join { box-sizing: border-box; min-width: 0; gap: 10px; }
.tournament-hero .join .chip { max-width: 100%; text-align: center; }
.tournament-hero .join-summary {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; align-items: stretch;
}
.tournament-hero .join-summary .join-count {
  grid-column: 1 / -1; padding: 3px 0 5px;
}
.tournament-hero .join-summary .join-count strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.tournament-hero .join-metric {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 0; gap: 3px; padding: 8px 3px;
  background: var(--surface); border: 1px solid var(--surface-border); border-radius: 10px;
}
.tournament-hero .join-metric:only-of-type { grid-column: 1 / -1; }
.tournament-hero .join-metric-value {
  font-family: var(--pr-font-ui, Inter, system-ui, sans-serif); font-size: 17px; font-weight: 700; line-height: 1.15;
  color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.tournament-hero .join-metric-label,
.tournament-hero .join-metric-detail { font-size: 11px; line-height: 1.3; color: var(--text-muted); }
.tournament-hero .join-metric--warn { background: var(--warn-bg); border-color: var(--warn-text); }
.tournament-hero .join-metric--warn .join-metric-value,
.tournament-hero .join-metric--warn .join-metric-label,
.tournament-hero .join-metric--warn .join-metric-detail { color: var(--warn-text); }
.tournament-hero .join-action { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tournament-hero .join-action .btn-join { white-space: normal; box-sizing: border-box; overflow-wrap: anywhere; }
.tournament-hero .join-form-alt,
.tournament-hero .join-note { color: var(--text-muted); }
.tournament-hero .hero-title { overflow-wrap: anywhere; }
.tournament-hero .join-summary:has(> .join-metric:nth-child(2):last-child) > .join-metric { grid-column: 1 / -1; }
@media (max-width: 900px) {
  .tournament-hero .join-summary { grid-template-columns: repeat(auto-fit, minmax(83px, 1fr)); }
  .tournament-hero .join-summary .join-count,
  .tournament-hero .join-summary:has(> .join-metric:nth-child(2):last-child) > .join-metric { grid-column: auto; }
  .tournament-hero .join-summary .join-count { display: flex; align-items: center; justify-content: center; }
  .tournament-hero .join-summary .join-count strong { font-size: 25px; }
  .tournament-hero .join-summary .join-count span { font-size: 11px; line-height: 1.25; display: block; }
  .tournament-hero .join-summary:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .tournament-card.tournament-hero { padding: 14px; gap: 16px; }
  .tournament-hero .tournament-hero-top { flex-direction: row; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .tournament-hero .hero-logo { flex: 0 0 84px; width: 84px; max-width: 84px; height: 112px; margin: 0; }
  .tournament-hero .hero-info { width: auto; flex: 1 1 160px; min-width: 0; }
  .tournament-hero .hero-title { font-size: 18px; }
  .tournament-hero .hero-meta { font-size: 12px; gap: 5px 8px; }
  .tournament-hero .hero-meta .sep { display: none; }
  .tournament-hero .hero-about { margin-top: 10px; }
  .tournament-hero .join { padding: 12px; }
  .tournament-hero .join-summary { grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 5px; }
  .tournament-hero .join-metric { padding: 8px 2px; }
}
@media (max-width: 340px) {
  .tournament-hero .join-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tournament-hero .hero-logo { flex-basis: 70px; width: 70px; height: 94px; }
  .tournament-hero .hero-info { flex-basis: 120px; }
}

/* Adapt to actual content width, including an expanded desktop sidebar. */
.tournament-card.tournament-hero { container-name: tournament-hero; container-type: inline-size; flex-wrap: wrap; }
.tournament-hero .tournament-hero-main { flex-basis: 320px; }
.tournament-hero .join-summary:has(> .join-metric:nth-child(4):last-child) > .join-metric:last-child { grid-column: 1 / -1; }
.tournament-hero .join:has(.join-summary [data-metric="form"]) .join-form-box > .join-form-deadline:not(.join-form-deadline--individual) { display: none; }
@container tournament-hero (max-width: 650px) {
  .tournament-hero .tournament-hero-main { flex-basis: 100%; }
  .tournament-hero .join { flex: 1 1 100%; width: 100%; }
  .tournament-hero .join-summary { grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); }
  .tournament-hero .join-summary .join-count,
  .tournament-hero .join-summary:has(> .join-metric:nth-child(2):last-child) > .join-metric,
  .tournament-hero .join-summary:has(> .join-metric:nth-child(4):last-child) > .join-metric:last-child { grid-column: auto; }
  .tournament-hero .join-summary:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tournament-hero .join-summary .join-count { display: flex; align-items: center; justify-content: center; }
  .tournament-hero .join-summary .join-count span { font-size: 11px; line-height: 1.25; display: block; }
}
@media (max-width: 900px) {
  .tournament-hero .tournament-hero-main { flex-basis: auto; }
  .tournament-hero .join { flex: 0 0 auto; }
}
@media (max-width: 340px) {
  .tournament-hero .join-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Mobile registration metrics: keep the whole player tile clickable. */
.tournament-hero .join-summary .join-count .join-count-label--mobile { display: none; }

@media (max-width: 767px) {
  .tournament-hero .join-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }
  .tournament-hero .join-summary:has(> .join-count:only-child) {
    grid-template-columns: minmax(0, 1fr);
  }
  .tournament-hero .join-summary:has(> :nth-child(2):last-child),
  .tournament-hero .join-summary:has(> :nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tournament-hero .join-summary .join-count,
  .tournament-hero .join-summary > .join-metric,
  .tournament-hero .join-summary:has(> .join-metric:nth-child(2):last-child) > .join-metric,
  .tournament-hero .join-summary:has(> .join-metric:nth-child(4):last-child) > .join-metric:last-child {
    grid-column: auto;
    min-width: 0;
  }
  .tournament-hero .join-summary .join-count { display: flex; padding: 0; }
  .tournament-hero .join-summary .join-count a.pr-hero-link {
    box-sizing: border-box; display: flex; flex: 1 1 auto; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    min-width: 0; min-height: 56px; padding: 8px 2px;
    background: var(--surface); border: 1px solid var(--teal); border-radius: 10px;
    color: var(--teal); text-decoration: none;
  }
  .tournament-hero .join-summary .join-count a.pr-hero-link:hover,
  .tournament-hero .join-summary .join-count a.pr-hero-link:active {
    background: var(--surface-hover);
  }
  .tournament-hero .join-summary .join-count strong {
    font-size: 17px; line-height: 1.15; margin: 0; color: inherit;
    overflow-wrap: anywhere; max-width: 100%;
  }
  .tournament-hero .join-summary .join-count .join-count-label--desktop { display: none; }
  .tournament-hero .join-summary .join-count .join-count-label--mobile {
    display: block; font-size: 11px; line-height: 1.3; text-decoration: none;
    overflow-wrap: anywhere; max-width: 100%;
  }
  .tournament-hero .join-summary .join-metric { padding: 8px 2px; }
  .tournament-hero .join-metric-label,
  .tournament-hero .join-metric-detail { max-width: 100%; overflow-wrap: anywhere; }
}
@media (max-width: 340px) {
  .tournament-hero .join-summary:has(> :nth-child(3):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tournament-hero .join-summary:has(> :nth-child(3):last-child) > :last-child {
    grid-column: 1 / -1;
  }
}

/* Mobile/tablet audit 2026-11-27: clear registration alternative. */
@media(max-width:1100px) {
  .tournament-hero .join-form-alt a { display:inline-flex; align-items:center; justify-content:center; min-height:36px; padding:5px 10px; border:1px solid var(--surface-border); border-radius:8px; text-decoration:underline; white-space:normal; }
  .tournament-hero .join-form-alt a:focus-visible { outline:2px solid var(--teal); outline-offset:2px; }
}
