* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: #fafafa;
  color: #1a1a1a;
  line-height: 1.5;
}

.container {
  max-width: 640px;
  margin: 40px auto;
  padding: 32px 24px;
  background: white;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
}

h1 { margin-top: 0; }
.subtitle { color: #666; }

.note {
  font-size: 14px;
  color: #666;
  border-left: 3px solid #ddd;
  padding-left: 12px;
  margin: 16px 0;
}

.question-text {
  font-size: 20px;
  margin: 8px 0 28px;
  font-weight: 500;
  min-height: 60px;
}

#scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 12px 0 8px;
}

.likert {
  padding: 18px 0;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  color: #444;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

.likert:hover { background: #f0f0f0; }
.likert:active { transform: scale(0.97); }

.likert.selected {
  background: #1a73e8;
  color: white;
  border-color: #1a73e8;
}

#scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
  margin-bottom: 24px;
  line-height: 1.3;
}

button, .button {
  display: inline-block;
  padding: 10px 20px;
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

#next { margin-top: 12px; }

input {
  display: block;
  width: 100%;
  padding: 10px;
  margin: 8px 0 16px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
}

#progress {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

.error {
  background: #fef0f0;
  border: 1px solid #f5c2c2;
  color: #c62828;
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 16px;
}

.factor-row {
  margin: 18px 0;
}

.factor-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.factor-name {
  font-size: 16px;
  font-weight: 600;
}

.factor-pct {
  font-size: 18px;
  font-weight: 700;
  color: #1a73e8;
  font-variant-numeric: tabular-nums;
}

.factor-bar {
  height: 12px;
  background: #eee;
  border-radius: 6px;
  overflow: hidden;
}

.factor-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

.factor-bar-fill.high     { background: #43a047; }
.factor-bar-fill.mid-high { background: #1e88e5; }
.factor-bar-fill.mid      { background: #8e9eab; }
.factor-bar-fill.mid-low  { background: #f9a825; }
.factor-bar-fill.low      { background: #e64a19; }

.factor-meaning {
  font-size: 13px;
  color: #555;
  margin-top: 6px;
  line-height: 1.4;
}

.meta {
  font-size: 14px;
  color: #888;
  margin: 20px 0;
}

.container-wide {
  max-width: 960px;
}

.footer-link {
  margin-top: 24px;
  font-size: 14px;
  color: #666;
}

.team-banner {
  background: #e3f2fd;
  border: 1px solid #90caf9;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
}

.team-banner-label {
  font-size: 13px;
  color: #1565c0;
  margin-bottom: 4px;
}

.team-banner-name {
  font-size: 18px;
  font-weight: 600;
  color: #0d47a1;
}

.link-block {
  margin: 18px 0;
}

.link-label {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.link-row {
  display: flex;
  gap: 8px;
}

.link-row input {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  margin: 0;
  background: #f8f8f8;
}

.copy-btn, .link-row button {
  padding: 8px 14px;
  font-size: 14px;
  white-space: nowrap;
}

.link-hint {
  font-size: 13px;
  color: #666;
  margin-top: 6px;
  line-height: 1.4;
}

.link-hint.warning {
  color: #c62828;
}

.aggregate {
  margin: 16px 0 24px;
}

.range {
  font-size: 13px;
  font-weight: 400;
  color: #888;
  margin-left: 6px;
}

.members-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.members-table th {
  text-align: left;
  padding: 10px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  border-bottom: 2px solid #ddd;
}

.members-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.cell-pct {
  text-align: center;
  white-space: nowrap;
}

.pct-badge {
  display: inline-block;
  min-width: 40px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
  color: white;
  font-variant-numeric: tabular-nums;
}

.pct-badge.high     { background: #43a047; }
.pct-badge.mid-high { background: #1e88e5; }
.pct-badge.mid      { background: #8e9eab; }
.pct-badge.mid-low  { background: #f9a825; }
.pct-badge.low      { background: #e64a19; }

.delta {
  display: block;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.delta-up   { color: #43a047; }
.delta-down { color: #e64a19; }
.delta-flat { color: #aaa; }

.cell-date {
  color: #888;
  font-size: 13px;
  white-space: nowrap;
}

h2 {
  margin-top: 32px;
  font-size: 18px;
}

.test-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 24px 0;
}

@media (max-width: 720px) {
  .test-cards { grid-template-columns: 1fr; }
}

.test-card {
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
}

.test-card .card-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.test-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.test-card .card-desc {
  color: #555;
  font-size: 14px;
  margin: 0 0 16px;
  flex: 1;
}

.test-card .card-form input {
  margin: 4px 0 12px;
}

.test-card .card-form button {
  width: 100%;
}

#category {
  display: inline-block;
  background: #eef2f7;
  color: #1565c0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.chart-wrap {
  margin: 24px 0;
  overflow-x: auto;
}

.profile-chart {
  width: 100%;
  min-width: 720px;
  height: auto;
}

.factor-letter {
  display: inline-block;
  width: 22px;
  font-weight: 700;
  font-size: 16px;
  margin-right: 6px;
}

/* ===== Матричный тест ===== */

/* Класс с display: flex/grid перебивает атрибут hidden — возвращаем ему силу. */
[hidden] { display: none !important; }

.mx-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.mx-timer {
  font-size: 15px;
  font-weight: 600;
  color: #666;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mx-timer.urgent { color: #c62828; }

.mx-intro h1 { margin-bottom: 8px; }
.mx-intro p { color: #444; }

.mx-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 420px;
  margin: 8px auto 24px;
}

.mx-cell-box {
  aspect-ratio: 1;
  background: white;
  border: 1px solid #333;
  border-radius: 2px;
}

.mx-cell-box svg { display: block; width: 100%; height: 100%; }

.mx-answer {
  border-style: dashed;
  border-color: #1a73e8;
  background: #f5f9ff;
}

.mx-palette-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.mx-palette {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-bottom: 20px;
}

@media (max-width: 620px) {
  .mx-palette { grid-template-columns: repeat(5, 1fr); }
}

.mx-option {
  padding: 0;
  aspect-ratio: 1;
  background: white;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.05s;
}

.mx-option:hover { background: #f0f4f8; }
.mx-option:active { transform: scale(0.95); }

.mx-option.selected {
  background: #e3f2fd;
  border-color: #1a73e8;
  box-shadow: inset 0 0 0 1px #1a73e8;
}

.mx-option svg { display: block; width: 100%; height: 100%; }

.mx-actions {
  display: flex;
  gap: 10px;
}

button.secondary {
  background: white;
  color: #444;
  border: 1px solid #ccc;
}

button.secondary:hover { background: #f2f2f2; }

.mx-feedback {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 15px;
}

.mx-feedback.ok  { background: #edf7ed; border: 1px solid #a5d6a7; color: #2e7d32; }
.mx-feedback.bad { background: #fef0f0; border: 1px solid #f5c2c2; color: #c62828; }

.mx-feedback-text { flex: 1; }

.mx-feedback-cell {
  width: 76px;
  flex: none;
  border-color: #c62828;
  background: white;
}

/* результат */

.mx-score {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 20px 0 24px;
}

.mx-score-number {
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mx-score-number.high     { color: #43a047; }
.mx-score-number.mid-high { color: #1e88e5; }
.mx-score-number.mid      { color: #8e9eab; }
.mx-score-number.mid-low  { color: #f9a825; }
.mx-score-number.low      { color: #e64a19; }

.mx-score-label { font-size: 13px; color: #888; text-transform: uppercase; letter-spacing: 0.04em; }
.mx-score-band  { font-size: 22px; font-weight: 600; margin-top: 2px; }
.mx-score-hint  { font-size: 14px; color: #666; margin-top: 2px; }

.mx-ruler { position: relative; height: 14px; margin-top: 8px; }

.mx-ruler-ci {
  position: absolute;
  top: 0;
  height: 100%;
  background: #c7dcf7;
  border-radius: 7px;
}

.mx-ruler-mark {
  position: absolute;
  top: -2px;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  border: 2px solid white;
}

.mx-ruler-mark.high     { background: #43a047; }
.mx-ruler-mark.mid-high { background: #1e88e5; }
.mx-ruler-mark.mid      { background: #8e9eab; }
.mx-ruler-mark.mid-low  { background: #f9a825; }
.mx-ruler-mark.low      { background: #e64a19; }

.mx-ruler-scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #999;
  margin: 6px 0 20px;
}

/* рейтинг в админке */

.rank-cell {
  font-size: 18px;
  font-weight: 700;
  color: #888;
  width: 36px;
  font-variant-numeric: tabular-nums;
}

.tie-note {
  font-size: 11px;
  color: #f9a825;
  display: block;
  margin-top: 2px;
}

.ci-text {
  font-size: 12px;
  color: #888;
  display: block;
  font-variant-numeric: tabular-nums;
}
