:root {
  --ink: #080a0a;
  --muted: #71767d;
  --paper: #fbfbfa;
  --soft: #f0f1f2;
  --line: #dfe2e5;
  --lime: #b8ff25;
  --lime-soft: #ddffa0;
  --orange: #ff4d16;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font-family: "PingFang SC", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { width: 100%; min-height: 100svh; background: var(--paper); }
.hero { position: relative; overflow: hidden; background: #050806; }
.hero::before { content: ""; position: absolute; inset: -30px; background: url("/assets/hero-banner.png") center / cover no-repeat; filter: blur(24px) brightness(.55); transform: scale(1.08); }
.hero-banner { position: relative; display: block; width: 100%; height: clamp(238px, 66.666vw, 430px); object-fit: contain; }

.sticky-overview { position: sticky; z-index: 30; top: 0; display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 12px; min-height: 82px; padding: 10px max(18px, calc((100% - 760px) / 2)) 12px; color: white; background: radial-gradient(circle at 88% 28%, rgba(52,171,96,.2), transparent 37%), rgba(5,8,6,.98); box-shadow: 0 14px 30px rgba(0,0,0,.18); }
.sticky-overview::after { content: ""; position: absolute; left: max(18px, calc((100% - 760px) / 2)); right: max(18px, calc((100% - 760px) / 2)); bottom: 0; height: 3px; background: linear-gradient(90deg, var(--lime), rgba(184,255,37,0)); transform: scaleX(var(--progress-scale, .025)); transform-origin: left; transition: transform .2s ease; }
.sticky-title { display: block; overflow: hidden; margin-bottom: 5px; color: rgba(255,255,255,.9); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.sticky-progress-line { display: flex; align-items: flex-end; gap: 8px; }
.sticky-progress-line > span:first-child { padding-bottom: 2px; color: rgba(255,255,255,.57); font-size: 11px; }
.sticky-count { color: var(--lime); font-size: 28px; line-height: .94; letter-spacing: -.06em; }
.sticky-dots { display: flex; flex: 1; gap: 4px; align-items: center; padding: 0 0 5px 2px; }
.progress-dot { width: 6px; height: 6px; border-radius: 50%; background: #424443; transition: .18s ease; }
.progress-dot.complete, .progress-dot.current { background: var(--lime); box-shadow: 0 0 10px rgba(184,255,37,.4); }
.sticky-people { position: relative; width: 72px; height: 53px; align-self: center; }
.sticky-people span { position: absolute; top: 4px; width: 44px; height: 44px; border-radius: 50%; background-image: url("/assets/hero-banner.png"); background-repeat: no-repeat; box-shadow: 0 7px 18px rgba(0,0,0,.28); }
.sticky-people span:first-child { left: 0; z-index: 2; background-size: 252px auto; background-position: 54% 30%; }
.sticky-people span:last-child { right: 0; background-size: 235px auto; background-position: 73% 55%; }

.survey { width: min(100%, 760px); margin: 0 auto; padding: 25px 24px 118px; background: var(--paper); }
.field { display: block; margin-bottom: 26px; }
.field-title { display: block; margin-bottom: 9px; font-size: 18px; font-weight: 750; }
.name-input, .open-answer, .editor-input, .editor-textarea, .search-box input, .editor-select { width: 100%; border: 0; outline: 0; color: #151719; background: var(--soft); border-radius: 10px; }
.name-input { height: 54px; padding: 0 16px; font-size: 17px; }
.name-input::placeholder, .open-answer::placeholder { color: #a8adb4; }
.section-title { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; font-size: 27px; line-height: 1; letter-spacing: -.035em; }
.section-title::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 2px; background: var(--orange); transform: skewX(-5deg); }
.question { margin: 0 0 34px; scroll-margin-top: 100px; }
.question-head { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 9px; align-items: center; min-height: 58px; margin-bottom: 10px; }
.question-number { color: #b2fb54; font-size: 51px; font-weight: 900; line-height: 1; letter-spacing: -.08em; }
.question-title { margin: 0; font-size: 16px; line-height: 1.42; overflow-wrap: anywhere; }
.answers { display: grid; gap: 7px; }
.answer { position: relative; display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 13px; align-items: center; min-height: 50px; padding: 10px 15px; background: #eff0f1; border-radius: 9px; font-size: 16px; line-height: 1.45; transition: .15s ease; }
.answer input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.control { position: relative; width: 24px; height: 24px; border-radius: 4px; background: #d4d7dc; }
input[type="radio"] + .control { border-radius: 50%; }
.control::after { content: ""; position: absolute; left: 7px; top: 4px; width: 7px; height: 12px; border: solid white; border-width: 0 3px 3px 0; opacity: 0; transform: rotate(45deg) scale(.7); }
.answer:has(input:checked) { background: var(--lime); box-shadow: 0 10px 24px rgba(153,220,20,.18); }
.answer:has(input:checked) .control { background: #080a0a; }
.answer:has(input:checked) .control::after { opacity: 1; transform: rotate(45deg); }
.open-answer { min-height: 116px; resize: vertical; padding: 14px 16px; font-size: 16px; line-height: 1.55; }
.missing .question-title, .missing .field-title { color: #d94013; }
.name-notice, .history-strip { margin: -14px 0 24px; padding: 13px 15px; border-radius: 10px; font-size: 14px; line-height: 1.55; }
.name-notice { color: #773213; background: #fff0e8; }
.history-strip { color: #23300b; background: #ebffbf; }
.history-strip button { margin-top: 8px; border: 0; padding: 0; color: #2e6500; background: transparent; font-weight: 800; }
.loading-card, .empty-card { padding: 30px 18px; color: var(--muted); text-align: center; background: var(--soft); border-radius: 12px; }

.submit-bar { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; padding: 11px 16px var(--safe-bottom); background: linear-gradient(to top, var(--paper) 70%, rgba(251,251,250,0)); }
.primary-button { border: 0; color: white; background: #090b0a; box-shadow: inset 0 4px 0 var(--lime), 0 14px 28px rgba(6,8,7,.18); font-weight: 800; letter-spacing: .08em; }
.submit-button { display: block; width: 100%; max-width: 728px; height: 60px; margin: 0 auto; border-radius: 14px; font-size: 20px; }
.submit-button:disabled { color: #858985; box-shadow: inset 0 4px 0 #555b55; cursor: not-allowed; }
.full-button { width: 100%; min-height: 52px; border-radius: 12px; }
.secondary-button { min-height: 44px; padding: 0 16px; border: 1px solid #cdd2d6; border-radius: 10px; color: var(--ink); background: white; font-weight: 750; }
.danger-button { min-height: 50px; border: 0; border-radius: 12px; color: #b52c1b; background: #ffe8e3; font-weight: 800; }

.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(92px + var(--safe-bottom)); max-width: calc(100% - 48px); padding: 11px 15px; color: white; background: rgba(9,11,10,.95); border-radius: 9px; box-shadow: 0 12px 30px rgba(0,0,0,.25); font-size: 13px; transform: translate(-50%,18px); opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
.modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: end center; padding-top: 40px; background: rgba(3,5,4,.7); backdrop-filter: blur(12px); }
.modal-card { position: relative; width: min(100%, 560px); max-height: calc(100svh - 40px); overflow: auto; padding: 32px 22px calc(24px + env(safe-area-inset-bottom)); background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: 0 -18px 60px rgba(0,0,0,.32); }
.modal-close { position: absolute; top: 10px; right: 14px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--soft); font-size: 25px; }
.modal-card h2 { margin: 8px 40px 8px 0; font-size: 26px; }
.modal-card > div > p { color: var(--muted); line-height: 1.6; }
.modal-actions { display: grid; gap: 9px; margin-top: 22px; }
.code-card { margin: 18px 0; padding: 17px; text-align: center; background: #ebffbf; border-radius: 12px; }
.code-card strong { display: block; margin-top: 5px; font-size: 32px; letter-spacing: .14em; }
.answer-review { display: grid; gap: 13px; margin-top: 20px; }
.review-item { padding: 15px; background: var(--soft); border-radius: 11px; }
.review-item strong { display: block; margin-bottom: 7px; }
.review-item p { margin: 0; color: #4a4f54; line-height: 1.55; }

.teacher-body { background: #eef0ef; }
.teacher-shell { width: min(100%, 620px); min-height: 100svh; margin: 0 auto; padding-bottom: 94px; background: var(--paper); }
.teacher-header { display: flex; align-items: center; justify-content: space-between; min-height: 116px; padding: calc(24px + env(safe-area-inset-top)) 22px 20px; color: white; background: radial-gradient(circle at 80% 20%, #135c31, transparent 46%), #050806; }
.eyebrow { color: var(--lime); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.teacher-header h1 { margin: 6px 0 0; font-size: 28px; }
.teacher-avatar, .profile-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: #0a1007; background: var(--lime); font-size: 21px; font-weight: 900; }
.login-view { padding: 60px 24px; }
.login-view h2 { margin: 16px 0 6px; text-align: center; font-size: 28px; }
.login-view > p { margin: 0 auto 30px; max-width: 330px; color: var(--muted); text-align: center; line-height: 1.6; }
.login-mark { display: grid; place-items: center; width: 76px; height: 76px; margin: 0 auto; border-radius: 24px; color: #080a0a; background: var(--lime); font-size: 34px; font-weight: 900; transform: rotate(-4deg); }
.teacher-panel { display: none; padding: 26px 20px; }
.teacher-panel.active { display: block; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-title h2 { margin: 5px 0 0; font-size: 25px; }
.response-count { display: grid; place-items: center; min-width: 50px; height: 50px; padding: 0 10px; border-radius: 16px; background: var(--lime); font-size: 24px; }
.search-box { display: grid; grid-template-columns: 24px 1fr; align-items: center; margin-bottom: 18px; padding: 0 13px; background: var(--soft); border-radius: 11px; }
.search-box input { height: 48px; }
.response-list { display: grid; gap: 10px; }
.response-card { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 14px; border: 0; text-align: left; background: var(--soft); border-radius: 12px; }
.student-badge { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: #102000; background: var(--lime-soft); font-size: 20px; font-weight: 900; }
.response-card strong { display: block; margin-bottom: 4px; font-size: 17px; }
.response-card small { color: var(--muted); }
.response-card > span:last-child { color: #6c7379; font-size: 22px; }
.version-chip { padding: 7px 10px; border-radius: 8px; color: #192600; background: var(--lime-soft); font-size: 13px; font-weight: 900; }
.panel-hint { margin: -8px 0 24px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.editor-question { margin-bottom: 13px; padding: 16px; border: 1px solid #e2e4e5; border-radius: 13px; background: white; box-shadow: 0 6px 22px rgba(0,0,0,.04); }
.editor-question-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.editor-index { color: #8dd321; font-size: 25px; font-weight: 900; }
.editor-tools { display: flex; gap: 5px; }
.editor-tools button { width: 34px; height: 34px; border: 0; border-radius: 8px; background: var(--soft); }
.editor-input, .editor-textarea, .editor-select { padding: 12px; border: 1px solid transparent; }
.editor-textarea { min-height: 86px; resize: vertical; margin-top: 9px; line-height: 1.5; }
.editor-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 10px; }
.required-toggle { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.editor-save { margin-top: 10px; }
.profile-card { padding: 34px 20px; text-align: center; background: #070a08; border-radius: 18px; color: white; }
.profile-icon { margin: 0 auto 14px; }
.profile-card h2 { margin: 0 0 6px; }
.profile-card p { margin: 0; color: #aeb4af; }
.simple-card { margin: 16px 0; padding: 18px; background: var(--soft); border-radius: 13px; }
.simple-card p { overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.qr-card { text-align: center; }
.qr-preview { display: grid; place-items: center; width: min(100%, 250px); margin: 16px auto 12px; border-radius: 16px; overflow: hidden; background: #07100a; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.qr-preview img { display: block; width: 100%; height: auto; }
.qr-loading { color: var(--muted); font-size: 13px; }
.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 14px; }
.qr-actions a { display: grid; place-items: center; text-decoration: none; }
.teacher-nav { position: fixed; z-index: 40; left: 50%; bottom: 0; display: grid; grid-template-columns: repeat(3,1fr); width: min(100%,620px); padding: 9px 12px var(--safe-bottom); transform: translateX(-50%); background: rgba(5,8,6,.98); box-shadow: 0 -8px 26px rgba(0,0,0,.16); }
.teacher-nav button { display: grid; gap: 3px; justify-items: center; border: 0; color: #878d88; background: transparent; font-size: 12px; }
.teacher-nav button span { font-size: 20px; }
.teacher-nav button.active { color: var(--lime); }

:focus-visible { outline: 3px solid #178a48; outline-offset: 3px; }
@media (max-width: 360px) { .survey { padding-left: 18px; padding-right: 18px; } .question-head { grid-template-columns: 46px 1fr; } .question-number { font-size: 44px; } .question-title { font-size: 15px; } }
@media (min-width: 900px) { .hero-banner { height: min(42vw, 620px); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
