:root {
  --hi-panel: #f7f7f4;
  --hi-ink: #1d1d1f;
  --hi-muted: #686868;
  --hi-line: #171717;
  --hi-accent: #e6d643;
}

.hi-page {
  min-height: 100vh;
  background: #ecece7;
  color: var(--hi-ink);
  display: block;
  overflow-x: hidden;
}

.hi-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(280px, 520px);
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 3px solid var(--hi-line);
  background: rgba(247, 247, 244, 0.96);
}

.hi-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
}

.hi-title {
  min-width: 0;
}

.hi-title h1,
.hi-stage-header h2,
.hi-panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.hi-title h1 {
  font-size: 22px;
  line-height: 1.1;
}

.hi-title span,
.hi-stage-header span {
  display: block;
  margin-top: 3px;
  color: var(--hi-muted);
  font-size: 12px;
  font-weight: 800;
}

.hi-toolbar,
.hi-stage-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.hi-search {
  min-width: 0;
  width: 100%;
}

.hi-page.detail-open .hi-search {
  display: none;
}

.hi-select {
  min-height: 38px;
  padding: 7px 30px 7px 10px;
  border: 2px solid var(--hi-line);
  border-radius: 0;
  background: #fff;
  color: var(--hi-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.hi-shell {
  display: block;
  padding: 16px;
}

.hi-shell.detail-open {
  display: block;
}

.hi-browser {
  min-height: 0;
}

.hi-shell.detail-open .hi-browser {
  display: none;
}

.hi-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding-right: 4px;
}

.hi-shell:not(.detail-open) .hi-list {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  max-height: none;
  padding-right: 0;
}

.hi-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 74px;
  padding: 8px;
  border: 2px solid var(--hi-line);
  border-radius: 0;
  background: #fff;
  color: var(--hi-ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--hi-line);
}

.hi-shell:not(.detail-open) .hi-card {
  display: block;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}

.hi-card.active {
  background: var(--hi-accent);
}

.hi-card img {
  width: 72px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 2px solid var(--hi-line);
  background: #ddd;
}

.hi-shell:not(.detail-open) .hi-card img {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--hi-line);
}

.hi-card strong,
.hi-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hi-card strong {
  font-size: 14px;
  line-height: 1.2;
}

.hi-card span {
  margin-top: 4px;
  color: var(--hi-muted);
  font-size: 11px;
  font-weight: 800;
}

.hi-shell:not(.detail-open) .hi-card > span {
  margin: 0;
  padding: 10px 12px 12px;
}

.hi-stage-column {
  min-width: 0;
}

.hi-shell:not(.detail-open) .hi-stage-column {
  display: none;
}

.hi-stage-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.hi-stage-header h2 {
  font-size: 24px;
  line-height: 1.1;
}

.hi-game-window {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 3px solid var(--hi-line);
  background: #111;
  box-shadow: 6px 6px 0 var(--hi-line);
  user-select: none;
}

.hi-game-window:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border: 0;
  box-shadow: none;
  background: #000;
}

.hi-bg,
.hi-spine,
.hi-spine > div,
.hi-spine canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.hi-bg {
  object-fit: cover;
  pointer-events: none;
}

.hi-spine {
  background: transparent;
  cursor: pointer;
}

.hi-spine .spine-player {
  background: transparent !important;
}

.hi-spine .spine-player-controls,
.hi-spine .spine-player-overlay {
  display: none !important;
}

.hi-loading {
  position: absolute;
  left: 12px;
  bottom: 10px;
  padding: 5px 8px;
  border: 2px solid var(--hi-line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--hi-ink);
  font-size: 12px;
  font-weight: 900;
}

.hi-loading.hidden {
  display: none;
}

.hi-switch-panel.hidden {
  display: none;
}

.hi-debug-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.hi-debug-overlay.hidden {
  display: none;
}

.hi-debug-overlay::before,
.hi-debug-overlay::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.68);
}

.hi-debug-overlay::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
}

.hi-debug-overlay::after {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.hi-debug-point {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #ffdf4d;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.7);
}

.hi-debug-point.center {
  border-color: #72f2ff;
}

.hi-debug-label,
.hi-debug-readout {
  position: absolute;
  padding: 4px 6px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.72);
  line-height: 1.35;
  white-space: pre-wrap;
}

.hi-debug-label {
  transform: translate(8px, -50%);
}

.hi-debug-readout {
  left: 8px;
  top: 8px;
  max-width: min(560px, calc(100% - 16px));
}

.hi-debug-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 12px;
}

.hi-debug-controls.hidden {
  display: none;
}

.hi-debug-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--hi-muted);
  font-size: 11px;
  font-weight: 900;
}

.hi-debug-number {
  width: 96px;
  min-height: 38px;
  padding: 7px 10px;
  border: 2px solid var(--hi-line);
  border-radius: 0;
  background: #fff;
  color: var(--hi-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.hi-detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.hi-detail-controls {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.hi-preview-column {
  min-width: 0;
}

.hi-panel {
  border: 2px solid var(--hi-line);
  background: var(--hi-panel);
  padding: 12px;
}

.hi-panel h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.hi-switches,
.hi-animations,
.hi-voices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hi-animations {
  display: grid;
  gap: 10px;
}

.hi-animation-group {
  display: grid;
  gap: 6px;
}

.hi-animation-group > span {
  color: var(--hi-muted);
  font-size: 11px;
  font-weight: 900;
}

.hi-animation-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hi-animation,
.hi-switch,
.hi-voice,
.hi-empty {
  min-height: 34px;
  padding: 7px 10px;
  border: 2px solid var(--hi-line);
  background: #fff;
  color: var(--hi-ink);
  font-size: 12px;
  font-weight: 900;
}

.hi-animation,
.hi-switch,
.hi-voice {
  cursor: pointer;
}

.hi-animation.active,
.hi-switch.active,
.hi-voice.playing {
  background: var(--hi-accent);
}

.hi-stats {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 800;
}

.hi-stats dt {
  color: var(--hi-muted);
}

.hi-stats dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .hi-topbar,
  .hi-detail-layout {
    grid-template-columns: 1fr;
  }

  .hi-list {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    max-height: none;
  }

  .hi-stage-header {
    align-items: stretch;
    flex-direction: column;
  }
}
