@charset "UTF-8";
html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #ffffff;
  color: #0f172a;
  margin: 0;
  padding: 0;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 1.6rem;
  margin: 0;
}

.topbar {
  padding: 8px 12px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.topbar__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.topbar__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.topbar__controls-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 32px;
}

.topbar__controls-group--left {
  flex: 1 1 auto;
  min-width: 0;
}

.topbar__controls-group--right {
  flex: 0 0 auto;
  margin-left: auto;
}

.topbar__mode-select {
  height: 32px;
  padding: 0 8px;
  font-size: 0.8125rem;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
}

.topbar__url-input {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 420px;
  height: 32px;
  padding: 0 8px;
  font-size: 0.8125rem;
  line-height: 1.2;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
}

.topbar__file-input {
  flex: 0 1 220px;
  min-width: 140px;
  max-width: 280px;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #475569;
}

.topbar__file-input::file-selector-button {
  height: 28px;
  padding: 0 10px;
  margin-right: 8px;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #ffffff;
  color: #0f172a;
  cursor: pointer;
}

.small {
  font-size: 0.85rem;
  color: #475569;
}

.main {
  flex: 1;
  display: flex;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 12px;
  box-sizing: border-box;
}

.main__stage {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  background: #ffffff;
  overflow: hidden;
  border-radius: 12px;
}

.main__stage--demo {
  border-right: 1px solid rgba(15, 23, 42, 0.08);
}

#demo_canvas,
#demo_canvas_easy,
#demo_canvas_hard {
  width: 100%;
  height: 100%;
  display: block;
  background: #ffffff;
  transform: scaleX(-1);
}

.input-row {
  display: flex;
  gap: 8px;
  margin-top: 0;
}

.input-row input {
  flex: 0 1 360px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #ffffff;
  color: #0f172a;
}

.input-row button {
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  background: #2563eb;
  color: #ffffff;
  cursor: pointer;
}

.btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-camera {
  background: #22c55e;
  color: #052e16;
}

.btn-record {
  background: #ef4444;
  color: #450a0a;
}

/* 頂欄按鈕：需高於 .btn 選擇性，避免被 padding 覆寫 */
.btn.btn-load {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
  line-height: 1;
  white-space: nowrap;
  background: #2563eb;
  color: #ffffff;
}

.btn.btn-camera,
.btn.btn-record {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
  line-height: 1;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-right: 4px;
  background: rgba(15, 23, 42, 0.06);
  color: #0f172a;
}

.tag.phase-ready {
  background: #111827;
  color: #e5e7eb;
}

.tag.phase-dance {
  background: #065f46;
  color: #d1fae5;
}

.tag.judge-on {
  background: #b45309;
  color: #fffbeb;
}

.tag.judge-success {
  background: #16a34a;
  color: #ecfdf5;
}

.tag.judge-fail {
  background: #b91c1c;
  color: #fee2e2;
}

dl {
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 4px;
  column-gap: 8px;
  margin: 0;
}

dt {
  font-weight: 600;
  color: #9ca3af;
}

dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.camera-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
}

.camera-wrapper--full {
  width: 100%;
  height: 100%;
}

#input_video {
  width: 100%;
  height: 100%;
  /* 與 PoseModel 一致：避免因裁切/縮放造成骨架看起來歪 */
  object-fit: contain;
  transform: scaleX(-1);
  display: block;
}

.stage-video {
  width: 100%;
  height: calc(100vh - 132px);
  object-fit: contain;
  display: block;
  background: #ffffff;
}

#output_canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
  pointer-events: none;
}

.hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* YouTube 小視窗（可拖曳 / 可縮放） */
.yt-wrapper {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 260px;
  height: 146px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.yt-wrapper__drag-handle {
  height: 16px;
  flex: 0 0 16px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  line-height: 16px;
  background: rgba(255, 255, 255, 0.9);
  cursor: grab;
  user-select: none;
}

.yt-wrapper__player {
  flex: 1;
  position: relative;
  z-index: 1;
}

.yt-wrapper__resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 50%, rgba(255, 255, 255, 0.35) 51%, rgba(255, 255, 255, 0.35) 100%);
  z-index: 2;
  pointer-events: auto;
}

.yt-wrapper__resize-handle--br {
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
}

.yt-wrapper__resize-handle--tl {
  left: 0;
  top: 0;
  cursor: nwse-resize;
  transform: rotate(180deg);
}

.yt-wrapper__resize-handle--tr {
  right: 0;
  top: 0;
  cursor: nesw-resize;
  transform: rotate(90deg);
}

.yt-wrapper__resize-handle--bl {
  left: 0;
  bottom: 0;
  cursor: nesw-resize;
  transform: rotate(270deg);
}

@media (max-width: 900px) {
  .camera-wrapper--full {
    height: 100%;
  }
  .stage-video {
    height: calc(100vh - 160px);
  }
  .main {
    flex-direction: column;
  }
  .main__stage--demo {
    border-right: none;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  }
}

/*# sourceMappingURL=main.css.map */
