@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: #0b1110;
  color: #edf5f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 78% -18%, #1d3a2e 0, transparent 34%), #0b1110;
}

.app-header {
  padding: 24px 20px 12px;
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: 28px;
}

.app-header p {
  margin: 8px 0 0;
  color: #4b5563;
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 16px;
}

.tab-btn {
  border: 1px solid #d1d5db;
  background-color: white;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.tab-btn.active {
  background-color: #2563eb;
  color: white;
  border-color: #2563eb;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px 24px;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.hero ul {
  padding-left: 20px;
  color: #4b5563;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

select,
input[type="range"] {
  width: 100%;
}

select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  background-color: white;
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-wrap span {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  color: #2563eb;
}

.recommendation-list {
  display: grid;
  gap: 12px;
}

.recommendation-item {
  border: 1px solid #dbe3ff;
  background: #f8faff;
  border-radius: 10px;
  padding: 12px;
}

.recommendation-item h4 {
  margin: 0 0 6px;
}

.recommendation-meta {
  color: #475569;
  font-size: 13px;
  margin-bottom: 10px;
}

.video-box {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
}

.video-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.actions-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.primary-btn,
.secondary-btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.primary-btn {
  background-color: #2563eb;
  color: white;
}

.secondary-btn {
  background-color: #eff6ff;
  color: #1d4ed8;
}

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

.status {
  color: #374151;
  margin-top: 8px;
}

.muted {
  color: #64748b;
}

.pose-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.pose-controls input[type="file"] {
  max-width: 260px;
}

.file-label {
  font-weight: 600;
}

.pose-stage {
  position: relative;
  width: 100%;
  min-height: 180px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 12px;
  background: #0f172a;
}

.pose-media {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #0f172a;
}

#pose-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.table-scroll {
  overflow-x: auto;
}

.landmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.landmark-table th,
.landmark-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: right;
  white-space: nowrap;
}

.landmark-table th:first-child,
.landmark-table td:first-child,
.landmark-table th:nth-child(2),
.landmark-table td:nth-child(2) {
  text-align: left;
}

.landmark-table thead {
  background: #eff6ff;
  color: #1e3a8a;
}

.empty-cell {
  padding: 20px !important;
  text-align: center !important;
  color: #64748b;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat h3 {
  margin-top: 0;
  font-size: 16px;
}

.stat p {
  font-size: 20px;
  font-weight: 700;
  color: #1d4ed8;
}

.history-list {
  margin: 0;
  padding-left: 18px;
  color: #4b5563;
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  .tab-nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .pose-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .pose-controls input[type="file"] {
    max-width: none;
  }
}

@media (max-width: 720px) {
  .tab-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* PoseAF-inspired clinical analysis workspace */
body { color: #edf5f0; }
.app-header { max-width: 1280px; margin: 0 auto; padding: 28px 20px 18px; display: flex; align-items: center; justify-content: space-between; text-align: left; border-bottom: 1px solid #26332d; }
.app-header h1 { font-size: 22px; letter-spacing: -1px; }
.app-header h1::first-letter { color: #79e3b1; }
.app-header p { color: #84918a; font: 11px "DM Mono", monospace; margin: 3px 0 0; }
.tab-nav { max-width: 1280px; grid-template-columns: repeat(5, auto); justify-content: start; gap: 8px; padding: 18px 20px; }
.tab-btn { border: 1px solid #2b3932; color: #aab9b0; background: #111a17; padding: 9px 14px; border-radius: 8px; font: 11px "DM Mono", monospace; }
.tab-btn:hover { border-color: #79e3b1; color: #dff5e8; }
.tab-btn.active { background: #79e3b1; color: #10221a; border-color: #79e3b1; }
main { max-width: 1280px; padding: 0 20px 30px; }
.card { background: #111a17; border-color: #26332d; box-shadow: none; border-radius: 14px; }
.card h2, .card h3, .card h4 { color: #edf5f0; }
.muted, .hero ul, .recommendation-meta, .history-list { color: #8c9b93; }
.primary-btn, .secondary-btn { border-radius: 8px; font: 600 12px "Manrope", sans-serif; }
.primary-btn { background: #79e3b1; color: #10221a; }
.secondary-btn { background: #202c27; color: #d4e1d9; }
.recommendation-item { background: #14221d; border-color: #31463b; }
select { color: #dceae1; background: #14201b; border-color: #34473d; }
.hidden { display: none !important; }

.pose-hero { display: flex; justify-content: space-between; align-items: end; padding: 46px 2px 34px; }
.eyebrow, .coordinate-label { color: #79e3b1; font: 11px "DM Mono", monospace; letter-spacing: 1.5px; }
.pose-hero h2 { margin: 12px 0 12px; color: #edf5f0; letter-spacing: -2.5px; line-height: 1; font-size: clamp(34px, 5vw, 56px); }
.pose-hero h2 em { color: #79e3b1; font-style: normal; }
.pose-hero .muted { max-width: 620px; line-height: 1.75; font-size: 14px; }
.pose-hero-stat { display: flex; gap: 13px; align-items: center; color: #7b8b82; }
.pose-hero-stat strong { color: #e9f2ec; font-size: 68px; line-height: .8; letter-spacing: -5px; }
.pose-hero-stat span { font: 10px "DM Mono", monospace; line-height: 1.7; }
.pose-workspace { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
.pose-control-card, .pose-result-card, .analysis-panel, .landmark-card { padding: 24px; }
.section-kicker { display: flex; align-items: center; gap: 10px; }
.section-kicker > span { color: #79e3b1; font: 11px "DM Mono", monospace; }
.section-kicker h3 { margin: 0; font-size: 15px; }
.field-label { display: block; margin: 24px 0 7px; color: #aebdb4; font-size: 11px; }
.field-label + select { height: 40px; padding: 0 10px; font-size: 12px; }
.upload-zone { height: 166px; margin: 20px 0 15px; border: 1px dashed #3d5047; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; cursor: pointer; text-align: center; transition: .2s; }
.upload-zone:hover { border-color: #79e3b1; background: #14221d; }
.upload-zone.has-file { border-color: #79e3b1; background: #14221d; }
.upload-zone input { display: none; }
.upload-zone .upload-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #79e3b1; color: #10221a; font-size: 19px; line-height: 1; }
.upload-zone strong { font-size: 12px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-zone small, .pose-note { color: #718179; font-size: 10px; line-height: 1.65; }
.pose-controls { margin-top: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pose-controls button { padding: 10px 8px; }
.text-btn { padding: 13px 0 0; border: 0; background: transparent; color: #9ccbb0; cursor: pointer; font-size: 11px; text-align: left; }
.text-btn:disabled { color: #5c6c63; }
.status { min-height: 22px; color: #a8b8ae !important; font: 10px "DM Mono", monospace; line-height: 1.65; }
.pose-note { border-top: 1px solid #26332d; margin: 13px 0 0; padding-top: 14px; }
.result-card-header, .analysis-header, .data-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.result-card-header { margin-bottom: 18px; }
.rule-chip { color: #a9d8bb; border: 1px solid #31513e; background: #14241c; border-radius: 999px; padding: 5px 9px; font: 10px "DM Mono", monospace; }
.pose-stage { min-height: 520px; margin-top: 0; border-radius: 9px; background: #080d0c; display: flex; align-items: center; justify-content: center; }
.pose-media { max-height: 660px; background: #080d0c; }
.pose-empty { color: #718179; display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; font-size: 11px; }
.pose-empty strong { color: #9aaea2; font-size: 14px; }

.analysis-panel { margin-top: 20px; }
.analysis-description { color: #90a199; font-size: 12px; line-height: 1.7; margin: 17px 0; }
.analysis-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.analysis-empty { grid-column: 1 / -1; border: 1px dashed #31443a; color: #718179; border-radius: 9px; padding: 20px; font-size: 12px; }
.metric-card { position: relative; overflow: hidden; min-height: 132px; padding: 15px; border: 1px solid #2b3c33; border-radius: 10px; background: #0d1512; }
.metric-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #6e7d75; }
.metric-card.normal::before { background: #79e3b1; }
.metric-card.warning::before { background: #ffcf70; }
.metric-card.alert::before { background: #ff8f8f; }
.metric-label { color: #9aada2; font-size: 11px; }
.metric-value { margin: 10px 0 5px; color: #f0f7f2; font: 700 28px "DM Mono", monospace; letter-spacing: -1.5px; }
.metric-value small { color: #88a395; font-size: 11px; margin-left: 2px; }
.metric-judgement { color: #c5d5cb; font-size: 11px; }
.metric-range { color: #718179; margin-top: 7px; font: 9px "DM Mono", monospace; }
.analysis-chart-wrap { margin-top: 20px; border-top: 1px solid #26332d; padding-top: 16px; }
.analysis-chart-wrap > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.analysis-chart-wrap strong { font-size: 12px; }
.analysis-chart-wrap span { color: #718179; font-size: 10px; text-align: right; }
#analysis-chart { display: block; width: 100%; height: 155px; margin-top: 12px; border-radius: 8px; background: #0b1210; }

.landmark-card { margin-top: 20px; }
.landmark-table { font-family: "DM Mono", monospace; font-size: 11px; }
.landmark-table th, .landmark-table td { border-color: #202c27; color: #b9c8c0; padding: 10px 12px; }
.landmark-table thead { background: #14221d; color: #92bda2; }
.landmark-table td:nth-child(2) { color: #dceae1; font-family: "Manrope", sans-serif; }
.empty-cell { color: #718179; }
.table-scroll { max-height: 390px; }
.video-box { background: #080d0c; }
.stat p { color: #79e3b1; }

@media (max-width: 800px) {
  .app-header { display: block; }
  .tab-nav { grid-template-columns: repeat(3, 1fr); }
  .pose-hero { padding: 34px 2px 26px; }
  .pose-hero-stat { display: none; }
  .pose-workspace { grid-template-columns: 1fr; }
  .pose-control-card { order: 1; }
  .pose-result-card { order: 0; }
  .pose-stage { min-height: 320px; }
  .analysis-chart-wrap > div { display: block; }
  .analysis-chart-wrap span { display: block; margin-top: 5px; text-align: left; }
}
