/* Patch Notes: readable release history in the Server Rules visual language. */

.patch-page {
  --patch-blue: #6ab7ff;
  --patch-blue-bright: #8ac9ff;
  --patch-text: #f1f6fd;
  --patch-muted: #a8b8cc;
  --patch-dim: #8296af;
  --patch-line: rgba(142, 177, 213, 0.17);
  --patch-panel: rgba(3, 13, 26, 0.93);
  width: min(1260px, 100%);
  min-height: calc(100vh - 180px);
  margin: 0 auto;
  padding: 34px 18px 72px;
  color: var(--patch-text);
}

.patch-shell {
  display: grid;
  gap: 23px;
}

.patch-intro {
  padding: 12px 0 23px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(365px, 0.8fr);
  align-items: center;
  gap: 32px;
  border-bottom: 1px solid var(--patch-line);
}

.patch-intro-copy {
  min-width: 0;
}

.patch-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--patch-blue);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.patch-intro h1 {
  margin: 0;
  color: #f5f8fd;
  font-size: clamp(2.3rem, 4.2vw, 3.6rem);
  font-weight: 850;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.patch-intro h1 span {
  color: var(--patch-blue-bright);
}

.patch-intro-copy > p {
  max-width: 660px;
  margin: 13px 0 0;
  color: #c0cee0;
  font-size: 0.98rem;
  line-height: 1.68;
}

.patch-hero-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.patch-primary-action,
.patch-secondary-action {
  min-height: 41px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(113, 184, 245, 0.3);
  border-radius: 8px;
  background: rgba(38, 123, 198, 0.2);
  color: #edf7ff;
  font-size: 0.79rem;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.patch-secondary-action {
  border-color: rgba(142, 177, 213, 0.17);
  background: rgba(255, 255, 255, 0.035);
  color: #c7d7e9;
}

.patch-primary-action:hover,
.patch-secondary-action:hover {
  border-color: rgba(138, 201, 255, 0.58);
  background: rgba(38, 123, 198, 0.3);
  color: #fff;
}

.patch-stats {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(142, 177, 213, 0.16);
  border-radius: 10px;
  background: rgba(3, 13, 26, 0.84);
}

.patch-stats > div {
  min-width: 0;
  min-height: 86px;
  padding: 12px 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(142, 177, 213, 0.11);
  border-bottom: 1px solid rgba(142, 177, 213, 0.11);
}

.patch-stats > div:nth-child(2n) {
  border-right: 0;
}

.patch-stats > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.patch-stats small {
  color: #91a5bd;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.patch-stats strong {
  margin-top: 4px;
  overflow: hidden;
  color: #edf5ff;
  font-size: 0.98rem;
  font-weight: 820;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patch-stats span {
  margin-top: 2px;
  color: var(--patch-dim);
  font-size: 0.68rem;
}

.patch-workspace {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  scroll-margin-top: 108px;
}

.patch-archive {
  position: sticky;
  top: 108px;
  min-width: 0;
  max-height: calc(100vh - 124px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(142, 177, 213, 0.16);
  border-radius: 10px;
  background: var(--patch-panel);
}

.patch-archive > header {
  padding: 14px 14px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #dbe8f7;
  font-size: 0.84rem;
  font-weight: 800;
}

.patch-archive > header strong,
.patch-channel-tabs button span,
.patch-release-count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(106, 183, 255, 0.1);
  color: #a9c9e8;
  font-size: 0.65rem;
  font-weight: 800;
}

.patch-channel-tabs {
  padding: 0 11px 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.patch-channel-tabs button {
  min-width: 0;
  min-height: 39px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(142, 177, 213, 0.13);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: #a7b8cc;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
}

.patch-channel-tabs button > i {
  color: #8bbce9;
}

.patch-channel-tabs button span {
  margin-left: auto;
}

.patch-channel-tabs button.active {
  border-color: rgba(106, 183, 255, 0.32);
  background: rgba(46, 124, 196, 0.14);
  color: #eff7ff;
}

.patch-search {
  min-width: 0;
  min-height: 41px;
  margin: 0 11px 9px;
  padding: 0 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(142, 177, 213, 0.15);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.2);
  color: #86bceb;
}

.patch-search:focus-within {
  border-color: rgba(106, 183, 255, 0.48);
  box-shadow: 0 0 0 3px rgba(106, 183, 255, 0.07);
}

.patch-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #edf6ff;
  font: inherit;
  font-size: 0.79rem;
}

.patch-search input::placeholder {
  color: #879ab1;
}

.patch-search kbd {
  padding: 2px 6px;
  border: 1px solid rgba(142, 177, 213, 0.14);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: #96a5b8;
  font-size: 0.63rem;
  box-shadow: none;
}

.patch-archive-list {
  min-height: 120px;
  padding: 1px 8px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(106, 183, 255, 0.34) transparent;
}

.patch-release-link {
  width: 100%;
  min-height: 58px;
  position: relative;
  padding: 8px;
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #afbed0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.patch-release-link + .patch-release-link {
  margin-top: 2px;
}

.patch-release-link:hover {
  background: rgba(63, 137, 205, 0.08);
  color: #edf6ff;
}

.patch-release-link.active {
  border-color: rgba(106, 183, 255, 0.2);
  background: rgba(46, 124, 196, 0.14);
  color: #f3f8ff;
  box-shadow: inset 2px 0 0 var(--patch-blue);
}

.patch-timeline-dot {
  width: 8px;
  height: 8px;
  z-index: 1;
  border: 2px solid #6d98bf;
  border-radius: 50%;
  background: #071726;
}

.patch-release-link.active .patch-timeline-dot {
  border-color: #a7dbff;
  background: #4aa3ff;
}

.patch-release-link > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.patch-release-link strong {
  overflow: hidden;
  color: inherit;
  font-size: 0.78rem;
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patch-release-link small {
  color: #91a5bd;
  font-size: 0.67rem;
  font-weight: 650;
}

.patch-release-count {
  min-width: 21px;
  height: 21px;
}

.patch-release-link[hidden] {
  display: none;
}

.patch-archive-loading,
.patch-archive-empty {
  min-height: 115px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #a1b3c8;
  font-size: 0.78rem;
  text-align: center;
}

.patch-archive-empty[hidden] {
  display: none;
}

.patch-detail-shell {
  min-width: 0;
  min-height: 180px;
}

.patch-detail-shell.is-loading {
  opacity: 0.72;
}

.patch-detail-card,
.patch-detail-loading,
.patch-detail-empty,
.patch-detail-error {
  border: 1px solid rgba(142, 177, 213, 0.16);
  border-radius: 11px;
  background: var(--patch-panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
}

.patch-detail-card {
  min-height: 450px;
  overflow: hidden;
}

.patch-detail-loading,
.patch-detail-empty,
.patch-detail-error {
  min-height: 390px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #a9b9cc;
  text-align: center;
}

.patch-detail-loading small {
  color: var(--patch-dim);
}

.patch-loader {
  width: 22px;
  height: 22px;
  display: inline-block;
  border: 2px solid rgba(106, 183, 255, 0.18);
  border-top-color: var(--patch-blue);
  border-radius: 50%;
  animation: patch-spin 0.8s linear infinite;
}

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

.patch-detail-header {
  padding: 21px 23px 19px;
  border-bottom: 1px solid rgba(142, 177, 213, 0.13);
  background: rgba(46, 124, 196, 0.045);
}

.patch-detail-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--patch-blue-bright);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.patch-detail-kicker span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.patch-detail-kicker small {
  color: #9aacbf;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.patch-detail-title-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
}

.patch-detail-title-row > div {
  min-width: 0;
}

.patch-detail-title-row h2 {
  margin: 0;
  color: #f1f6fd;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.patch-detail-title-row p {
  max-width: 760px;
  margin: 9px 0 0;
  color: #b4c3d5;
  font-size: 0.88rem;
  line-height: 1.62;
}

.patch-change-total {
  min-width: 64px;
  display: grid;
  justify-items: end;
  color: #9aadc3;
  font-size: 0.67rem;
  font-weight: 750;
}

.patch-change-total strong {
  color: var(--patch-blue-bright);
  font-size: 1.25rem;
  line-height: 1.2;
}

.patch-detail-content {
  padding: 0 23px 7px;
}

.patch-detail-section,
.patch-detail-content > .patch-section {
  min-width: 0;
  padding: 18px 0;
  border-bottom: 1px solid rgba(142, 177, 213, 0.12);
}

.patch-detail-section:last-child,
.patch-detail-content > .patch-section:last-child {
  border-bottom: 0;
}

.patch-detail-content > .legal-divider {
  display: none;
}

.patch-detail-section h2,
.patch-section-title {
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #e6f1fd;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.35;
}

.patch-detail-section h2 > span,
.patch-section-title > i {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(106, 183, 255, 0.18);
  border-radius: 7px;
  background: rgba(46, 124, 196, 0.11);
  color: var(--patch-blue-bright);
  font-size: 0.84rem;
}

.patch-change-list {
  display: grid;
}

.patch-change {
  min-width: 0;
  padding: 9px 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border-bottom: 1px solid rgba(142, 177, 213, 0.08);
}

.patch-change:last-child {
  border-bottom: 0;
}

.patch-change p {
  margin: 1px 0 0;
  color: #b0bfd1;
  font-size: 0.86rem;
  line-height: 1.62;
}

.patch-change-type {
  min-height: 22px;
  padding: 3px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(106, 183, 255, 0.2);
  border-radius: 5px;
  background: rgba(106, 183, 255, 0.07);
  color: #a8d6fa;
  font-size: 0.59rem;
  font-weight: 850;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.patch-change-type.added {
  border-color: rgba(52, 211, 153, 0.22);
  background: rgba(52, 211, 153, 0.07);
  color: #78dfbd;
}

.patch-change-type.fixed {
  color: #8fc9fa;
}

.patch-change-type.improved {
  border-color: rgba(167, 139, 250, 0.22);
  background: rgba(139, 92, 246, 0.07);
  color: #c2acfa;
}

.patch-change-type.removed {
  border-color: rgba(251, 113, 133, 0.22);
  background: rgba(251, 113, 133, 0.07);
  color: #f3a0ad;
}

.patch-change-type.security {
  border-color: rgba(251, 191, 36, 0.23);
  background: rgba(251, 191, 36, 0.07);
  color: #efd27a;
}

.patch-list {
  margin: 0;
  padding-left: 1.2rem;
  color: #b0bfd1;
  font-size: 0.87rem;
  line-height: 1.65;
}

.patch-list li {
  margin: 7px 0;
  padding-left: 3px;
}

.patch-list ul {
  margin: 6px 0 10px;
  padding-left: 1.2rem;
  color: #a3b4c8;
}

.patch-list strong {
  color: #e0edf9;
}

.patch-list code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(106, 183, 255, 0.09);
  color: #bbddfa;
}

.patch-detail-footer {
  min-height: 56px;
  padding: 10px 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(142, 177, 213, 0.12);
  background: rgba(0, 8, 18, 0.2);
}

.patch-detail-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #a7c9b8;
  font-size: 0.73rem;
  font-weight: 750;
}

.patch-detail-footer > span i {
  color: #56d5a0;
}

.patch-detail-footer button,
.patch-detail-error button {
  min-height: 35px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(142, 177, 213, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.035);
  color: #bfd5e9;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.patch-detail-footer button:hover,
.patch-detail-error button:hover {
  border-color: rgba(106, 183, 255, 0.38);
  color: #fff;
}

.patch-detail-empty > i,
.patch-detail-error > i {
  color: var(--patch-blue-bright);
  font-size: 1.8rem;
}

.patch-detail-empty h2,
.patch-detail-error h2 {
  margin: 1px 0 0;
  color: #edf6ff;
  font-size: 1.15rem;
}

.patch-detail-empty p,
.patch-detail-error p {
  margin: 0;
  color: #a7b8cc;
  font-size: 0.84rem;
  line-height: 1.55;
}

.patch-noscript {
  margin-top: 15px;
  padding: 14px 16px;
  border: 1px solid rgba(142, 177, 213, 0.15);
  border-radius: 9px;
  background: var(--patch-panel);
  color: #b8c9dc;
  font-size: 0.84rem;
}

.patch-noscript a {
  color: var(--patch-blue-bright);
}

.patch-page :is(a, button, input):focus-visible {
  outline: 2px solid var(--patch-blue-bright);
  outline-offset: 3px;
}

@media (max-width: 1120px) {
  .patch-intro {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .patch-stats {
    max-width: 760px;
  }

  .patch-workspace {
    grid-template-columns: 270px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .patch-page {
    padding: 24px 15px 56px;
  }

  .patch-workspace {
    grid-template-columns: 1fr;
  }

  .patch-archive {
    position: static;
    max-height: 440px;
  }

  .patch-archive-list {
    max-height: 330px;
  }
}

@media (max-width: 560px) {
  .patch-page {
    padding: 18px 12px 44px;
  }

  .patch-shell {
    gap: 18px;
  }

  .patch-intro {
    padding-bottom: 18px;
  }

  .patch-intro h1 {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }

  .patch-intro-copy > p {
    font-size: 0.91rem;
  }

  .patch-hero-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .patch-hero-actions a {
    padding-inline: 8px;
    font-size: 0.74rem;
  }

  .patch-stats > div {
    min-height: 75px;
    padding: 10px;
  }

  .patch-stats strong {
    font-size: 0.87rem;
  }

  .patch-detail-header {
    padding: 17px 14px;
  }

  .patch-detail-title-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .patch-detail-title-row h2 {
    font-size: 1.55rem;
  }

  .patch-change-total {
    display: flex;
    align-items: baseline;
    justify-items: initial;
    gap: 5px;
  }

  .patch-change-total strong {
    font-size: 1rem;
  }

  .patch-detail-content {
    padding: 0 14px 5px;
  }

  .patch-change {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .patch-change-type {
    width: max-content;
  }

  .patch-detail-footer {
    padding-inline: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .patch-loader {
    animation: none;
  }

  .patch-primary-action,
  .patch-secondary-action {
    transition: none;
  }
}
