:root {
  color-scheme: dark;
}

html {
  min-height: 100%;
  background: #05060c;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: transparent;
  color: #e2e8f0;
  min-height: 100vh;
  position: relative;
  cursor: default;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at top, #111827 0%, #0b1120 45%, #05060c 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
  pointer-events: none;
  will-change: transform;
}

.patches-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 80px;
  box-sizing: border-box;
}

.patches-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  position: static;
  top: auto;
  z-index: auto;
  backdrop-filter: none;
  background: rgba(15, 23, 42, 0.3);
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.patches-header .bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.site-nav-separator {
  width: 100%;
  margin-top: 16px;
  height: 1px;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0) 0%, rgba(59, 130, 246, 0.5) 50%, rgba(59, 130, 246, 0) 100%);
}

.patches-header .title span {
  color: #3b82f6;
}

.site-nav a.to-right-side {
  color: #3b82f6;
}

.patches-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.55);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}

.patches-title h1 {
  margin: 0;
  font-size: 2.25rem;
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.patches-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: rgba(226, 232, 240, 0.82);
  font-size: 0.95rem;
}

.patches-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  align-self: flex-end;
  min-width: 220px;
}

.patch-language-toggle-wrapper,
.patch-version-select-wrapper {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.patch-version-select-wrapper {
  position: relative;
}

.patches-controls select {
  min-width: 200px;
  width: 100%;
  padding: 12px 40px 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.7) 60%, rgba(15, 23, 42, 0.85) 100%);
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 24px rgba(15, 23, 42, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.patches-controls select option {
  color: #e2e8f0;
  background: #0f172a;
  font-weight: 500;
  padding: 8px 12px;
}

.patches-controls select option:checked {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.6));
  color: #ffffff;
}

.patches-controls select option:hover,
.patches-controls select option:focus {
  background: rgba(59, 130, 246, 0.75);
  color: #ffffff;
}

.patches-controls select:hover {
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08), 0 14px 28px rgba(37, 99, 235, 0.2);
}

.patches-controls select:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.75);
  outline-offset: 2px;
}

.patch-version-select-wrapper::after {
  content: '▾';
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  pointer-events: none;
  color: rgba(148, 163, 184, 0.7);
  font-size: 0.75rem;
  transition: color 0.2s ease;
}

.patch-version-select-wrapper:hover::after {
  color: rgba(148, 163, 184, 0.95);
}

body.patch-builder-mode .patch-scroll-link,
body.patch-builder-mode a[href^="#"] {
  pointer-events: none;
}

body.patch-builder-render .patch-scroll-link,
body.patch-builder-render a[href^="#"] {
  pointer-events: auto;
}

body.patch-builder-mode .patch-builder-editable {
  outline: 1px dashed rgba(96, 165, 250, 0.45);
  outline-offset: 2px;
  transition: background 0.15s ease, outline-color 0.15s ease;
}

body.patch-builder-mode .patch-builder-editable:focus {
  outline-color: rgba(59, 130, 246, 0.85);
  background: rgba(37, 99, 235, 0.08);
}

.patch-builder-media-container,
.patch-builder-anchor-container {
  position: relative;
}

body.patch-builder-mode .patch-entry {
  position: relative;
}

body.patch-builder-mode .patch-entry:hover > .patch-builder-overlay-button,
body.patch-builder-mode .patch-entry:focus-within > .patch-builder-overlay-button {
  opacity: 1;
}

.patch-builder-overlay-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.82);
  color: #e2e8f0;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.patch-builder-media-container:hover > .patch-builder-overlay-button,
.patch-builder-media-container:focus-within > .patch-builder-overlay-button,
.patch-builder-anchor-container:hover > .patch-builder-overlay-button,
.patch-builder-anchor-container:focus-within > .patch-builder-overlay-button {
  opacity: 1;
}

.patch-builder-overlay-button:hover {
  background: rgba(59, 130, 246, 0.85);
  border-color: rgba(59, 130, 246, 0.9);
}

.patch-builder-overlay-button[data-variant='anchor'] {
  left: 8px;
  right: auto;
}

.patch-builder-overlay-button[data-variant='insert'] {
  top: auto;
  bottom: 8px;
  left: 8px;
  right: auto;
}

.patch-builder-overlay-button[data-variant='danger'] {
  background: rgba(239, 68, 68, 0.9);
  border-color: rgba(239, 68, 68, 0.95);
  color: #fff;
}

.patch-builder-overlay-button[data-variant='danger']:hover {
  background: rgba(220, 38, 38, 0.95);
  border-color: rgba(220, 38, 38, 1);
}

.patch-builder-talents-row > .patch-builder-overlay-button[data-variant='talent-level'] {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

body.patch-builder-render .patch-builder-overlay-button {
  display: none;
}

body.patch-builder-render .patch-builder-editable {
  outline: none !important;
  background: transparent !important;
}

body.patch-builder-render .patch-builder-inline-button {
  display: none;
}

body.patch-builder-mode .patch-builder-placeholder {
  position: relative;
}

body.patch-builder-mode .patch-builder-placeholder[data-builder-placeholder]:empty::after {
  content: attr(data-builder-placeholder);
  color: rgba(148, 163, 184, 0.6);
  pointer-events: none;
  font-style: italic;
  display: inline-block;
  width: 100%;
}

body.patch-builder-render .patch-builder-placeholder[data-builder-placeholder]::after {
  content: none;
}

body.patch-builder-mode .patch-builder-media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.28);
  color: rgba(226, 232, 240, 0.8);
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
}

body:not(.patch-builder-mode) .patch-builder-inline-button {
  display: none;
}

body.patch-builder-mode .patch-builder-inline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.55);
  color: #e2e8f0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

body.patch-builder-mode .patch-builder-inline-button:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.8);
}

body.patch-builder-mode .patch-builder-inline-button--small {
  margin-top: 8px;
  padding: 4px 10px;
  font-size: 0.7rem;
}

.patch-builder-subcategory-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.patch-builder-subcategory-add__label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.7);
}

body.patch-builder-render .patch-builder-subcategory-add {
  display: none;
}

.patch-language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.6);
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.4);
}

.patch-language-flag {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 0 0 1px rgba(148, 163, 184, 0.25);
  flex-shrink: 0;
}

.patch-language-toggle[data-language="ru"] .patch-language-flag {
  background-image: url('/img/patches/flag-ru.svg');
}

.patch-language-toggle[data-language="en"] .patch-language-flag {
  background-image: url('/img/patches/flag-en.svg');
}

.patch-language-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.patch-language-option {
  opacity: 0.55;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.patch-language-option.is-active {
  opacity: 1;
  color: #ffffff;
}

.patch-language-separator {
  opacity: 0.4;
}

.patch-language-toggle:hover {
  background: rgba(59, 130, 246, 0.7);
  transform: translateY(-1px);
}

.patch-language-toggle:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

.patch-category {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.35);
}

.patch-category-title {
  margin: 0 0 20px;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}

.patch-category-description {
  margin: 0 0 20px;
  color: rgba(226, 232, 240, 0.78);
  font-size: 1rem;
}

.patch-entry {
  padding: 18px 0;
}

.patch-entry.patch-entry--divider {
  padding: 0;
}

.patch-entry:first-child {
  padding-top: 0;
}

.patch-entry:last-child {
  padding-bottom: 0;
}

.patch-entry-divider {
  border: none;
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  margin: 16px 0;
}

.patch-icon-text {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: flex-start;
}

.patch-icon-text--multi {
  grid-template-columns: 1fr;
}

.patch-icon-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.patch-icon {
  width: 56px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: rgba(148, 163, 184, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.patch-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.patch-icon span {
  font-size: 1.4rem;
  font-weight: 600;
  color: rgba(226, 232, 240, 0.86);
}

.patch-icon-item {
  width: 96px;
  aspect-ratio: 11 / 8;
  border-radius: 12px;
}

.patch-icon-ability {
  background: rgba(96, 165, 250, 0.18);
}

.patch-icon-item img {
  object-fit: contain;
  background: rgba(15, 23, 42, 0.45);
}

.patch-icon-hero {
  background: rgba(96, 165, 250, 0.18);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18);
}

.patch-icon-hero img {
  object-fit: cover;
  background: none;
  transform: scale(1.05);
}

#patch-scroll-top {
  position: fixed;
  right: 24px;
  bottom: 32px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.82);
  color: #e2e8f0;
  font-size: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}

#patch-scroll-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#patch-scroll-top:hover {
  background: rgba(59, 130, 246, 0.8);
}

#patch-scroll-top:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.9);
  outline-offset: 2px;
}

.patch-icon-text h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.patch-icon-text p {
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.6;
}

.patch-description {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.patch-description-part + .patch-description-part {
  margin-top: 12px;
}

.patch-description h4 {
  margin: 0;
  font-size: 1.05rem;
}

.patch-description p {
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.6;
}

.patch-talents {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.78), rgba(30, 41, 59, 0.65));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14), 0 18px 32px rgba(15, 23, 42, 0.35);
}

.patch-talents-title {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.92);
}

.patch-talents-description,
.patch-talents-footer {
  margin: 0;
  color: rgba(226, 232, 240, 0.72);
  line-height: 1.6;
}

.patch-talents-hero {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.28);
  align-self: flex-start;
}

.patch-talents-hero img {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.45);
}

.patch-talents-hero-name {
  font-size: 0.95rem;
  color: rgba(226, 232, 240, 0.9);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.patch-talents-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


.patch-talents-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.7));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.patch-talents-row:hover {
  transform: translateY(-1px);
}

.patch-talents-option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 12px;
  min-height: 54px;
  background: rgba(15, 23, 42, 0.6);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14);
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(226, 232, 240, 0.9);
  transition: box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.patch-talents-option.is-left,
.patch-talents-option.is-right {
  justify-content: center;
  text-align: center;
}

.patch-talents-option:hover,
.patch-talents-option:focus-visible {
  background: linear-gradient(135deg, rgba(253, 224, 71, 0.78), rgba(249, 115, 22, 0.62));
  box-shadow: inset 0 0 0 2px rgba(253, 224, 71, 0.75), inset 0 18px 28px rgba(217, 119, 6, 0.28);
  color: #0f172a;
}

.patch-talents-option .patch-scroll-link {
  font-size: 0.95rem;
}

.patch-talents-option.is-highlighted .patch-scroll-link {
  color: #1f2937;
}

.patch-talents-option.is-highlighted .patch-scroll-link::after {
  background: linear-gradient(90deg, rgba(250, 204, 21, 0.2), rgba(217, 119, 6, 0.8), rgba(250, 204, 21, 0.2));
}

.patch-talents-option:hover .patch-scroll-link,
.patch-talents-option:focus-visible .patch-scroll-link {
  color: #0f172a;
}

.patch-talents-option.is-highlighted .patch-scroll-link:hover,
.patch-talents-option.is-highlighted .patch-scroll-link:focus {
  color: #1f2937;
  text-shadow: none;
}

.patch-talents-level {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(248, 189, 64, 0.95), rgba(217, 119, 6, 0.9));
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.9), 0 8px 20px rgba(217, 119, 6, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(248, 189, 64, 0.65);
  text-shadow: 0 0 6px rgba(15, 23, 42, 0.8);
}

.patch-talents-level-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #0f172a;
}

.patch-talents-option.is-highlighted {
  background: linear-gradient(135deg, rgba(253, 224, 71, 0.9), rgba(249, 115, 22, 0.85));
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.7);
  color: #1f2937;
}

.patch-talents-row.has-highlight {
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.45), 0 12px 26px rgba(217, 119, 6, 0.35);
}

.patch-talents-row.has-highlight .patch-talents-level {
  background: radial-gradient(circle at 30% 30%, rgba(253, 224, 71, 1), rgba(250, 204, 21, 0.95));
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.9), 0 8px 24px rgba(253, 224, 71, 0.45);
  border-color: rgba(250, 204, 21, 0.85);
}

.patch-talents-note {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(250, 204, 21, 0.12);
  color: rgba(255, 237, 213, 0.92);
  font-size: 0.85rem;
  text-align: center;
}

.patch-talents-tooltip {
  position: absolute;
  top: 50%;
  max-width: min(600px, calc(100vw - 80px));
  padding: 18px 32px;
  border-radius: 14px;
  border: 1px solid rgba(250, 204, 21, 0.65);
  background: radial-gradient(circle at top left, rgba(253, 224, 71, 0.16), rgba(15, 23, 42, 0.94));
  color: rgba(226, 232, 240, 0.92);
  font-size: 0.85rem;
  line-height: 1.4;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.5);
  opacity: 0;
  pointer-events: none;
  white-space: normal;
  overflow-wrap: break-word;
  transform: translateY(-50%) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.patch-talents-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 10px solid transparent;
}

.patch-talents-tooltip.is-left {
  right: calc(100% + 30px);
}

.patch-talents-tooltip.is-left::after {
  right: -20px;
  border-left-color: rgba(250, 204, 21, 0.65);
}

.patch-talents-tooltip.is-right {
  left: calc(100% + 30px);
}

.patch-talents-tooltip.is-right::after {
  left: -20px;
  border-right-color: rgba(250, 204, 21, 0.65);
}

.patch-talents-option:hover .patch-talents-tooltip,
.patch-talents-option:focus-within .patch-talents-tooltip {
  opacity: 1;
  transform: translateY(-50%) scale(1.02);
}

.patch-scroll-link {
  position: relative;
  color: #60a5fa;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.patch-scroll-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.8), rgba(96, 165, 250, 0.2));
  transform: scaleX(0.6);
  opacity: 0.6;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}

.patch-scroll-link:hover,
.patch-scroll-link:focus {
  color: #93c5fd;
  text-shadow: 0 0 6px rgba(59, 130, 246, 0.75);
}

.patch-scroll-link:hover::after,
.patch-scroll-link:focus::after {
  transform: scaleX(1);
  opacity: 1;
}

.patch-anchor-highlight {
  position: relative;
  outline: 2px solid rgba(96, 165, 250, 0.65);
  outline-offset: 4px;
  border-radius: 10px;
  box-shadow: 0 0 18px rgba(59, 130, 246, 0.35);
}

.patch-media {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.patch-media-title {
  margin: 0;
  font-size: 1.1rem;
}

.patch-media-description {
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.55;
}

.patch-media-gallery {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.patch-media-item {
  margin: 0;

.patch-ability {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.6);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(6px);
}

.patch-ability__header {
  display: flex;
  gap: 18px;
  align-items: center;
}

.patch-ability__icon {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.7));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.18), 0 12px 28px rgba(10, 12, 20, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.patch-ability__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.patch-ability__icon--placeholder {
  color: rgba(148, 163, 184, 0.6);
  font-size: 1.6rem;
  font-weight: 600;
}

.patch-ability__icon--placeholder::after {
  content: '?';
}

.patch-ability__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.patch-ability__name {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.35;
  color: #f8fafc;
}

.patch-ability__code {
  font-size: 0.9rem;
  color: rgba(148, 163, 184, 0.9);
  word-break: break-all;
}

.patch-ability__description {
  margin: 0;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.6;
}

.patch-ability__details {
  display: grid;
  gap: 20px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 16px;
}

.patch-ability__details--loading {
  position: relative;
}

.patch-ability__details--empty .patch-ability__meta,
.patch-ability__details--empty .patch-ability__values {
  display: none;
}

.patch-ability__meta,
.patch-ability__values {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.patch-ability__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
}

.patch-ability__meta--empty,
.patch-ability__values--empty {
  display: none;
}

.patch-ability__term {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(203, 213, 225, 0.92);
  font-weight: 600;
  flex: 0 0 auto;
  white-space: nowrap;
}

.patch-ability__definition {
  margin: 0;
  color: rgba(226, 232, 240, 0.92);
  line-height: 1.5;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.patch-ability__value-main {
  font-weight: 600;
  color: #f8fafc;
}


.patch-ability__value-extra {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: rgba(226, 232, 240, 0.92);
  font-size: 0.85rem;
}

.patch-ability__extra-label {
  color: rgba(148, 163, 184, 0.85);
  font-weight: 600;
  font-size: 0.75rem;
}

.patch-ability__value-extra-value {
  color: rgba(248, 250, 252, 0.95);
}

.patch-ability__separator {
  color: rgba(94, 114, 142, 0.85);
  font-weight: 600;
  margin: 0 8px;
}

.patch-ability__note {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.55);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.16);
  color: rgba(226, 232, 240, 0.9);
  line-height: 1.5;
}
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.32);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.patch-media-surface {
  position: relative;
  width: 100%;
  aspect-ratio: var(--patch-media-aspect, auto);
  background: rgba(30, 41, 59, 0.7);
}

.patch-media-surface > img,
.patch-media-surface > video,
.patch-media-surface > iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: none;
  background: rgba(15, 23, 42, 0.4);
}

.patch-media-surface > video {
  object-fit: contain;
}

.patch-media-item-caption {
  margin: 0 16px 16px;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.9rem;
  line-height: 1.5;
}

.patch-media-caption {
  margin: 0;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.95rem;
}

.patch-description ul {
  margin: 6px 0 0 20px;
  padding: 0;
  color: rgba(226, 232, 240, 0.78);
  line-height: 1.6;
}

.patch-subcategory {
  position: relative;
  margin-top: 12px;
  padding-left: 24px;
}

.patch-subcategory::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 999px;
  background: var(--patch-subcategory-accent, transparent);
  opacity: var(--patch-subcategory-accent-opacity, 1);
  pointer-events: none;
}

.patch-subcategory-title {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.patch-subcategory-description {
  margin: 0 0 16px;
  color: rgba(226, 232, 240, 0.74);
}

.patch-empty {
  text-align: center;
  padding: 60px 20px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  color: rgba(226, 232, 240, 0.65);
}

@media (max-width: 640px) {
  .patches-page {
    padding: 24px 16px 64px;
  }

  .patch-icon-text {
    grid-template-columns: 1fr;
  }

  .patch-icon {
    width: 48px;
  }

  .patch-icon-item {
    width: 72px;
  }

  .patch-icon img {
    width: 100%;
    height: 100%;
  }

  .patches-controls {
    width: 100%;
    align-items: stretch;
    min-width: 0;
  }

  .patch-language-toggle-wrapper,
  .patch-version-select-wrapper {
    width: 100%;
    justify-content: flex-start;
  }

  .patch-language-toggle {
    width: 100%;
    justify-content: center;
  }

  .patches-controls select {
    min-width: 0;
  }

  .patch-media-gallery {
    grid-template-columns: 1fr;
  }

  #patch-scroll-top {
    right: 16px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    font-size: 1.2rem;
  }

  .patches-title h1 {
    font-size: 1.8rem;
  }

  .patch-category {
    padding: 22px;
  }
}
