:root {
  color-scheme: dark;
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101115;
}

.preview-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #16181d;
  background-image:
    linear-gradient(45deg, #1d2026 25%, transparent 25%),
    linear-gradient(-45deg, #1d2026 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1d2026 75%),
    linear-gradient(-45deg, transparent 75%, #1d2026 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
}

.preview-underlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#rive-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.rive-hit-layer {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: max(100vw, calc(100vh * 16 / 9));
  height: max(100vh, calc(100vw * 9 / 16));
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.rive-hit-button {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.rive-hit-button:focus:not(:focus-visible) {
  outline: none;
}

.rive-hit-button:focus-visible {
  outline: 2px solid #46ffff;
  outline-offset: 2px;
}

.hit-up {
  top: 24.6%;
  left: 73.0%;
  width: 4.6%;
  height: 6.2%;
}

.hit-down {
  top: 33.0%;
  left: 73.0%;
  width: 4.6%;
  height: 6.2%;
}

.hit-left {
  top: 29.0%;
  left: 70.8%;
  width: 4.4%;
  height: 6.2%;
}

.hit-right {
  top: 29.0%;
  left: 75.4%;
  width: 4.4%;
  height: 6.2%;
}

.hit-ai {
  top: 41.7%;
  left: 70.5%;
  width: 9.6%;
  height: 4.8%;
}

.hit-intro {
  top: 49.0%;
  left: 70.5%;
  width: 4.3%;
  height: 4.6%;
}

.hit-works {
  top: 49.0%;
  left: 75.8%;
  width: 4.3%;
  height: 4.6%;
}

.hit-close {
  top: 72.2%;
  left: 71.6%;
  width: 3.7%;
  height: 6.2%;
}

.preview-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(720px, calc(100% - 32px));
  min-height: 54px;
  padding: 8px 10px 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(15, 17, 22, 0.88);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.file-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.file-info strong,
.file-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-info strong {
  color: #f5f7fb;
  font-size: 14px;
  font-weight: 600;
}

.file-info span {
  color: #9da5b4;
  font-size: 12px;
}

.preview-controls {
  display: flex;
  gap: 6px;
}

.preview-controls button {
  min-width: 54px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 5px;
  background: #282c34;
  color: #f5f7fb;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.preview-controls button:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.3);
  background: #343944;
}

.preview-controls button:disabled {
  color: #6e7480;
  cursor: default;
}

.error-message {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 40px));
  padding: 16px;
  border: 1px solid rgba(255, 98, 98, 0.45);
  border-radius: 6px;
  background: rgba(35, 15, 18, 0.94);
  color: #ffd3d3;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  transform: translate(-50%, -50%);
}

@media (max-width: 560px) {
  .preview-bar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .preview-controls {
    width: 100%;
  }

  .preview-controls button {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .preview-controls button {
    transition-duration: 1ms;
  }
}
