:root {
  --background: #080708;
  --panel: #100e10;
  --panel-raised: #151114;
  --line: #2a2528;
  --line-strong: #43383d;
  --text: #e8e4e3;
  --muted: #938b8e;
  --dim: #655d61;
  --accent: #c52b46;
  --accent-bright: #d43a52;
  --red: #c52b46;
  --mono: "Cascadia Code", Consolas, monospace;
  --display: "Bahnschrift Condensed", "Arial Narrow", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -30%, rgb(77 17 31 / 14%), transparent 58%),
    var(--background);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
}

button,
a {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 4px;
}

.site-shell {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border-bottom: 1px solid var(--line);
}

.brand,
.session-area,
.main-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 240px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid var(--line-strong);
  object-fit: cover;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: #e6e1e2;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.brand small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.main-nav {
  justify-content: center;
  gap: clamp(16px, 3vw, 42px);
  color: var(--muted);
  font-size: 11px;
}

.main-nav a:hover,
.site-footer a:hover {
  color: var(--accent-bright);
}

.session-area {
  justify-content: flex-end;
  gap: 17px;
  min-width: 240px;
}

.connection-indicator,
.setup-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.connection-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connection-indicator i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-bright);
  box-shadow: 0 0 9px rgb(212 58 82 / 55%);
}

.setup-label {
  color: #c7a86c;
}

.button {
  min-height: 37px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  transition: background 160ms ease, border-color 160ms ease;
}

.button:hover {
  border-color: var(--accent);
  background: rgb(197 43 70 / 9%);
}

.button-primary {
  color: var(--accent-bright);
}

.button-quiet {
  color: var(--muted);
}

.button-large {
  min-height: 49px;
  margin-top: 14px;
  padding: 0 21px;
}

.button-large span {
  margin-right: 8px;
  font-size: 14px;
}

.hero-panel {
  position: relative;
  margin-top: 36px;
  padding: 25px 30px 0;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(115deg, rgb(20 13 16 / 96%), rgb(8 7 8 / 96%)),
    var(--panel);
  overflow: hidden;
}

.hero-panel::after {
  position: absolute;
  top: 0;
  right: 0;
  width: 260px;
  height: 260px;
  border: 1px solid rgb(197 43 70 / 7%);
  border-radius: 50%;
  content: "";
  transform: translate(35%, -45%);
  pointer-events: none;
}

.hero-topline,
.hero-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.hero-topline {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  align-items: center;
  gap: 56px;
  min-height: 350px;
  padding: 36px 0;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 700;
}

h1 {
  margin-bottom: 18px;
  color: #e5e9e3;
  font-size: clamp(45px, 7vw, 76px);
  line-height: 0.87;
  letter-spacing: 0.015em;
}

h1 span {
  color: var(--accent);
}

.hero-description {
  max-width: 560px;
  margin-bottom: 18px;
  color: #aaa1a3;
  font-size: 12px;
  line-height: 1.8;
}

.system-card {
  padding: 18px;
  border: 1px solid var(--line);
  background: rgb(5 4 5 / 56%);
}

.card-heading,
.system-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.card-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.mono {
  color: var(--muted);
}

.system-row {
  padding: 12px 0;
  border-bottom: 1px solid rgb(42 37 40 / 76%);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.system-row strong {
  color: #ded8da;
  font-weight: 400;
  text-align: right;
}

.system-note {
  margin: 15px 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.7;
}

.hero-footer {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 8px;
}

.access-strip,
.archive-section {
  padding-top: 58px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 20px;
}

.section-heading .eyebrow {
  margin-bottom: 7px;
}

.section-heading h2,
.protocol-panel h2 {
  margin-bottom: 0;
  color: #e0e7df;
  font-size: 30px;
  line-height: 1;
}

.section-heading > p {
  max-width: 430px;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.8;
  text-align: right;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.level-card {
  min-height: 133px;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--dim);
}

.level-card.is-available {
  border-color: var(--line-strong);
  color: var(--accent-bright);
  background: linear-gradient(145deg, #1a1014, var(--panel));
}

.level-card-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 9px;
}

.level-card > strong,
.level-card > small,
.level-state {
  display: block;
}

.level-card > strong {
  color: #d8e1d7;
  font-family: var(--display);
  font-size: 27px;
  line-height: 1;
}

.level-card > small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.level-state {
  margin-top: 15px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.archive-heading {
  margin-bottom: 17px;
}

.result-count {
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 9px;
}

.notice-panel {
  display: flex;
  align-items: center;
  gap: 17px;
  min-height: 94px;
  padding: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(100deg, #120e10, #0b090a);
}

.notice-error {
  border-color: rgb(200 92 87 / 50%);
}

.notice-icon {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--accent-bright);
  font-size: 17px;
}

.notice-error .notice-icon {
  border-color: var(--red);
  color: var(--red);
}

.notice-panel strong {
  display: block;
  margin-bottom: 6px;
  color: #dce5dc;
  font-family: var(--display);
  font-size: 18px;
}

.notice-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.notice-tag {
  margin-left: auto;
  color: #c7a86c;
  font-family: var(--mono);
  font-size: 8px;
  text-align: right;
}

.document-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.archive-browser[hidden],
[hidden] {
  display: none !important;
}

.level-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.level-tab {
  display: grid;
  flex: 1 0 96px;
  gap: 8px;
  min-height: 57px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.level-tab > span {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
}

.level-tab > small {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.06em;
}

.level-tab:hover:not(:disabled),
.level-tab[aria-selected="true"] {
  border-color: var(--accent);
  background: #180e12;
  color: var(--accent-bright);
}

.level-tab[aria-selected="true"] {
  box-shadow: inset 0 2px var(--accent);
}

.level-tab:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.level-panel {
  min-height: 190px;
  padding: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(110deg, #100c0e, #090809);
}

.level-panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.level-panel-heading .eyebrow {
  margin-bottom: 5px;
}

.level-panel-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 21px;
}

.document-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgb(5 4 5 / 55%);
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease;
}

.document-button:hover {
  border-color: var(--accent);
  background: rgb(197 43 70 / 7%);
}

.document-button-icon {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 8px;
}

.document-button-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #ded8da;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
}

.document-button-action {
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 8px;
  white-space: nowrap;
}

.empty-level {
  margin: 0;
  padding: 20px 0 6px;
  color: var(--muted);
  font-size: 11px;
}

.document-dialog {
  width: min(840px, calc(100% - 32px));
  max-width: 840px;
  max-height: min(82vh, 900px);
  padding: 0;
  border: 1px solid var(--line-strong);
  background: var(--background);
  color: var(--text);
  box-shadow: 0 24px 100px rgb(0 0 0 / 75%);
}

.document-dialog::backdrop {
  background: rgb(0 0 0 / 78%);
  backdrop-filter: blur(3px);
}

.document-dialog-heading {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 24px 17px;
  border-bottom: 1px solid var(--line);
  background: #100d0f;
}

.document-dialog-heading .eyebrow {
  margin-bottom: 6px;
}

.document-dialog-heading h2 {
  margin: 0;
  font-size: 27px;
  overflow-wrap: anywhere;
}

.dialog-close {
  flex: 0 0 auto;
}

.document-content {
  margin: 0;
  padding: 22px 24px 28px;
  overflow: auto;
  color: #b1a9ab;
  font: 11px/1.9 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.document-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--accent-bright);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.document-meta span:last-child {
  color: var(--muted);
}

.protocol-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: end;
  gap: 48px;
  margin-top: 58px;
  padding: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(110deg, #120d10, #090809);
}

.protocol-panel h2 {
  font-size: 27px;
  line-height: 1.05;
}

.protocol-panel > p {
  max-width: 510px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.9;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 30px;
  padding: 19px 0 25px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.07em;
}

.site-footer a {
  color: var(--muted);
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    padding: 17px 0;
  }

  .main-nav {
    order: 3;
    justify-content: flex-start;
    width: 100%;
  }

  .session-area {
    min-width: unset;
  }

  .level-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-shell {
    width: min(100% - 28px, 1120px);
  }

  .topbar {
    gap: 15px;
  }

  .brand {
    min-width: 0;
  }

  .brand strong {
    font-size: 10px;
  }

  .session-area {
    gap: 9px;
  }

  .connection-indicator {
    display: none;
  }

  .button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 8px;
  }

  .main-nav {
    gap: 18px;
    font-size: 10px;
  }

  .hero-panel {
    margin-top: 19px;
    padding: 18px 17px 0;
  }

  .hero-topline,
  .hero-footer {
    font-size: 7px;
  }

  .hero-main {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 33px 0 25px;
  }

  h1 {
    font-size: clamp(46px, 15vw, 68px);
  }

  .hero-description {
    font-size: 11px;
  }

  .system-card {
    padding: 14px;
  }

  .access-strip,
  .archive-section {
    padding-top: 43px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .section-heading h2 {
    font-size: 27px;
  }

  .section-heading > p {
    text-align: left;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .document-list {
    grid-template-columns: 1fr;
  }

  .level-panel {
    padding: 14px;
  }

  .level-card {
    min-height: 122px;
  }

  .notice-panel {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 15px;
  }

  .notice-tag {
    width: 100%;
    margin-left: 55px;
    text-align: left;
  }

  .protocol-panel {
    grid-template-columns: 1fr;
    gap: 18px;
    margin-top: 43px;
    padding: 18px;
  }

  .document-dialog-heading {
    padding: 17px;
  }

  .document-dialog-heading h2 {
    font-size: 22px;
  }

  .document-content {
    padding: 17px;
  }

  .site-footer {
    flex-direction: column;
    gap: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
