:root {
  --ink: #ffffff;
  --bg: #000000;
  --panel: rgba(20, 20, 20, 0.9);
  --accent: #ff7a59;
  --mascot-size: 80px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.wrap {
  width: 100%;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.controls {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  margin: 0;
  padding: 0;
}

.controls[open] {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.controls-toggle {
  list-style: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--panel);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.controls-toggle::-webkit-details-marker {
  display: none;
}

.controls-toggle::marker {
  content: "";
}

.controls-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.controls[open] .controls-toggle {
  margin-bottom: 12px;
}

.controls-icon {
  position: relative;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
}

.controls-icon::before,
.controls-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 999px;
}

.controls-icon::before {
  top: -6px;
}

.controls-icon::after {
  top: 6px;
}

.controls-body {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.control {
  display: flex;
  gap: 8px;
  align-items: center;
}

.control span {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.control input[type="number"],
.control input[type="text"],
.control select {
  width: 88px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font: inherit;
  background: #000;
  color: #fff;
}

.control input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

.control input[type="file"] {
  width: 180px;
  color: #fff;
}

#imagePreview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.18;
  pointer-events: none;
}

button {
  font: inherit;
  border: none;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 122, 89, 0.35);
}

button:active {
  transform: translateY(1px);
}

.stage {
  position: relative;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0;
  background: #0b0b0b;
  overflow: hidden;
  border: none;
}

#mascotLayer {
  position: absolute;
  inset: 0;
}

.mascot {
  position: absolute;
  width: var(--mascot-size);
  user-select: none;
  pointer-events: auto;
  transform-origin: 50% 80%;
  cursor: pointer;
  --flash-glow: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
  --select-glow: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5)) var(--select-glow)
    var(--flash-glow);
}

.mascot-hitbox {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-sizing: border-box;
  pointer-events: none;
  z-index: 2;
}

.mascot.flash {
  --flash-glow: drop-shadow(0 0 8px rgba(90, 160, 255, 0.9))
    drop-shadow(0 0 16px rgba(90, 160, 255, 0.7));
}

.mascot.selected {
  --select-glow: drop-shadow(0 0 6px rgba(120, 190, 255, 0.85))
    drop-shadow(0 0 12px rgba(120, 190, 255, 0.6));
}

@media (max-width: 720px) {
  .control input {
    width: 74px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
