@font-face {
  font-family: "Musical Lilita One";
  src: url("/assets/fonts/LilitaOne-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Musical Baloo 2";
  src: url("/assets/fonts/Baloo2-Variable.ttf") format("truetype");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --musical-stage-scale: 1;
  --musical-purple: #6d25a8;
  --musical-purple-dark: #47116f;
  --musical-gold: #e6ad3d;
}

html,
body.celeiro-musical-page {
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body.celeiro-musical-page {
  position: fixed;
  inset: 0;
  background: #1598e7;
  color: #3e2254;
  font-family: "Musical Baloo 2", "Trebuchet MS", sans-serif;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body.celeiro-musical-page::before,
body.celeiro-musical-page::after {
  content: "";
  position: fixed;
  inset: -16px;
  pointer-events: none;
}

body.celeiro-musical-page::before {
  z-index: 0;
  background: url("/jogos/celeiro-musical/assets/celeiro-bg-horizontal.png") center / cover no-repeat;
  filter: blur(5px) saturate(.96);
  transform: scale(1.04);
}

body.celeiro-musical-page::after {
  z-index: 0;
  background: rgba(21, 66, 82, .15);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

body.celeiro-musical-page.game-access-pending #app {
  visibility: hidden;
}

.musical-shell {
  position: fixed;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.musical-board {
  position: absolute;
  top: 50%;
  left: 50%;
  isolation: isolate;
  width: 1280px;
  height: 720px;
  flex: 0 0 1280px;
  overflow: hidden;
  transform: translate(-50%, -50%) scale(var(--musical-stage-scale));
  transform-origin: center;
  background: #1598e7 url("/jogos/celeiro-musical/assets/celeiro-bg-horizontal.png") center / cover no-repeat;
  box-shadow: 0 18px 48px rgba(17, 40, 47, .28);
}

.musical-stage {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 64px;
  width: 1152px;
  height: 768px;
  overflow: visible;
  transform: translateY(-50%);
}

.musical-scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.musical-ui-btn {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  filter: drop-shadow(0 6px 5px rgba(60, 30, 14, .3));
  transition: transform 100ms ease, filter 100ms ease;
  touch-action: manipulation;
}

.musical-ui-btn img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.musical-ui-btn:active {
  transform: scale(.9);
  filter: brightness(1.12) drop-shadow(0 4px 4px rgba(60, 30, 14, .28));
}

.musical-ui-btn:focus-visible,
.musical-mode-btn:focus-visible,
.musical-song-btn:focus-visible,
.musical-pause-actions button:focus-visible {
  outline: 5px solid rgba(255, 255, 255, .96);
  outline-offset: 3px;
}

.musical-back {
  position: absolute;
  z-index: 32;
  top: 14px;
  left: 18px;
  width: 82px;
  height: 82px;
}

.musical-top-controls {
  position: absolute;
  z-index: 32;
  top: 14px;
  right: 18px;
  height: 78px;
  display: flex;
  gap: 8px;
}

.musical-top-controls .musical-ui-btn {
  width: 78px;
  height: 78px;
}

.musical-mode-menu {
  position: absolute;
  z-index: 26;
  top: 155px;
  left: 17px;
  width: 78px;
  display: grid;
  gap: 18px;
}

.musical-mode-btn {
  position: relative;
  width: 78px;
  height: 78px;
  padding: 0;
  overflow: hidden;
  border: 4px solid #ffae1d;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff2a4, #d66d0d 18%, #ffc341 35%, #a84608);
  box-shadow: 0 6px 10px rgba(65, 24, 2, .34);
  transition: transform 120ms ease, filter 120ms ease;
  touch-action: manipulation;
}

.musical-mode-btn::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: var(--inner, linear-gradient(#32bc4b, #147825));
  box-shadow: inset 0 5px 9px rgba(255, 255, 255, .35), inset 0 -5px 8px rgba(0, 0, 0, .25);
}

.musical-mode-btn > * {
  position: relative;
  z-index: 2;
}

.musical-mode-btn.is-selected {
  transform: scale(1.08);
  filter: drop-shadow(0 0 7px #fff56a) drop-shadow(0 0 12px #ffd31c);
}

.musical-mode-btn:active {
  transform: scale(.94);
}

.animal-mode-img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 112%;
  height: 112%;
  object-fit: contain;
  transform: translate(-50%, -50%);
}

.mode-piano {
  --inner: linear-gradient(#2997ec, #0f62aa);
}

.mode-xylophone {
  --inner: linear-gradient(#51d962, #168529);
}

.piano-icon {
  position: absolute;
  inset: 18% 17%;
  display: flex;
  overflow: hidden;
  border: 2px solid #fff;
  border-radius: 3px;
  background: #fff;
}

.piano-icon i {
  position: relative;
  flex: 1;
  border-right: 1px solid #6d6d6d;
  background: #fff;
}

.piano-icon i:last-child {
  border-right: 0;
}

.piano-icon i:nth-child(1)::after,
.piano-icon i:nth-child(2)::after,
.piano-icon i:nth-child(4)::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0;
  right: -35%;
  width: 55%;
  height: 55%;
  border-radius: 0 0 2px 2px;
  background: #252525;
}

.xylo-icon {
  position: absolute;
  inset: 17% 16%;
  display: flex;
  align-items: center;
  gap: 5%;
}

.xylo-icon i {
  flex: 1;
  height: var(--bar-height, 100%);
  border-radius: 3px;
  box-shadow: inset 0 3px 4px rgba(255, 255, 255, .45), 0 2px 4px rgba(0, 0, 0, .25);
}

.xylo-icon i:nth-child(1) { --bar-height: 100%; background: #9d43dc; }
.xylo-icon i:nth-child(2) { --bar-height: 88%; background: #2389e8; }
.xylo-icon i:nth-child(3) { --bar-height: 76%; background: #20b95b; }
.xylo-icon i:nth-child(4) { --bar-height: 64%; background: #f4c91e; }
.xylo-icon i:nth-child(5) { --bar-height: 52%; background: #f47620; }

.musical-animals,
.musical-keys {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.musical-animals {
  z-index: 14;
}

.musical-animal {
  position: absolute;
  z-index: 14;
  top: var(--animal-y);
  left: var(--animal-x);
  width: var(--animal-width);
  height: var(--animal-height);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 48% 48% 42% 42% / 40% 40% 28% 28%;
  background: transparent;
  transform: translateX(-50%);
  pointer-events: auto;
  touch-action: none;
}

.musical-animal img {
  position: absolute;
  bottom: var(--animal-bottom);
  left: 50%;
  width: var(--animal-image-width);
  height: auto;
  max-width: none;
  object-fit: contain;
  object-position: center bottom;
  transform: translateX(-50%);
  transform-origin: center bottom;
  pointer-events: none;
  transition: transform 120ms ease, filter 120ms ease;
}

.musical-animal:nth-child(1) { --animal-x: 18.52%; --animal-y: 31.05%; --animal-width: 6.90%; --animal-height: 18.45%; --animal-image-width: 106%; --animal-bottom: 8%; }
.musical-animal:nth-child(2) { --animal-x: 27.44%; --animal-y: 29.10%; --animal-width: 7.42%; --animal-height: 20.40%; --animal-image-width: 128%; --animal-bottom: 4%; }
.musical-animal:nth-child(3) { --animal-x: 36.52%; --animal-y: 27.34%; --animal-width: 7.49%; --animal-height: 22.07%; --animal-image-width: 116%; --animal-bottom: 5%; }
.musical-animal:nth-child(4) { --animal-x: 45.70%; --animal-y: 26.27%; --animal-width: 7.62%; --animal-height: 23.14%; --animal-image-width: 136%; --animal-bottom: 4%; }
.musical-animal:nth-child(5) { --animal-x: 54.82%; --animal-y: 26.27%; --animal-width: 7.88%; --animal-height: 23.14%; --animal-image-width: 142%; --animal-bottom: 4%; }
.musical-animal:nth-child(6) { --animal-x: 63.93%; --animal-y: 27.34%; --animal-width: 7.62%; --animal-height: 22.07%; --animal-image-width: 118%; --animal-bottom: 5%; }
.musical-animal:nth-child(7) { --animal-x: 72.98%; --animal-y: 29.10%; --animal-width: 7.49%; --animal-height: 20.40%; --animal-image-width: 128%; --animal-bottom: 4%; }
.musical-animal:nth-child(8) { --animal-x: 81.74%; --animal-y: 31.05%; --animal-width: 6.90%; --animal-height: 18.45%; --animal-image-width: 110%; --animal-bottom: 7%; }

.musical-animal.is-active img {
  transform: translateX(-50%) translateY(-4%) scale(1.08) rotate(-2deg);
  filter: brightness(1.12) drop-shadow(0 0 8px #fff45f);
}

.musical-keys {
  z-index: 18;
}

.musical-key {
  position: absolute;
  z-index: 18;
  top: 53.13%;
  left: var(--key-x);
  width: var(--key-width);
  height: 24.41%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 15% 15% 18% 18% / 8% 8% 10% 10%;
  background: transparent;
  box-shadow: none;
  transform-origin: center bottom;
  transition: transform 90ms ease, filter 90ms ease, box-shadow 90ms ease;
  pointer-events: auto;
  touch-action: none;
}

.musical-key:nth-child(1) { --key-x: 14.78%; --key-width: 7.94%; }
.musical-key:nth-child(2) { --key-x: 23.57%; --key-width: 8.20%; }
.musical-key:nth-child(3) { --key-x: 32.42%; --key-width: 8.20%; }
.musical-key:nth-child(4) { --key-x: 41.28%; --key-width: 8.40%; }
.musical-key:nth-child(5) { --key-x: 50.26%; --key-width: 8.20%; }
.musical-key:nth-child(6) { --key-x: 58.98%; --key-width: 8.33%; }
.musical-key:nth-child(7) { --key-x: 67.90%; --key-width: 8.07%; }
.musical-key:nth-child(8) { --key-x: 76.69%; --key-width: 8.27%; }

.musical-key-icon {
  position: absolute;
  inset: 20% 16% 21%;
  width: 68%;
  height: 59%;
  object-fit: contain;
  filter: grayscale(1) brightness(0) invert(1);
  opacity: .77;
  pointer-events: none;
}

.musical-key.is-pressed {
  transform: translateY(3%) scale(.97);
  filter: brightness(1.15);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .72), 0 0 18px color-mix(in srgb, var(--key-color) 65%, white 35%);
}

.musical-song-buttons {
  position: absolute;
  z-index: 22;
  top: 76.5%;
  left: 35.1%;
  width: 29.4%;
  height: 11.2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.musical-song-btn {
  position: relative;
  width: 26%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(#a35c20, #63300c);
  box-shadow: inset 0 4px 7px rgba(255, 255, 255, .25), 0 6px 10px rgba(58, 24, 4, .38);
  touch-action: manipulation;
}

.musical-song-btn::before {
  content: "";
  position: absolute;
  width: 76%;
  height: 76%;
  clip-path: polygon(50% 0%, 61% 34%, 98% 35%, 69% 56%, 79% 92%, 50% 71%, 21% 92%, 31% 56%, 2% 35%, 39% 34%);
  background: var(--star);
  filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .75)) drop-shadow(0 4px 3px rgba(0, 0, 0, .28));
}

.musical-song-btn span {
  position: relative;
  z-index: 2;
  color: #fff;
  font-family: "Musical Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-size: 36px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}

.song-yellow { --star: linear-gradient(#ffe950, #f3a916); }
.song-blue { --star: linear-gradient(#54d5ff, #118bd2); }
.song-purple { --star: linear-gradient(#d568ff, #9230d1); }

.musical-song-btn.is-active {
  transform: scale(.94);
  filter: brightness(1.15) drop-shadow(0 0 11px #fff05e);
}

.musical-toast {
  position: absolute;
  z-index: 50;
  bottom: 4.8%;
  left: 50%;
  min-width: 190px;
  padding: 7px 18px;
  border: 3px solid #ffc332;
  border-radius: 999px;
  background: rgba(99, 29, 139, .94);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 140%);
  transition: opacity 170ms ease, transform 170ms ease;
  pointer-events: none;
}

.musical-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.musical-overlay {
  position: absolute;
  z-index: 90;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow: hidden;
  background: rgba(35, 22, 42, .62);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}

.musical-overlay[hidden] {
  display: none !important;
}

.musical-pause-card {
  width: 650px;
  min-height: 430px;
  padding: 27px 42px 32px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 12px;
  overflow: hidden;
  border: 6px solid #d99a25;
  border-radius: 38px;
  background: radial-gradient(circle at 50% 12%, rgba(255, 255, 255, .94), transparent 38%), linear-gradient(145deg, #fffaf0, #f8e3b5);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .72), 0 20px 48px rgba(42, 20, 38, .38);
  text-align: center;
}

.musical-pause-icon {
  width: 118px;
  height: 102px;
  object-fit: contain;
  filter: drop-shadow(0 7px 6px rgba(75, 33, 12, .2));
}

.musical-pause-card h2 {
  margin: 0;
  color: #602090;
  font-family: "Musical Lilita One", "Arial Rounded MT Bold", sans-serif;
  font-size: 48px;
  font-weight: 400;
  line-height: 1;
  text-shadow: 0 2px 0 #fff, 0 4px 10px rgba(91, 31, 132, .16);
}

.musical-pause-card p {
  margin: 0;
  color: #674d71;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.12;
}

.musical-pause-actions {
  width: 540px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.musical-pause-actions button {
  min-width: 0;
  min-height: 88px;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 3px solid;
  border-radius: 24px;
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  touch-action: manipulation;
}

.musical-pause-actions img {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  object-fit: contain;
  pointer-events: none;
}

.musical-secondary-btn {
  color: #5b386c;
  border-color: #dda841;
  background: linear-gradient(180deg, #fffdf2, #ffe9b3);
  box-shadow: 0 6px 0 #ad641d;
}

.musical-primary-btn {
  color: #fff;
  border-color: #b66ce4;
  background: linear-gradient(180deg, #974fd0, #6924a5);
  box-shadow: 0 6px 0 var(--musical-purple-dark);
}

.musical-pause-actions button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(80, 38, 16, .6);
}

@media (max-aspect-ratio: 16 / 9) {
  body.celeiro-musical-page::before {
    filter: blur(4px) saturate(.96);
  }
}

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