@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=DM+Mono:wght@400;500&display=swap");

:root {
  --ink: #0B0B0A;
  --ink-2: #171614;
  --panel: rgba(23, 22, 20, 0.92);
  --panel-solid: #171614;

  --oxide: #8F241C;
  --paper: #D4C39C;
  --static: #4E8D91;
  --concrete: #686762;
  --white: #EEE9DC;

  --pink: #8F241C;
  --soft-pink: #D4C39C;
  --muted: #A89F8A;

  --border: rgba(78, 141, 145, 0.45);
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, #2a2027 0, #0a090b 46%),
    var(--ink);
  color: var(--white);
  font-family: "DM Mono", monospace;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.game-shell {
  min-height: 100vh;
}

.scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
}

.scene__background,
.scene__overlay,
.scene__scanlines {
  position: absolute;
  inset: 0;
}

.scene__background {
  z-index: -4;
  background:
    linear-gradient(135deg, rgba(143, 36, 28, 0.08), rgba(78, 141, 145, 0.04)),
    #171318;
  background-size: cover;
  background-position: center;
  transition:
    background-image 350ms ease,
    filter 350ms ease;
}

.scene__overlay {
  z-index: -3;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.08), rgba(10, 9, 11, 0.52)),
    radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.58) 100%);
}

.scene__scanlines {
  z-index: 10;
  pointer-events: none;
  opacity: 0.15;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.08) 0,
      rgba(255, 255, 255, 0.08) 1px,
      transparent 2px,
      transparent 4px
    );
  mix-blend-mode: soft-light;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 9, 11, 0.86);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
}

.brand__eyebrow,
.eyebrow {
  color: var(--soft-pink);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand__title {
  font-family: "Archivo Black", sans-serif;
  letter-spacing: 0.04em;
  color: var(--oxide);
  text-shadow: 0 0 14px rgba(143, 36, 28, 0.42);
}

.status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.status__dot {
  color: var(--static);
  animation: pulse 1.2s infinite;
}

.icon-button {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  cursor: pointer;
}

.stage {
  position: relative;
  min-height: 58vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2rem 1rem 1rem;
}

.character-layer {
  width: min(680px, 92vw);
  min-height: 50vh;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.character-sprite {
  max-height: 54vh;
  max-width: 72vw;
  object-fit: contain;
  filter: drop-shadow(0 15px 28px rgba(0, 0, 0, 0.5));
  animation: idleFloat 2.8s ease-in-out infinite;
}

.character-sprite.enter {
  animation:
    spriteEnter 300ms ease-out,
    idleFloat 2.8s 300ms ease-in-out infinite;
}

.character-sprite.shake {
  animation: shake 250ms linear 1;
}

.character-sprite.glitch {
  animation: glitchSprite 280ms steps(2, end) 2;
}

.objective-card {
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: min(310px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid rgba(78, 141, 145, 0.42);
  background: rgba(10, 9, 11, 0.78);
  box-shadow: 0 0 18px rgba(78, 141, 145, 0.08);
  backdrop-filter: blur(10px);
}

.objective-card__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--static);
}

.glitch-message {
  position: absolute;
  inset: 35% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  max-width: min(900px, 90vw);
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(1.3rem, 5vw, 3.5rem);
  color: var(--white);
  text-align: center;
  text-shadow:
    -3px 0 var(--oxide),
    3px 0 var(--static);
  animation: glitchText 120ms steps(2, end) infinite;
}

.glitch-message[hidden] {
  display: none;
}

.dialogue-panel {
  position: relative;
  z-index: 20;
  width: min(940px, calc(100% - 2rem));
  margin: 0 auto 1.25rem;
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.dialogue-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.speaker-name {
  font-family: "Archivo Black", sans-serif;
  color: var(--oxide);
  text-transform: uppercase;
}

.scene-counter {
  color: var(--muted);
  font-size: 0.72rem;
}

.dialogue-text {
  min-height: 3.6em;
  margin: 0;
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  line-height: 1.65;
}

.choices {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.choice-button,
.primary-button,
.secondary-button {
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease;
}

.choice-button {
  width: 100%;
  padding: 0.85rem 1rem;
  text-align: left;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(143, 36, 28, 0.10), rgba(78, 141, 145, 0.05)),
    rgba(255, 255, 255, 0.02);
}

.choice-button:hover,
.choice-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--static);
}

.choice-button::before {
  content: ">";
  margin-right: 0.6rem;
  color: var(--oxide);
  font-weight: 700;
}

.fragment-screen,
.festival-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
  background: rgba(4, 4, 5, 0.95);
  backdrop-filter: blur(14px);
}

.fragment-screen[hidden],
.festival-screen[hidden] {
  display: none !important;
}

.fragment-screen__inner {
  width: min(540px, 100%);
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at center, rgba(143, 36, 28, 0.13), transparent 48%),
    var(--panel-solid);
  box-shadow: 0 0 60px rgba(143, 36, 28, 0.18);
}

.fragment-icon {
  font-size: 5rem;
  color: var(--oxide);
  text-shadow: 0 0 30px rgba(143, 36, 28, 0.72);
  animation: pulse 1.1s infinite;
}

.fragment-screen h2,
.festival-card h1 {
  margin: 0.25rem 0;
  font-family: "Archivo Black", sans-serif;
  color: var(--oxide);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.8rem 1rem;
}

.primary-button {
  background: var(--oxide);
  color: var(--white);
  border-color: var(--oxide);
  font-weight: 700;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--static);
  color: var(--ink);
}

.primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.secondary-button {
  background: transparent;
  color: var(--white);
}

.festival-card {
  display: grid;
  grid-template-columns: 1fr 0.9fr;
  gap: 1.25rem;
  width: min(1040px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--panel-solid);
  box-shadow: 0 0 60px rgba(143, 36, 28, 0.18);
}

.festival-card__copy {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.festival-card__poster img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 76vh;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.03);
}

.festival-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

body.corrupted .scene__background {
  filter: grayscale(0.7) contrast(1.3) saturate(0.65);
}

body.corrupted .dialogue-panel {
  box-shadow:
    -8px 0 0 rgba(143, 36, 28, 0.08),
    8px 0 0 rgba(78, 141, 145, 0.06);
}

@keyframes idleFloat {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-7px);
  }
}

@keyframes spriteEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-5px);
  }
}

@keyframes glitchSprite {
  0% {
    transform: translate(0, 0);
    filter: none;
  }

  25% {
    transform: translate(-5px, 2px);
    filter: grayscale(1);
  }

  50% {
    transform: translate(5px, -2px);
    filter: contrast(1.7);
  }

  75% {
    transform: translate(-2px, -3px);
    filter: invert(0.15);
  }

  100% {
    transform: translate(0, 0);
    filter: none;
  }
}

@keyframes glitchText {
  0% {
    transform: translate(-50%, -50%) translate(0, 0);
  }

  33% {
    transform: translate(-50%, -50%) translate(-3px, 1px);
  }

  66% {
    transform: translate(-50%, -50%) translate(3px, -1px);
  }

  100% {
    transform: translate(-50%, -50%) translate(0, 0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
  }

  .status {
    flex-direction: column;
    align-items: flex-end;
  }

  .stage {
    min-height: 50vh;
    padding-top: 5.4rem;
  }

  .character-sprite {
    max-height: 43vh;
    max-width: 88vw;
  }

  .festival-card {
    grid-template-columns: 1fr;
  }

  .festival-card__poster {
    order: -1;
  }

  .festival-card__poster img {
    max-height: 46vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}