:root {
  color-scheme: light;
  --page-bg: #eef5fa;
  --surface: #ffffff;
  --card: #f9fcff;
  --text: #0a3474;
  --muted: #173765;
  --blue: #005aa9;
  --blue-dark: #003b78;
  --blue-light: #0d92d4;
  --green: #58a946;
  --border: rgba(0, 90, 169, .24);
  --shadow: 0 20px 55px rgba(8, 52, 116, .16);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #061526;
  --surface: #0b2037;
  --card: #102b48;
  --text: #f1f8ff;
  --muted: #d5e8f7;
  --blue: #4fb2f3;
  --blue-dark: #8ed4ff;
  --blue-light: #58c0f4;
  --green: #78ca69;
  --border: rgba(143, 210, 255, .28);
  --shadow: 0 22px 65px rgba(0, 0, 0, .42);
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--muted);
  background:
    radial-gradient(circle at 10% 0%, rgba(13, 146, 212, .13), transparent 30rem),
    var(--page-bg);
}

a { color: var(--blue); }

.theme-toggle {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(0, 40, 80, .13);
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 34px);
}

.survey-page {
  width: min(100%, 980px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-band,
.footer-band {
  height: 14px;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue-light) 74%, var(--green));
}

.footer-band { height: 18px; margin-top: 28px; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 86px 10px;
  text-align: left;
}

.jcs-logo {
  width: 64px;
  height: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.55rem, 3.2vw, 2.35rem);
  line-height: 1.05;
  letter-spacing: -.025em;
}

.subtitle {
  margin: 6px 0 0;
  font-size: clamp(.96rem, 1.7vw, 1.15rem);
  font-weight: 700;
}

.accent-line {
  width: min(calc(100% - 64px), 820px);
  height: 4px;
  margin: 10px auto 24px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.survey-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 0 28px;
}

.survey-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 22px 22px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  text-align: center;
}

.survey-card h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
}

.instruction {
  min-height: 3.1em;
  margin: 0 auto 16px;
  font-size: clamp(.95rem, 1.55vw, 1.08rem);
  line-height: 1.45;
  font-weight: 600;
}

.qr-link {
  display: block;
  width: min(100%, 320px);
  padding: 14px;
  border: 4px solid var(--blue);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 80, 155, .14);
  transition: transform .18s ease, box-shadow .18s ease;
}

.qr-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(0, 80, 155, .22);
}

.qr-code {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  image-rendering: pixelated;
}

.direct-link-label {
  margin: 17px 0 4px;
  font-size: .94rem;
}

.direct-link {
  max-width: 100%;
  font-size: clamp(.92rem, 1.45vw, 1.05rem);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.theme-toggle:focus-visible,
.qr-link:focus-visible,
.direct-link:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 4px;
}

@media (max-width: 760px) {
  .theme-label { display: none; }
  .site-header { padding: 58px 24px 8px; text-align: center; }
  .jcs-logo { width: 54px; }
  .survey-grid { gap: 14px; padding: 0 16px; }
  .survey-card { padding: 18px 12px 20px; border-radius: 17px; }
  .qr-link { padding: 9px; border-width: 3px; border-radius: 16px; }
  .instruction { min-height: 4.2em; }
}

@media (max-width: 560px) {
  .page-shell { padding: 10px; }
  .survey-page { border-radius: 18px; }
  .site-header { display: block; }
  .jcs-logo { margin-bottom: 10px; }
  .survey-grid { grid-template-columns: 1fr; }
  .instruction { min-height: 0; }
  .qr-link { width: min(82vw, 340px); }
}

/* 10-inch iPad portrait/landscape tuning */
@media (min-width: 768px) and (max-width: 1180px) {
  .page-shell { padding: 20px; }
  .survey-page { width: min(100%, 960px); }
  .site-header { padding-top: 22px; }
  .survey-grid { gap: 20px; }
  .qr-link { width: min(100%, 300px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
