:root {
  color-scheme: dark;
  --ink: #100b0a;
  --ink-soft: #1b1210;
  --paper: #e7d9bb;
  --paper-dim: #a9997d;
  --blood: #d6412e;
  --blood-dark: #6e1f19;
  --acid: #d7eb51;
  --cyan: #52d7d7;
  --line: rgba(231, 217, 187, 0.24);
  --shadow: #050303;
  font-family: "Courier New", Courier, monospace;
  background: var(--ink);
  color: var(--paper);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #070404;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 85% 12%, rgba(214, 65, 46, 0.19), transparent 28rem),
    radial-gradient(circle at 0 72%, rgba(82, 215, 215, 0.08), transparent 30rem),
    repeating-linear-gradient(91deg, transparent 0 17px, rgba(255, 255, 255, 0.008) 18px 19px),
    linear-gradient(145deg, #17100e, #090606 68%);
}

body::after {
  position: fixed;
  z-index: 20;
  inset: 0;
  pointer-events: none;
  content: "";
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, 0.16) 4px 5px);
  mix-blend-mode: multiply;
}

.film-grain {
  position: fixed;
  z-index: 19;
  inset: -30%;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.24) 0 0.5px, transparent 0.8px),
    radial-gradient(circle, rgba(0, 0, 0, 0.4) 0 0.6px, transparent 0.9px);
  background-position:
    0 0,
    7px 11px;
  background-size:
    13px 17px,
    19px 23px;
  transform: rotate(0.001deg);
}

a {
  color: var(--acid);
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.site-header,
.site-footer,
main {
  position: relative;
  z-index: 2;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--paper);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: var(--blood);
  border: 2px solid #fa775d;
  box-shadow: 4px 4px 0 var(--shadow);
  transform: rotate(-3deg);
}

.site-header nav a,
.nav-state {
  color: var(--paper-dim);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.nav-state::before {
  color: var(--acid);
  content: "● ";
}

main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 70px 0 90px;
}

.hero-panel {
  position: relative;
  max-width: 900px;
  margin-bottom: 58px;
  padding: 34px 0 30px;
}

.hero-panel::before {
  position: absolute;
  z-index: -1;
  top: -5px;
  left: -48px;
  width: 210px;
  height: 210px;
  content: "";
  background: var(--blood);
  clip-path: polygon(13% 0, 88% 6%, 100% 68%, 72% 100%, 4% 83%, 0 23%);
  filter: drop-shadow(14px 16px 0 rgba(0, 0, 0, 0.28));
  opacity: 0.85;
  transform: rotate(-7deg);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--acid);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.2em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 100%;
  margin-bottom: 18px;
  color: #fff2d5;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.78;
  text-shadow:
    5px 5px 0 #3a1711,
    9px 9px 0 #050303;
  transform: scaleY(1.08);
}

.lede {
  max-width: 690px;
  margin-bottom: 25px;
  color: #e8dcc7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 2vw, 1.42rem);
  line-height: 1.55;
}

.signal {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 9px 13px;
  color: var(--acid);
  border: 1px solid rgba(215, 235, 81, 0.46);
  background: rgba(11, 16, 4, 0.72);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.signal-dot {
  width: 8px;
  height: 8px;
  background: var(--acid);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--acid);
}

.tape-grid,
.stat-grid,
.editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.tape {
  position: relative;
  min-height: 230px;
  padding: 28px 24px 24px;
  color: #1d1812;
  background: linear-gradient(94deg, transparent 0 47%, rgba(0, 0, 0, 0.06) 48% 52%, transparent 53%), #d3c4a3;
  border: 3px solid #695e4b;
  box-shadow: 8px 10px 0 rgba(0, 0, 0, 0.5);
  transform: rotate(-0.7deg);
}

.tape:nth-child(even) {
  transform: rotate(0.8deg) translateY(8px);
}

.tape::after {
  position: absolute;
  right: 16px;
  bottom: 13px;
  left: 16px;
  height: 18px;
  content: "";
  background: repeating-linear-gradient(90deg, #332f27 0 6px, transparent 6px 11px);
  opacity: 0.52;
}

.tape-notch {
  position: absolute;
  top: 12px;
  right: 17px;
  width: 22px;
  height: 22px;
  border: 5px solid #6e6556;
  border-radius: 50%;
  box-shadow: -35px 0 0 -5px #6e6556;
}

.tape h2 {
  margin: 0 0 22px;
  color: var(--blood-dark);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 2.25rem;
  letter-spacing: 0.04em;
}

.tape ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0 0 22px;
  list-style: none;
}

.tape li {
  display: flex;
  justify-content: space-between;
  padding-bottom: 5px;
  border-bottom: 1px dashed rgba(29, 24, 18, 0.4);
  font-size: 0.78rem;
}

.privacy-card {
  max-width: 840px;
  margin: 84px 0 0 auto;
  padding: 34px 38px;
  border: 1px solid rgba(82, 215, 215, 0.4);
  background: linear-gradient(120deg, rgba(21, 63, 65, 0.38), rgba(11, 13, 13, 0.8));
  box-shadow: -10px 10px 0 rgba(82, 215, 215, 0.06);
}

.privacy-card h2,
.config-editor h2 {
  margin-bottom: 12px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.2rem, 5vw, 4rem);
  letter-spacing: 0.02em;
}

.privacy-card p:not(.stamp) {
  max-width: 690px;
  color: #c7c6b9;
  line-height: 1.65;
}

.stamp {
  display: inline-block;
  margin-bottom: 18px;
  padding: 5px 9px;
  color: var(--cyan);
  border: 2px solid var(--cyan);
  font-size: 0.69rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  transform: rotate(-2deg);
}

.text-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.login-shell {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 60px;
  align-items: center;
  min-height: 62vh;
}

.login-copy h1,
.admin-heading h1,
.error-shell h1 {
  font-size: clamp(3.6rem, 9vw, 7.3rem);
}

.login-copy p:last-child {
  max-width: 520px;
  color: var(--paper-dim);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18rem;
  line-height: 1.6;
}

.login-card,
.config-editor {
  border: 1px solid var(--line);
  background: rgba(9, 6, 6, 0.84);
  box-shadow: 13px 16px 0 rgba(0, 0, 0, 0.42);
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 36px;
  border-top: 6px solid var(--blood);
}

label,
.config-field span {
  color: var(--paper-dim);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  color: var(--paper);
  background: #0d0908;
  border: 1px solid #5a4b40;
  border-radius: 0;
  font: inherit;
  font-size: 1rem;
}

input:focus {
  border-color: var(--cyan);
}

button,
.button-link {
  min-height: 48px;
  padding: 12px 18px;
  color: #150a07;
  background: var(--blood);
  border: 2px solid #ff8268;
  border-radius: 0;
  box-shadow: 5px 5px 0 #3f120c;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: #f15940;
  transform: translate(-1px, -1px);
}

.button-quiet {
  min-height: auto;
  color: var(--paper-dim);
  background: transparent;
  border-color: #54463e;
  box-shadow: none;
}

.alert {
  margin-bottom: 24px;
  padding: 14px 16px;
  border-left: 5px solid;
  font-size: 0.82rem;
  line-height: 1.5;
}

.alert-danger {
  color: #ffd7cc;
  background: rgba(141, 33, 21, 0.27);
  border-color: var(--blood);
}

.alert-success {
  color: #efffb0;
  background: rgba(107, 128, 19, 0.2);
  border-color: var(--acid);
}

.admin-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 42px;
}

.admin-heading h1 {
  margin-bottom: 0;
}

.stat-grid {
  margin-bottom: 30px;
}

.stat-card {
  min-height: 165px;
  padding: 22px;
  border-top: 4px solid var(--blood);
  background: linear-gradient(145deg, rgba(50, 31, 26, 0.92), rgba(13, 9, 8, 0.92));
  box-shadow: 6px 7px 0 rgba(0, 0, 0, 0.34);
}

.stat-card p {
  color: var(--paper-dim);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.stat-card strong {
  display: block;
  margin: 7px 0 10px;
  color: var(--acid);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
}

.stat-card small {
  color: #8d8272;
  font-size: 0.68rem;
}

.config-editor {
  margin-top: 38px;
  padding: 32px;
}

.config-editor > header,
.config-editor > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.config-editor > header {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.config-editor h2 {
  margin-bottom: 0;
}

.revision {
  padding: 7px 10px;
  color: var(--cyan);
  border: 1px dashed var(--cyan);
  font-size: 0.69rem;
}

.editor-grid {
  align-items: start;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 20px;
  border: 1px solid #453932;
  background: rgba(32, 21, 18, 0.58);
}

legend {
  padding: 0 8px;
  color: var(--blood);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.07em;
}

.fieldset-note {
  min-height: 46px;
  color: #817468;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
  line-height: 1.4;
}

.config-field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.config-field input {
  min-height: 43px;
}

.config-field > strong {
  color: var(--cyan);
  font-size: 0.82rem;
  line-height: 1.45;
}

.config-field input[aria-invalid="true"] {
  border-color: var(--blood);
}

.field-error {
  color: #ff8b74;
  font-size: 0.65rem;
  line-height: 1.35;
}

.config-editor > footer {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.config-editor > footer p {
  margin: 0;
  color: #817468;
  font-size: 0.72rem;
}

.error-shell {
  max-width: 760px;
  min-height: 58vh;
  padding-top: 60px;
}

.error-code {
  margin-bottom: 8px;
  color: var(--blood);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 7rem;
  line-height: 0.8;
}

.error-shell > p:not(.error-code, .eyebrow) {
  max-width: 560px;
  margin-bottom: 32px;
  color: var(--paper-dim);
  line-height: 1.6;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 26px 0 38px;
  color: #6f6457;
  border-top: 1px solid var(--line);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.13em;
}

@media (max-width: 980px) {
  .tape-grid,
  .stat-grid,
  .editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-shell {
    grid-template-columns: 1fr;
    gap: 30px;
  }
}

@media (max-width: 620px) {
  .site-header,
  .site-footer,
  main {
    width: min(100% - 24px, 1180px);
  }

  .site-header {
    align-items: flex-start;
  }

  .brand {
    font-size: 0.8rem;
  }

  .site-header nav {
    max-width: 100px;
    text-align: right;
  }

  main {
    padding-top: 44px;
  }

  h1 {
    font-size: clamp(3.7rem, 20vw, 6rem);
  }

  .tape-grid,
  .stat-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .tape:nth-child(even) {
    transform: rotate(0.5deg);
  }

  .privacy-card,
  .login-card,
  .config-editor {
    padding: 24px 20px;
  }

  .admin-heading,
  .config-editor > header,
  .config-editor > footer,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .config-editor > footer button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
