:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --panel: #fffdf8;
  --ink: #1f2a2e;
  --muted: #647076;
  --line: #ddd6c8;
  --accent: #1d6f78;
  --accent-dark: #134f56;
  --soft: #e7f1ef;
  --danger: #a43d32;
  --success: #236b38;
  --shadow: 0 16px 45px rgba(30, 42, 46, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(29, 111, 120, 0.18), transparent 30rem),
    linear-gradient(135deg, #fbfaf5 0%, var(--bg) 55%, #edf4f2 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  line-height: 1.6;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 128px;
}

.hero {
  margin-bottom: 22px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

h3 {
  margin-bottom: 10px;
  font-size: 15px;
}

.intro {
  max-width: 980px;
  margin: 0 auto;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 19px;
  font-weight: 600;
}

.notice,
.card,
.submit-card {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.notice {
  margin-bottom: 22px;
  padding: 18px 22px;
}

.notice strong,
.notice span {
  display: block;
}

.notice span {
  margin-top: 6px;
  color: var(--danger);
  font-size: 18px;
  font-weight: 900;
}

.notice strong {
  color: var(--danger);
  font-size: 20px;
  font-weight: 900;
}

.notice small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.card {
  margin-bottom: 22px;
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label span,
.score-field legend {
  color: var(--ink);
  font-weight: 700;
}

b {
  color: var(--danger);
}

input[type="text"],
input[type="password"],
textarea {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  outline: none;
}

input[type="text"],
input[type="password"] {
  height: 46px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  padding: 12px 14px;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(29, 111, 120, 0.12);
}

.packet-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.slice-count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  padding: 6px 12px;
  font-weight: 700;
}

.slice-browser {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #fffaf0;
  padding: 16px;
}

.slice-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.layer-status {
  color: var(--accent-dark);
  font-weight: 900;
  text-align: center;
}

.layer-button,
.expand-layer-button {
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent-dark);
  padding: 10px 16px;
}

.expand-layer-button {
  background: var(--accent);
  color: #fff;
}

.layer-button:disabled {
  border-color: var(--line);
  background: #eee9df;
  color: #8b918e;
}

.slice-stack {
  display: block;
  touch-action: pan-y;
}

.slice-row {
  display: none;
  border: 0;
  border-radius: 20px;
  background: transparent;
  padding: 0;
}

.slice-row.is-active,
.slice-browser.is-expanded .slice-row {
  display: block;
}

.slice-browser.is-expanded .slice-row + .slice-row {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.layer-hint {
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.image-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.b-image-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

figure {
  margin: 0;
}

figcaption {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

img {
  display: block;
  width: 100%;
  border: 1px solid #cfc7b8;
  border-radius: 16px;
  background: #111;
  image-rendering: auto;
}

.zoomable-image {
  cursor: zoom-in;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.zoomable-image:hover,
.zoomable-image:focus {
  box-shadow: 0 0 0 4px rgba(29, 111, 120, 0.18);
  transform: translateY(-1px);
  outline: none;
}

.score-panel {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.score-field {
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}

.radio-row,
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.radio-pill {
  cursor: pointer;
}

.radio-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-pill span,
.choice-row label {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 18px;
  font-weight: 700;
}

.radio-pill span {
  min-width: 116px;
}

.radio-pill input:checked + span,
.choice-row label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.choice-row label {
  gap: 8px;
  color: var(--ink);
}

.choice-row input {
  accent-color: var(--accent);
}

.comment-box {
  display: block;
}

.submit-card {
  position: sticky;
  bottom: 88px;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
}

button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 13px 28px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

#submit-button:disabled {
  background: #9aa3a1;
}

#submit-message {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

#submit-message.success {
  color: var(--success);
}

#submit-message.error {
  color: var(--danger);
}

.empty-state code {
  background: #eee7d7;
  border-radius: 8px;
  padding: 2px 6px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(100%, 520px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  padding: 32px;
}

.auth-card h1 {
  font-size: clamp(30px, 7vw, 46px);
}

.auth-card .intro {
  margin-bottom: 20px;
  text-align: left;
}

.auth-card button {
  width: 100%;
  margin-top: 18px;
}

.auth-error {
  border: 1px solid rgba(164, 61, 50, 0.34);
  border-radius: 14px;
  background: rgba(164, 61, 50, 0.08);
  color: var(--danger);
  font-weight: 800;
  padding: 10px 12px;
}

.admin-page {
  padding-bottom: 52px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  padding: 10px 18px;
  text-decoration: none;
}

.admin-link.secondary {
  border: 1px solid var(--accent);
  background: #fff;
  color: var(--accent-dark);
}

.path-note {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 700;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.image-modal.is-open {
  display: flex;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 13, 15, 0.78);
}

.image-modal-content {
  position: relative;
  z-index: 1;
  width: min(94vw, 980px);
  max-height: 94vh;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: #0e1214;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  padding: 18px;
}

.image-modal-content img {
  width: 100%;
  max-height: calc(94vh - 104px);
  object-fit: contain;
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 16px;
}

.image-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.58);
  padding: 8px 14px;
}

#modal-caption {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-weight: 700;
  text-align: center;
}

.progress-dock {
  position: fixed;
  right: 24px;
  bottom: 18px;
  left: 24px;
  z-index: 900;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 18px 45px rgba(30, 42, 46, 0.16);
  padding: 14px 18px;
  backdrop-filter: blur(10px);
}

.progress-copy {
  display: flex;
  gap: 10px;
  align-items: baseline;
  white-space: nowrap;
}

.progress-copy strong {
  color: var(--accent-dark);
}

.progress-copy span {
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ded1;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #61a890);
  transition: width 0.24s ease;
}

@media (max-width: 780px) {
  .page {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
    padding-bottom: 150px;
  }

  .form-grid,
  .image-pair {
    grid-template-columns: 1fr;
  }

  .b-image-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(30px, 9vw, 42px);
  }

  .intro {
    font-size: 17px;
    text-align: left;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .packet-head,
  .submit-card {
    display: block;
  }

  .slice-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .layer-status,
  .expand-layer-button {
    grid-column: 1 / -1;
  }

  .layer-button,
  .expand-layer-button {
    width: 100%;
  }

  .slice-count {
    display: inline-block;
    margin-top: 8px;
  }

  .submit-card {
    position: static;
  }

  button {
    width: 100%;
  }

  #submit-message {
    margin-top: 12px;
  }

  .radio-pill span {
    min-width: 136px;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .image-modal {
    padding: 10px;
  }

  .image-modal-content {
    width: 100%;
    padding: 12px;
  }

  .progress-dock {
    right: 10px;
    bottom: 10px;
    left: 10px;
    grid-template-columns: 1fr;
    gap: 8px;
    border-radius: 20px;
  }

  .progress-copy {
    justify-content: space-between;
  }
}

@media (min-width: 781px) and (max-width: 1080px) {
  .b-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
