:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --text: #243044;
  --muted: #6f7a8d;
  --line: #dfe5ef;
  --line-strong: #cbd5e4;
  --primary: #2f6fed;
  --primary-strong: #1e56cc;
  --success: #159c6e;
  --warning: #d1840f;
  --danger: #d94b4b;
  --shadow: 0 8px 24px rgba(36, 48, 68, 0.08);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

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

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.sidebar {
  background: #202b3d;
  color: #edf3ff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  padding: 4px 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
}

.brand-subtitle {
  margin-top: 6px;
  color: #aeb9cc;
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 6px;
  color: #d8e2f2;
  background: transparent;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-icon {
  width: 20px;
  text-align: center;
  color: #9fb0c9;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 0;
  color: #9fb0c9;
  font-size: 12px;
  line-height: 1.6;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.metric,
.code-card,
.report-card,
.question-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

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

.panel-title {
  margin: 0;
  font-size: 17px;
}

.panel-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.metric {
  padding: 16px;
  min-height: 96px;
}

.metric-label {
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 800;
}

.metric-foot {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.btn {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 18px;
  color: var(--text);
  background: #edf2f8;
  white-space: nowrap;
}

.btn:hover {
  background: #e3eaf4;
}

.btn.primary {
  color: #ffffff;
  background: var(--primary);
}

.btn.primary:hover {
  background: var(--primary-strong);
}

.btn.success {
  color: #ffffff;
  background: var(--success);
}

.btn.warning {
  color: #ffffff;
  background: var(--warning);
}

.btn.danger {
  color: #ffffff;
  background: var(--danger);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
}

.btn.square {
  width: 36px;
  padding: 0;
  border-radius: 50%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.label {
  color: var(--muted);
  font-size: 13px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  background: #ffffff;
  outline: none;
}

.textarea {
  min-height: 82px;
  padding-top: 10px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12);
}

.section-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.code-list,
.report-list {
  display: grid;
  gap: 12px;
}

.code-card,
.report-card {
  padding: 14px;
}

.code-row,
.report-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.1fr) minmax(120px, 0.7fr) minmax(160px, 0.9fr);
  gap: 12px;
  align-items: center;
}

.report-row {
  grid-template-columns: minmax(130px, 0.8fr) minmax(160px, 0.9fr) minmax(150px, 0.8fr) minmax(160px, 1fr);
}

.code-main,
.report-main {
  min-width: 0;
}

.code-value {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: #163d84;
  background: #e8f0ff;
  font-family: "Segoe UI Mono", Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0;
}

.item-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  font-size: 12px;
  color: #17633f;
  background: #e5f6ed;
}

.status.off {
  color: #874d00;
  background: #fff1d8;
}

.mini-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.empty {
  padding: 34px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  background: var(--panel-soft);
}

.invite-preview {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}

.code-tile {
  width: 232px;
  min-height: 232px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(90deg, rgba(47, 111, 237, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(47, 111, 237, 0.08) 1px, transparent 1px),
    #ffffff;
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.code-tile-label {
  color: var(--muted);
  font-size: 13px;
}

.code-tile-value {
  margin-top: 12px;
  font-family: "Segoe UI Mono", Consolas, monospace;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.code-tile-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.share-link {
  width: 100%;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  text-align: left;
}

.take-layout {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.take-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 24px;
  background: #202b3d;
  color: #ffffff;
}

.take-title {
  font-weight: 800;
  font-size: 18px;
}

.take-content {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.progress-wrap {
  height: 8px;
  border-radius: 4px;
  background: #e5ebf5;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--primary);
  transition: width 180ms ease;
}

.question-card {
  padding: 22px;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.question-title {
  margin: 18px 0 20px;
  font-size: 22px;
  line-height: 1.5;
}

.scale {
  display: grid;
  gap: 10px;
}

.scale-option {
  width: 100%;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
  text-align: left;
}

.scale-option:hover,
.scale-option.active {
  border-color: var(--primary);
  background: #eef4ff;
}

.scale-value {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--primary);
  background: #e8f0ff;
  font-weight: 700;
}

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.report-detail {
  display: grid;
  gap: 16px;
}

.report-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
}

.score-panel {
  padding: 18px;
  border-radius: var(--radius);
  background: #202b3d;
  color: #ffffff;
}

.score-label {
  color: #b7c4d9;
  font-size: 13px;
}

.score-value {
  margin-top: 8px;
  font-size: 46px;
  font-weight: 800;
}

.trait-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.trait-tag {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
}

.chart-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
}

.bar-name {
  font-size: 13px;
  font-weight: 700;
}

.bar-track {
  height: 10px;
  border-radius: 5px;
  background: #e8edf5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 5px;
}

.bar-score {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.insight {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel-soft);
}

.insight h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.insight p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  min-width: 210px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: #202b3d;
  box-shadow: var(--shadow);
}

.hidden {
  display: none !important;
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 8;
    padding: 12px;
  }

  .brand {
    padding-bottom: 8px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
    padding: 0 8px;
  }

  .nav-icon,
  .sidebar-footer {
    display: none;
  }

  .topbar {
    height: auto;
    min-height: 60px;
    padding: 12px 16px;
    align-items: flex-start;
  }

  .content,
  .take-content {
    padding: 16px;
  }

  .grid.metrics,
  .grid.two,
  .grid.three,
  .report-hero,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .code-row,
  .report-row {
    grid-template-columns: 1fr;
  }

  .mini-actions {
    justify-content: flex-start;
  }
}

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

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

  .question-title {
    font-size: 18px;
  }

  .question-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .question-actions .btn {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .bar-score {
    text-align: left;
  }
}

/* Mobile H5 polish */
.ui-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.h5-mode {
  background:
    radial-gradient(circle at 20% 0%, rgba(47, 111, 237, 0.12), transparent 30%),
    linear-gradient(180deg, #eef4ff 0%, #f7f9fd 44%, #f3f6fb 100%);
}

.h5-header {
  min-height: 64px;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: #202b3d;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.icon-button:active,
.btn:active,
.scale-option:active {
  transform: scale(0.98);
}

.take-content {
  width: min(430px, 100%);
  padding: 16px 16px calc(92px + env(safe-area-inset-bottom));
}

.h5-hero,
.h5-card,
.h5-question-card {
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 228, 0.82);
  box-shadow: 0 18px 42px rgba(36, 48, 68, 0.1);
}

.h5-hero {
  position: relative;
  min-height: 304px;
  padding: 24px 20px 22px;
  overflow: hidden;
}

.h5-hero h1,
.h5-step h1,
.h5-question-card h1 {
  margin: 0;
  line-height: 1.22;
  letter-spacing: 0;
}

.h5-hero h1 {
  position: relative;
  max-width: 260px;
  margin-top: 88px;
  font-size: 31px;
}

.h5-hero p {
  position: relative;
  max-width: 305px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.h5-kicker {
  color: var(--primary) !important;
  font-size: 12px !important;
  font-weight: 800;
}

.talent-orbit {
  position: absolute;
  inset: 0;
}

.talent-orbit::before,
.talent-orbit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 34%;
  width: 124px;
  height: 124px;
  transform: translate(-50%, -50%);
  border: 1px solid #dce6f5;
  border-radius: 50%;
}

.talent-orbit::after {
  width: 78px;
  height: 78px;
  background: #f8fbff;
}

.talent-orbit span {
  position: absolute;
  z-index: 1;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 10px 18px rgba(36, 48, 68, 0.18);
}

.talent-orbit span:nth-child(1) { left: 34%; top: 16%; }
.talent-orbit span:nth-child(2) { left: 62%; top: 15%; }
.talent-orbit span:nth-child(3) { left: 74%; top: 34%; }
.talent-orbit span:nth-child(4) { left: 66%; top: 56%; }
.talent-orbit span:nth-child(5) { left: 41%; top: 59%; }
.talent-orbit span:nth-child(6) { left: 24%; top: 42%; }
.talent-orbit span:nth-child(7) { left: 25%; top: 23%; }

.h5-card {
  margin-top: 14px;
  padding: 18px;
}

.h5-card-title h2 {
  margin: 0;
  font-size: 18px;
}

.h5-card-title p,
.h5-step p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.h5-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.h5-form label {
  display: grid;
  gap: 8px;
}

.h5-form label > span,
.privacy-note strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.h5-form .input,
.h5-form .select {
  min-height: 50px;
  border-radius: 8px;
  font-size: 16px;
}

.h5-step {
  padding: 8px 2px 2px;
}

.h5-step span,
.h5-question-head strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  color: var(--primary);
  background: #e8f0ff;
  font-size: 12px;
  font-weight: 800;
}

.h5-step h1 {
  margin-top: 16px;
  font-size: 30px;
}

.privacy-note {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  background: #f5f8fc;
  font-size: 12px;
  line-height: 1.55;
}

.quick-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.quick-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quick-row .btn {
  min-height: 44px;
  border-radius: 22px;
  font-size: 13px;
  padding-left: 10px;
  padding-right: 10px;
}

.h5-question-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 2px 0;
}

.h5-question-head div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.h5-question-head span,
.h5-question-head em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.h5-progress {
  height: 8px;
  margin-top: 14px;
}

.h5-question-card {
  margin-top: 14px;
  padding: 22px 16px 18px;
}

.h5-question-card .question-title {
  margin-bottom: 20px;
  font-size: 22px;
}

.scale-option {
  min-height: 54px;
  border-radius: 8px;
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.scale-option.active {
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, 0.18);
}

.sticky-action {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 12;
  width: min(430px, 100%);
  display: grid;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(247, 249, 253, 0.94);
  border-top: 1px solid rgba(203, 213, 228, 0.8);
  backdrop-filter: blur(14px);
}

.sticky-action.split {
  grid-template-columns: 0.82fr 1.18fr;
}

.btn.block {
  width: 100%;
  min-height: 52px;
  border-radius: 26px;
  font-weight: 800;
  font-size: 16px;
}

.report-detail .panel,
.report-detail .insight,
.report-detail .chart-panel,
.report-detail .score-panel {
  border-radius: 8px;
}

.toast {
  left: 50%;
  right: auto;
  bottom: calc(80px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  text-align: center;
}

@media (max-width: 940px) {
  .app-shell {
    min-height: 100dvh;
    background: #f4f7fb;
  }

  .sidebar {
    gap: 12px;
    background: #202b3d;
  }

  .nav-button {
    min-height: 44px;
    border-radius: 22px;
    font-size: 13px;
  }

  .topbar {
    position: static;
    border-bottom: 0;
    background: #f4f7fb;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .content {
    padding-bottom: 28px;
  }

  .btn {
    min-height: 44px;
    border-radius: 22px;
  }
}

@media (max-width: 560px) {
  .take-header {
    align-items: center;
  }

  .take-content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .h5-hero h1 {
    font-size: 28px;
  }

  .sticky-action {
    padding-left: 14px;
    padding-right: 14px;
  }

  .sticky-action.split {
    grid-template-columns: 1fr 1fr;
  }

  .quick-row.three {
    grid-template-columns: 1fr;
  }

  .report-hero {
    gap: 12px;
  }

  .score-value {
    font-size: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
