/* Dynamic Patch Notes */

.patch-page {
  --patch-blue: #4aa3ff;
  --patch-cyan: #38bdf8;
  --patch-text: #f2f7ff;
  --patch-muted: #9db0ca;
  --patch-line: rgba(125, 175, 255, 0.16);
  width: min(1480px, calc(100% - 28px));
  min-height: calc(100vh - 180px);
  margin: 0 auto;
  padding: 42px 0 74px;
  color: var(--patch-text);
}

.patch-hero,
.patch-archive,
.patch-detail-card,
.patch-detail-empty,
.patch-detail-error,
.patch-noscript {
  position: relative;
  border: 1px solid var(--patch-line);
  background:
    radial-gradient(
      ellipse at 12% 0%,
      rgba(74, 163, 255, 0.11),
      transparent 44%
    ),
    linear-gradient(180deg, rgba(8, 18, 32, 0.94), rgba(4, 13, 25, 0.92));
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px) saturate(125%);
}

.patch-hero::before,
.patch-archive::before,
.patch-detail-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(117, 192, 255, 0.52),
    transparent
  );
}

.patch-hero {
  min-height: 340px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(520px, 0.82fr);
  align-items: center;
  gap: 52px;
  padding: 42px;
  overflow: hidden;
  border-radius: 20px;
}

.patch-hero::after {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  right: -140px;
  top: -260px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(45, 212, 232, 0.09),
    transparent 68%
  );
  pointer-events: none;
}

.patch-hero-copy,
.patch-stats {
  position: relative;
  z-index: 1;
}

.patch-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px 11px;
  color: #7dc0ff;
  border: 1px solid rgba(74, 163, 255, 0.2);
  border-radius: 999px;
  background: rgba(74, 163, 255, 0.07);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.patch-hero h1 {
  margin: 0;
  color: var(--patch-text);
  font-size: clamp(3rem, 6vw, 5.3rem);
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.patch-hero h1 span {
  color: #70b7ff;
}

.patch-hero-copy > p {
  max-width: 690px;
  margin: 20px 0 0;
  color: #b8c9df;
  font-size: 1.04rem;
  line-height: 1.7;
}

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

.patch-primary-action,
.patch-secondary-action {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  color: #fff;
  border: 1px solid rgba(102, 179, 255, 0.45);
  border-radius: 12px;
  background: linear-gradient(135deg, #2f8df5, #2563eb);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
  transition: 180ms ease;
}

.patch-secondary-action {
  color: #c8dcf4;
  border-color: rgba(125, 175, 255, 0.18);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: none;
}

.patch-primary-action:hover,
.patch-secondary-action:hover {
  color: #fff;
  transform: translateY(-1px);
}

.patch-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(125, 175, 255, 0.15);
  border-radius: 16px;
  background: rgba(3, 11, 22, 0.5);
}

.patch-stats > div {
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 22px;
  border-right: 1px solid rgba(125, 175, 255, 0.11);
  border-bottom: 1px solid rgba(125, 175, 255, 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: #7f97b6;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.patch-stats strong {
  margin-top: 7px;
  color: #f5f9ff;
  font-size: 1.36rem;
  font-weight: 950;
  line-height: 1.2;
}
.patch-stats span {
  margin-top: 5px;
  color: #84a0bf;
  font-size: 0.77rem;
}

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

.patch-archive {
  position: static;
  align-self: start;
  max-height: calc(100vh - 116px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
}

.patch-archive > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 13px;
  color: #8fc4fb;
  font-size: 0.7rem;
  font-weight: 950;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.patch-archive > header strong,
.patch-channel-tabs button span,
.patch-release-count {
  min-width: 25px;
  height: 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  color: #9bb6d6;
  border-radius: 999px;
  background: rgba(125, 175, 255, 0.1);
  font-size: 0.7rem;
  font-weight: 900;
}

.patch-channel-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  padding: 0 14px 12px;
}

.patch-channel-tabs button {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  color: #92a7c1;
  border: 1px solid rgba(125, 175, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.patch-channel-tabs button span {
  margin-left: auto;
}
.patch-channel-tabs button.active {
  color: #eff7ff;
  border-color: rgba(74, 163, 255, 0.4);
  background: rgba(74, 163, 255, 0.13);
}
.patch-channel-tabs button.active i {
  color: #6eb8ff;
}

.patch-search {
  min-height: 44px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin: 0 14px 13px;
  padding: 0 11px;
  color: #7697bc;
  border: 1px solid rgba(125, 175, 255, 0.14);
  border-radius: 10px;
  background: rgba(1, 8, 17, 0.5);
}

.patch-search:focus-within {
  border-color: rgba(74, 163, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(74, 163, 255, 0.08);
}
.patch-search input {
  min-width: 0;
  color: #edf6ff;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
}
.patch-search input::placeholder {
  color: #647f9e;
}
.patch-search kbd {
  padding: 2px 6px;
  color: #7891ae;
  border: 1px solid rgba(125, 175, 255, 0.14);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.67rem;
}

.patch-archive-list {
  min-height: 130px;
  padding: 2px 12px 15px 22px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(74, 163, 255, 0.35) transparent;
}

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

.patch-release-link::before {
  content: "";
  position: absolute;
  left: 9px;
  top: -9px;
  bottom: 38px;
  width: 1px;
  background: rgba(91, 168, 255, 0.24);
}

.patch-release-link:first-child::before {
  top: 31px;
}
.patch-release-link:hover {
  color: #ddecff;
  background: rgba(74, 163, 255, 0.055);
}
.patch-release-link.active {
  color: #f4f9ff;
  border-color: rgba(74, 163, 255, 0.31);
  background: linear-gradient(
    90deg,
    rgba(74, 163, 255, 0.18),
    rgba(74, 163, 255, 0.06)
  );
}
.patch-timeline-dot {
  width: 9px;
  height: 9px;
  position: relative;
  z-index: 1;
  border: 2px solid #568fc5;
  border-radius: 50%;
  background: #071526;
  box-shadow: 0 0 0 3px #071526;
}
.patch-release-link.active .patch-timeline-dot {
  border-color: #a7dbff;
  background: #4aa3ff;
  box-shadow: 0 0 0 4px rgba(74, 163, 255, 0.17);
}
.patch-release-link > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.patch-release-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 900;
}
.patch-release-link small {
  color: #758aa6;
  font-size: 0.68rem;
  font-weight: 700;
}
.patch-release-count {
  height: 23px;
  min-width: 23px;
  font-size: 0.66rem;
}
.patch-release-link[hidden] {
  display: none;
}

.patch-archive-loading,
.patch-archive-empty {
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #7e96b4;
  font-size: 0.8rem;
}
.patch-archive-empty[hidden] {
  display: none;
}

.patch-detail-shell {
  min-width: 0;
  min-height: 580px;
}
.patch-detail-shell.is-loading {
  opacity: 0.72;
}
.patch-detail-loading,
.patch-detail-empty,
.patch-detail-error {
  min-height: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 40px;
  border-radius: 18px;
  text-align: center;
}
.patch-detail-loading {
  color: #a5b9d2;
}
.patch-detail-loading small {
  color: #7088a5;
}
.patch-loader {
  width: 22px;
  height: 22px;
  display: inline-block;
  border: 2px solid rgba(74, 163, 255, 0.18);
  border-top-color: #63b3ff;
  border-radius: 50%;
  animation: patch-spin 0.8s linear infinite;
}
@keyframes patch-spin {
  to {
    transform: rotate(360deg);
  }
}

.patch-detail-card {
  min-height: 580px;
  overflow: hidden;
  border-radius: 18px;
}
.patch-detail-header {
  position: relative;
  padding: 30px 32px 27px;
  border-bottom: 1px solid rgba(125, 175, 255, 0.13);
  background: radial-gradient(
    ellipse at 92% 0%,
    rgba(28, 141, 233, 0.14),
    transparent 50%
  );
}
.patch-detail-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: #79baf5;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.patch-detail-kicker span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.patch-detail-kicker small {
  color: #7e95b1;
  font-size: 0.68rem;
}
.patch-detail-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 26px;
  align-items: end;
  margin-top: 15px;
}
.patch-detail-title-row h2 {
  margin: 0;
  color: #f5f9ff;
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 950;
  letter-spacing: -0.04em;
  line-height: 1;
}
.patch-detail-title-row p {
  max-width: 760px;
  margin: 14px 0 0;
  color: #aebfd4;
  font-size: 0.94rem;
  line-height: 1.65;
}
.patch-change-total {
  min-width: 88px;
  display: grid;
  justify-items: end;
  color: #7f96b2;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.patch-change-total strong {
  color: #70b7ff;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

.patch-detail-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
}
.patch-detail-section,
.patch-detail-content > .patch-section {
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(125, 175, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.patch-detail-content > .legal-divider {
  display: none;
}
.patch-detail-section h2,
.patch-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px;
  color: #7bc0ff;
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.patch-detail-section h2 > span,
.patch-section-title > i {
  width: 35px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #70b7ff;
  border: 1px solid rgba(74, 163, 255, 0.24);
  border-radius: 10px;
  background: rgba(74, 163, 255, 0.08);
  font-size: 1rem;
}
.patch-change-list {
  display: grid;
  gap: 4px;
}
.patch-change {
  min-height: 38px;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(125, 175, 255, 0.075);
}
.patch-change:last-child {
  border-bottom: 0;
}
.patch-change p {
  margin: 1px 0 0;
  color: #aebdd1;
  font-size: 0.82rem;
  line-height: 1.55;
}
.patch-change-type {
  min-height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 6px;
  color: #90c8fa;
  border: 1px solid rgba(74, 163, 255, 0.22);
  border-radius: 5px;
  background: rgba(74, 163, 255, 0.08);
  font-size: 0.59rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.patch-change-type.added {
  color: #63e6bd;
  border-color: rgba(52, 211, 153, 0.25);
  background: rgba(52, 211, 153, 0.08);
}
.patch-change-type.fixed {
  color: #80c7ff;
}
.patch-change-type.improved {
  color: #bda1ff;
  border-color: rgba(167, 139, 250, 0.25);
  background: rgba(139, 92, 246, 0.08);
}
.patch-change-type.removed {
  color: #f6a1ad;
  border-color: rgba(251, 113, 133, 0.25);
  background: rgba(251, 113, 133, 0.08);
}
.patch-change-type.security {
  color: #f3cc6d;
  border-color: rgba(251, 191, 36, 0.25);
  background: rgba(251, 191, 36, 0.08);
}

/* Historical release HTML is displayed through the same restrained card system. */
.patch-list {
  margin: 0;
  padding-left: 1.05rem;
  color: #aebdd1;
  font-size: 0.82rem;
  line-height: 1.62;
}
.patch-list li {
  margin: 7px 0;
  padding-left: 3px;
}
.patch-list ul {
  margin: 6px 0 10px;
  padding-left: 1.15rem;
  color: #90a5bf;
}
.patch-list strong {
  color: #d9e9fa;
}
.patch-list code {
  padding: 2px 5px;
  color: #a7d5ff;
  border-radius: 4px;
  background: rgba(74, 163, 255, 0.1);
}

.patch-detail-footer {
  min-height: 63px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 22px;
  border-top: 1px solid rgba(125, 175, 255, 0.12);
  background: rgba(0, 8, 18, 0.3);
}
.patch-detail-footer > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #7fa58f;
  font-size: 0.75rem;
  font-weight: 800;
}
.patch-detail-footer > span i {
  color: #34d399;
}
.patch-detail-footer button,
.patch-detail-error button {
  min-height: 37px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  color: #a9c8e9;
  border: 1px solid rgba(125, 175, 255, 0.17);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 900;
  cursor: pointer;
}
.patch-detail-footer button:hover {
  color: #fff;
  border-color: rgba(74, 163, 255, 0.45);
}
.patch-detail-empty i,
.patch-detail-error i {
  color: #5eabf3;
  font-size: 2rem;
}
.patch-detail-empty h2,
.patch-detail-error h2 {
  margin: 2px 0 0;
  color: #edf6ff;
  font-size: 1.35rem;
}
.patch-detail-empty p,
.patch-detail-error p {
  margin: 0;
  color: #8da3bf;
}
.patch-noscript {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  color: #b8c9dc;
}
.patch-noscript a {
  color: #70b7ff;
}

@media (max-width: 1120px) {
  .patch-hero {
    grid-template-columns: 1fr;
  }
  .patch-stats {
    max-width: 720px;
  }
  .patch-workspace {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

@media (max-width: 820px) {
  .patch-page {
    padding-top: 24px;
  }
  .patch-hero {
    min-height: 0;
    padding: 30px 24px;
  }
  .patch-workspace {
    grid-template-columns: 1fr;
  }
  .patch-archive {
    max-height: none;
  }
  .patch-archive-list {
    max-height: 320px;
  }
  .patch-detail-shell,
  .patch-detail-card,
  .patch-detail-loading,
  .patch-detail-empty,
  .patch-detail-error {
    min-height: 440px;
  }
}

@media (max-width: 560px) {
  .patch-page {
    width: min(100% - 18px, 1480px);
  }
  .patch-hero {
    padding: 25px 19px;
    border-radius: 15px;
  }
  .patch-hero h1 {
    font-size: 3rem;
  }
  .patch-stats {
    grid-template-columns: 1fr;
  }
  .patch-stats > div {
    min-height: 90px;
    border-right: 0;
    border-bottom: 1px solid rgba(125, 175, 255, 0.11) !important;
  }
  .patch-stats > div:last-child {
    border-bottom: 0 !important;
  }
  .patch-primary-action,
  .patch-secondary-action {
    width: 100%;
  }
  .patch-detail-header {
    padding: 24px 19px;
  }
  .patch-detail-kicker {
    align-items: flex-start;
    flex-direction: column;
  }
  .patch-detail-title-row {
    grid-template-columns: 1fr;
  }
  .patch-change-total {
    justify-items: start;
  }
  .patch-detail-content {
    padding: 10px;
  }
  .patch-detail-section,
  .patch-detail-content > .patch-section {
    padding: 16px;
  }
  .patch-change {
    grid-template-columns: 1fr;
  }
  .patch-change-type {
    width: max-content;
  }
  .patch-detail-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .patch-loader {
    animation: none;
  }
  .patch-primary-action,
  .patch-secondary-action {
    transition: none;
  }
}
