:root {
  --primary: #b02a37;
  --primary-dark: #8a1f2a;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e3e6ea;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #dcecfb 0%, #eef6fd 35%, #f2f8fc 70%, #eaf2f9 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(135deg, #7d1826 0%, #b02a37 55%, #c23a45 100%);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.topbar-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px 10px;
  position: relative;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.title-block { display: flex; align-items: center; gap: 14px; margin-left: 4px; }
.logo { height: 44px; width: auto; background: #fff; border-radius: 6px; padding: 3px 6px; }
.topbar h1 { margin: 0; font-size: 1.25rem; }
.subtitle { margin: 0; font-size: 0.85rem; opacity: 0.9; }

.meta { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.brand-col {
  position: relative;
  display: flex;
  align-items: center;
}
.brand-col .logo { height: 38px; }
.prof-block {
  position: absolute;
  left: 0;
  top: calc(100% + 22px);
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 10px;
  border-left: 2px solid #ffd166;
  white-space: nowrap;
}
.prof-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.85; }
.prof-static { font-size: 1.02rem; font-weight: 700; }
.student-label { font-size: 0.85rem; display: flex; flex-direction: column; gap: 3px; opacity: 0.95; }
.student-label input:disabled { background: #e9eaec; color: #555; cursor: not-allowed; }

.q-reminder {
  margin: 4px 0 12px;
  padding: 8px 12px;
  background: #fff8e6;
  border-left: 4px solid #f0b429;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #92400e;
}
.student-label input {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.97);
  font: inherit;
  font-size: 0.85rem;
  color: var(--text);
  min-width: 190px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.student-label input:focus { outline: 2px solid #ffd166; outline-offset: 1px; }

.progress-track { height: 6px; background: rgba(255, 255, 255, 0.25); }
.progress-bar { height: 100%; width: 0%; background: #ffd166; transition: width 0.3s ease; }

main { max-width: 860px; margin: 20px auto 40px; padding: 0 16px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.card h3 { margin: 16px 0 4px; font-size: 1rem; }
.card h3:first-child { margin-top: 0; }

.task-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.task-head h2 { margin: 0 0 6px; font-size: 1.15rem; }
.pts { color: var(--primary); font-weight: 700; white-space: nowrap; }
.task-progress { color: var(--muted); font-size: 0.85rem; }

.task-intro { margin: 6px 0 12px; color: var(--muted); font-size: 0.95rem; }

.steps { padding-left: 24px; margin: 8px 0; }
.steps > li { margin: 8px 0; }
.steps label { cursor: pointer; }

.step-check { margin-right: 8px; transform: scale(1.15); accent-color: var(--primary); }

.values { border-collapse: collapse; margin: 8px 0 4px; font-size: 0.92rem; }
.values th, .values td { border: 1px solid var(--border); padding: 5px 10px; text-align: left; }
.values th { background: #fafbfc; }
.values code, code { background: #f0f1f3; padding: 1px 5px; border-radius: 4px; font-size: 0.88em; }

.query {
  background: #f0f1f3;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0 4px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
}

.hint {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff8e6;
  border-left: 4px solid #f0b429;
  border-radius: 6px;
  font-size: 0.88rem;
}

.shot {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px 2px 6px;
  background: #e8f0fe;
  color: #1a56db;
  border: 1px dashed #1a56db;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  vertical-align: middle;
  white-space: normal;
  text-align: left;
  line-height: 1.4;
  max-width: 100%;
}
.shot-icon { height: 14px; width: auto; vertical-align: -2px; margin-right: 3px; }

.shot-block {
  margin: 10px 0 4px 28px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.shot-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.shot-thumb {
  max-width: 220px;
  max-height: 90px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
}
.shot-caption {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.85rem;
}

.shot-scan { margin-top: 6px; font-size: 0.82rem; padding: 6px 10px; border-radius: 6px; }
.shot-scan.scanning { background: #eef3fb; color: #1a56db; display: flex; align-items: center; gap: 8px; }
.shot-scan.pass { background: #e6f4ea; color: #1a7f37; }
.shot-scan.warn { background: #fff8e6; color: #92400e; }
.scan-spin {
  width: 12px; height: 12px; flex: none;
  border: 2px solid #1a56db; border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scan-note { margin: 4px 0 0; font-size: 0.82rem; }
.scan-note.pass { color: #1a7f37; }
.scan-note.warn { color: #92400e; }

.name-warn { font-weight: 700; color: #b02a37; }

.print-footer { display: none; }

.sub-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  break-inside: avoid;
}
.sub-item img { max-width: 100%; border: 1px solid var(--border); border-radius: 6px; display: block; margin: 6px 0; }
.sub-item p { margin: 4px 0 0; font-size: 0.9rem; }
.sub-item.answer-item p { white-space: pre-wrap; }
.sub-item.missing { background: #fff8f8; color: #b02a37; font-size: 0.88rem; }
.sub-task-group { margin: 14px 0; }
.sub-task-title { display: block; font-size: 0.95rem; margin-bottom: 6px; }

.muted { color: var(--muted); }
.print-only { display: none; }
.submission-head { border-bottom: 2px solid var(--text); margin-bottom: 12px; padding-bottom: 8px; }
.submission-head h1 { font-size: 1.3rem; margin: 0 0 4px; }
.submission-head p { font-size: 1.15rem; font-weight: 700; margin: 0; }
.submission-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.submission-head-row p { margin: 0; }
.head-right { margin-left: auto; font-size: 1.15rem; font-weight: 700; }
.prof-blank { display: inline-block; min-width: 220px; border-bottom: 1px solid #000; }


.answer { width: 100%; margin-top: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 0.9rem; }


.objectives { margin: 8px 0 4px; padding-left: 22px; }
.objectives li { margin: 5px 0; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; border: 1px solid var(--border); border-radius: 8px; display: block; }
.gallery figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 4px; text-align: center; }

.arch { width: 100%; max-width: 700px; display: block; margin: 10px auto 0; border: 1px solid var(--border); border-radius: 8px; }

.btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: #f0f1f3; }
.btn-danger { color: #b02a37; border-color: #b02a37; }
.btn-danger:hover { background: #fdecea; }

.btn-disabled { opacity: 0.45; cursor: not-allowed; }
.btn-disabled.btn:hover { background: var(--primary); }
.btn-disabled.btn-outline:hover { background: transparent; }

.export-hint {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fdecea;
  border: 1px solid #f5c6cb;
  color: #b02a37;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
}

.field-missing { border-color: #b02a37 !important; box-shadow: 0 0 0 2px rgba(176, 42, 55, 0.25); }

.results-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.cleanup p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.note ul { margin: 6px 0 0; padding-left: 20px; }
.note li { margin: 4px 0; }

footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 20px; }

@media print {
  .topbar, .meta, .results-actions, .btn, footer, .progress-track, .shot-block { display: none !important; }
  .card[data-task], #submit-panel, .gallery, .arch { display: none !important; }
  #submission-preview .task-head, #submission-preview .task-intro { display: none !important; }
  #submission-preview { border: none; padding: 0; }
  .sub-item { margin: 16px 0; }
  .sub-item > strong { font-size: 0.95rem; }
  .sub-item img { max-height: 9in; width: auto; }
  .print-only { display: block; }
  .print-hide { display: none !important; }
  .print-footer {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9px;
    color: #555;
    padding: 4px 0;
    border-top: 1px solid #ccc;
    background: #fff;
  }
  body { background: #fff; }
  .card { break-inside: avoid; border: 1px solid #ccc; }
  .steps label { cursor: default; }
}

.cmd { background: #f0f1f3; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; margin: 6px 0; overflow-x: auto; }
