:root {
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e3e8ee;
  --bg: #f4f6f9;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #c0392b;
}

* {
  box-sizing: border-box;
}

/* The author rules below set display on .picked and .lightbox, which beats the
   browser's own [hidden] rule and would leave them on screen from page load. */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  padding: 0 20px 60px;
}

.page-head {
  max-width: 1080px;
  margin: 0 auto;
  padding: 36px 0 20px;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: .2px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

main {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 20px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.step {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.timing {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.drop {
  border: 1.5px dashed #c7d0da;
  border-radius: 12px;
  background: #fafbfd;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.drop:hover,
.drop:focus-visible,
.drop.over {
  border-color: var(--accent);
  background: #f2f6ff;
  outline: none;
}

.drop-icon {
  width: 32px;
  height: 32px;
  color: #9aa7b4;
}

.drop-main {
  margin: 10px 0 4px;
  font-size: 15px;
}

.drop-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.drop-sub + .drop-sub {
  margin-top: 4px;
}

.picked {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.picked img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1f5;
  flex: none;
}

.picked-info {
  min-width: 0;
}

.picked-name {
  margin: 0 0 4px;
  font-weight: 600;
  word-break: break-all;
}

.picked-meta {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

button {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d3dae2;
  border-radius: 9px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}

button:hover:not(:disabled) {
  border-color: #b9c3ce;
  background: #f7f9fb;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

button.link {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.link:hover:not(:disabled) {
  background: none;
  color: var(--accent-dark);
}

.actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.actions .primary {
  padding: 10px 26px;
  font-size: 15px;
}

.status {
  margin: 14px 0 0;
  font-size: 14px;
}

.status.working {
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.working::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid #c3cbd6;
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -1px;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.result-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.viewer {
  position: relative;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
  overflow: hidden;
  max-height: 70vh;
  display: grid;
  place-items: center;
  padding: 10px;
}

.viewer img {
  max-width: 100%;
  max-height: calc(70vh - 20px);
  display: block;
}

.viewer-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(31, 41, 51, .78);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
}

.finish {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(23, 30, 37, .94);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.lightbox-title {
  font-weight: 600;
}

.lightbox-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-tools button {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .22);
  color: #fff;
}

.lightbox-tools button:hover:not(:disabled) {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .4);
}

.lightbox-tools button.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.zoom-level {
  min-width: 56px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #d6dde5;
}

.lightbox-stage {
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.lightbox-stage.dragging {
  cursor: grabbing;
}

.lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  will-change: transform;
  background: #fff;
  user-select: none;
}

.lightbox-hint {
  margin: 0;
  padding: 10px 16px 16px;
  text-align: center;
  color: #9fabb8;
  font-size: 12.5px;
}

.page-foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 4px 4px 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.page-foot p {
  margin: 0;
}

.page-foot a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.doc h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.doc ul {
  margin: 0;
  padding-left: 20px;
}

.doc li {
  margin-bottom: 8px;
}

.doc p {
  margin: 0;
}

.doc .doc-foot {
  padding: 4px 4px 0;
  font-size: 13px;
}

.doc .doc-foot a {
  color: var(--accent);
  text-underline-offset: 3px;
}

@media (max-width: 620px) {
  .toolbar-right {
    margin-left: 0;
    width: 100%;
  }

  .toolbar-right button {
    flex: 1;
  }

  .card {
    padding: 18px 16px;
  }
}
