:root {
  --ink: #17212b;
  --muted: #607080;
  --paper: #f7f6f0;
  --panel: #ffffff;
  --teal: #087f7a;
  --teal-dark: #075e5b;
  --gold: #f4b942;
  --coral: #d95d45;
  --blue: #2f5f98;
  --line: #dcd7c8;
  --shadow: 0 18px 50px rgba(23, 33, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(8, 127, 122, 0.12), rgba(244, 185, 66, 0.12)),
    var(--paper);
}

button,
select,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 24px;
}

.eyebrow,
.step-label,
.mini-label {
  margin: 0 0 6px;
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

h2 {
  font-size: 1.08rem;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-strip span,
.pill,
.adapter-list span {
  border: 1px solid rgba(8, 127, 122, 0.24);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--teal-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(300px, 0.8fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(220, 215, 200, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.capture-panel,
.confirm-panel {
  grid-row: span 2;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.video-stage {
  position: relative;
  display: grid;
  min-height: 360px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #111820;
}

.video-stage video,
.video-empty {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.video-stage video {
  object-fit: cover;
}

.video-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 28px;
  color: #eef7f5;
  text-align: center;
  background:
    linear-gradient(140deg, rgba(8, 127, 122, 0.8), rgba(47, 95, 152, 0.82)),
    #17212b;
}

.video-empty.hidden {
  display: none;
}

.hand-mark {
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 1.6rem;
}

.capture-actions,
.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.file-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button,
.file-button {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.danger-button {
  background: #fff6f3;
  color: #9f331f;
  border-color: rgba(217, 93, 69, 0.45);
}

.compact {
  min-height: 36px;
  padding: 8px 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

#videoUpload {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.notice {
  margin-top: 14px;
  border-left: 4px solid var(--gold);
  padding: 10px 12px;
  background: rgba(244, 185, 66, 0.14);
  color: #5f4a13;
  font-size: 0.9rem;
  line-height: 1.45;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 178px;
  padding: 12px;
  line-height: 1.5;
}

.recognition-card,
.confirmation-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

output {
  display: block;
  font-weight: 700;
  line-height: 1.5;
}

.adapter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.workflow-grid {
  display: grid;
  gap: 10px;
}

.workflow-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-areas:
    "icon title"
    "icon copy";
  gap: 2px 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.workflow-card.active {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px rgba(8, 127, 122, 0.12);
}

.workflow-card .icon {
  grid-area: icon;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #3d2e07;
  font-weight: 900;
}

.workflow-card strong {
  grid-area: title;
}

.workflow-card small {
  grid-area: copy;
  color: var(--muted);
  line-height: 1.35;
}

.action-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.avatar-stage {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  align-items: center;
  min-height: 170px;
  padding: 16px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(8, 127, 122, 0.12), rgba(47, 95, 152, 0.12));
}

.avatar-figure {
  position: relative;
  width: 104px;
  height: 134px;
}

.avatar-figure span {
  position: absolute;
  display: block;
  background: var(--blue);
}

.avatar-figure .head {
  top: 0;
  left: 31px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--coral);
}

.avatar-figure .body {
  top: 50px;
  left: 34px;
  width: 36px;
  height: 70px;
  border-radius: 18px 18px 8px 8px;
}

.avatar-figure .arm {
  top: 54px;
  width: 18px;
  height: 72px;
  border-radius: 999px;
  transform-origin: top center;
}

.avatar-figure .left {
  left: 20px;
  transform: rotate(32deg);
}

.avatar-figure .right {
  right: 20px;
  transform: rotate(-42deg);
  animation: sign-wave 1.4s ease-in-out infinite alternate;
}

@keyframes sign-wave {
  from { transform: rotate(-36deg); }
  to { transform: rotate(-66deg); }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .capture-panel,
  .confirm-panel {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .topbar,
  .workspace {
    display: block;
  }

  .status-strip {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .panel {
    margin-bottom: 14px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .video-stage {
    min-height: 260px;
  }

  .avatar-stage {
    grid-template-columns: 1fr;
  }
}
