/* Service audio control: speaker button plus a liquid-glass volume panel (card synthesis, job change). */
.service-audio { position: absolute; z-index: 6; }
#game .service-audio .service-audio-button {
  width: 36px; height: 36px; padding: 0 !important; border-radius: 50% !important; line-height: 1; cursor: pointer;
  display: inline-grid; place-items: center;
  border: 1px solid rgb(255 255 255 / 85%) !important; background: rgb(255 255 255 / 72%) !important; color: #23344e !important;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 4px 12px rgb(20 30 70 / 22%) !important;
}
.service-audio-button svg { width: 20px; height: 20px; fill: currentColor; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.service-audio-button[data-audio-state="off"] { color: #8a3a3a !important; }
/* Volume bar slides out to the left of the speaker, same glass pill. */
.service-audio { display: flex; align-items: center; flex-direction: row; }
.service-audio-bar {
  position: absolute; right: 42px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px;
  width: 168px; height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid rgb(255 255 255 / 80%);
  background: linear-gradient(rgb(255 255 255 / 80%), rgb(245 248 255 / 62%));
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 6px 18px rgb(20 30 70 / 22%), inset 0 1px 0 #fff; animation: service-audio-in .18s ease-out;
  font: 600 12px var(--glass-font, 'Microsoft JhengHei', sans-serif); color: #23344e;
}
.service-audio-bar[hidden] { display: none; }
@keyframes service-audio-in { from { opacity: 0; transform: translate(12px, -50%) scaleX(.6); } }
.service-audio-value { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.service-audio-muted .service-audio-value { color: #8a3a3a; }
.service-audio-open .service-audio-button { box-shadow: 0 0 0 2px rgb(111 154 214 / 55%), 0 4px 12px rgb(20 30 70 / 22%) !important; }
.service-audio-range {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 6px; margin: 0; border-radius: 3px; cursor: pointer;
  background: linear-gradient(90deg, #4f7cc0 var(--fill, 0%), rgb(30 50 90 / 18%) var(--fill, 0%));
}
.service-audio-range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 1px 4px rgb(20 30 70 / 35%), 0 0 0 1px rgb(255 255 255 / 80%);
}
.service-audio-range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgb(20 30 70 / 35%); }
/* Placement under each service's banner. */
.town-service-scene > .service-audio { top: 12px; right: 12px; }
.card-alchemist-scene > .service-audio { top: 72px; right: 12px; }
.valkyrie-scene > .service-audio { top: 82px; right: 12px; }
@media (max-width: 720px) { .valkyrie-scene > .service-audio { top: 70px; right: 8px; } }


/* Film/voice audio controls (Merchant, Kafra, Refine) keep the old .forge-sound position; the wrapper itself is invisible. */
#game .service-audio.forge-sound, .service-audio.forge-sound {
  width: auto; height: auto; padding: 0; border: 0 !important; background: none !important; box-shadow: none !important; overflow: visible;
}
#game .forge-stage .service-audio .service-audio-button { width: 30px; height: 30px; font-size: 14px; }
/* Minimize, next to every service window's close button; a folded window keeps only its title bar. */
#game .town-service-window > .titlebar .town-service-minimize {
  width: 26px; height: 26px; margin: 0 6px 0 auto; padding: 0 !important; border-radius: 50% !important; cursor: pointer; flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 70%) !important; background: rgb(255 255 255 / 28%) !important; color: #fff !important;
  font: 700 14px/1 var(--glass-font, sans-serif); display: inline-grid; place-items: center;
}
#game .town-service-window > .titlebar .town-service-minimize + .town-service-close { margin-left: 0; }
#game .town-service-window.town-service-minimized { height: auto !important; min-height: 0 !important; bottom: auto !important; max-height: none !important; }
#game .town-service-window.town-service-minimized > :not(.titlebar) { display: none !important; }
/* Refine keeps its forge film inside the window: folding hides the controls and list, the forge stays. */
#game .town-service-window.forge-window.town-service-minimized > .forge-refine { display: block !important; }
#game .forge-window.town-service-minimized .forge-actions,
#game .forge-window.town-service-minimized .forge-list { display: none !important; }
