:root {
  color-scheme: light;
  --accent: #3157c8;
  --accent-dark: #23419e;
  --accent-soft: #eef3ff;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ef;
  --surface: #ffffff;
  --danger: #b42318;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, #e9f0ff 0, transparent 34rem),
    #f5f7fb;
}

button,
input,
textarea { font: inherit; }

.page-shell {
  width: min(760px, calc(100% - 28px));
  margin: 0 auto;
  padding: 44px 0 64px;
}

.hero { padding: 0 8px 22px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero h1 { margin: 0; font-size: clamp(30px, 7vw, 48px); line-height: 1.13; letter-spacing: -.035em; }
.intro { max-width: 620px; margin: 15px 0 0; color: var(--muted); font-size: 16px; line-height: 1.75; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.meta-row span,
.class-note {
  border: 1px solid #d8e1f8;
  border-radius: 999px;
  background: rgba(255, 255, 255, .74);
  color: #4c5f83;
  font-size: 12px;
  padding: 6px 10px;
}
.class-note { display: inline-block; margin: 10px 0 0; }

#survey-form { display: grid; gap: 14px; }
.question-card {
  min-width: 0;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(26, 46, 86, .045);
}
.question-card legend,
.question-card h2,
.question-title {
  width: 100%;
  margin: 0 0 17px;
  padding: 0;
  color: var(--ink);
  font-size: 17px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.55;
}
.optional-identity { display: grid; gap: 15px; }
.optional-identity-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.optional-identity-heading h2 { margin: 0; font-size: 16px; }
.optional-identity-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.optional-identity-heading > span { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.identity-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.identity-grid label { display: grid; gap: 6px; color: #475467; font-size: 13px; font-weight: 650; }
input[name="student_name"],
input[name="student_id"] { width: 100%; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfe; color: var(--ink); outline: none; }
input[name="student_name"]:focus,
input[name="student_id"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(49, 87, 200, .12); }
.question-card legend > span,
.question-card h2 > span,
.question-title > b {
  display: inline-grid;
  width: 26px;
  height: 26px;
  margin-right: 9px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
}
.choice-list { display: grid; gap: 9px; }
.choice-list.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice-list label { cursor: pointer; }
.choice-list input { position: absolute; opacity: 0; pointer-events: none; }
.choice-list label > span {
  display: flex;
  min-height: 46px;
  align-items: center;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #344054;
  line-height: 1.45;
  transition: .15s ease;
}
.choice-list input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.choice-list input:focus-visible + span,
.rating-scale input:focus-visible + span,
.number-scale input:focus-visible + span { outline: 3px solid rgba(49, 87, 200, .22); outline-offset: 2px; }

.rating-scale,
.number-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.rating-scale label,
.number-scale label { cursor: pointer; }
.rating-scale input,
.number-scale input { position: absolute; opacity: 0; pointer-events: none; }
.rating-scale label > span,
.number-scale label > span {
  display: grid;
  min-height: 62px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #475467;
  transition: .15s ease;
}
.rating-scale b { font-size: 17px; }
.rating-scale small { margin-top: -10px; color: var(--muted); font-size: 10px; }
.rating-scale input:checked + span,
.number-scale input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 5px 14px rgba(49, 87, 200, .2);
}
.rating-scale input:checked + span small { color: #e6ecff; }

.scale-hint { margin: -8px 0 14px 35px; color: var(--muted); font-size: 12px; }
.mini-rating { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.1fr); gap: 20px; align-items: center; margin: 0; padding: 15px 0; border: 0; border-top: 1px solid #edf0f5; }
.mini-rating legend { width: auto; margin: 0; font-size: 14px; font-weight: 600; }
.number-scale label > span { min-height: 38px; font-size: 13px; font-weight: 700; }

.text-question { display: block; }
.question-title { display: block; }
.question-title em { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
textarea,
.admin-login input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfcfe;
  color: var(--ink);
  outline: none;
}
textarea { min-height: 108px; resize: vertical; padding: 13px; line-height: 1.6; }
textarea:focus,
.admin-login input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(49, 87, 200, .12); }
.text-question > small { display: block; margin-top: 7px; color: var(--muted); text-align: right; }

.submit-button,
.secondary-button,
.text-button { border: 0; cursor: pointer; }
.submit-button {
  min-height: 52px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(49, 87, 200, .2);
}
.submit-button:hover { background: var(--accent-dark); }
.submit-button:disabled { cursor: wait; opacity: .65; }
.privacy-note { margin: -2px 0 0; color: var(--muted); font-size: 11px; text-align: center; }
.form-error { margin: 0; padding: 11px 13px; border-radius: 10px; background: #fff1f0; color: var(--danger); font-size: 13px; }
.form-trap { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }

.success-card { padding: 54px 28px; border: 1px solid var(--line); border-radius: 20px; background: #fff; text-align: center; }
.success-mark { display: grid; width: 52px; height: 52px; margin: 0 auto 16px; place-items: center; border-radius: 50%; background: #e8f7ee; color: #17834f; font-size: 27px; font-weight: 800; }
.success-card h2 { margin: 0; font-size: 26px; }
.success-card p { margin: 12px auto 22px; max-width: 480px; color: var(--muted); line-height: 1.7; }
.text-button { background: transparent; color: var(--accent); font-weight: 650; }
.noscript { padding: 14px; border-radius: 10px; background: #fff1f0; color: var(--danger); }

.compact-hero { padding-bottom: 18px; }
.admin-login form { display: grid; gap: 12px; }
.admin-login label { font-size: 14px; font-weight: 650; }
.admin-login input { height: 48px; padding: 0 13px; }
.admin-login .submit-button { margin-top: 3px; }
.dashboard-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 22px; border-radius: 18px; background: var(--accent); color: white; }
.dashboard-head span { display: block; color: #dce5ff; font-size: 12px; }
.dashboard-head strong { display: block; margin-top: 2px; font-size: 36px; line-height: 1; }
.admin-actions { display: flex; align-items: center; gap: 9px; }
.secondary-button { padding: 10px 14px; border-radius: 9px; background: white; color: var(--accent-dark); font-weight: 700; }
.dashboard-head .text-button { color: white; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.metric-grid article { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.metric-grid span { display: block; color: var(--muted); font-size: 12px; }
.metric-grid strong { display: block; margin-top: 6px; color: var(--accent-dark); font-size: 24px; }
.distribution-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.distribution-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.distribution-grid h2 { margin: 0 0 17px; font-size: 15px; }
.bar-row + .bar-row { margin-top: 12px; }
.bar-row p { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 5px; color: #475467; font-size: 12px; }
.bar-track { height: 7px; overflow: hidden; border-radius: 99px; background: #edf1f7; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.empty-copy { color: var(--muted); font-size: 13px; }
#dashboard > .form-error { margin-top: 12px; }

[hidden] { display: none !important; }

@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 760px); padding-top: 26px; }
  .hero { padding-inline: 4px; }
  .hero h1 { font-size: 31px; }
  .intro { font-size: 14px; }
  .question-card { padding: 18px 15px; border-radius: 15px; }
  .optional-identity-heading { flex-direction: column; gap: 8px; }
  .identity-grid { grid-template-columns: 1fr; }
  .choice-list.two-columns { grid-template-columns: 1fr; }
  .rating-scale { gap: 5px; }
  .rating-scale label > span { min-height: 58px; }
  .mini-rating { grid-template-columns: 1fr; gap: 9px; }
  .mini-rating legend { width: 100%; }
  .number-scale { gap: 6px; }
  .number-scale label > span { min-height: 40px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .distribution-grid { grid-template-columns: 1fr; }
  .dashboard-head { align-items: flex-start; flex-direction: column; }
}
