:root {
  --bg: #eaf7ff;
  --surface: #ffffff;
  --text: #17314d;
  --muted: #5f7893;
  --line: #c7e2f5;
  --accent: #1f75bd;
  --accent-strong: #14528d;
  --warm: #315d94;
  --danger: #b42318;
  --success: #176b70;
  --navy: #102b57;
  --sky: #c8ebff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.92) 0 7%, transparent 8%),
    radial-gradient(circle at 87% 16%, rgba(143, 207, 236, 0.45) 0 5%, transparent 6%),
    linear-gradient(180deg, #eff9ff 0%, #d9f1ff 46%, #f6fbff 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 48px);
  background: rgba(238, 249, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 20px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.layout {
  width: min(960px, calc(100% - 24px));
  margin: 24px auto 72px;
}

.layout.narrow {
  width: min(760px, calc(100% - 28px));
}

.intro,
.panel {
  margin-bottom: 18px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(19, 45, 37, 0.06);
}

.intro {
  border-left: 5px solid var(--accent);
  background: linear-gradient(135deg, #ffffff 0%, #edf8ff 100%);
  color: var(--muted);
  font-size: 16px;
}

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

.info-panel h2 {
  text-align: center;
}

.info-list {
  display: grid;
  gap: 0;
}

.info-list label {
  grid-template-columns: minmax(110px, 34%) 1fr;
  align-items: center;
  min-height: 58px;
  padding: 10px 0;
  border-bottom: 1px solid #edf3f8;
}

.info-list label:last-child {
  border-bottom: 0;
}

.info-list span {
  color: #596a7a;
  font-size: 17px;
}

.info-list b {
  margin-right: 4px;
  color: #d83b55;
}

.info-list input,
.info-list select,
.info-list textarea {
  text-align: right;
  background: transparent;
  border-color: transparent;
}

.info-list textarea {
  text-align: left;
  background: #f8fbff;
  border-color: var(--line);
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: #fbfdff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.question-group h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: #2f3e4d;
  text-align: center;
}

.question {
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.question-locked {
  opacity: 0.34;
  filter: grayscale(0.1);
}

.question:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

legend {
  width: 100%;
  margin-bottom: 16px;
  color: #1c2a37;
  font-size: clamp(20px, 4vw, 28px);
  font-weight: 800;
}

.question-number {
  display: inline-block;
  min-width: 2.6em;
  color: #a5abb3;
  font-weight: 500;
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  color: #7c3d00;
  background: #fff4d6;
  border-radius: 999px;
  font-size: 12px;
}

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

.scale label {
  min-height: 64px;
  justify-items: center;
  align-content: center;
  padding: 10px 8px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(31, 117, 189, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.scale input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale span {
  color: #1f2933;
  font-size: clamp(16px, 3.8vw, 22px);
  font-weight: 800;
}

.scale label.option-selected {
  color: #fff;
  background: #1e9af0;
  box-shadow: 0 10px 26px rgba(30, 154, 240, 0.36);
  transform: translateY(-2px);
}

.scale label.option-selected span {
  color: #fff;
}

.question-locked .scale label {
  cursor: not-allowed;
  box-shadow: none;
}

.submit-panel {
  display: grid;
  gap: 16px;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
}

.consent input {
  width: 18px;
  min-height: 18px;
  margin-top: 4px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: var(--accent-strong);
}

.button-link.subtle {
  color: var(--accent-strong);
  background: #e7f5ff;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.status {
  color: var(--muted);
  font-weight: 700;
}

.status.success {
  color: var(--success);
}

.result-title,
.result-line {
  display: block;
}

.result-title {
  margin-bottom: 8px;
  font-size: 18px;
}

.result-line strong {
  color: var(--accent-strong);
  font-size: 20px;
}

.status.error {
  color: var(--danger);
}

body.modal-open {
  overflow: hidden;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  overflow: auto;
  width: min(720px, 100%);
  max-height: min(86vh, 900px);
  padding: 28px;
  text-align: left;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.26);
}

.modal-dialog h2 {
  margin-bottom: 18px;
  text-align: center;
}

.modal-result {
  margin-bottom: 22px;
  text-align: center;
  color: #66717f;
  font-size: 18px;
  font-weight: 700;
}

.modal-result strong {
  color: #4f565e;
  font-size: 22px;
}

.result-analysis {
  margin-top: 16px;
  padding: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.result-analysis h3 {
  margin: 0 0 10px;
  color: var(--accent-strong);
}

.result-analysis p,
.result-analysis li {
  color: #4b5b68;
  font-weight: 700;
}

.result-analysis ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.score-bars {
  display: grid;
  gap: 10px;
}

.score-row {
  display: grid;
  grid-template-columns: 64px 1fr 42px;
  align-items: center;
  gap: 10px;
  color: #516173;
  font-weight: 800;
}

.score-track {
  overflow: hidden;
  height: 12px;
  background: #e9f2fa;
  border-radius: 999px;
}

.score-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #44b6ff 0%, #177bd1 100%);
  border-radius: inherit;
}

.modal-confirm {
  width: 100%;
  margin-top: 20px;
  color: #d64055;
  background: #fff;
  border-top: 1px solid #edf0f3;
  border-radius: 0;
  font-size: 20px;
}

.modal-confirm:hover {
  background: #fff6f8;
}

.result-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.95) 0 8%, transparent 9%),
    linear-gradient(180deg, #e9f7ff 0%, #f7fbff 100%);
}

.result-backdrop-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.result-dialog {
  width: min(760px, 100%);
}

.success-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.success-card {
  width: min(560px, 100%);
  padding: clamp(28px, 7vw, 48px);
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(28, 83, 128, 0.16);
}

.success-mark {
  display: inline-grid;
  width: 72px;
  height: 72px;
  place-items: center;
  margin-bottom: 18px;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  font-size: 40px;
  font-weight: 900;
}

.error-mark {
  background: var(--danger);
}

.success-card h1 {
  margin-bottom: 10px;
  color: var(--accent-strong);
}

.success-subtitle {
  margin-bottom: 28px;
  color: var(--muted);
  font-weight: 700;
}

.constitution-result {
  padding: 20px;
  background: linear-gradient(135deg, #edf8ff 0%, #ffffff 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.constitution-result p {
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.constitution-result strong {
  color: var(--accent-strong);
  font-size: clamp(28px, 8vw, 46px);
  line-height: 1.2;
}

.qr-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  background: #dff2ff;
}

.qr-poster {
  position: relative;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  justify-items: center;
  overflow: hidden;
  width: min(430px, 100%);
  min-height: min(760px, calc(100vh - 36px));
  padding: 34px 22px 0;
  text-align: center;
  background:
    radial-gradient(circle at 16% 58%, rgba(255, 255, 255, 0.78) 0 10px, rgba(129, 199, 232, 0.38) 11px 18px, transparent 20px),
    radial-gradient(circle at 83% 18%, rgba(255, 255, 255, 0.7) 0 13px, rgba(127, 195, 228, 0.42) 14px 28px, transparent 30px),
    linear-gradient(180deg, #d7edff 0%, #c8ebff 56%, #edf9ff 100%);
  border: 1px solid rgba(79, 148, 199, 0.25);
  border-radius: 10px;
  box-shadow: 0 18px 42px rgba(28, 83, 128, 0.18);
}

.qr-copy {
  position: relative;
  z-index: 2;
  margin-bottom: 18px;
  color: #654861;
  font-size: clamp(17px, 4.4vw, 22px);
  font-weight: 900;
  line-height: 1.7;
}

.qr-frame {
  position: relative;
  z-index: 2;
  padding: 10px;
  background: #fff;
  border: 1px solid rgba(39, 96, 148, 0.32);
  box-shadow: 0 8px 20px rgba(26, 91, 145, 0.16);
}

.qr-frame img {
  display: block;
  width: min(245px, 64vw);
  height: auto;
}

.url-text {
  position: relative;
  z-index: 2;
  overflow-wrap: anywhere;
  max-width: 100%;
  margin: 18px 0 14px;
  color: #315d94;
  font-size: 13px;
  font-weight: 700;
}

.qr-open {
  position: relative;
  z-index: 2;
  margin-bottom: 28px;
}

.poster-title {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: end;
  width: calc(100% + 44px);
  min-height: 72px;
  padding: 12px 14px;
  color: #8bc4ff;
  background: linear-gradient(180deg, #173864 0%, #0d244e 100%);
  font-size: clamp(20px, 5.2vw, 30px);
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.32);
}

.bubble {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, rgba(255, 255, 255, 0.86), rgba(95, 179, 224, 0.32) 58%, rgba(50, 135, 194, 0.12));
}

.bubble-one {
  width: 56px;
  height: 56px;
  top: 66px;
  right: 32px;
}

.bubble-two {
  width: 34px;
  height: 34px;
  left: 36px;
  bottom: 166px;
}

@media (max-width: 720px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .scale {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
  }

  .scale label {
    min-height: 58px;
  }

  .info-list label {
    grid-template-columns: 112px 1fr;
  }

  .modal-dialog {
    padding: 22px 18px;
  }
}
