:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #e5eaf1;
  --primary: #335cff;
  --primary-dark: #2448db;
  --success: #14804a;
  --danger: #c43232;
  --warning: #8a5a00;
  --shadow: 0 18px 48px rgba(33, 48, 82, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(51, 92, 255, .10), transparent 32%),
    radial-gradient(circle at 90% 10%, rgba(30, 181, 160, .08), transparent 28%),
    var(--bg);
  font-family: Inter, "PingFang SC", "Noto Sans SC", "Microsoft YaHei UI", system-ui, -apple-system, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; user-select: none; cursor: pointer; }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, #3157f4, #5b7bff); box-shadow: 0 8px 22px rgba(51, 92, 255, .28); font-size: 23px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .02em; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.status-dot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.status-dot span { width: 8px; height: 8px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 4px rgba(34,160,107,.12); }
.main { flex: 1; padding: 28px 0 48px; }
footer { min-height: 62px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-top: 1px solid rgba(207,216,229,.75); color: var(--muted); font-size: 12px; }

.card { background: rgba(255,255,255,.94); border: 1px solid rgba(226,232,240,.92); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(22px, 4vw, 36px); }
.intro-card { max-width: 1060px; margin: 0 auto; padding: clamp(28px, 5vw, 58px); }
.intro-heading { max-width: 880px; }
.eyebrow { display: inline-flex; align-items: center; width: max-content; color: var(--primary); background: rgba(51,92,255,.08); border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 800; letter-spacing: .05em; }
h1 { margin: 20px 0 14px; font-size: clamp(32px, 5vw, 54px); line-height: 1.12; letter-spacing: -.035em; }
.lead { margin: 0; color: var(--muted); font-size: 17px; line-height: 1.8; }
.intro-copy { margin-top: 28px; color: #3b465c; line-height: 1.9; }
.intro-copy p { margin: 0 0 14px; }
.definition-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 24px 0; }
.definition-card { display: flex; flex-direction: column; gap: 9px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.definition-card strong { color: var(--primary); }
.definition-card span { color: var(--muted); font-size: 13px; line-height: 1.7; }
.notice-box { margin-top: 24px; padding: 22px 24px; border-radius: 15px; background: #f5f8ff; border: 1px solid #dbe4ff; }
.notice-box h3 { margin: 0 0 12px; font-size: 18px; }
.notice-box ol { margin: 0; padding-left: 22px; color: #3d4960; line-height: 1.85; }
.notice-box li + li { margin-top: 7px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

.btn { border: 0; border-radius: 12px; min-height: 46px; padding: 0 18px; font-weight: 750; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.btn-primary { color: white; background: var(--primary); box-shadow: 0 8px 18px rgba(51,92,255,.22); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { color: var(--text); background: white; border: 1px solid var(--line); }
.btn-small { min-height: 36px; padding: 0 12px; border-radius: 9px; font-size: 13px; }
.link-btn { border: 0; background: transparent; color: var(--primary); padding: 8px 0; }
.download-btn { display: inline-grid; place-items: center; text-decoration: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.page-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 14px; font-weight: 700; }
.required::after { content: " *"; color: var(--danger); }
input, select, textarea { width: 100%; border: 1px solid #d7deea; border-radius: 11px; background: white; color: var(--text); padding: 12px 13px; outline: none; transition: border .15s ease, box-shadow .15s ease; }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(51,92,255,.10); }
.hidden { display: none !important; }
.other-field { margin-top: 2px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--line); }
.check-row input { width: 18px; flex: 0 0 auto; margin-top: 2px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.check-option { position: relative; display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 11px; border: 1px solid #d9e0eb; border-radius: 10px; background: white; color: #43506a; cursor: pointer; font-weight: 600; }
.check-option input { width: 17px; height: 17px; flex: 0 0 auto; }
.check-option:has(input:checked) { border-color: var(--primary); color: var(--primary); background: rgba(51,92,255,.07); box-shadow: inset 0 0 0 1px var(--primary); }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

.progress-wrap { margin-bottom: 18px; }
.progress-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; color: var(--muted); font-size: 13px; }
.progress { height: 9px; overflow: hidden; border-radius: 999px; background: #e9edf5; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #6f87ff); transition: width .25s ease; }
.experiment-grid { display: grid; grid-template-columns: .68fr 1.32fr; gap: 22px; align-items: start; }
.music-card { position: sticky; top: 18px; }
.music-number { display: inline-flex; align-items: center; padding: 7px 11px; border-radius: 999px; color: var(--primary); background: rgba(51,92,255,.08); font-size: 13px; font-weight: 800; }
.music-card h2 { font-size: 34px; margin: 20px 0 8px; }
.music-card p { color: var(--muted); line-height: 1.75; }
audio { width: 100%; margin-top: 18px; }
.listen-state { margin-top: 14px; padding: 12px 13px; border-radius: 11px; color: var(--warning); background: #fff8e8; border: 1px solid #f4dfab; font-size: 13px; line-height: 1.6; }
.listen-state.done { color: var(--success); background: #ebf8f1; border-color: #bfe8d1; }
.missing-audio { color: var(--danger); background: #fff0f0; border-color: #f3c6c6; }
.mini-note { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.question-card { padding: 24px; background: white; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.question-title { font-weight: 800; line-height: 1.55; margin-bottom: 8px; }
.question-subtitle { color: var(--muted); font-size: 12px; line-height: 1.65; margin-bottom: 14px; }
.options { display: grid; gap: 9px; }
.category-options { grid-template-columns: repeat(4, minmax(0,1fr)); }
.four-options { grid-template-columns: repeat(2, minmax(0,1fr)); }
.handling-options { grid-template-columns: repeat(2, minmax(0,1fr)); }
.option { position: relative; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option label { min-height: 44px; border: 1px solid #d9e0eb; border-radius: 10px; display: grid; place-items: center; text-align: center; padding: 9px; color: #43506a; background: white; cursor: pointer; font-weight: 600; line-height: 1.45; }
.option input:checked + label { border-color: var(--primary); color: var(--primary); background: rgba(51,92,255,.08); box-shadow: inset 0 0 0 1px var(--primary); }
.scale { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 7px; }
.emotion-matrix { display: flex; flex-direction: column; gap: 13px; }
.matrix-row { display: grid; grid-template-columns: minmax(190px, .65fr) 1fr; gap: 16px; align-items: center; padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.matrix-label { display: flex; flex-direction: column; gap: 5px; }
.matrix-label span { color: var(--muted); font-size: 11px; line-height: 1.5; }
.questionnaire.locked { filter: grayscale(.18); }
.questionnaire.locked .option label { cursor: not-allowed; opacity: .58; }
.requires-answer { border-color: #f1c58b; background: #fffdf8; }

.admin-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.summary-card { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.summary-card strong { font-size: 28px; display: block; }
.summary-card span { color: var(--muted); font-size: 12px; }
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.bulk-upload { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.track-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f8fafc; color: var(--muted); font-size: 12px; font-weight: 800; position: sticky; top: 0; }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.track-title-input { min-width: 290px; padding: 9px 10px; }
.track-dimension { min-width: 110px; padding: 9px 10px; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 9px; font-size: 11px; font-weight: 800; }
.badge-ok { color: var(--success); background: #eaf7f0; }
.badge-no { color: var(--danger); background: #fff0f0; }
.data-path { margin-top: 14px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.complete { max-width: 680px; margin: 60px auto 0; text-align: center; }
.complete-icon { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 22px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, #19a66a, #35c487); font-size: 34px; box-shadow: 0 14px 30px rgba(25,166,106,.24); }
.complete h2 { font-size: 34px; margin: 0 0 12px; }
.complete p { color: var(--muted); line-height: 1.8; }
.complete-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 30; color: white; background: rgba(23,32,51,.94); border-radius: 11px; padding: 12px 16px; box-shadow: 0 12px 36px rgba(0,0,0,.2); transition: .2s ease; font-size: 13px; max-width: min(560px, calc(100% - 30px)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

@media (max-width: 960px) {
  .experiment-grid { grid-template-columns: 1fr; }
  .music-card { position: static; }
  .definition-grid { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1180px); }
  .topbar { height: 70px; }
  .status-dot { display: none; }
  .main { padding-top: 18px; }
  .intro-card { padding: 28px 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .checkbox-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .category-options, .four-options, .handling-options { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .matrix-row { grid-template-columns: 1fr; }
  .scale { grid-template-columns: repeat(7, minmax(38px,1fr)); overflow-x: auto; padding-bottom: 5px; }
  .admin-summary { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
  footer { align-items: flex-start; flex-direction: column; padding: 18px 0; }
}
@media (max-width: 440px) {
  .checkbox-grid, .category-options, .four-options, .handling-options { grid-template-columns: 1fr; }
}

.brand-mark img { display: block; width: 100%; height: 100%; border-radius: inherit; }
.header-action { display: inline-flex; align-items: center; gap: 7px; flex-shrink: 0; min-height: 38px; padding: 0 13px; border: 1px solid rgba(207,216,229,.85); border-radius: 999px; background: rgba(255,255,255,.65); color: var(--muted); font-size: 12px; transition: background .15s, color .15s; }
.header-action[hidden] { display: none; }
.header-action span { font-size: 19px; line-height: 1; }
.header-action:hover { color: var(--text); background: white; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.browser-note { margin: 24px 0 6px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.recovery-details { margin-top: 8px; }
.recovery-details summary { width: fit-content; padding: 8px 0; color: var(--primary); font-size: 13px; cursor: pointer; }
.recovery-details[open] summary { margin-bottom: 10px; }
.recovery-details .field { max-width: 480px; }
.recovery-details .hint { margin: 0; }

.auth-page { min-height: calc(100svh - 210px); display: grid; place-items: center; padding: 20px 0 46px; }
.auth-card { width: min(100%, 430px); padding: 38px; }
.auth-icon { display: block; margin-bottom: 24px; border-radius: 16px; box-shadow: 0 8px 22px rgba(51,92,255,.16); }
.auth-eyebrow { display: block; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .08em; }
.auth-card h1 { margin: 10px 0 12px; font-size: 28px; line-height: 1.35; letter-spacing: -.03em; }
.auth-description { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.auth-card form { margin-top: 28px; }
.auth-card input { min-height: 48px; }
.auth-submit { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 49px; margin-top: 20px; font-size: 14px; }
.auth-submit span { font-size: 21px; font-weight: 400; }
.back-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; transition: color .15s; }
.back-link:hover { color: var(--primary); }
.auth-card .back-link { justify-content: center; width: 100%; margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .topbar { gap: 12px; }
  .brand-mark { flex-shrink: 0; }
  .brand strong { font-size: 15px; }
  .brand span { font-size: 11px; }
  .auth-page { min-height: calc(100svh - 160px); padding: 12px 6px 24px; }
  .auth-card { padding: 30px 26px; }
  .auth-card h1 { font-size: 26px; }
}

