:root {
  color-scheme: light;
  font-family: "Inter", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #18243a;
  background: #f2f5fa;
  font-size: 16px;
  --accent: #2458b5;
  --line: #dbe2ed;
  --secondary: #516077;
  --error: #ad2e32;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 34px 20px 64px;
  line-height: 1.7;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .65; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.study-header, .tools-slot, .card {
  width: min(100%, 780px);
  margin-inline: auto;
}

.study-header { padding-bottom: 18px; }
h1 {
  margin: 0 0 26px;
  text-align: center;
  font-size: clamp(1.32rem, 3.5vw, 1.85rem);
  line-height: 1.3;
  font-weight: 700;
}

.progress-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--secondary);
  font-size: .87rem;
}

#percent { margin-inline-start: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
progress {
  display: block;
  width: 100%;
  height: 7px;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #dce5f2;
  accent-color: var(--accent);
}
progress::-webkit-progress-bar { background: #dce5f2; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 10px; }

.developer-panel {
  margin-bottom: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--secondary);
  background: #f7f9fd;
  font-size: .86rem;
}

.developer-panel summary { cursor: pointer; font-weight: 600; }
.developer-panel p { margin-block: 8px; }
.developer-field, .export-option {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.developer-field select {
  min-width: 0;
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: inherit;
}

.card {
  min-width: 0;
  padding: 32px clamp(18px, 5vw, 46px) 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow-wrap: anywhere;
}

.card h2 {
  margin: 0 0 23px;
  font-size: 1.25rem;
  line-height: 1.4;
}
.card:focus, .card h2:focus { outline: 0; }
.copy { margin: 0 0 18px; white-space: pre-wrap; }
.instruction-list { padding-inline-start: 1.55rem; margin-block: 12px 24px; }
.instruction-list li { margin-bottom: 8px; }
.underlined { text-decoration: underline; text-underline-offset: .15em; }

.question {
  min-width: 0;
  margin: 0 0 26px;
  padding: 0 0 19px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
}

.question legend {
  max-width: 100%;
  margin-bottom: 8px;
  padding: 0;
  font-weight: 600;
}
.required { margin-inline-end: 5px; color: var(--error); }
.question-number { font-variant-numeric: tabular-nums; }
.question-hint {
  margin: 0 0 8px;
  color: var(--secondary);
  font-size: .9rem;
}
.choices { display: grid; gap: 6px; }
.scale {
  grid-template-columns: repeat(var(--scale-count), minmax(0, 1fr));
  gap: 3px;
}
.scale-endpoints {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 3px 4px 0;
  color: var(--secondary);
  font-size: .84rem;
}
.scale-endpoints :last-child { text-align: end; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.choice:hover, .choice:has(input:focus-visible) { background: #f3f6fc; }
.choice:has(input:checked) { border-color: #c6d5f2; background: #eef4ff; }
.scale .choice {
  align-items: center;
  flex-direction: column-reverse;
  justify-content: center;
  gap: 4px;
  padding: 5px 0;
  font-variant-numeric: tabular-nums;
}
.choice input, .export-option input {
  flex: none;
  margin: 4px 0 0;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}
.scale input, .export-option input { margin-top: 0; }

.text-input {
  display: block;
  width: min(100%, 23rem);
  padding: 8px 10px;
  border: 1px solid #aebbd0;
  border-radius: 6px;
  background: #fff;
  color: inherit;
}
textarea.text-input { width: 100%; resize: vertical; }
.unavailable-field, .pk-status {
  margin: 0;
  color: var(--secondary);
  font-size: .9rem;
}
.field-error, .form-message {
  margin: 5px 0 0;
  color: var(--error);
  font-size: .9rem;
}
.form-message:empty { display: none; }
.invalid .text-input { border-color: var(--error); }
.actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.actions .primary { margin-inline-start: auto; }

.primary, .secondary {
  min-height: 44px;
  padding: 7px 20px;
  border: 1px solid transparent;
  border-radius: 7px;
  line-height: 1.5;
  font-weight: 600;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: #1e4897; }
.secondary { border-color: #c7d1e2; background: #fff; color: #30425c; }
.secondary:hover { background: #edf2fa; }

.pk-card { width: min(100%, 540px); padding: 18px 12px; }
.pk-card h2, .pk-card .actions { margin-inline: 8px; }
.pk-card h2 { margin-bottom: 12px; }
.pk-slot { margin-bottom: 12px; background: #101116; overflow: hidden; border-radius: 8px; }
.pk-frame { display: block; width: 100%; height: 760px; border: 0; }

@media (max-width: 480px) {
  body { padding: 24px 10px 40px; }
  .card { padding-block: 23px 26px; }
  .card.pk-card { padding: 13px 0; }
  .pk-slot { border-radius: 0; }
  .question { margin-bottom: 20px; padding-bottom: 14px; }
}
