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

:root {
  --ink: #0b0a08;
  --ink-2: #17120b;
  --panel: rgba(23, 18, 11, 0.91);
  --panel-solid: #17120b;
  --gold: #f4b942;
  --orange: #ff7a1a;
  --green: #9fd44c;
  --purple: #8f5ed8;
  --white: #fffaf2;
  --muted: #d6c8b8;
  --danger: #ff5a3d;
  --border: rgba(244, 185, 66, 0.55);
  --shadow: 0 0 24px rgba(244, 185, 66, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, #30200f 0, #0b0a08 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;
}

.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(244, 185, 66, 0.13), rgba(143, 94, 216, 0.08)),
    radial-gradient(circle at 80% 20%, rgba(159, 212, 76, 0.14), transparent 35%),
    #17120b;
  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.04), rgba(11, 10, 8, 0.44)),
    radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
}

.scene__scanlines {
  z-index: 10;
  pointer-events: none;
  opacity: 0.12;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.08) 0px,
    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(11, 10, 8, 0.84);
  backdrop-filter: blur(14px);
}

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

.brand__eyebrow,
.eyebrow {
  color: var(--green);
  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(--gold);
  text-shadow: 0 0 14px rgba(244, 185, 66, 0.42);
}

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

.status__dot {
  color: var(--gold);
  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.45));
  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(159, 212, 76, 0.52);
  background: rgba(11, 15, 8, 0.76);
  box-shadow: 0 0 18px rgba(159, 212, 76, 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(--green);
}

.glitch-message {
  position: absolute;
  inset: 35% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  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(--green),
    3px 0 var(--orange);
  animation: glitchText 120ms steps(2, end) infinite;
}

.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;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.7rem;
}

.speaker-name {
  font-family: "Archivo Black", sans-serif;
  color: var(--gold);
  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;
}

.choice-button {
  width: 100%;
  padding: 0.85rem 1rem;
  text-align: left;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(244, 185, 66, 0.14), rgba(143, 94, 216, 0.08)),
    rgba(255,255,255,0.025);
}

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

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

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

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

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

.fragment-icon {
  font-size: 5rem;
  color: var(--gold);
  text-shadow: 0 0 30px rgba(244, 185, 66, 0.78);
  animation: pulse 1.1s infinite;
}

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

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

.primary-button {
  background: var(--gold);
  color: #17120b;
  border-color: var(--gold);
  font-weight: 700;
}

.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(244, 185, 66, 0.2);
}

.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: saturate(1.35) contrast(1.08) hue-rotate(8deg);
}

body.corrupted .dialogue-panel {
  box-shadow:
    -8px 0 0 rgba(159, 212, 76, 0.08),
    8px 0 0 rgba(244, 185, 66, 0.08);
}

@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: hue-rotate(45deg); }
  50% { transform: translate(5px,-2px); filter: contrast(1.6); }
  75% { transform: translate(-2px,-3px); filter: hue-rotate(-45deg); }
  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;
  }
}