:root {
  --fm-page-ink: #231826;
  --fm-page-muted: #66576d;
  --fm-page-bg: #f8fbff;
}

* {
  box-sizing: border-box;
}

body.dm-festival-page {
  margin: 0;
  min-height: 100vh;
  color: var(--fm-page-ink);
  background:
    linear-gradient(135deg, rgba(255, 200, 61, 0.42), rgba(55, 199, 255, 0.28) 42%, rgba(255, 111, 203, 0.32)),
    #f8fbff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.fm-site-header,
.fm-page-main,
.fm-site-footer {
  width: min(1180px, 94vw);
  margin: 0 auto;
}

.fm-site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 10px;
  flex-wrap: wrap;
}

.fm-brand,
.fm-nav a,
.fm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 950;
}

.fm-brand {
  padding: 10px 16px;
  color: #ffffff;
  background: var(--fm-page-ink);
  box-shadow: 0 4px 0 rgba(35, 24, 38, 0.24);
}

.fm-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fm-nav a {
  padding: 8px 13px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(35, 24, 38, 0.1);
}

.fm-page-main {
  padding: 8px 0 28px;
}

.fm-game {
  --fm-primary: #ff6fcb;
  --fm-secondary: #ffc83d;
  --fm-accent: #37c7ff;
  --fm-ink: #231826;
  position: relative;
  overflow: hidden;
  border: 4px solid var(--fm-page-ink);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.34)),
    linear-gradient(135deg, color-mix(in srgb, var(--fm-primary), white 35%), color-mix(in srgb, var(--fm-accent), white 48%));
  box-shadow: 0 16px 0 rgba(35, 24, 38, 0.12), 0 30px 54px rgba(35, 24, 38, 0.18);
}

.fm-game::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background-image:
    linear-gradient(90deg, rgba(35, 24, 38, 0.18) 1px, transparent 1px),
    linear-gradient(0deg, rgba(35, 24, 38, 0.12) 1px, transparent 1px);
  background-size: 34px 34px;
  animation: fm-grid 9s linear infinite;
  pointer-events: none;
}

@keyframes fm-grid {
  from { background-position: 0 0, 0 0; }
  to { background-position: 68px 34px, 34px 68px; }
}

.fm-game-shell {
  position: relative;
  z-index: 1;
  padding: clamp(14px, 3vw, 24px);
}

.fm-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.fm-kicker {
  margin: 0 0 5px;
  color: color-mix(in srgb, var(--fm-ink), var(--fm-primary) 28%);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fm-topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.fm-now {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
  min-width: min(100%, 450px);
}

.fm-stat {
  min-height: 62px;
  padding: 9px 10px;
  border: 2px solid rgba(35, 24, 38, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 5px 0 rgba(35, 24, 38, 0.12);
}

.fm-stat span,
.fm-stat small {
  display: block;
  color: var(--fm-page-muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.fm-stat strong {
  display: block;
  margin-top: 2px;
  font-size: 1.25rem;
  line-height: 1;
}

.fm-layout {
  display: grid;
  grid-template-columns: minmax(270px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.fm-menu,
.fm-stage-wrap {
  position: relative;
  border: 3px solid rgba(35, 24, 38, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 0 rgba(35, 24, 38, 0.1);
}

.fm-menu {
  min-height: 620px;
  padding: 14px;
}

.fm-stage-wrap {
  overflow: hidden;
  min-height: 620px;
}

.fm-stage-head {
  position: absolute;
  inset: 14px 14px auto;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.fm-stage-name,
.fm-song-name {
  min-height: 38px;
  padding: 8px 11px;
  border: 2px solid rgba(35, 24, 38, 0.84);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
  font-weight: 950;
}

.fm-canvas {
  display: block;
  width: 100%;
  height: min(68vh, 680px);
  min-height: 620px;
}

.fm-character {
  position: absolute;
  right: clamp(8px, 3vw, 32px);
  bottom: clamp(92px, 15vw, 126px);
  z-index: 4;
  width: clamp(118px, 18vw, 205px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
  filter: drop-shadow(0 18px 20px rgba(35, 24, 38, 0.22));
  transition: transform 120ms ease;
}

.fm-character img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fm-character-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px solid var(--fm-ink);
  border-radius: 50%;
  background: var(--fm-secondary);
  font-size: 3rem;
  font-weight: 950;
}

.fm-character-badge {
  position: absolute;
  right: clamp(20px, 4vw, 48px);
  bottom: clamp(78px, 12vw, 98px);
  z-index: 5;
  pointer-events: none;
}

.fm-game[data-fm-mood="cheer"] .fm-character {
  transform: translateY(-14px) rotate(-4deg) scale(1.08);
}

.fm-game[data-fm-mood="miss"] .fm-character {
  transform: translateX(8px) rotate(4deg) scale(0.96);
}

.fm-touch {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.fm-lane-button {
  min-height: clamp(58px, 12vw, 78px);
  border: 3px solid rgba(35, 24, 38, 0.92);
  border-radius: 8px;
  color: var(--fm-ink);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), color-mix(in srgb, var(--fm-primary), white 42%));
  box-shadow: 0 7px 0 rgba(35, 24, 38, 0.18);
  font-size: 1.25rem;
  font-weight: 950;
  touch-action: manipulation;
}

.fm-lane-button:active {
  transform: translateY(4px);
  box-shadow: 0 3px 0 rgba(35, 24, 38, 0.18);
}

.fm-panel {
  display: none;
}

.fm-panel.is-active {
  display: block;
}

.fm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.fm-panel h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.1;
}

.fm-stack {
  display: grid;
  gap: 10px;
}

.fm-card {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 10px;
  border: 2px solid rgba(35, 24, 38, 0.9);
  border-radius: 8px;
  color: var(--fm-page-ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.58)),
    linear-gradient(145deg, var(--card-primary, var(--fm-primary)), var(--card-secondary, var(--fm-secondary)));
  box-shadow: 0 6px 0 rgba(35, 24, 38, 0.12);
  text-align: left;
  cursor: pointer;
}

.fm-card:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  filter: grayscale(0.25);
}

.fm-card:not(:disabled):hover {
  transform: translateY(-2px);
}

.fm-card-art {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(35, 24, 38, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  overflow: hidden;
}

.fm-card-art img {
  width: clamp(62px, 11vw, 90px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
}

.fm-card-art span,
.fm-song-index,
.fm-difficulty-mark {
  font-size: 1.35rem;
  font-weight: 950;
}

.fm-card-copy {
  min-width: 0;
}

.fm-card-copy strong,
.fm-card-copy small {
  display: block;
}

.fm-card-copy strong {
  font-size: 1rem;
  line-height: 1.08;
}

.fm-card-copy small {
  margin-top: 4px;
  color: var(--fm-page-muted);
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.2;
}

.fm-card-status,
.fm-stars {
  font-weight: 950;
  white-space: nowrap;
}

.fm-stars {
  color: #d08800;
  letter-spacing: 0;
}

.fm-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.fm-button {
  width: 100%;
  border: 0;
  padding: 10px 14px;
  color: #ffffff;
  background: var(--fm-page-ink);
  box-shadow: 0 6px 0 rgba(35, 24, 38, 0.16);
  cursor: pointer;
}

.fm-button.primary {
  color: var(--fm-ink);
  background: linear-gradient(145deg, var(--fm-secondary), var(--fm-accent));
}

.fm-button.secondary {
  color: var(--fm-page-ink);
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(35, 24, 38, 0.86);
}

.fm-button:disabled,
.fm-button.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.fm-overlay {
  position: absolute;
  inset: 86px 28px 120px;
  z-index: 6;
  display: none;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

.fm-overlay.is-visible {
  display: grid;
}

.fm-overlay-box {
  max-width: min(420px, 92%);
  padding: 18px;
  border: 3px solid var(--fm-ink);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 0 rgba(35, 24, 38, 0.14), 0 22px 44px rgba(35, 24, 38, 0.18);
}

.fm-overlay h2 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1;
}

.fm-overlay p {
  margin: 8px 0 0;
  color: var(--fm-page-muted);
  font-weight: 800;
}

.fm-result-grid {
  display: grid;
  gap: 10px;
}

.fm-result-stars {
  padding: 12px;
  border: 2px solid rgba(35, 24, 38, 0.86);
  border-radius: 8px;
  background: linear-gradient(145deg, #fff8aa, #ffffff);
  color: #c27b00;
  font-size: 2.2rem;
  text-align: center;
}

.fm-result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fm-result-stats span {
  padding: 10px;
  border: 2px solid rgba(35, 24, 38, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.fm-result-stats strong,
.fm-result-stats small {
  display: block;
}

.fm-result-stats small {
  color: var(--fm-page-muted);
  font-weight: 850;
}

.fm-reward {
  display: none;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 2px solid rgba(35, 24, 38, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.fm-reward.is-visible {
  display: grid;
}

.fm-reward img {
  width: clamp(120px, 28vw, 170px);
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(35, 24, 38, 0.18));
}

.fm-site-footer {
  padding: 18px 0 28px;
  color: var(--fm-page-muted);
  font-weight: 750;
}

@media (max-width: 900px) {
  .fm-topbar,
  .fm-layout {
    grid-template-columns: 1fr;
  }

  .fm-now {
    min-width: 0;
  }

  .fm-menu,
  .fm-stage-wrap {
    min-height: auto;
  }

  .fm-canvas {
    min-height: 540px;
    height: 62vh;
  }
}

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

  .fm-nav,
  .fm-nav a,
  .fm-brand {
    width: 100%;
  }

  .fm-now {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fm-game-shell {
    padding: 10px;
  }

  .fm-menu {
    padding: 10px;
  }

  .fm-canvas {
    min-height: 500px;
    height: 58vh;
  }

  .fm-stage-head {
    inset: 10px 10px auto;
    flex-direction: column;
    align-items: flex-start;
  }

  .fm-character {
    right: 4px;
    bottom: 94px;
    width: 118px;
  }

  .fm-overlay {
    inset: 94px 12px 104px;
  }

  .fm-result-stats {
    grid-template-columns: 1fr;
  }
}


/* Bloque editorial bajo el juego */
.fm-editorial {
  max-width: 860px;
  margin: 26px auto 10px;
  padding: 26px 24px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(35, 24, 38, 0.12);
  border-radius: 22px;
  color: #2a2033;
  line-height: 1.6;
}
.fm-editorial h2 { margin: 18px 0 8px; font-size: 1.2rem; }
.fm-editorial h2:first-child { margin-top: 0; }
.fm-editorial p { margin: 0 0 12px; }
.fm-editorial-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.fm-editorial-links a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  border-radius: 999px; background: #2a2033; color: #fff; text-decoration: none; font-weight: 700;
}
.fm-footer-links a { color: inherit; }
@media (max-width: 640px) {
  .fm-editorial { margin: 18px 10px 6px; padding: 20px 16px; }
}
