/* ==========================================================================
   URAL OPEN CUP 2027 — REGULATIONS (ПОЛОЖЕНИЕ) STYLES
   Brutalist Document Theater: Vertical TOC (Left), Canvas (Center), Actions (Right)
   ========================================================================== */

.rules-main {
  padding: 0;
  background: #060608;
  color: #f0eeeb;
}

.rules-main > .wrap {
  max-width: none;
  padding: 0;
}

.rules-page {
  --rules-red: #f24946;
  --rules-yellow: #f5d548;
  --rules-dark: #0a0a0d;
  --rules-panel: #101015;
  --rules-border: rgba(255, 255, 255, 0.12);
  --rules-muted: #8c8985;
}

/* --------------------------------------------------------------------------
   01. COVER / HERO
   -------------------------------------------------------------------------- */
.rules-cover {
  position: relative;
  background: #000000;
  color: #ffffff;
  border-bottom: 1px solid var(--rules-border);
  overflow: hidden;
  padding-block: clamp(48px, 6vw, 76px) clamp(40px, 5vw, 60px);
}

.rules-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 73, 70, 0.03) 0%, transparent 60%);
  background-size: 24px 24px, 100% 100%;
  pointer-events: none;
}

.rules-cover-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  align-items: center;
  gap: clamp(28px, 4vw, 56px);
  position: relative;
  z-index: 1;
}

.rules-cover-copy {
  max-width: 720px;
}

.rules-overline,
.rules-sec-kicker,
.metric-tag,
.rules-viewer-topline,
.sidebar-box-head,
.sidebar-box-label,
.rules-counter-v,
.rules-side-btn,
.rules-card-kicker,
.rules-updated-note {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.rules-overline {
  display: block;
  color: var(--rules-red);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 16px;
}

#rules-title {
  font-size: clamp(3.2rem, 7.8vw, 7.2rem);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: -0.07em;
  margin: 0 0 20px;
  color: #ffffff;
}

#rules-title span {
  color: var(--rules-red);
}

.rules-lead {
  font-size: clamp(1rem, 1.45vw, 1.25rem);
  line-height: 1.5;
  color: #c7c5c2;
  margin: 0;
}

.rules-cover-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.btn-rules-dl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 18px 22px;
  background: var(--rules-red);
  color: #ffffff !important;
  text-decoration: none !important;
  border: 2px solid var(--rules-red);
  box-shadow: 0 8px 28px rgba(242, 73, 70, 0.32);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn-rules-dl:hover {
  background: #ffffff;
  color: #000000 !important;
  border-color: #ffffff;
  transform: translateY(-2px);
}

.btn-dl-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.92;
  letter-spacing: 0.06em;
}

.btn-dl-text {
  font-size: 1.22rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.btn-dl-sub {
  font-size: 0.76rem;
  opacity: 0.82;
}

.btn-rules-ext {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono, monospace);
  font-size: 0.76rem;
  font-weight: 700;
  color: #a4a29e !important;
  text-decoration: none !important;
  padding: 10px 16px;
  border: 1px solid var(--rules-border);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.16s ease;
}

.btn-rules-ext:hover {
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
}

/* --------------------------------------------------------------------------
   02. KEY METRICS BAND
   -------------------------------------------------------------------------- */
.rules-metrics-band {
  background: #0a0a0e;
  border-bottom: 1px solid var(--rules-border);
  padding-block: 22px;
}

.rules-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.rules-metric-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 16px;
  border-left: 2px solid rgba(255, 255, 255, 0.16);
}

.rules-metric-card:first-child {
  border-left-color: var(--rules-red);
}

.metric-tag {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--rules-red);
}

.metric-value {
  font-size: clamp(1.1rem, 1.7vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  white-space: nowrap;
}

.metric-note {
  font-size: 0.78rem;
  color: var(--rules-muted);
}

/* --------------------------------------------------------------------------
   03. THEATER DOCUMENT VIEWER (3-COLUMN LAYOUT)
   -------------------------------------------------------------------------- */
.rules-viewer-wrap {
  background: #060609;
  padding-block: clamp(32px, 5vw, 60px);
  border-bottom: 1px solid var(--rules-border);
}

.rules-viewer-inner {
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* Topline Header */
.rules-viewer-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--rules-border);
  font-size: 0.74rem;
  color: #b5b3af;
}

.rules-viewer-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
}

.viewer-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rules-red);
  box-shadow: 0 0 10px var(--rules-red);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.tag-sub {
  color: var(--rules-muted);
  font-size: 0.7rem;
  padding-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.rules-viewer-pagemeta {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--rules-yellow);
  font-weight: 700;
}

/* 3-Column Theater Grid */
.rules-theater-layout {
  display: grid;
  grid-template-columns: 215px minmax(0, 1fr) 200px;
  gap: 16px;
  align-items: start;
}

/* LEFT SIDEBAR: Vertical TOC */
.rules-sidebar-toc {
  background: var(--rules-panel);
  border: 1px solid var(--rules-border);
  display: flex;
  flex-direction: column;
  max-height: 84vh;
  position: sticky;
  top: 76px;
}

.sidebar-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #16161d;
  border-bottom: 1px solid var(--rules-border);
  font-size: 0.69rem;
  font-weight: 700;
  color: #8c8985;
}

.sidebar-box-head small {
  color: var(--rules-red);
  font-weight: 700;
}

.rules-toc-vertical {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.rules-toc-vertical::-webkit-scrollbar {
  width: 4px;
}

.rules-toc-vertical::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.rules-toc-vbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  color: #9f9d98;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.14s ease;
}

.rules-toc-vbtn:hover {
  background: #1d1d25;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.16);
}

.rules-toc-vbtn.is-active {
  background: #241215;
  color: #ffffff;
  border-color: var(--rules-red);
  font-weight: 700;
}

.vbtn-num {
  color: var(--rules-red);
  font-weight: 700;
  font-size: 0.72rem;
  min-width: 18px;
}

.vbtn-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* CENTER: Slide Canvas + Micro-Thumbnails */
.rules-stage-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.rules-stage-container {
  position: relative;
  background: #000000;
  border: 1px solid var(--rules-border);
  min-height: 540px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.85);
}

.rules-click-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  z-index: 5;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  outline: none;
}

.zone-left { left: 0; cursor: w-resize; }
.zone-right { right: 0; cursor: e-resize; }

.rules-stage-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 44px;
  height: 44px;
  background: rgba(14, 14, 18, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.arrow-left { left: 14px; }
.arrow-right { right: 14px; }

.rules-stage-arrow:hover:not(:disabled) {
  background: var(--rules-red);
  border-color: var(--rules-red);
  color: #ffffff;
  transform: translateY(-50%) scale(1.06);
}

.rules-stage-arrow:disabled {
  opacity: 0.15;
  cursor: not-allowed;
}

.rules-slides-deck {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  position: relative;
  z-index: 2;
}

.rules-slide-item {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.rules-slide-item.is-active {
  display: flex;
  animation: fadeInSlide 0.15s ease forwards;
}

@keyframes fadeInSlide {
  from { opacity: 0; transform: scale(0.995); }
  to { opacity: 1; transform: scale(1); }
}

.rules-slide-sheet {
  width: auto;
  max-width: 100%;
  background: #0e0e12;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.rules-slide-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  display: block;
}

/* Micro-Thumbnails Ribbon (3x smaller!) */
.rules-micro-thumbs-bar {
  padding: 6px 10px;
  background: var(--rules-panel);
  border: 1px solid var(--rules-border);
}

.rules-thumbs-track {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  align-items: center;
}

.rules-thumbs-track::-webkit-scrollbar {
  height: 3px;
}

.rules-thumbs-track::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.rules-micro-thumb {
  background: transparent;
  border: 1px solid transparent;
  padding: 2px;
  cursor: pointer;
  flex: 0 0 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0.55;
  transition: all 0.14s ease;
}

.rules-micro-thumb:hover {
  opacity: 0.95;
}

.rules-micro-thumb.is-active {
  opacity: 1;
  border-color: var(--rules-red);
  background: rgba(242, 73, 70, 0.12);
}

.micro-thumb-preview {
  width: 22px;
  height: 31px;
  background: #1c1c22;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.micro-thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.micro-thumb-index {
  font-family: var(--font-mono, monospace);
  font-size: 0.58rem;
  font-weight: 700;
  color: #b5b3ae;
}

/* RIGHT SIDEBAR: Actions, Nav, Hotkeys */
.rules-sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 76px;
}

.rules-action-box {
  background: var(--rules-panel);
  border: 1px solid var(--rules-border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-box-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--rules-red);
}

.rules-counter-v {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--rules-muted);
  text-align: center;
  padding-block: 4px;
}

.rules-counter-v strong {
  color: #ffffff;
  font-size: 1.15rem;
}

.rules-v-nav-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.rules-side-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--rules-border);
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.btn-side-prev,
.btn-side-next {
  background: #181820;
  color: #ffffff;
}

.btn-side-prev:hover:not(:disabled),
.btn-side-next:hover:not(:disabled) {
  background: var(--rules-red);
  border-color: var(--rules-red);
  color: #ffffff;
}

.btn-side-prev:disabled,
.btn-side-next:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.btn-side-fs {
  background: #1c1c24;
  color: #ffffff;
}

.btn-side-fs:hover {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
}

.btn-side-pdf {
  background: var(--rules-red);
  color: #ffffff !important;
  border-color: var(--rules-red);
  flex-direction: column;
  padding: 11px 10px;
  gap: 2px;
}

.btn-side-pdf:hover {
  background: var(--rules-yellow);
  color: #000000 !important;
  border-color: var(--rules-yellow);
}

.btn-side-pdf small {
  font-size: 0.65rem;
  opacity: 0.85;
}

.btn-side-docs {
  background: rgba(255, 255, 255, 0.04);
  color: #a4a29e !important;
  font-size: 0.68rem;
}

.btn-side-docs:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3);
}

.side-hotkey-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  color: #7a7874;
}

.side-hotkey-list div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.side-hotkey-list code {
  background: #171720;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #dcdad6;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 0.66rem;
}

/* --------------------------------------------------------------------------
   FULLSCREEN MODE — UNCOMPROMISED HEIGHT FOR SLIDE
   -------------------------------------------------------------------------- */
:fullscreen#rules-viewer,
.rules-viewer-wrap.is-fullscreen-custom {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  z-index: 999999 !important;
  background: #020204 !important;
  padding: 8px 14px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  overflow: hidden !important;
}

:fullscreen#rules-viewer .rules-viewer-inner,
.rules-viewer-wrap.is-fullscreen-custom .rules-viewer-inner {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  max-width: none !important;
  padding: 0 !important;
}

:fullscreen#rules-viewer .rules-viewer-topline,
.rules-viewer-wrap.is-fullscreen-custom .rules-viewer-topline {
  margin-bottom: 6px !important;
  padding-bottom: 4px !important;
}

:fullscreen#rules-viewer .rules-theater-layout,
.rules-viewer-wrap.is-fullscreen-custom .rules-theater-layout {
  flex: 1 1 auto !important;
  height: calc(100vh - 44px) !important;
  display: grid !important;
  grid-template-columns: 200px minmax(0, 1fr) 180px !important;
  gap: 12px !important;
  align-items: stretch !important;
}

:fullscreen#rules-viewer .rules-sidebar-toc,
.rules-viewer-wrap.is-fullscreen-custom .rules-sidebar-toc {
  height: 100% !important;
  max-height: none !important;
  position: static !important;
}

:fullscreen#rules-viewer .rules-stage-column,
.rules-viewer-wrap.is-fullscreen-custom .rules-stage-column {
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

:fullscreen#rules-viewer .rules-stage-container,
.rules-viewer-wrap.is-fullscreen-custom .rules-stage-container {
  flex: 1 1 auto !important;
  height: 100% !important;
  min-height: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

:fullscreen#rules-viewer .rules-slide-image,
.rules-viewer-wrap.is-fullscreen-custom .rules-slide-image {
  max-height: calc(100vh - 94px) !important;
  object-fit: contain !important;
}

:fullscreen#rules-viewer .rules-micro-thumbs-bar,
.rules-viewer-wrap.is-fullscreen-custom .rules-micro-thumbs-bar {
  padding: 3px 8px !important;
}

:fullscreen#rules-viewer .rules-sidebar-actions,
.rules-viewer-wrap.is-fullscreen-custom .rules-sidebar-actions {
  height: 100% !important;
  position: static !important;
  justify-content: space-between !important;
}

body.rules-lock-scroll {
  overflow: hidden !important;
}

/* --------------------------------------------------------------------------
   04. SUMMARY OF REGULATIONS / HIGHLIGHTS
   -------------------------------------------------------------------------- */
.rules-summary-section {
  padding-block: clamp(56px, 7vw, 90px);
  background: #08080b;
  border-bottom: 1px solid var(--rules-border);
}

.rules-summary-head {
  max-width: 680px;
  margin-bottom: 36px;
}

.rules-sec-kicker {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--rules-red);
  margin-bottom: 12px;
}

.rules-summary-head h2,
.rules-prose-head h2,
.rules-bottom-copy h2 {
  font-size: clamp(2.2rem, 4.8vw, 3.8rem);
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1;
  margin: 0 0 12px;
  color: #ffffff;
}

.rules-summary-head h2 span,
.rules-prose-head h2 span {
  color: var(--rules-red);
}

.rules-summary-head p {
  color: var(--rules-muted);
  font-size: 1.05rem;
  margin: 0;
}

.rules-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.rules-card {
  position: relative;
  background: #0f0f14;
  border: 1px solid var(--rules-border);
  padding: clamp(24px, 3.5vw, 36px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.18s ease;
}

.rules-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.rules-card-index {
  position: absolute;
  top: 18px;
  right: 22px;
  font-family: var(--font-mono, monospace);
  font-size: 2.4rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.06);
  line-height: 1;
  pointer-events: none;
}

.rules-card-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--rules-red);
}

.rules-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  color: #ffffff;
}

.rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #bebdb8;
}

.rules-list li strong {
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   05. PROSE SECTION (DB TEXT BLOCK)
   -------------------------------------------------------------------------- */
.rules-prose-section {
  padding-block: clamp(48px, 6vw, 72px);
  background: #050507;
  border-bottom: 1px solid var(--rules-border);
}

.rules-prose-inner {
  max-width: 860px;
  margin-inline: auto;
}

.rules-prose-head {
  margin-bottom: 24px;
}

.rules-updated-note {
  margin-top: 28px;
  font-size: 0.72rem;
  color: var(--rules-muted);
}

/* --------------------------------------------------------------------------
   06. BOTTOM CTA
   -------------------------------------------------------------------------- */
.rules-bottom-cta {
  padding-block: clamp(50px, 6vw, 76px);
  background: #000000;
}

.rules-bottom-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
}

.rules-bottom-copy {
  max-width: 600px;
}

.rules-bottom-copy h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.8rem);
  margin-top: 10px;
}

.rules-bottom-copy p {
  color: var(--rules-muted);
  font-size: 1rem;
  margin: 0;
}

.rules-bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 280px;
}

/* Single Download PDF Display Logic */
.rules-mobile-only-dl {
  display: none !important;
}
.rules-desktop-only {
  display: inline-flex !important;
}
.rules-seo-prose {
  display: none !important;
}

/* Mobile Controls & Fullscreen Elements Default State */
.rules-mobile-tap-hint {
  display: none;
}
.rules-mobile-fs-close {
  display: none;
}
.rules-mobile-fs-bar {
  display: none;
}

/* --------------------------------------------------------------------------
   07. RESPONSIVE QUERIES
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .rules-theater-layout {
    grid-template-columns: 190px minmax(0, 1fr) 170px;
    gap: 12px;
  }
}

@media (max-width: 900px) and (min-width: 769px) {
  .rules-cover-inner {
    grid-template-columns: 1fr;
  }
  .rules-cover-actions {
    max-width: 400px;
  }
  .rules-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .rules-theater-layout {
    grid-template-columns: 1fr;
  }
  .rules-sidebar-toc {
    position: static;
    max-height: 220px;
  }
  .rules-sidebar-actions {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .rules-cards-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   MOBILE VERSION (≤ 768px):
   - Убираем ВСЕ лишние элементы управления (TOC, sidebar, thumbnails, hotkeys, arrows)
   - Полноэкранный режим по клику/тапу
   - Листание свайпами
   - Единственная кнопка Скачать PDF в шапке
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Переключение видимости кнопки скачивания: на мобильных она в шапке */
  .rules-mobile-only-dl {
    display: inline-flex !important;
  }
  .rules-desktop-only {
    display: none !important;
  }

  /* СКРЫВАЕМ ВСЕ ЛИШНИЕ ЭЛЕМЕНТЫ УПРАВЛЕНИЯ НА ТЕЛЕФОНЕ */
  .rules-sidebar-toc {
    display: none !important;
  }
  .rules-sidebar-actions {
    display: none !important;
  }
  .rules-micro-thumbs-bar {
    display: none !important;
  }
  .rules-stage-arrow {
    display: none !important;
  }
  .rules-click-zone {
    display: none !important;
  }
  .rules-side-hotkeys {
    display: none !important;
  }

  .rules-theater-layout {
    display: block !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .rules-stage-column {
    width: 100% !important;
    height: auto !important;
  }

  .rules-stage-container {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    cursor: pointer;
    border: 1px solid var(--rules-border);
    border-radius: 4px;
    background: #000;
  }

  .rules-slide-image {
    max-height: 72vh !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
  }

  /* Плашка-подсказка под слайдом */
  .rules-mobile-tap-hint {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 11px 14px;
    background: #111115;
    border: 1px solid var(--rules-border);
    border-radius: 4px;
    font-size: 0.74rem;
    color: #f7f5ef;
    cursor: pointer;
    transition: background 0.16s ease;
  }
  .rules-mobile-tap-hint:active {
    background: #1a1a20;
  }
  .mobile-hint-badge {
    font-weight: 800;
    color: var(--rules-gold);
    letter-spacing: 0.05em;
    white-space: nowrap;
  }
  .mobile-hint-text {
    color: #b5b3af;
    font-size: 0.71rem;
    text-align: right;
  }

  /* Полноэкранный режим на смартфонах */
  :fullscreen#rules-viewer,
  .rules-viewer-wrap.is-fullscreen-custom {
    padding: 0 !important;
    background: #000 !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    overflow: hidden !important;
  }

  :fullscreen#rules-viewer .rules-theater-layout,
  .rules-viewer-wrap.is-fullscreen-custom .rules-theater-layout {
    display: flex !important;
    flex-direction: column !important;
    height: 100vh !important;
    width: 100vw !important;
  }

  :fullscreen#rules-viewer .rules-stage-column,
  .rules-viewer-wrap.is-fullscreen-custom .rules-stage-column {
    height: 100% !important;
    width: 100% !important;
  }

  :fullscreen#rules-viewer .rules-stage-container,
  .rules-viewer-wrap.is-fullscreen-custom .rules-stage-container {
    height: 100vh !important;
    max-height: 100vh !important;
    aspect-ratio: auto !important;
    border: none !important;
    box-shadow: none !important;
  }

  :fullscreen#rules-viewer .rules-slide-image,
  .rules-viewer-wrap.is-fullscreen-custom .rules-slide-image {
    max-height: 100vh !important;
    height: 100vh !important;
    width: 100vw !important;
    object-fit: contain !important;
  }

  :fullscreen#rules-viewer .rules-viewer-topline,
  .rules-viewer-wrap.is-fullscreen-custom .rules-viewer-topline,
  :fullscreen#rules-viewer .rules-mobile-tap-hint,
  .rules-viewer-wrap.is-fullscreen-custom .rules-mobile-tap-hint {
    display: none !important;
  }

  /* Плавающая кнопка выхода из полноэкранного режима */
  :fullscreen#rules-viewer .rules-mobile-fs-close,
  .rules-viewer-wrap.is-fullscreen-custom .rules-mobile-fs-close {
    display: inline-flex !important;
    position: fixed !important;
    top: 16px;
    right: 16px;
    z-index: 100000;
    background: rgba(17, 17, 19, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    padding: 8px 14px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    border-radius: 4px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  /* Плавающая панель страниц в полноэкранном режиме */
  :fullscreen#rules-viewer .rules-mobile-fs-bar,
  .rules-viewer-wrap.is-fullscreen-custom .rules-mobile-fs-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    background: rgba(17, 17, 19, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 0.74rem;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
  }
  .mobile-fs-counter strong {
    color: var(--rules-gold);
    font-weight: 800;
  }
  .mobile-fs-hint {
    color: #b0aea9;
    font-size: 0.69rem;
  }

  .rules-cover-inner {
    grid-template-columns: 1fr;
  }
  .rules-cover-actions {
    max-width: 100%;
  }
  .rules-metrics-grid {
    grid-template-columns: 1fr;
  }
  .rules-cards-grid {
    grid-template-columns: 1fr;
  }
  .rules-bottom-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .rules-bottom-actions {
    width: 100%;
  }
}
