:root {
  color-scheme: dark;
  --ink: #f8ead5;
  --muted: #c5a985;
  --gold: #e3b261;
  --line: rgba(227, 178, 97, 0.34);
  --panel-width: clamp(278px, 22vw, 360px);
  --patch-bg: url("patches/v11/images/bg.png");
  --patch-panel: url("patches/v11/images/left-panel.png");
  font-family: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #100d0a;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--patch-bg) center top / cover no-repeat;
  filter: brightness(1.36) contrast(1.08);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at center top, rgba(105, 58, 25, 0.16), transparent 44%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.46));
}

button,
a {
  font: inherit;
}

button {
  border: 0;
}

.patch-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 3;
  width: var(--panel-width);
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.28)),
    var(--patch-panel) right center / 100% 100% no-repeat;
}

.patch-sidebar-inner {
  height: 100vh;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(24px, 3vw, 42px) clamp(22px, 2.6vw, 34px);
  text-align: center;
}

.direct-link {
  flex: 0 0 auto;
  width: 222px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px 2px;
  border: 0;
  color: #f9e7bd;
  background: url("key-images/button.png") center / 100% 100% no-repeat;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-shadow:
    0 1px 1px #000,
    0 2px 6px rgba(0, 0, 0, 0.88);
  white-space: nowrap;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.34));
}

.direct-link:hover,
.direct-link:focus-visible {
  color: #fff6d8;
  filter:
    brightness(1.08)
    drop-shadow(0 9px 14px rgba(0, 0, 0, 0.42));
  outline: none;
}

.patch-kicker {
  margin: 0;
  color: var(--gold);
  font-family: "Lora", "Palatino Linotype", Georgia, serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  text-shadow: 0 2px 8px #000;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.9);
}

h1 {
  font-size: clamp(34px, 4.5vw, 56px);
}

h2 {
  margin-top: 5px;
  font-size: clamp(28px, 4vw, 48px);
}

.patch-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.patch-list-item {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border-left: 3px solid rgba(227, 178, 97, 0.62);
  color: #ead5b6;
  background:
    linear-gradient(90deg, rgba(97, 51, 20, 0.36), rgba(9, 6, 4, 0.1));
  font-family: "Segoe UI", Arial, sans-serif;
  text-align: left;
  text-shadow: 0 2px 8px #000;
  cursor: pointer;
}

.patch-list-item:hover,
.patch-list-item:focus-visible,
.patch-list-item.active {
  border-left-color: rgba(141, 255, 177, 0.95);
  color: #fff2cf;
  background:
    linear-gradient(90deg, rgba(60, 95, 63, 0.36), rgba(40, 22, 10, 0.12));
  outline: none;
}

.patch-list-item span {
  font-size: 16px;
  font-weight: 850;
}

.patch-list-item strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.patch-viewer {
  min-height: 100vh;
  margin-left: var(--panel-width);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.patch-viewer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 68px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px clamp(16px, 3vw, 34px);
  border-bottom: 1px solid rgba(227, 178, 97, 0.24);
  background:
    linear-gradient(180deg, rgba(18, 12, 7, 0.82), rgba(18, 12, 7, 0.46));
  backdrop-filter: blur(8px);
}

.patch-viewer-head h2 {
  margin-top: 3px;
  font-size: clamp(22px, 3vw, 34px);
}

.patch-viewer-head .patch-kicker {
  font-size: 11px;
}

#patch-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 68px);
  border: 0;
  background: transparent;
}

.outdated-patch-note {
  position: fixed;
  right: clamp(14px, 2.5vw, 28px);
  bottom: clamp(14px, 2.5vw, 28px);
  z-index: 5;
  width: min(360px, calc(100vw - 28px));
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(227, 178, 97, 0.36);
  border-left: 3px solid rgba(141, 255, 177, 0.86);
  border-radius: 4px;
  color: #eddabe;
  background:
    linear-gradient(180deg, rgba(30, 20, 12, 0.9), rgba(12, 8, 5, 0.82)),
    rgba(12, 8, 5, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 238, 188, 0.05),
    0 16px 28px rgba(0, 0, 0, 0.36);
  font-family: "Segoe UI", Arial, sans-serif;
  text-shadow: 0 2px 8px #000;
}

.outdated-patch-note p {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.outdated-patch-note strong {
  color: #fff0bf;
}

.outdated-patch-note button {
  width: fit-content;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(141, 255, 177, 0.42);
  border-radius: 4px;
  color: #d9ffe3;
  background: rgba(40, 85, 48, 0.26);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.outdated-patch-note button:hover,
.outdated-patch-note button:focus-visible {
  border-color: rgba(169, 255, 191, 0.72);
  color: #f0fff4;
  background: rgba(50, 104, 59, 0.34);
  outline: none;
}

@media (max-width: 920px) {
  .patch-sidebar {
    position: relative;
    width: 100%;
    min-height: auto;
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.28)),
      var(--patch-panel) right center / cover no-repeat;
  }

  .patch-sidebar-inner {
    height: auto;
    min-height: 300px;
  }

  .patch-viewer {
    margin-left: 0;
  }

  #patch-frame {
    min-height: 80vh;
  }
}

@media (max-width: 560px) {
  .patch-sidebar-inner {
    padding: 22px 16px;
  }

  .patch-viewer-head {
    display: grid;
    align-items: start;
    min-height: 0;
    padding: 12px 14px;
  }

  .direct-link {
    width: 222px;
    max-width: 100%;
    justify-self: start;
  }

  #patch-frame {
    min-height: 76vh;
  }

  .outdated-patch-note {
    right: 10px;
    bottom: 10px;
    width: min(340px, calc(100vw - 20px));
  }
}
