@import url("/game-assets/melody-repair/v1/style.css");
body {
  display:flex;flex-direction:column;
  background: #2c261f;
  min-height: 100svh;
}
.bar {
  position: relative; z-index: 5; background: #162a2de8; border-color: #bfa26e80;
}
.workshop {
  position: relative; isolation: isolate; display: flex; flex-direction: column;
  width: 100%; min-height: 0;flex:1;overflow:clip; padding: .75rem clamp(.7rem, 2vw, 2rem) .5rem; gap: 0;
  background: linear-gradient(#0c222a8c 0%, transparent 38%, transparent 70%, #24180ee6 100%),
    url("/game-assets/melody-repair/v2/assets/room.webp") center / cover;
}
.scene-top {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; z-index: 3;
}
.commission { display: flex; gap: .65rem; align-items: center; white-space: nowrap; font-weight: 750; padding: .35rem .65rem; background: #172b2de0; border-radius: 30px; }
.commission strong { color: #ffe6ac; }
.commission span { font-size: .85rem; }
.steps { justify-content: center; padding: .25rem; background: #172b2de6; border-radius: 30px; }
.steps li { color: #f4eedb; }
.gears { position: static; gap: .4rem; }
.gear { width: clamp(26px, 3vw, 39px); }
.instruction {
  align-self: center; text-align: center; z-index: 2; padding: .35rem .75rem; max-width: min(100%,900px);
  border-radius: 18px; background: #152a2ce0; box-shadow: 0 4px 20px #101a1d24; margin-top: .5rem;
}
.instruction h1 { font-size: clamp(1.2rem, 2.1vw, 1.8rem); margin: .2rem 0; }
.instruction p { color: #fcf1d6; font-size: clamp(.8rem, 1.25vw, 1rem); min-height: 1.5em; }
.world {
  position: relative; width: min(100%, calc((100svh - 338px) * 1.895), 1440px);
  aspect-ratio: 1440 / 760; margin: auto; flex: 0 0 auto; min-height: 0;
}
.illustration { display: block; position: absolute; width: 100%; height: 100%; inset: 0; overflow: visible; pointer-events: none; }
.music-console {
  position: absolute; left: 52.5%; top: 21%; width: 40.5%; height: 25%;
  display: flex; flex-direction: column; z-index: 2; padding: .35rem .5rem .7rem;
}
.console-label { display: flex; justify-content: center; gap: .5rem; align-items: center; color: #fff0c1; font-size: clamp(.65rem, 1.1vw, .85rem); text-shadow: 0 2px 3px #000; }
.console-label small { display: none; }
.pipes {
  margin: .35rem 0 0; flex: 1; gap: clamp(3px, .55vw, 9px);
  padding: 0 0 .45rem; border-bottom: 5px ridge #d4ab66;
  transform: perspective(1000px) rotateY(-4deg);
}
.pipe, .pipe:disabled {
  position: relative; background: linear-gradient(90deg,#253a32ed,#4b6253e8 28%,#263e35ed 67%,#132c29f2);
  color: #fff6d9; border: 1px solid #d9c18a; min-height: 66px; min-width: 0;
  border-radius: 40px 40px 7px 7px; box-shadow: inset 3px 0 3px #f8ffe350, inset -3px 0 5px #0005, 0 4px 0 #8f6b32;
  padding: .3rem .1rem; opacity: 1;
}
.pipe::before { content: ""; position: absolute; left: 17%; right: 17%; bottom: 10px; height: 7px; background: #f4d884; border-radius: 100%; filter: blur(3px); opacity: .4; }
.pipe .icon { font-family: Georgia,serif; font-size: clamp(1rem,2vw,1.8rem); color: #fff0be; }
.pipe .index { font-size: clamp(.9rem,1.45vw,1.2rem); position: relative; }
.pipe:hover:not(:disabled) { background: #335347; color: #fff6d9; }
.pipe:active:not(:disabled) { background: #1e4034; color: #fff6d9; }
.pipe:is(.playing,[aria-pressed="true"],.fixed) { background: linear-gradient(90deg,#b4dba6,#e3f7c4 48%,#b5dca7); color: #143222; box-shadow: inset 3px 0 3px #fff8, 0 0 18px #c6f19d99, 0 4px 0 #ae8b4b; border-color:#efffcf; }
.pipe:is(.playing,[aria-pressed="true"],.fixed) .icon { color: #143222; }
.pipe.playing::before { opacity: 1; }
.choices {
  position: absolute; z-index: 4; left: 48%; right: 4%; bottom: 3%;
  padding: .65rem .8rem; border: 1px solid #bba575; border-radius: 12px;
  background: linear-gradient(130deg,#24413af5,#132b2af5); box-shadow: 0 6px 15px #0007;
}
.choices p { color: #fff1d1; text-align: center; font-size: .82rem; margin: 0 0 .4rem; }
.offsets { margin: 0; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: .35rem; }
.offsets button { padding: .4rem .25rem; min-height: 44px; background: #ede4c8; color: #1b3530; border: 1px solid #c3ae76; border-radius: 9px; font-size: clamp(.75rem, 1.2vw, 1rem); }
.offsets button:hover:not(:disabled) { background: #fff0c2; color: #1b3530; }
.offsets button:active:not(:disabled) { background: #d9cc9f; color: #1b3530; }
.offsets button[aria-pressed="true"] { background: #b9e5cb; color: #18382d; border-color: #e5ffe6; }
.offsets button:disabled { background: #d1d7c4; color:#32423b; border-color:#99aa97; }
.listening-badge {
  position: absolute; z-index: 3; left: 6%; top: 4%; max-width: 38%; padding: .45rem .9rem;
  background: #fff0cceF; color:#24392f; font-weight: 800; border-radius: 18px 18px 18px 2px;
  font-size: clamp(.8rem, 1.4vw, 1.1rem); box-shadow: 0 3px 10px #0003; border: 1px solid #dac18b;
}
.workbench-controls {
  position: relative; z-index: 3; width: min(1100px,100%); margin: 0 auto;
  border-top: 2px solid #d7ad65; padding: .75rem 1rem .3rem;
  background: linear-gradient(0deg,#2a2017ec,#442a18de); box-shadow: 0 -7px 25px #23150e4d;
  border-radius: 6px 6px 0 0;
}
.controls { justify-content: center; gap:.45rem; }
.controls button { min-height: 48px; padding: .5rem .9rem; }
.tools { border-color: #a2875b80; margin-top: .45rem; padding-top: .25rem; justify-content:center; }
.tools button { color: #fff1d1; min-height:44px; padding: .35rem .55rem; }
.tools button:hover { background:#3a4438; }
#music-status { color: #e4d7b6; font-size:.75rem; margin-left:auto; }
.panda { transform-origin: 320px 700px; animation: breathe 4s ease-in-out infinite; }
.panda-head { transform-origin: 310px 386px; animation: curious 6s ease-in-out infinite; }
.workshop[data-mood="listen"] .panda-head { animation: listen-tilt 2.4s ease-in-out infinite; }
.workshop[data-mood="repair"] .panda { animation: happy-hop .8s ease-in-out 2; }
.workshop[data-mood="retry"] .panda-head { animation: thinking .55s ease-in-out 2; }
.cog, .crank { transform-box: fill-box; transform-origin: center; animation: turn 3s linear infinite paused; }
.cog-two { animation-direction: reverse; animation-duration: 2s; }
.crank { transform-origin: 20% 50%; animation-duration: 1.5s; }
.drum-pins { animation: drum-roll 1.6s linear infinite paused; }
.workshop[data-mood="listen"] :is(.cog,.crank,.drum-pins),
.workshop[data-mood="repair"] :is(.cog,.crank,.drum-pins),
.workshop[data-complete="true"] :is(.cog,.crank,.drum-pins) { animation-play-state: running; }
.sparkles { opacity: 0; transform-origin: center; }
.workshop[data-mood="repair"] .sparkles { animation: sparkle .8s ease-out 2; }
.atmosphere { position:absolute;inset:0;overflow:hidden;pointer-events:none;z-index:-1; }
.atmosphere i { position:absolute;width:4px;height:4px;box-shadow:0 0 7px #ffe5b6;background:#ffe5b6;border-radius:100%;left:20%;bottom:20%;animation:dust 9s linear infinite; }
.atmosphere i:nth-child(2) { left:55%; animation-delay:-3s; }
.atmosphere i:nth-child(3) { left:75%; animation-delay:-6s; }
@keyframes turn { to { transform:rotate(360deg); } }
@keyframes drum-roll { to { transform:translateY(-28px); } }
@keyframes breathe { 50% { transform:translateY(-3px) scaleY(1.008); } }
@keyframes curious { 0%,35%,100% { transform:rotate(0); } 50%,75% { transform:rotate(-2deg); } }
@keyframes listen-tilt { 0%,100% { transform:rotate(-3deg); } 50% { transform:rotate(1deg); } }
@keyframes thinking { 25% { transform:rotate(-3deg); } 75% { transform:rotate(2deg); } }
@keyframes happy-hop { 0%,100% { transform:translateY(0); } 40% { transform:translateY(-15px) rotate(-1.5deg); } }
@keyframes sparkle { 30% { opacity:1; } 100% { opacity:0;transform:translateY(-25px); } }
@keyframes dust { 0% { opacity:0; transform:translate(0,0); } 30% { opacity:.6; } 100% { opacity:0;transform:translate(60px,-350px); } }
.audio-note { font-size:.82rem; color:#435b4e; }
.dialog-lobby { color:#244e45; font-size:.9rem; margin-right:auto; padding:.5rem 0; }
dialog { color-scheme: light; }
@media (max-width: 960px) {
  .world { width:100%; aspect-ratio:1.62; flex:0 0 auto; }
  .illustration { height:90%; top:-3%; }
  .music-console { left:10%; width:80%; height:29%; top:auto; bottom:2%; padding:.4rem .6rem; background:linear-gradient(100deg,#392514f2,#78512ff0,#3d2c1af2);border:1px solid #ba9859;border-radius:12px;box-shadow:0 8px 20px #120c0788; }
  .console-label small { display:inline; color:#fff0c1; }
  .console-label { justify-content:space-between;font-size:.8rem; }
  .pipes { margin-top:.2rem; }
  .choices { left:27%;right:3%; bottom:34%; padding:.45rem .6rem; }
  .choices p { font-size:.75rem; }
  .scene-top { flex-wrap:wrap; }
  .steps { order:3; margin:auto; }
  .workbench-controls { padding:.6rem .5rem .1rem; }
  #music-status { margin-left:0; }
}
@media (max-width: 560px) {
  .bar nav { width:auto; margin-left:auto; }
  .brand small { display:none; }
  .brand strong { font-size:1rem; }
  .bar { gap:.35rem;padding:.5rem; }
  .bar a { font-size:.8rem;padding:.4rem; }
  .bar nav button { font-size:.78rem;padding:.4rem .45rem; }
  .workshop { padding:.55rem .5rem; }
  .instruction { width:100%; margin-top:.4rem; padding:.4rem; }
  .instruction p { font-size:.8rem; }
  .scene-top { gap:.35rem; }
  .commission { padding:.2rem .55rem; }
  .gears { gap:.2rem; }
  .gear { width:27px; }
  .steps { padding:.15rem; }
  .steps li { font-size:.7rem; padding:.2rem .4rem; }
  .world { aspect-ratio:1.15; min-height:300px; margin:auto; }
  .illustration { width:116%;height:91%;left:-8%;top:-5%; }
  .music-console { bottom:1%; height:33%; left:1%; width:98%; padding:.3rem; }
  .pipes { gap:4px; }
  .pipe, .pipe:disabled { min-height:60px; }
  .pipe .icon { font-size:1rem; }
  .pipe .index { font-size:1rem; }
  .listening-badge { left:1%;max-width:47%; top:1%; padding:.3rem .5rem;font-size:.8rem; }
  .choices { left:28%;right:0;bottom:35%; }
  .offsets { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .offsets button { font-size:.75rem; }
  .controls button { flex:1 1 auto; font-size:.85rem; min-height:44px;padding:.4rem .6rem; }
  .tools button { font-size:.8rem; }
  .tools { gap:.2rem; }
}
@media (max-width:370px) { .brand { flex-basis:45%; } }
@media (max-height: 500px) and (min-width:700px) {
  .workshop { min-height:560px; }
  .world { width:690px;max-width:100%; aspect-ratio:1.9; }
  .music-console { height:28%;width:80%;left:10%; }
}
@media (prefers-reduced-motion: reduce) { .workshop *, .workshop *::before { animation:none!important; } }
/* The cream speech bubble needs its own ink color, overriding the v1 label. */
#playback-label { color:#24392f; margin-left:0; }
@media (min-width:961px) {
  .music-console:has(.pipes[data-count="6"]),.music-console:has(.pipes[data-count="7"]) { min-width:380px;left:47%;width:45%; }
}
@media (max-width:370px) {
  .music-console { height:auto;min-height:139px;overflow:visible; }
  .pipes[data-count="6"],.pipes[data-count="7"] { grid-template-columns:repeat(4,minmax(0,1fr));gap:4px; }
  .pipes[data-count="6"] .pipe,.pipes[data-count="7"] .pipe { min-height:48px;flex-direction:row;gap:5px; }
  .pipes[data-count="6"] .icon,.pipes[data-count="7"] .icon { font-size:.85rem; }
  .choices { bottom:44%; }
}
