:root {
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172236; background: #f5f7fa;
  --text: #172236; --muted: #5e6c80; --border: #dbe3ee;
  --primary: #244bcc; --primary-dark: #1939a3; --tint: #eff4ff;
  --radius: 20px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
button, input, textarea, select { font: inherit; }
button, .primary, .secondary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, a[download] { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
button, .primary, .secondary, .plain {
  min-height: 43px; padding: 9px 15px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 650; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; text-decoration: none; line-height: 1.25;
}
.primary { color: white; background: var(--primary); }
.primary:hover:not(:disabled) { background: var(--primary-dark); }
.secondary { color: #214083; background: white; border-color: #cdd9ee; }
.secondary:hover:not(:disabled), .plain:hover:not(:disabled) { background: var(--tint); }
.plain { color: #354d76; background: transparent; }
.small { min-height: 38px; padding: 7px 11px; font-size: 13px; }
.icon { padding-inline: 10px; min-width: 40px; font-size: 21px; }
:focus-visible { outline: 3px solid #819bff; outline-offset: 3px; }
.shell { max-width: 1232px; margin-inline: auto; padding-inline: 32px; }
.masthead { border-bottom: 1px solid #e3e9f1; background: #fff; }
.topline { min-height: 69px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--text); font-weight: 750; text-decoration: none; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); position: relative; }
.logo i { width: 7px; height: 7px; border: 2px solid white; position: absolute; }
.logo i:nth-child(1) { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.logo i:nth-child(2) { top: 7px; right: 7px; border-left: 0; border-bottom: 0; }
.logo i:nth-child(3) { bottom: 7px; left: 7px; border-right: 0; border-top: 0; }
.logo i:nth-child(4) { bottom: 7px; right: 7px; border-left: 0; border-top: 0; }
.logo b { position: absolute; height: 2px; width: 10px; background: #b5e4fd; top: 15px; left: 11px; }
.intro { padding: 46px 0 28px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(32px, 5vw, 54px); letter-spacing: -.055em; line-height: 1.14; }
h1 span { color: var(--primary); margin-left: 4px; }
.intro p { color: var(--muted); font-size: 16px; margin-top: 12px; line-height: 1.6; }
.workspace { display: grid; grid-template-columns: 355px minmax(0, 1fr); gap: 22px; padding-bottom: 48px; align-items: start; }
.panel { background: white; border: 1px solid #e0e7f0; border-radius: var(--radius); padding: 22px; box-shadow: 0 12px 24px #20385907; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 11px; margin-bottom: 18px; }
h2 { font-size: 21px; letter-spacing: -.025em; line-height: 1.3; }
.panel-heading p { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.drop {
  min-height: 172px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; border: 1.5px dashed #9baee4; border-radius: 15px; background: #f6f8ff;
  padding: 14px 8px; text-align: center;
}
.drop.dragging { background: #e6edff; border-color: var(--primary); }
.drop strong { font-size: 14px; }
.upload-icon {
  display: grid; place-items: center; width: 36px; height: 36px;
  font-size: 24px; background: #e5ecff; color: #284dc3; border-radius: 11px; margin-bottom: 3px;
}
.formats, .privacy { color: var(--muted); font-size: 12px; line-height: 1.55; }
.upload-buttons { display: flex; gap: 4px; margin-top: 3px; }
.upload-buttons button { min-height: 36px; }
.sources { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.source {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center;
  background: #f6f8fc; padding: 5px 7px; border-radius: 9px;
}
.source img { width: 34px; height: 36px; border-radius: 6px; object-fit: cover; background: white; }
.source span { font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.source button { min-width: 34px; min-height: 33px; padding: 4px; }
label { font-size: 13px; font-weight: 700; }
.intake > label { display: block; margin: 19px 0 8px; }
label span { color: var(--muted); font-weight: 400; margin-left: 6px; }
textarea, input:not([type=file]):not([type=checkbox]), select {
  border: 1px solid var(--border); border-radius: 10px; min-height: 42px; padding: 9px 11px;
  background: #fafbfe; color: var(--text); font-size: 14px;
}
textarea { width: 100%; resize: vertical; display: block; }
.start { width: 100%; margin-top: 14px; justify-content: space-between; }
.start span { font-size: 19px; }
.privacy { margin-top: 12px; }
progress { display: block; width: 100%; accent-color: var(--primary); margin-top: 10px; }
.status { min-height: 0; margin-top: 8px; font-size: 13px; line-height: 1.5; color: #354d76; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status.error { color: #9f3042; }
.result-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-bottom: 14px; }
.result-controls select { min-height: 38px; max-width: 100%; padding-block: 5px; }
.empty {
  display: grid; justify-items: center; align-content: center; gap: 10px; min-height: 350px;
  text-align: center; border: 1px solid #e6ebf6; border-radius: 15px; padding: 20px;
  background: radial-gradient(#d8e1f3 1px, transparent 1px) 0 0 / 17px 17px, #f8faff;
}
.empty p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.paper-art {
  border: 1px solid #cbd8f9; box-shadow: 0 10px 23px #1c408b16;
  width: 65px; height: 80px; border-radius: 10px; background: white;
  transform: rotate(-8deg); display: grid; align-content: center; gap: 7px; padding: 14px; margin-bottom: 11px;
}
.paper-art span { height: 2px; border-radius: 1px; background: #b8c9ec; }
.paper-art span:first-child { width: 50%; background: #4665ce; }
.paper-art span:last-child { width: 74%; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { border: 1px solid #e0e7f1; border-radius: 13px; padding: 9px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 7px; min-height: 29px; font-size: 13px; }
.card-head input { width: 17px; height: 17px; accent-color: var(--primary); }
.card-head span { color: #81520f; background: #fff1d8; border-radius: 6px; padding: 2px 5px; font-size: 11px; }
.thumb { width: 100%; padding: 6px; height: 143px; background: #f5f7fc; border: 1px solid #e7edf8; display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; min-height: 0; }
.card-actions { display: flex; gap: 3px; flex-wrap: wrap; padding-top: 5px; }
.card-actions > * { min-height: 34px; padding: 5px 8px; font-size: 12px; }
.card-actions .delete { color: #a13849; }
.sr { clip-path: inset(50%); position: absolute; width: 1px; height: 1px; overflow: hidden; }
dialog { border: 1px solid #d4ddeb; border-radius: 18px; color: var(--text); background: white; padding: 18px; width: min(400px, 95vw); max-height: 92dvh; }
dialog::backdrop { background: #10234494; }
dialog.wide { width: min(690px, 95vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
#auth-form { display: grid; gap: 10px; }
#auth-form .modal-head { margin-bottom: 0; }
#preview-image { display: block; max-width: 100%; max-height: 67dvh; object-fit: contain; margin: 0 auto; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-top: 13px; }
#editor-help { color: var(--muted); font-size: 13px; margin: -5px 0 9px; }
.edit-scroll { max-height: 58dvh; overflow: auto; border: 1px solid var(--border); background: #f0f3f9; }
.photo-board { position: relative; width: 100%; margin: auto; }
.photo-board img { width: 100%; display: block; user-select: none; }
#frames { position: absolute; inset: 0; pointer-events: none; }
.frame { position: absolute; border: 2px solid #354dcc; background: #4862dd1f; touch-action: none; }
.frame.editable { pointer-events: auto; cursor: move; border-color: #2545d9; box-shadow: 0 0 0 1px #fff; }
.frame > span { position: absolute; top: 2px; left: 2px; background: #244bcc; color: white; font-size: 11px; border-radius: 4px; padding: 2px 4px; }
.handle { min-height: 27px; width: 27px; height: 27px; position: absolute; padding: 0; border: 0; background: transparent; border-radius: 6px; }
.handle::after { content: ""; width: 13px; height: 13px; border: 1px solid #fff; background: #244bcc; border-radius: 4px; }
.handle[data-corner=tl] { top: 0; left: 0; cursor: nw-resize; }
.handle[data-corner=tr] { top: 0; right: 0; cursor: ne-resize; }
.handle[data-corner=bl] { bottom: 0; left: 0; cursor: sw-resize; }
.handle[data-corner=br] { bottom: 0; right: 0; cursor: se-resize; }
.divider { position: absolute; left: 0; right: 0; width: 100%; min-height: 26px; padding: 0;
  transform: translateY(-50%); background: #244bcc; color: white; touch-action: none; cursor: ns-resize; }
#region-label { width: 110px; }
.camera { display: none; }
@media (pointer: coarse) {
  .camera { display: inline-flex; }
  textarea, input:not([type=file]):not([type=checkbox]), select { font-size: 16px; }
}
@media (max-width: 820px) {
  .shell { padding-inline: 20px; }
  .workspace { grid-template-columns: 1fr; gap: 16px; }
  .intro { padding: 32px 0 21px; }
  .panel { padding: 17px; }
  .empty { min-height: 230px; }
}
@media (max-width: 430px) {
  .shell { padding-inline: 13px; }
  .topline { min-height: 56px; }
  .panel { padding: 14px; }
  .cards { grid-template-columns: 1fr; }
  .card-actions > * { min-height: 40px; }
  .thumb { height: 147px; }
}
