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

:root {
  --bg: #2a1c14;
  --ink: #e8efe4;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at center, #5a4030 0%, var(--bg) 75%);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
    "Yu Gothic", Meiryo, "Segoe UI", system-ui, sans-serif;
}

.shell {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 0.8vw, 10px);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: #4a3424;
  border: 2px solid #6a4e38;
  border-radius: 4px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
  touch-action: none;
}

/* BGM mute + volume — sits above the canvas corner */
.audio-dock {
  position: fixed;
  right: clamp(10px, 1.6vw, 22px);
  bottom: clamp(10px, 1.6vw, 22px);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(20, 14, 10, 0.78);
  border: 1px solid rgba(232, 200, 160, 0.22);
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  user-select: none;
}

.audio-music {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 8px;
  border-left: 1px solid rgba(232, 239, 228, 0.14);
}

.audio-btn {
  appearance: none;
  border: 1px solid rgba(232, 239, 228, 0.25);
  background: rgba(70, 58, 42, 0.75);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.audio-btn:hover {
  background: rgba(100, 78, 52, 0.9);
}

.audio-btn[aria-pressed="true"] {
  background: rgba(45, 36, 28, 0.9);
  border-color: rgba(232, 239, 228, 0.18);
}

.mute-btn {
  width: auto;
  min-width: 72px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.mute-btn .mute-icon {
  font-size: 14px;
  line-height: 1;
}

.mute-btn[aria-pressed="true"] .mute-icon {
  opacity: 0.55;
}

.mute-btn .mute-label {
  white-space: nowrap;
}

.lang-btn {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  min-width: 40px;
  background: rgba(90, 70, 40, 0.75);
}

.lang-btn:hover {
  background: rgba(120, 90, 50, 0.9);
}

.audio-vol {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(232, 239, 228, 0.9);
  font-size: 12px;
  font-weight: 700;
}

.audio-vol-label {
  white-space: nowrap;
  min-width: 2.6em;
}

.audio-vol-pct {
  min-width: 2.6em;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: rgba(232, 200, 160, 0.9);
  font-weight: 800;
}

.audio-vol input[type="range"] {
  width: min(110px, 16vw);
  accent-color: #c4a574;
  cursor: pointer;
}

.audio-track {
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  color: rgba(232, 239, 228, 0.55);
}

@media (max-width: 720px) {
  .audio-track {
    display: none;
  }
  .mute-btn .mute-label {
    display: none;
  }
  .mute-btn {
    min-width: 40px;
    width: 40px;
    padding: 0;
  }
}
