:root {
  color-scheme: light;
  --ink: var(--puze-color-ink);
  --muted: var(--puze-color-muted);
  --line: var(--puze-color-line);
  --paper: var(--puze-color-paper);
  --panel: var(--puze-color-panel);
  --teal: var(--puze-color-accent);
  --teal-soft: #edf4ff;
  --amber: var(--puze-color-gold);
  --amber-soft: #fff0d4;
  --e: #0f766e;
  --i: #2f5f98;
  --s: #a86416;
  --n: #7c3aed;
  --t: #9f1239;
  --f: #15803d;
  --j: #1d4ed8;
  --p: #be4b0a;
  --shadow: 0 18px 55px rgba(32, 46, 66, 0.11);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(120deg, rgba(31, 65, 143, 0.1), transparent 38%),
    linear-gradient(285deg, rgba(22, 158, 156, 0.12), transparent 34%),
    var(--paper);
  color: var(--ink);
  font-family: var(--puze-font-base);
}

button,
input { font: inherit; }

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand {
  min-width: 0;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 60px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 10px 24px rgba(31, 65, 143, 0.08);
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.company {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 14px;
}

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.system-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--teal);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.session-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  align-items: center;
  min-width: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
  box-shadow: 0 10px 24px rgba(31, 65, 143, 0.08);
}

.session-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.session-card strong {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
}

.session-card small {
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
}

.session-card button {
  grid-column: 2;
  grid-row: 1 / span 3;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--teal);
  padding: 6px 10px;
  font-weight: 800;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side,
.main-panel,
.question-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.side { padding: 20px; }

.side h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

.test-switch {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
}

.test-switch a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 11px;
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.test-switch a.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal);
}

.steps {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  color: var(--muted);
  font-size: 14px;
}

.step span:first-child {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  background: #eef2f6;
  color: #516072;
  font-weight: 800;
}

.step.active {
  color: var(--teal);
  font-weight: 700;
}

.step.active span:first-child {
  background: var(--teal-soft);
  color: var(--teal);
}

.notice {
  margin: 18px 0 0;
  border-left: 4px solid var(--amber);
  padding: 10px 12px;
  background: var(--amber-soft);
  color: #68410d;
  font-size: 13px;
  line-height: 1.65;
}

.main-panel { padding: 24px; }

.screen { display: none; }
.screen.active { display: block; }

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

.field {
  display: grid;
  gap: 7px;
}

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

.candidate-summary div {
  border: 1px solid #d8e6f7;
  border-radius: 8px;
  background: #f7fbff;
  padding: 13px 14px;
}

.candidate-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.candidate-summary strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

label {
  color: #344154;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfd7e2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.previous-result {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  border: 1px solid #d8e6f7;
  border-radius: 8px;
  background: #f7fbff;
  padding: 14px 16px;
}

.previous-result span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.previous-result strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
}

.previous-result p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.previous-result a {
  flex: 0 0 auto;
  border: 1px solid var(--teal);
  border-radius: 8px;
  color: var(--teal);
  background: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 750;
}

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

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

.current-test-card {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  border: 2px solid var(--teal);
  border-radius: 8px;
  background: linear-gradient(180deg, #f1fbf8, #ffffff);
  padding: 18px 20px;
  box-shadow: 0 10px 24px rgba(22, 158, 156, 0.1);
}

.current-test-card span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
}

.current-test-card strong {
  color: var(--teal);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.15;
}

.current-test-card p {
  margin: 0;
  color: #344154;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.5;
}

.progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
  transition: width 180ms ease;
}

.question-panel {
  padding: 26px;
  box-shadow: none;
}

.question-title {
  margin-bottom: 20px;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.35;
}

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

.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 18px;
  align-items: center;
  min-height: 88px;
  border: 2px solid #d6dee8;
  border-radius: 8px;
  padding: 22px 24px;
  background: #fff;
  color: #253246;
  font-size: clamp(17px, 1.8vw, 22px);
  font-weight: 850;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.option:hover {
  border-color: var(--teal);
  box-shadow: 0 10px 22px rgba(31, 65, 143, 0.08);
}

.option input {
  width: 30px;
  height: 30px;
  min-height: 30px;
  margin: 0;
  accent-color: var(--teal);
}

.option.selected {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 1px var(--teal), 0 10px 22px rgba(22, 158, 156, 0.12);
}

.test-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.result-summary,
.copy-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
}

.result-summary span,
.copy-card label {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.result-summary strong {
  display: block;
  margin: 6px 0;
  color: var(--teal);
  font-size: clamp(48px, 9vw, 86px);
  line-height: 1;
  letter-spacing: 0;
}

.result-summary p {
  margin: 0;
  color: #344154;
  line-height: 1.7;
}

.score-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.score-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 28px;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.e { color: var(--e); }
.i { color: var(--i); }
.s { color: var(--s); }
.n { color: var(--n); }
.t { color: var(--t); }
.f { color: var(--f); }
.j { color: var(--j); }
.p { color: var(--p); }

.copy-card {
  display: grid;
  gap: 12px;
}

.copy-card textarea {
  min-height: 108px;
  resize: vertical;
  background: #fbfcfe;
  font: 700 15px/1.7 inherit;
}

.error {
  min-height: 22px;
  margin: 12px 0 0;
  color: #a44455;
  font-size: 14px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 28px, 760px);
    padding-top: 18px;
  }

  .topbar,
  .layout,
  .form-grid,
  .candidate-summary,
  .score-band {
    grid-template-columns: 1fr;
  }

  .topbar { display: grid; }

  .session-card { width: 100%; }

  .brand {
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 10px;
  }

  .brand-logo {
    width: 54px;
    height: 54px;
  }
  .main-panel { padding: 18px; }
  h1 { font-size: 28px; }
  .test-actions { flex-direction: column-reverse; }
  .previous-result { display: grid; }
}
