/* ============================================
   GLHF Tournaments - Правила турнірів (кнопка і модальне вікно)
   ============================================ */

/* --- Кнопка в нижньому рядку картки турніру: спокійна, без власної панелі --- */
#glhf-wrapper button.glhf-rules-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    margin: 0;
    padding: 0.725rem 0.95rem 0.725rem 0.8rem;
    /* .glhf-tournament-content button forces its own top/bottom with !important */
    padding-top: 0.725rem !important;
    padding-bottom: 0.725rem !important;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    color: var(--glhf-text-secondary);
    font-family: var(--glhf-font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    box-shadow: none;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
#glhf-wrapper button.glhf-rules-trigger:hover {
    background: rgba(var(--glhf-accent-rgb), 0.06);
    border-color: var(--glhf-border-bright);
    color: var(--glhf-text-primary);
    box-shadow: none;
}
#glhf-wrapper button.glhf-rules-trigger:focus-visible {
    outline: 2px solid var(--glhf-accent);
    outline-offset: 2px;
}
.glhf-rules-trigger-ico {
    display: grid;
    color: var(--glhf-accent);
    opacity: 0.85;
}
.glhf-rules-trigger-ico .glhf-rules-ico {
    width: 15px;
    height: 15px;
}
/* The heading font sits low in its line box: lift the caps to the optical centre */
.glhf-rules-trigger-text {
    position: relative;
    top: -0.05em;
}

/* --- Модальне вікно --- */
body.glhf-rules-open {
    overflow: hidden;
}
.glhf-rules[hidden] {
    display: none;
}
.glhf-rules {
    --rules-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --rules-ease-in: cubic-bezier(0.5, 0, 0.75, 0);
    position: fixed;
    inset: 0;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 3vw, 32px);
    color: var(--glhf-text-primary);
    font-family: var(--glhf-font-body);
}
.glhf-rules-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(var(--glhf-accent-rgb), 0.08), transparent 60%), rgba(3, 6, 9, 0.78);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.glhf-rules-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1120px, 100%);
    height: min(880px, 100%);
    background:
        radial-gradient(900px 340px at 0% 0%, rgba(var(--glhf-accent-rgb), 0.07), transparent 70%),
        linear-gradient(180deg, #10161c 0%, #0b1015 100%);
    border: 1px solid var(--glhf-border);
    border-radius: var(--glhf-radius-lg);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    overflow: hidden;
    outline: none;
    opacity: 0;
    transform: translateY(26px) scale(0.965);
    transition: opacity 0.35s ease, transform 0.5s var(--rules-ease-out);
}
.glhf-rules.is-open .glhf-rules-backdrop { opacity: 1; }
.glhf-rules.is-open .glhf-rules-dialog { opacity: 1; transform: none; }

.glhf-rules.is-closing .glhf-rules-backdrop {
    opacity: 0;
    transition: opacity 0.28s ease 0.04s;
}
.glhf-rules.is-closing .glhf-rules-dialog {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.28s var(--rules-ease-in);
}

/* Вміст з'являється трохи пізніше за саме вікно */
.glhf-rules-head-text,
.glhf-rules-nav li,
.glhf-rules-section {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.45s ease, transform 0.55s var(--rules-ease-out);
}
.glhf-rules.is-open .glhf-rules-head-text,
.glhf-rules.is-open .glhf-rules-nav li,
.glhf-rules.is-open .glhf-rules-section {
    opacity: 1;
    transform: none;
}
.glhf-rules.is-open .glhf-rules-head-text { transition-delay: 0.08s; }
.glhf-rules.is-open .glhf-rules-section:nth-child(1) { transition-delay: 0.14s; }
.glhf-rules.is-open .glhf-rules-section:nth-child(2) { transition-delay: 0.2s; }
.glhf-rules.is-open .glhf-rules-section:nth-child(n+3) { transition-delay: 0.26s; }
.glhf-rules.is-open .glhf-rules-nav li { transition-delay: calc(0.1s + var(--i, 0) * 0.025s); }
.glhf-rules.is-closing .glhf-rules-head-text,
.glhf-rules.is-closing .glhf-rules-nav li,
.glhf-rules.is-closing .glhf-rules-section {
    transition: none;
}

.glhf-rules-ico {
    display: block;
    width: 20px;
    height: 20px;
}

/* --- Шапка --- */
.glhf-rules-head {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 1.4rem 1.6rem 1.3rem;
    border-bottom: 1px solid var(--glhf-border);
}
.glhf-rules-head-mark {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(var(--glhf-accent-rgb), 0.22), rgba(var(--glhf-accent-rgb), 0.05));
    box-shadow: inset 0 0 0 1px rgba(var(--glhf-accent-rgb), 0.35), 0 10px 30px -12px rgba(var(--glhf-accent-rgb), 0.6);
    color: var(--glhf-accent);
}
.glhf-rules-head-mark .glhf-rules-ico {
    width: 26px;
    height: 26px;
}
.glhf-rules-head-text {
    flex: 1 1 auto;
    min-width: 0;
}
.glhf-rules .glhf-rules-head h2 {
    margin: 0;
    font-family: var(--glhf-font-heading);
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--glhf-text-primary);
    position: relative;
    top: 0.12em;
}
.glhf-rules-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
    margin-top: 0.65rem;
    font-size: 0.8rem;
    color: var(--glhf-text-muted);
}
.glhf-rules-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.glhf-rules-meta .glhf-rules-ico {
    width: 14px;
    height: 14px;
    color: var(--glhf-text-secondary);
}
.glhf-rules button.glhf-rules-close {
    flex: 0 0 auto;
    align-self: flex-start;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--glhf-text-secondary);
    cursor: pointer;
    box-shadow: none;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.glhf-rules button.glhf-rules-close:hover {
    color: var(--glhf-text-primary);
    border-color: var(--glhf-border-bright);
    background: rgba(var(--glhf-accent-rgb), 0.08);
}
.glhf-rules button.glhf-rules-close:focus-visible,
.glhf-rules button.glhf-rules-ok:focus-visible,
.glhf-rules-nav a:focus-visible {
    outline: 2px solid var(--glhf-accent);
    outline-offset: 2px;
}
.glhf-rules-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    overflow: hidden;
}
.glhf-rules-progress i {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, rgba(var(--glhf-accent-rgb), 0.4), var(--glhf-accent));
    box-shadow: 0 0 12px var(--glhf-accent-glow);
    transform-origin: 0 50%;
    transform: scaleX(var(--rules-progress, 0));
}

/* --- Тіло: навігація + текст --- */
.glhf-rules-main {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 270px 1fr;
}
.glhf-rules-nav {
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 0.75rem 1.25rem;
    border-right: 1px solid rgba(var(--glhf-accent-rgb), 0.08);
    background: rgba(0, 0, 0, 0.18);
    scrollbar-width: none;
}
.glhf-rules-nav::-webkit-scrollbar { display: none; }
.glhf-rules-nav ol {
    margin: 0;
    padding: 0;
    list-style: none;
}
.glhf-rules-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.7rem;
    border-radius: 10px;
    color: var(--glhf-text-secondary);
    font-size: 0.86rem;
    line-height: 1.25;
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
}
.glhf-rules-nav a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 0;
    border-radius: 3px;
    background: var(--glhf-accent);
    box-shadow: 0 0 10px var(--glhf-accent-glow);
    transform: translateY(-50%);
    transition: height 0.3s var(--rules-ease-out);
}
.glhf-rules-nav a:hover {
    color: var(--glhf-text-primary);
    background: rgba(255, 255, 255, 0.03);
}
.glhf-rules-nav a.is-active {
    color: var(--glhf-text-primary);
    background: rgba(var(--glhf-accent-rgb), 0.08);
}
.glhf-rules-nav a.is-active::before {
    height: 60%;
}
.glhf-rules-nav-num {
    flex: 0 0 auto;
    font-family: var(--glhf-font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--glhf-text-muted);
    min-width: 1.4rem;
    transition: color 0.2s ease;
}
.glhf-rules-nav a.is-active .glhf-rules-nav-num {
    color: var(--glhf-accent);
}

.glhf-rules-content {
    position: relative;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.5rem clamp(1.1rem, 3vw, 2.6rem) 0;
    scroll-padding-top: 1rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--glhf-accent-rgb), 0.3) transparent;
}
.glhf-rules-content::-webkit-scrollbar { width: 8px; }
.glhf-rules-content::-webkit-scrollbar-thumb {
    background: rgba(var(--glhf-accent-rgb), 0.25);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* --- Розділ --- */
.glhf-rules-section {
    padding: 1.8rem 0 0.4rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
    scroll-margin-top: 0.5rem;
}
.glhf-rules-section:last-of-type {
    border-bottom: 0;
}
.glhf-rules-section-head {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}
.glhf-rules-section-ico {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(var(--glhf-accent-rgb), 0.1);
    box-shadow: inset 0 0 0 1px rgba(var(--glhf-accent-rgb), 0.2);
    color: var(--glhf-accent);
}
.glhf-rules-section-num {
    font-family: var(--glhf-font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--glhf-text-muted);
    letter-spacing: 1px;
    position: relative;
    top: 0.12em;
}
.glhf-rules .glhf-rules-section h3 {
    margin: 0;
    font-family: var(--glhf-font-heading);
    font-size: clamp(1.02rem, 1.6vw, 1.22rem);
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--glhf-text-primary);
    position: relative;
    top: 0.12em;
}
.glhf-rules-section-body {
    font-size: 0.94rem;
    line-height: 1.65;
    color: var(--glhf-text-secondary);
}
.glhf-rules-section-body p {
    margin: 0 0 0.9rem;
}
.glhf-rules-section-body b {
    color: var(--glhf-text-primary);
    font-weight: 600;
}
.glhf-rules-section-body code,
.glhf-rules-end code {
    padding: 0.08em 0.45em;
    border-radius: 6px;
    background: rgba(var(--glhf-discord-rgb), 0.16);
    color: #c9cdff;
    font-family: var(--glhf-font-mono);
    font-size: 0.88em;
    font-weight: 700;
}
.glhf-rules-lead {
    font-size: 1rem;
    color: var(--glhf-text-primary);
}
.glhf-rules-sub {
    margin: 1.3rem 0 0.6rem;
    font-family: var(--glhf-font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--glhf-accent);
}
.glhf-rules-fc {
    display: inline-block;
    width: 15px;
    height: auto;
    vertical-align: -2px;
}

/* Списки */
.glhf-rules-list {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}
.glhf-rules-list li {
    position: relative;
    padding: 0.32rem 0 0.32rem 1.55rem;
}
.glhf-rules-list li::before {
    content: "";
    position: absolute;
    left: 0.3rem;
    top: 0.95em;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    background: var(--glhf-accent);
    box-shadow: 0 0 8px rgba(var(--glhf-accent-rgb), 0.5);
    transform: rotate(45deg);
}
.glhf-rules-list.is-cross li::before {
    left: 0.15rem;
    top: 0.62em;
    width: 12px;
    height: 12px;
    border-radius: 0;
    background: none;
    box-shadow: none;
    transform: none;
    background-image: linear-gradient(45deg, transparent 43%, #ff5a6a 43%, #ff5a6a 57%, transparent 57%), linear-gradient(-45deg, transparent 43%, #ff5a6a 43%, #ff5a6a 57%, transparent 57%);
}

/* Кроки реєстрації */
.glhf-rules-steps {
    counter-reset: rules-step;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 0 0 1.1rem;
    padding: 0;
    list-style: none;
}
.glhf-rules-steps li {
    counter-increment: rules-step;
    position: relative;
    padding: 2.6rem 0.9rem 0.9rem;
    border: 1px solid rgba(var(--glhf-accent-rgb), 0.14);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.86rem;
    line-height: 1.45;
}
.glhf-rules-steps li::before {
    content: counter(rules-step);
    position: absolute;
    top: 0.8rem;
    left: 0.9rem;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--glhf-accent);
    color: var(--glhf-bg-primary);
    font-family: var(--glhf-font-heading);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    padding-top: 0.15em;
}
.glhf-rules-steps li b {
    display: block;
}

/* Коротко: плитки */
.glhf-rules-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 0.4rem 0 1.2rem;
}
.glhf-rules-fact {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.85rem 0.9rem;
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(var(--glhf-accent-rgb), 0.08), rgba(255, 255, 255, 0.015));
    border: 1px solid rgba(var(--glhf-accent-rgb), 0.14);
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.glhf-rules-fact:hover {
    border-color: rgba(var(--glhf-accent-rgb), 0.35);
    transform: translateY(-1px);
}
.glhf-rules-fact-val {
    font-family: var(--glhf-font-heading);
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--glhf-text-primary);
    line-height: 1.15;
    position: relative;
    top: 0.1em;
}
.glhf-rules-fact-lbl {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--glhf-text-muted);
}

/* Вето */
.glhf-rules-veto {
    margin: 0.3rem 0 1.2rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.22);
}
.glhf-rules-veto-head {
    margin-bottom: 0.8rem;
    font-family: var(--glhf-font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--glhf-text-muted);
}
.glhf-rules-veto-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 0.65rem;
}
.glhf-rules-veto-fmt {
    flex: 0 0 auto;
    width: 46px;
    padding: 0.42rem 0 0.3rem;
    border-radius: 8px;
    background: rgba(var(--glhf-accent-rgb), 0.14);
    color: var(--glhf-accent);
    font-family: var(--glhf-font-heading);
    font-size: 0.74rem;
    font-weight: 800;
    text-align: center;
}
.glhf-rules-veto-row ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.glhf-rules-veto-step {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.78rem;
    color: var(--glhf-text-secondary);
    white-space: nowrap;
}
.glhf-rules-veto-step b {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    font-family: var(--glhf-font-heading);
    font-size: 0.66rem;
    line-height: 1;
    padding-top: 0.12em;
    color: var(--glhf-bg-primary);
}
.glhf-rules-veto-step.side-a b { background: #4ea8ff; }
.glhf-rules-veto-step.side-b b { background: #ffb547; }
.glhf-rules-veto-step.is-ban span { color: #ff8a96; }
.glhf-rules-veto-step.is-pick { border-color: rgba(var(--glhf-accent-rgb), 0.35); background: rgba(var(--glhf-accent-rgb), 0.08); }
.glhf-rules-veto-step.is-pick span { color: var(--glhf-accent); font-weight: 600; }
.glhf-rules-veto-step.is-left { border-style: dashed; }
.glhf-rules-veto-step.is-left span { color: var(--glhf-text-primary); font-weight: 600; }
.glhf-rules-veto-note {
    margin: 0.4rem 0 0 !important;
    font-size: 0.8rem;
    color: var(--glhf-text-muted);
}

/* Таблиця пауз */
.glhf-rules-table-wrap {
    margin: 0 0 1rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    overflow-x: auto;
}
.glhf-rules-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.glhf-rules-table th {
    padding: 0.7rem 1rem 0.55rem;
    background: rgba(var(--glhf-accent-rgb), 0.07);
    font-family: var(--glhf-font-heading);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-align: left;
    text-transform: uppercase;
    color: var(--glhf-text-muted);
}
.glhf-rules-table td {
    padding: 0.7rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--glhf-text-primary);
}
.glhf-rules-table tr.is-limit td {
    color: var(--glhf-text-secondary);
    background: rgba(255, 255, 255, 0.015);
}
.glhf-rules-table tr.is-limit td:not(:first-child) {
    color: var(--glhf-accent);
    font-weight: 600;
}
.glhf-rules-pill {
    display: inline-block;
    padding: 0.22rem 0.55rem 0.1rem;
    border-radius: 6px;
    background: var(--glhf-accent);
    color: var(--glhf-bg-primary);
    font-family: var(--glhf-font-heading);
    font-size: 0.72rem;
    font-weight: 800;
}

/* Виноски */
.glhf-rules-callout {
    display: flex;
    gap: 0.75rem;
    margin: 0.4rem 0 1.2rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 152, 0, 0.28);
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.1), rgba(255, 152, 0, 0.02));
    color: var(--glhf-text-primary);
    font-size: 0.9rem;
    line-height: 1.55;
}
.glhf-rules-callout > .glhf-rules-ico {
    flex: 0 0 auto;
    margin-top: 0.1rem;
    color: var(--glhf-warning);
}
.glhf-rules-callout.is-info {
    border-color: rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.02));
}
.glhf-rules-callout.is-info > .glhf-rules-ico { color: #7cb3ff; }
.glhf-rules-callout.is-safety {
    border-color: rgba(var(--glhf-accent-rgb), 0.3);
    background: linear-gradient(135deg, rgba(var(--glhf-accent-rgb), 0.11), rgba(var(--glhf-accent-rgb), 0.02));
}
.glhf-rules-callout.is-safety > .glhf-rules-ico { color: var(--glhf-accent); }

/* Сходинки санкцій */
.glhf-rules-ladder {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem;
    margin: 0.2rem 0 1.2rem;
}
.glhf-rules-ladder-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 152, 0, 0.22);
    background: rgba(255, 152, 0, 0.06);
    color: var(--glhf-text-primary);
    font-size: 0.82rem;
    line-height: 1.3;
}
.glhf-rules-ladder-step span {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 152, 0, 0.9);
    color: var(--glhf-bg-primary);
    font-family: var(--glhf-font-heading);
    font-size: 0.7rem;
    font-weight: 800;
    padding-top: 0.12em;
}
.glhf-rules-ladder-step.is-hot {
    border-color: rgba(255, 90, 106, 0.35);
    background: rgba(255, 90, 106, 0.08);
}
.glhf-rules-ladder-step.is-hot span { background: #ff5a6a; }
.glhf-rules-ladder-step.is-max {
    border-color: rgba(255, 90, 106, 0.55);
    background: linear-gradient(135deg, rgba(255, 90, 106, 0.18), rgba(255, 90, 106, 0.05));
}
.glhf-rules-ladder-step.is-max span { background: #ff2d47; color: #fff; }

/* Розклад */
.glhf-rules-timeline {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
    margin: 0.2rem 0 1.1rem;
}
.glhf-rules-time {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.02);
}
.glhf-rules-time-at {
    font-family: var(--glhf-font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--glhf-text-primary);
    position: relative;
    top: 0.1em;
}
.glhf-rules-time-what {
    display: flex;
    flex-direction: column;
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--glhf-text-muted);
}
.glhf-rules-time-what b {
    font-size: 0.9rem;
    color: var(--glhf-text-primary);
}
.glhf-rules-time.is-live {
    border-color: rgba(255, 60, 80, 0.3);
    background: linear-gradient(135deg, rgba(255, 60, 80, 0.1), rgba(255, 60, 80, 0.02));
}
.glhf-rules-time.is-live .glhf-rules-time-what b::after {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 0.45rem;
    border-radius: 50%;
    background: #ff3c50;
    box-shadow: 0 0 0 0 rgba(255, 60, 80, 0.6);
    vertical-align: 1px;
    animation: glhfRulesLive 1.8s ease-out infinite;
}
@keyframes glhfRulesLive {
    0%   { box-shadow: 0 0 0 0 rgba(255, 60, 80, 0.55); }
    80%, 100% { box-shadow: 0 0 0 7px rgba(255, 60, 80, 0); }
}

/* Кінець документа */
.glhf-rules-end {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.2rem calc(-1 * clamp(1.1rem, 3vw, 2.6rem)) 0;
    padding: 1rem clamp(1.1rem, 3vw, 2.6rem);
    border-top: 1px solid var(--glhf-border);
    background: linear-gradient(180deg, rgba(11, 16, 21, 0.85), #0b1015 40%);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.glhf-rules-end p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--glhf-text-muted);
}
.glhf-rules button.glhf-rules-ok {
    flex: 0 0 auto;
    margin: 0;
    padding: 0.75rem 1.6rem 0.55rem;
    border: 0;
    border-radius: var(--glhf-radius-sm);
    background: var(--glhf-accent);
    color: var(--glhf-bg-primary);
    font-family: var(--glhf-font-heading);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 8px 24px -10px var(--glhf-accent-glow);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.glhf-rules button.glhf-rules-ok:hover {
    background: var(--glhf-accent-hover);
    box-shadow: 0 10px 30px -8px var(--glhf-accent-glow);
    transform: translateY(-1px);
}

/* --- Планшет --- */
@media (max-width: 960px) {
    .glhf-rules-main { grid-template-columns: 220px 1fr; }
    .glhf-rules-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .glhf-rules-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .glhf-rules-ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* --- Телефон: вікно виїжджає знизу, розділи - горизонтальна стрічка --- */
@media (max-width: 720px) {
    .glhf-rules {
        align-items: flex-end;
        padding: 0;
    }
    .glhf-rules-dialog {
        width: 100%;
        height: calc(100% - 16px);
        border-radius: 20px 20px 0 0;
        border-bottom: 0;
        transform: translateY(100%);
        opacity: 1;
        transition: transform 0.5s var(--rules-ease-out);
    }
    .glhf-rules.is-closing .glhf-rules-dialog {
        opacity: 1;
        transform: translateY(100%);
        transition: transform 0.32s var(--rules-ease-in);
    }
    .glhf-rules-dialog::before {
        content: "";
        position: absolute;
        top: 7px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 4px;
        background: rgba(255, 255, 255, 0.14);
    }
    .glhf-rules-head {
        gap: 0.8rem;
        padding: 1.3rem 1rem 1rem;
    }
    .glhf-rules-head-mark { width: 44px; height: 44px; border-radius: 12px; }
    .glhf-rules-head-mark .glhf-rules-ico { width: 22px; height: 22px; }
    .glhf-rules-meta { margin-top: 0.45rem; font-size: 0.74rem; }
    .glhf-rules-main {
        display: flex;
        flex-direction: column;
    }
    .glhf-rules-nav {
        flex: 0 0 auto;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.6rem 1rem;
        border-right: 0;
        border-bottom: 1px solid rgba(var(--glhf-accent-rgb), 0.08);
        -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent);
        mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 24px), transparent);
    }
    .glhf-rules-nav ol {
        display: flex;
        gap: 0.4rem;
        width: max-content;
    }
    .glhf-rules-nav a {
        padding: 0.42rem 0.75rem;
        border: 1px solid rgba(255, 255, 255, 0.07);
        border-radius: 999px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    .glhf-rules-nav a::before { display: none; }
    .glhf-rules-nav a.is-active {
        border-color: rgba(var(--glhf-accent-rgb), 0.45);
    }
    .glhf-rules-nav-num { min-width: 0; }
    .glhf-rules-content { flex: 1 1 auto; }
    .glhf-rules-section { padding-top: 1.4rem; }
    .glhf-rules-section-body { font-size: 0.92rem; }
    .glhf-rules-steps { grid-template-columns: 1fr; }
    .glhf-rules-steps li { padding: 0.75rem 0.9rem 0.75rem 3rem; }
    .glhf-rules-steps li::before { top: 50%; transform: translateY(-50%); }
    .glhf-rules-steps li b { display: inline; }
    .glhf-rules-timeline { grid-template-columns: 1fr; }
    /* На телефоні місця мало: підсумок і кнопка - лише в кінці тексту */
    .glhf-rules-end {
        position: static;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        margin-top: 1.6rem;
        background: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding-bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
    }
    .glhf-rules .glhf-rules-head h2 { font-size: 1.3rem; }
    .glhf-rules-table { font-size: 0.82rem; }
    .glhf-rules-table th { padding: 0.6rem 0.6rem 0.45rem; font-size: 0.62rem; letter-spacing: 0.8px; }
    .glhf-rules-table td { padding: 0.6rem; }
}
@media (max-width: 420px) {
    .glhf-rules-head-mark { display: none; }
    .glhf-rules-meta span + span { display: none; }
    .glhf-rules-facts { gap: 0.45rem; }
    .glhf-rules-fact { padding: 0.7rem; }
    .glhf-rules-ladder { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .glhf-rules-dialog,
    .glhf-rules.is-closing .glhf-rules-dialog,
    .glhf-rules-head-text,
    .glhf-rules-nav li,
    .glhf-rules-section {
        transform: none !important;
        transition: opacity 0.2s ease !important;
    }
    .glhf-rules-time.is-live .glhf-rules-time-what b::after { animation: none; }
}
