:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #1b2a41;
  --muted: #6c7b93;
  --line: #e3e9f2;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #16a34a;
  --shadow: 0 8px 28px rgba(31, 63, 112, .08);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex: 0 0 232px;
  background: linear-gradient(180deg, #123c73 0%, #0e2d57 100%);
  color: #dce9ff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  display: grid; place-items: center; font-size: 18px; font-weight: 700; color: #fff;
  box-shadow: 0 6px 14px rgba(37,99,235,.45);
}
.brand-title { font-weight: 700; font-size: 15px; color: #fff; }
.brand-sub { font-size: 12px; color: #9fc2f5; margin-top: 2px; }
.tree { margin-top: 22px; flex: 1; }
.tree-caption { font-size: 12px; color: #8fb0df; padding: 0 8px 8px; letter-spacing: 1px; }
.tree-group-title { padding: 8px 10px; font-size: 13px; color: #cfe0fa; }
.caret { display: inline-block; margin-right: 4px; }
.tree-item {
  margin: 2px 0 2px 18px; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; color: #bdd2f0; cursor: default;
}
.tree-item.active { background: rgba(96,165,250,.18); color: #fff; border-left: 3px solid #60a5fa; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #a9c6ee; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.12); }
.status-dot { width: 8px; height: 8px; background: #4ade80; border-radius: 50%; box-shadow: 0 0 0 3px rgba(74,222,128,.15); }
.sidebar-foot small { margin-left: auto; opacity: .7; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 18px 28px; display: flex; align-items: center; justify-content: space-between;
}
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.top-badges { display: flex; gap: 8px; }
.badge { padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-green { background: #e8f8ef; color: #15803d; }
.badge-blue { background: var(--blue-soft); color: var(--blue-dark); }
.content { padding: 22px 28px 40px; max-width: 1320px; margin: 0 auto; }

.notice {
  display: flex; gap: 14px; background: #fffaf0; border: 1px solid #f4dfb6;
  border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.notice-icon {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: #f59e0b; color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.notice-title { font-weight: 700; color: #92400e; margin-bottom: 4px; }
.notice-text { color: #6b4f1d; line-height: 1.7; }
.notice-rules { color: #7a5a22; margin-top: 6px; line-height: 1.7; }
.agree-line { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; cursor: pointer; font-weight: 600; color: #7c4a0b; }

.card-requirements { padding: 16px 20px; margin-bottom: 18px; }
.req-step { width: auto; padding: 0 8px; font-size: 12px; }
.require-list { margin: 0; padding-left: 22px; color: #334155; line-height: 1.9; }
.require-list li { padding-left: 2px; }
.require-list li::marker { color: var(--blue); font-weight: 700; }

.grid { display: grid; grid-template-columns: 340px 1fr; gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; }
.step { width: 24px; height: 24px; border-radius: 7px; background: var(--blue-soft); color: var(--blue-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.dropzone {
  border: 2px dashed #c5d4ea; border-radius: 12px; padding: 30px 16px; text-align: center;
  background: #fafcff; cursor: pointer; transition: .2s;
}
.dropzone:hover, .dropzone.over { border-color: var(--blue); background: #f0f6ff; }
.drop-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 24px; margin: 0 auto 10px; }
.drop-title { font-weight: 600; }
.drop-sub { color: var(--muted); font-size: 12px; margin-top: 6px; }
.file-line { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 13px; }
.file-name { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { border: 0; background: none; color: var(--blue); cursor: pointer; font-size: 13px; }
.preview-thumb { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-height: 260px; display: grid; place-items: center; background: #f8fafc; }
.preview-thumb img { max-width: 100%; max-height: 260px; display: block; }

.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.field.small { grid-column: span 1; }
.field select, .field input {
  width: 100%; height: 36px; border: 1px solid #d8e1ee; border-radius: 8px;
  padding: 0 10px; font-size: 13px; color: var(--ink); background: #fff; outline: none;
}
.field select:focus, .field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.format-save { display: flex; gap: 8px; margin: 16px 0 12px; }
.format-save input { flex: 1; height: 34px; border: 1px solid #d8e1ee; border-radius: 8px; padding: 0 10px; font-size: 13px; }
.btn {
  border: 0; border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { background: #a9bdda; cursor: not-allowed; }
.btn-ghost { background: var(--blue-soft); color: var(--blue-dark); }
.btn-ghost:hover { background: #dbe8ff; }
.btn-block { width: 100%; margin-top: 4px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 7px; }
.hint.saved-size { color: #0b7a4b; font-weight: 600; }

.preview-tools { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.tool { border: 1px solid #d8e1ee; background: #fff; color: var(--muted); border-radius: 7px; padding: 6px 10px; font-size: 12px; cursor: pointer; }
.tool:hover { border-color: var(--blue); color: var(--blue); }
.tool.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.preview-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.canvas-wrap { display: flex; flex-direction: column; align-items: center; }
.canvas-frame {
  position: relative; border: 1px solid #c9d6e8; border-radius: 10px; overflow: hidden;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #ffffff 0% 50%) 50% / 18px 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.canvas-frame canvas { display: block; width: 358px; height: 441px; max-width: 100%; touch-action: none; }
.canvas-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #94a3b8; font-size: 13px; pointer-events: none; }
.brush-cursor {
  position: absolute; left: 0; top: 0; border-radius: 50%;
  border: 2px dashed rgba(37, 99, 235, .95);
  background: rgba(37, 99, 235, .08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .85) inset;
  transform: translate(-50%, -50%); pointer-events: none; z-index: 5;
}
.canvas-tip { color: var(--muted); font-size: 12px; margin-top: 10px; }
.adjust-panel { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.adjust-title { font-weight: 700; margin-bottom: 14px; }
.slider-line { display: grid; grid-template-columns: 68px 1fr 36px; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 12px; color: var(--muted); }
.slider-line input { width: 100%; accent-color: var(--blue); }
.slider-line output { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.adjust-note { font-size: 12px; color: var(--blue-dark); background: var(--blue-soft); border-radius: 7px; padding: 8px 10px; margin: 6px 0 16px; }

.result-body { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.result-body img { width: 200px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.result-meta { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; width: min(100%, 380px); }
.student-info { margin: 14px 0; padding-top: 12px; border-top: 1px dashed var(--line); }
.student-title { font-size: 13px; font-weight: 700; color: var(--blue-dark); margin-bottom: 8px; }
.name-fields { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px; width: 100%; }
.name-fields .field input { width: 100%; }
.file-name-hint { word-break: break-all; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: #1e293b; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1000px) {
  .grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-layout { grid-template-columns: 1fr; }
  .adjust-panel { width: 100%; }
}
@media (max-width: 640px) {
  .sidebar { display: none; }
  .topbar { padding: 14px 16px; }
  .content { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .top-badges { display: none; }
}

body.consent-open { overflow: hidden; }
.consent-mask {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: rgba(9, 24, 48, .72); padding: 20px;
}
.consent-card {
  width: min(100%, 680px); max-height: 90vh; overflow: auto;
  background: #fff; border-radius: 14px; padding: 24px; box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.consent-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.consent-head h2 { margin: 0; font-size: 20px; }
.consent-countdown { color: var(--muted); font-size: 12px; white-space: nowrap; }
.consent-section { padding: 12px 0; border-top: 1px solid var(--line); }
.consent-section h3 { margin: 0 0 8px; font-size: 14px; color: var(--blue-dark); }
.consent-section p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.consent-section ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.advanced-panel { margin: 16px 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.advanced-panel > summary { cursor: pointer; padding: 14px 18px; font-weight: 600; color: var(--blue-dark); list-style: none; }
.advanced-panel > summary::-webkit-details-marker { display: none; }
.advanced-panel > summary::before { content: '▸ '; }
.advanced-panel[open] > summary::before { content: '▾ '; }
.advanced-panel > .grid, .advanced-panel > .card-preview { padding: 0 18px 18px; }
.processing-mask {
  position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
  background: rgba(9, 24, 45, .58); backdrop-filter: blur(3px);
}
.processing-card {
  width: min(88vw, 320px); padding: 28px 24px; border-radius: 16px;
  background: #fff; box-shadow: 0 24px 60px rgba(0,0,0,.28);
  text-align: center;
}
.processing-spinner {
  width: 46px; height: 46px; margin: 0 auto 16px;
  border: 4px solid var(--blue-soft); border-top-color: var(--blue);
  border-radius: 50%; animation: processing-spin .8s linear infinite;
}
@keyframes processing-spin { to { transform: rotate(360deg); } }
.processing-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.processing-sub { margin-top: 8px; font-size: 12px; color: var(--muted); }
