:root {
  --mh-primary: #007bee;
  --mh-primary-light: #4da3ff;
  --mh-primary-subtle: #cce4fc;
  --mh-navy: #002752;
  --mh-dark: #2b2d30;
  --mh-gray-100: #e8eef7;
  --mh-gray-200: #d4dce8;
  --mh-gray-300: #b8c2d0;
  --mh-gray-400: #9aa5b3;
  --mh-white: #fff;

  --bg: var(--mh-navy);
  --surface: rgba(0, 39, 82, 0.78);
  --surface-2: rgba(0, 39, 82, 0.86);
  --surface-3: rgba(0, 39, 82, 0.92);
  --surface-strong: rgba(0, 39, 82, 0.98);
  --text: var(--mh-gray-100);
  --text-body: var(--mh-gray-200);
  --text-muted: var(--mh-gray-300);
  --heading: var(--mh-white);
  --accent: var(--mh-primary);
  --accent-hover: var(--mh-primary-light);
  --accent-subtle: rgba(0, 123, 238, 0.14);
  --accent-subtle-strong: rgba(0, 123, 238, 0.22);
  --accent-focus: rgba(77, 163, 255, 0.42);
  --border: rgba(77, 163, 255, 0.26);
  --border-strong: rgba(204, 228, 252, 0.34);
  --input-bg: rgba(0, 39, 82, 0.58);

  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Paytone One", var(--font-body);
  --radius: 12px;
  --radius-inner: 10px;
  --radius-media: 9px;
  --radius-logo: 18px;
  --radius-pill: 999px;
  --shadow-panel: 0 22px 70px rgba(0, 39, 82, 0.38);
  --shadow-card: 0 8px 28px rgba(0, 39, 82, 0.16);
  --shadow-dropdown: 0 12px 32px rgba(0, 0, 0, 0.35);
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --z-content: 1;
  --z-sticky: 20;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text-body);
  font: 400 15px/1.6 var(--font-body);
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  position: absolute;
  right: -18px;
  left: -18px;
  z-index: 0;
  height: 1080px;
  content: "";
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 72%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 72%, transparent 100%);
}

body::before {
  top: -18px;
  background: url("https://storage.minehub.cz/storage/minehub/backgrounds/background_main.webp") center top / cover no-repeat;
  filter: blur(3px);
  opacity: 0.88;
  transform: scale(1.02);
}

body::after {
  top: 0;
  height: 1020px;
  background: rgba(0, 39, 82, 0.52);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

img,
svg {
  max-width: 100%;
}

::selection {
  background: var(--mh-primary-light);
  color: var(--mh-navy);
}

:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--mh-white);
  color: var(--mh-navy);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-shell {
  position: relative;
  z-index: var(--z-content);
  width: min(1440px, calc(100% - 32px));
  margin-inline: auto;
  padding: 0 0 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  margin-inline: -16px;
  padding-inline: 16px;
  border-bottom: 1px solid transparent;
  transition: background var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.topbar.is-scrolled {
  border-color: var(--border);
  background: rgba(0, 39, 82, 0.88);
  box-shadow: 0 8px 24px rgba(0, 20, 42, 0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.topbar-brand,
.topbar-links,
.topbar-links a {
  display: flex;
  align-items: center;
}

.topbar-brand {
  gap: 10px;
  border-radius: var(--radius);
  color: var(--heading);
  font: 400 1.14rem/1 var(--font-display);
  text-decoration: none;
}

.topbar-brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.topbar-links {
  gap: 8px;
}

.topbar-links a,
.button {
  min-height: 40px;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.topbar-links a:hover {
  background: var(--accent-subtle);
  color: var(--heading);
}

.topbar-links .button-primary,
.button-primary {
  border-color: rgba(77, 163, 255, 0.92);
  background: var(--accent);
  color: var(--mh-white);
}

.topbar-links .button-primary:hover,
.button-primary:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--mh-white);
  transform: translateY(-1px);
}

.material-symbols-outlined {
  font-size: 20px;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  line-height: 1;
}

.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(1100px, 100%);
  min-height: 310px;
  margin-inline: auto;
  padding: 72px 32px 58px;
}

.headline-logo-link {
  display: block;
  flex: 0 0 auto;
  border-radius: var(--radius-logo);
  transition: transform var(--transition-normal), filter var(--transition-normal);
}

.headline-logo {
  display: block;
  width: clamp(72px, 6vw, 88px);
  height: clamp(72px, 6vw, 88px);
  object-fit: contain;
}

.headline-logo-link:hover {
  filter: drop-shadow(0 10px 18px rgba(77, 163, 255, 0.48));
  transform: translateY(-2px) scale(1.09) rotate(-2deg);
}

.headline-logo-link:focus-visible {
  transform: scale(1.06);
}

.hero-copy {
  min-width: 0;
  max-width: 760px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--mh-primary-light);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--mh-primary-light);
  box-shadow: 0 0 0 5px rgba(77, 163, 255, 0.14);
}

.hero h1 {
  margin: 0;
  color: var(--heading);
  font: 400 clamp(2.65rem, 6vw, 5.15rem)/1 var(--font-display);
  letter-spacing: -0.025em;
}

.hero-description {
  max-width: 650px;
  margin: 14px 0 0;
  color: var(--text-body);
  font-size: clamp(1rem, 1.5vw, 1.12rem);
}

.content-layout {
  width: min(1100px, 100%);
  margin-inline: auto;
}

.sidebar {
  position: sticky;
  top: 82px;
  min-width: 0;
}

.sidebar-panel,
.changelog-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow-panel);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.sidebar-panel {
  padding: 12px;
}

.search-field {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--input-bg);
  color: var(--text-muted);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.search-field:focus-within {
  border-color: var(--mh-primary-light);
  background: rgba(0, 39, 82, 0.78);
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.search-field .material-symbols-outlined {
  flex: 0 0 auto;
  font-size: 19px;
}

.search-field input {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
}

.search-field input::placeholder {
  color: var(--text-muted);
  opacity: 0.9;
}

.search-field kbd {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text-muted);
  font: 600 0.72rem/1 var(--font-body);
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 4px 8px;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.count-badge {
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding-inline: 6px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--accent-subtle);
  color: var(--text);
  font-size: 0.72rem;
  letter-spacing: 0;
}

.table-of-contents {
  display: grid;
  gap: 3px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  scrollbar-color: var(--mh-primary-light) transparent;
  scrollbar-width: thin;
}

.table-of-contents a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-body);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

.table-of-contents a::before {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  content: "";
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.table-of-contents a:hover {
  background: var(--accent-subtle);
  color: var(--heading);
}

.table-of-contents a.is-active {
  background: var(--accent-subtle-strong);
  box-shadow: inset 3px 0 0 var(--mh-primary-light);
  color: var(--heading);
}

.table-of-contents a.is-active::before {
  background: var(--mh-primary-light);
  transform: scale(1.25);
}

.toc-placeholder {
  margin: 8px 6px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.sidebar-footer {
  display: flex;
  gap: 9px;
  margin-top: 14px;
  padding: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.sidebar-footer .material-symbols-outlined {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--mh-primary-light);
}

.sidebar-footer p {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.5;
}

.sidebar-footer a {
  color: var(--heading);
  font-weight: 700;
}

.changelog-panel {
  min-width: 0;
  overflow: hidden;
  background: var(--surface-3);
}

.search-status {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-subtle);
  color: var(--text);
  font-size: 0.88rem;
}

.search-status[hidden] {
  display: none;
}

.search-status .material-symbols-outlined {
  color: var(--mh-primary-light);
}

.search-status button {
  min-height: 32px;
  margin-left: auto;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--heading);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
}

.search-status button:hover {
  background: var(--accent-subtle-strong);
}

.markdown-content {
  padding: clamp(22px, 4vw, 48px);
  overflow-wrap: anywhere;
}

.markdown-content > :first-child {
  margin-top: 0;
}

.markdown-content > :last-child {
  margin-bottom: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  scroll-margin-top: 88px;
  color: var(--heading);
  text-wrap: balance;
}

.markdown-content h1 {
  margin: 56px 0 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font: 400 clamp(1.85rem, 3vw, 2.35rem)/1.2 var(--font-display);
}

.markdown-content h1:first-child {
  position: relative;
  margin: 0;
  padding: 18px 18px 12px 54px;
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--accent-subtle);
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 800;
}

.markdown-content h1:first-child::before {
  position: absolute;
  top: 17px;
  left: 18px;
  color: var(--mh-primary-light);
  font: 400 25px/1 "Material Symbols Outlined";
  content: "info";
}

.markdown-content h1:first-child + p {
  margin: 0 0 46px;
  padding: 0 18px 20px 54px;
  border: 1px solid var(--border-strong);
  border-top: 0;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--accent-subtle);
  color: var(--text-body);
}

.markdown-content h2 {
  margin: 38px 0 14px;
  color: var(--heading);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.3;
}

.markdown-content h2::before {
  content: none;
}

.markdown-content h3 {
  margin: 26px 0 10px 24px;
  color: var(--mh-primary-light);
  font-size: 1.05rem;
  font-weight: 800;
}

.markdown-content h4 {
  margin: 20px 0 8px 48px;
  font-size: 0.95rem;
  font-weight: 800;
}

.markdown-content h3 + p,
.markdown-content h3 + ul,
.markdown-content h3 + ol {
  margin-left: 24px;
}

.markdown-content h4 + p,
.markdown-content h4 + ul,
.markdown-content h4 + ol {
  margin-left: 48px;
}

.markdown-content p {
  margin: 0 0 16px;
  color: var(--text-body);
}

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 22px;
  padding-left: 0;
  list-style: none;
}

.markdown-content li {
  position: relative;
  margin: 8px 0;
  padding-left: 24px;
  color: var(--text-body);
}

.markdown-content li::before {
  position: absolute;
  top: 0.7em;
  left: 4px;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--mh-primary-light);
  content: "";
  transform: translateY(-50%);
}

.markdown-content li > ul,
.markdown-content li > ol {
  margin: 8px 0 4px;
}

.markdown-content li li::before {
  border: 1px solid var(--mh-primary-light);
  background: transparent;
}

.markdown-content a {
  border-radius: 3px;
  color: var(--mh-primary-light);
  font-weight: 600;
  text-decoration-color: rgba(77, 163, 255, 0.46);
  text-underline-offset: 3px;
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.markdown-content a:hover {
  color: var(--heading);
  text-decoration-color: var(--heading);
}

.markdown-content strong {
  color: var(--heading);
  font-weight: 800;
}

.markdown-content code {
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--mh-primary-subtle);
  font-size: 0.88em;
}

.markdown-content hr {
  height: 1px;
  margin: 44px 0;
  border: 0;
  background: var(--border);
}

.markdown-content .search-hidden {
  display: none;
}

.empty-search {
  display: grid;
  min-height: 320px;
  padding: 30px;
  place-items: center;
  text-align: center;
}

.empty-search .material-symbols-outlined {
  display: block;
  margin-bottom: 12px;
  color: var(--mh-primary-light);
  font-size: 42px;
}

.empty-search h2 {
  display: block;
  margin: 0 0 6px;
}

.empty-search h2::before {
  display: none;
}

.empty-search p {
  margin: 0;
  color: var(--text-muted);
}

.loading-state,
.error-state {
  display: flex;
  min-height: 360px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--mh-primary-light);
  border-radius: var(--radius-pill);
  animation: spin 800ms linear infinite;
}

.error-state {
  flex-direction: column;
  text-align: center;
}

.error-state .material-symbols-outlined {
  color: var(--mh-primary-light);
  font-size: 42px;
}

.error-state strong {
  color: var(--heading);
  font-size: 1.05rem;
}

.error-state p {
  max-width: 440px;
  margin: -4px 0 0;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1100px, 100%);
  margin-inline: auto;
  padding: 30px 4px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  background: var(--accent-subtle);
  color: var(--heading);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .hero {
    min-height: 280px;
    padding-inline: 16px;
  }

  .content-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
  }

  .table-of-contents {
    display: flex;
    max-height: none;
    padding-bottom: 4px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .table-of-contents a {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 600px) {
  html {
    scroll-padding-top: 76px;
  }

  .site-shell {
    width: calc(100% - 24px);
  }

  .topbar {
    margin-inline: -12px;
    padding-inline: 12px;
  }

  .topbar-brand span,
  .topbar-links .link-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .topbar-links a,
  .button {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 9px;
  }

  .topbar-links .button-primary {
    padding-inline: 11px;
  }

  .hero {
    align-items: flex-start;
    min-height: 0;
    padding: 52px 0 42px;
  }

  .headline-logo {
    width: 64px;
    height: 64px;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 11vw, 3rem);
  }

  .hero-description {
    font-size: 0.95rem;
  }

  .sidebar-panel {
    padding: 10px;
  }

  .search-field {
    min-height: 44px;
  }

  .search-field input {
    height: 42px;
  }

  .table-of-contents a {
    min-height: 44px;
  }

  .search-status {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .search-status button {
    min-height: 36px;
  }

  .markdown-content {
    padding: 22px 16px 30px;
  }

  .markdown-content h1:first-child {
    padding: 16px 14px 16px 46px;
    font-size: 1rem;
  }

  .markdown-content h1:first-child::before {
    top: 15px;
    left: 14px;
  }

  .markdown-content h1:first-child + p {
    padding: 0 14px 17px 46px;
  }

  .markdown-content h1 {
    font-size: 1.75rem;
  }

  .markdown-content h2 {
    font-size: 1.2rem;
  }

  .markdown-content h3 {
    margin-left: 16px;
  }

  .markdown-content h4 {
    margin-left: 32px;
  }

  .markdown-content h3 + p,
  .markdown-content h3 + ul,
  .markdown-content h3 + ol {
    margin-left: 16px;
  }

  .markdown-content h4 + p,
  .markdown-content h4 + ul,
  .markdown-content h4 + ol {
    margin-left: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .headline-logo-link:hover,
  .headline-logo-link:focus-visible,
  .topbar-links .button-primary:hover {
    transform: none;
  }
}
