:root {
  --bg-dark: #12110f;
  --bg-mid: #1e1c1a;
  --ink: #191611;
  --paper: #f5edd8;
  --paper-shadow: #dccfb5;
  --accent-red: #b53d2c;
  --accent-blue: #2c4f7b;
  --line: #201b16;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  background:
    radial-gradient(circle at 12% 18%, #3d3832 0, transparent 35%),
    radial-gradient(circle at 88% 78%, #2c2823 0, transparent 40%),
    linear-gradient(160deg, var(--bg-mid), var(--bg-dark));
  color: var(--ink);
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  overflow-x: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.15), transparent 30%),
    radial-gradient(circle at 75% 45%, rgba(255, 255, 255, 0.08), transparent 40%),
    repeating-radial-gradient(circle at 60% 30%, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 4px);
  mix-blend-mode: soft-light;
  z-index: -1;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Bangers", "Impact", fantasy;
  letter-spacing: 0.04em;
}

p,
li {
  margin: 0;
  line-height: 1.45;
  font-family: "Special Elite", "Courier New", monospace;
}

ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.65rem;
}

[data-lang="it"] .de,
[data-lang="de"] .it {
  display: none;
}

.top-strip {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.4rem 1.2rem 0.8rem;
  color: #f2ebda;
  text-transform: uppercase;
  position: relative;
}

.top-strip h1 {
  font-size: clamp(2.4rem, 8vw, 4.8rem);
  line-height: 0.95;
  text-shadow: 3px 3px 0 #090807;
}

.logo-home {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-shadow: inherit;
  cursor: pointer;
}

.logo-home:focus-visible {
  outline: 2px solid rgba(242, 235, 218, 0.7);
  outline-offset: 4px;
  border-radius: 6px;
}

.lang-toggle {
  position: absolute;
  top: 1.6rem;
  right: 1.2rem;
  min-width: 58px;
  padding: 0.5rem 0.8rem;
  border: 2px solid #f2ebda;
  background: linear-gradient(160deg, #34302c, #1d1a16);
  color: #f2ebda;
  font-family: "Bangers", "Impact", fantasy;
  letter-spacing: 0.08em;
  cursor: pointer;
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1.2rem 1.4rem;
}

#comic-book {
  position: relative;
  min-height: 0;
  perspective: 2200px;
}

.safari-fallback #comic-book {
  perspective: none;
}

.spread {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.safari-fallback .spread {
  transform-style: flat;
}

.spread.active {
  opacity: 1;
  pointer-events: auto;
}

.gate-spread {
  align-items: center;
}

.page {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background:
    linear-gradient(130deg, rgba(255, 255, 255, 0.56), transparent 35%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.04) 0 1px, transparent 1px 5px),
    var(--paper);
  border: 3px solid var(--line);
  border-radius: 16px;
  box-shadow:
    inset 0 -6px 18px rgba(0, 0, 0, 0.14),
    0 18px 30px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.image-page {
  padding: 0;
  background: #e7dcc0;
}

.full-page-art {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  isolation: isolate;
}

.full-page-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(244, 231, 203, 0.16), rgba(177, 141, 85, 0.18)),
    radial-gradient(circle at 20% 16%, rgba(255, 245, 221, 0.22), transparent 34%);
  mix-blend-mode: multiply;
}

.full-page-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 24%;
  filter: grayscale(1) sepia(0.52) saturate(0.7) contrast(0.98) brightness(1.03);
}

.full-page-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 3px rgba(0, 0, 0, 0.18),
    inset 0 -48px 72px rgba(0, 0, 0, 0.08);
}

.index-page {
  align-content: start;
}

.gate-page {
  grid-column: 1 / -1;
  width: min(100%, 760px);
  margin: 0 auto;
  align-content: center;
}

.panel {
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.32);
  border: 2px solid var(--line);
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: repeating-linear-gradient(
    120deg,
    transparent 0 14px,
    rgba(0, 0, 0, 0.03) 14px 15px
  );
}

.hero-panel h2,
.panel h2 {
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.05;
}

.panel h3 {
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  color: var(--accent-blue);
}

.panel-kicker {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-red);
}

.gate-panel {
  gap: 0.95rem;
  text-align: center;
}

.gate-panel h2 {
  font-size: clamp(1.85rem, 3vw, 2.4rem);
}

.gate-image {
  width: min(100%, 460px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(244, 236, 219, 0.85);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 10px 18px rgba(0, 0, 0, 0.14);
}

.gate-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(1) sepia(0.5) contrast(0.98) brightness(1.03);
}

.unlock-form {
  display: grid;
  gap: 0.62rem;
  width: min(100%, 420px);
  margin: 0 auto;
  text-align: left;
}

.unlock-form label {
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.unlock-form input {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff8e7;
  color: var(--ink);
  padding: 0.6rem 0.75rem;
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-size: 1rem;
}

.unlock-form input:focus {
  outline: 2px solid rgba(44, 79, 123, 0.5);
  outline-offset: 1px;
}

.unlock-btn {
  border: 2px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8e7, #f0e4ca);
  color: var(--ink);
  padding: 0.52rem 0.95rem;
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.unlock-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.unlock-feedback {
  min-height: 1.2rem;
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.unlock-feedback[data-state="error"] {
  color: var(--accent-red);
}

.unlock-feedback[data-state="ok"] {
  color: #2e6d3e;
}

.crest-image {
  width: min(100%, 300px);
  aspect-ratio: 1 / 1;
  margin: 0.2rem auto 0;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(244, 236, 219, 0.85);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 10px 18px rgba(0, 0, 0, 0.16);
}

.crest-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(1) sepia(0.42) contrast(0.98) brightness(1.02);
}

.guest-panel {
  align-content: start;
}

.guest-panel h2,
.guest-panel h3 {
  font-size: clamp(1.18rem, 1.9vw, 1.55rem);
  color: var(--ink);
}

.guest-roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 1rem;
}

.guest-roster-all {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1.45rem;
}

.guest-roster li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: 1.15;
}

.guest-copy {
  display: grid;
  gap: 0.1rem;
}

.guest-name {
  font-family: "Bangers", "Impact", fantasy;
  font-size: clamp(1rem, 2vw, 1.35rem);
  letter-spacing: 0.03em;
}

.guest-role {
  font-family: "Special Elite", "Courier New", monospace;
  font-size: clamp(0.66rem, 1.15vw, 0.8rem);
  letter-spacing: 0.02em;
  color: #4a4337;
  text-transform: none;
}

.guest-roster-all .guest-name {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
}

.guest-roster-all .guest-role {
  font-size: clamp(0.68rem, 1.05vw, 0.88rem);
  line-height: 1.25;
}

.guest-symbol {
  flex: 0 0 auto;
  font-size: 0.9em;
  margin-top: 0.1rem;
}

.guest-symbol-female {
  color: var(--accent-red);
}

.guest-symbol-male {
  color: var(--accent-blue);
}

.guest-symbol-group {
  color: #6b5e45;
}

.location-map {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}

.map-pin {
  flex: 0 0 auto;
  margin-top: 0.08rem;
  color: var(--accent-red);
}

.map-link {
  color: var(--accent-blue);
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.map-link:hover {
  color: #19395f;
}

.location-logo {
  width: min(100%, 240px);
  margin: 0.25rem auto 0;
  justify-self: center;
}

.location-logo a {
  display: block;
}

.location-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.index-list {
  display: grid;
  gap: 0.6rem;
}

.index-entry {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 0.65rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #faf1dc, #ecdfc4);
  color: var(--ink);
  padding: 0.56rem 0.68rem;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.chapter-jump {
  width: min(320px, 100%);
  justify-self: start;
  align-self: start;
  height: auto;
}

.index-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.entry-no {
  font-family: "Bangers", "Impact", fantasy;
  letter-spacing: 0.06em;
  font-size: 1.2rem;
  color: var(--accent-red);
}

.to-index {
  display: inline-flex;
  align-items: center;
  align-self: start;
  justify-self: start;
  width: fit-content;
  margin-top: 0.3rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #fff8e7, #f0e4ca);
  padding: 0.45rem 0.9rem;
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
}

body.locked .nav-strip {
  visibility: hidden;
  pointer-events: none;
}

.nav-strip {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.8rem;
  align-items: center;
}

.nav-btn {
  border: 2px solid #f0e5cc;
  border-radius: 10px;
  background: rgba(14, 13, 12, 0.55);
  color: #f5ecd8;
  padding: 0.65rem 0.9rem;
  font-family: "IBM Plex Sans Condensed", "Trebuchet MS", sans-serif;
  font-size: 0.95rem;
  cursor: pointer;
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.page-meta {
  min-width: 220px;
  text-align: center;
  color: #f5ecd8;
}

#spread-title {
  font-family: "Bangers", "Impact", fantasy;
  letter-spacing: 0.05em;
  font-size: 1.3rem;
}

#spread-count {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 980px) {
  .spread {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 1rem;
  }

  .page {
    min-height: 0;
    height: auto;
    align-content: start;
  }

  .spread > .image-page {
    order: 1;
    min-height: clamp(280px, 52vw, 420px);
  }

  .spread > .page:not(.image-page) {
    order: 2;
    overflow: hidden;
    padding-bottom: 1.05rem;
  }

  .guest-roster-all {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 720px) {
  .top-strip {
    padding-top: 1rem;
  }

  .lang-toggle {
    top: 1.1rem;
  }

  main {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .page {
    padding: 0.78rem;
  }

  .panel {
    padding: 0.82rem;
  }

  .gate-page {
    width: 100%;
  }

  .gate-image,
  .unlock-form {
    width: 100%;
  }

  .guest-roster,
  .guest-roster-all {
    grid-template-columns: 1fr;
  }

  .nav-strip {
    grid-template-columns: 1fr;
  }

  .page-meta {
    order: -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
