:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #252d2a; background: #f3f3ed;
  --ink: #253f35; --line: #d9dcd3; --mute: #5f6961;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
button, input, a { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, a[download] { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #42745c; outline-offset: 3px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 42px; }
.mast { border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 67px; font-size: 18px; font-weight: 700; letter-spacing: .025em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); position: relative; }
.brand-mark::before, .brand-mark::after { content: ''; position: absolute; width: 12px; height: 10px; border: 1.5px solid #f2efdc; border-radius: 2px; }
.brand-mark::before { left: 6px; top: 7px; }
.brand-mark::after { left: 9px; top: 10px; background: var(--ink); }
.intro { padding: 32px 0 22px; }
h1, h2, p { margin: 0; }
h1 { color: var(--ink); font-weight: 650; letter-spacing: -.045em; font-size: clamp(36px, 4vw, 51px); line-height: 1.24; }
.intro p { margin-top: 13px; line-height: 1.7; font-size: 15px; color: var(--mute); }
.workspace { display: grid; grid-template-columns: minmax(285px, .75fr) minmax(0, 1.55fr); gap: 20px; align-items: start; padding-bottom: 58px; }
.workspace.with-scenes { grid-template-columns: 1fr; }
.panel { background: #fffefa; border: 1px solid var(--line); border-radius: 18px; padding: 22px; min-width: 0; }
.panel-heading, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 35px; margin-bottom: 15px; }
h2 { font-size: 19px; line-height: 1.4; letter-spacing: -.025em; font-weight: 650; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.output .panel-heading { flex-wrap: wrap; }
.drop-area { position: relative; min-height: 218px; overflow: hidden; border: 1.5px dashed #aeb8a8; border-radius: 11px; background: #f7f8f1; display: grid; place-items: center; transition: background .16s ease; }
.drop-area:hover, .drop-area.dragging { background: #eef3e9; border-color: var(--ink); }
.drop-area:focus-within { outline: 3px solid #497760; outline-offset: 3px; }
.drop-area input { position: absolute; inset: 0; z-index: 2; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.drop-area input:disabled { cursor: progress; }
.drop-hint { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.upload-icon { background: #e7ecdf; color: var(--ink); width: 42px; height: 42px; border-radius: 50%; text-align: center; line-height: 40px; font-size: 26px; margin-bottom: 5px; }
.drop-hint strong, .empty strong { font-size: 16px; font-weight: 600; }
.drop-hint span:last-child, .empty p, .file-meta { font-size: 13px; color: var(--mute); }
#input-preview { width: 100%; height: 218px; object-fit: contain; }
#input-preview:not([hidden]) ~ .drop-hint { display: none; }
#replace-hint { position: absolute; bottom: 9px; right: 9px; border-radius: 5px; padding: 4px 8px; font-size: 12px; background: #fffffff0; }
.file-meta { padding: 10px 0 19px; line-height: 1.6; overflow-wrap: anywhere; }
#cutout-option { margin-bottom: 16px; }
#cutout-option label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14px; }
#force-cutout { accent-color: var(--ink); width: 16px; height: 16px; margin: 0; }
#force-cutout-help { margin: 4px 0 0 23px; color: var(--mute); font-size: 13px; line-height: 1.6; }
.auth { padding: 0 0 18px; }
.auth label { display: block; margin-bottom: 7px; font-size: 14px; }
#hosted-note { margin: 0 0 13px; color: var(--mute); font-size: 13px; line-height: 1.6; }
#quota { margin-bottom: 12px; }
.quota-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
#quota-status { color: var(--ink); font-size: 15px; }
#refresh-quota { padding: 4px 2px; border: 0; background: transparent; color: #375e47; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
#refresh-quota:disabled { opacity: .55; }
#quota p { margin-top: 3px; color: var(--mute); font-size: 13px; line-height: 1.65; }
.auth input { width: 100%; padding: 10px; border-radius: 7px; border: 1px solid #bac0b6; color: var(--ink); background: white; }
.primary, .secondary { border-radius: 8px; border: 1px solid var(--line); text-decoration: none; line-height: 1.4; }
.primary { width: 100%; padding: 13px; font-weight: 600; color: #fff; background: var(--ink); border-color: var(--ink); }
.primary:hover:enabled { background: #355846; }
.primary:disabled { color: #5d685f; background: #e2e7de; border-color: #e2e7de; }
.secondary { padding: 7px 11px; color: var(--ink); background: #fffefa; font-size: 13px; display: inline-block; }
.secondary:hover { background: #f0f3e9; }
.output { min-height: 371px; }
.empty { min-height: 267px; text-align: center; display: flex; flex-direction: column; justify-content: center; align-items: center; border-radius: 11px; background: #f5f4ee; padding: 24px 12px; }
.empty p { margin-top: 7px; line-height: 1.6; }
#feedback:not(:empty) { font-size: 14px; margin-top: 16px; line-height: 1.6; overflow-wrap: anywhere; }
#feedback[data-error="true"] { color: #963c29; }
#retry { margin-top: 10px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr)); gap: 17px 14px; }
figure { margin: 0; min-width: 0; }
.thumb { display: block; padding: 0; border: 1px solid var(--line); background: #f4f4ed; width: 100%; border-radius: 9px; overflow: hidden; cursor: zoom-in; }
.thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
figcaption { padding: 7px 1px 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
figcaption span { overflow-wrap: anywhere; }
figcaption a { text-decoration: underline; text-underline-offset: 3px; color: var(--ink); flex: none; padding: 3px; }
dialog { width: min(770px, 92vw); max-height: 90vh; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fffefa; color: inherit; }
dialog::backdrop { background: #182a20b3; }
#full-preview { display: block; max-height: 65vh; max-width: 100%; margin: 0 auto 14px; object-fit: contain; }
@media (max-width: 790px) { .wrap { padding: 0 23px; } .panel { padding: 17px; } .workspace { gap: 14px; } }
@media (max-width: 640px) { .brand { min-height: 54px; } .wrap { padding: 0 16px; } .intro { padding: 29px 0 21px; } .workspace { grid-template-columns: 1fr; } .drop-area { min-height: 166px; } #input-preview { height: 166px; } .empty { min-height: 182px; } .output { min-height: 0; } .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.with-scenes .setup {
  display: grid;
  grid-template-columns: minmax(210px, .72fr) minmax(0, 2fr);
  gap: 18px 26px;
}
.with-scenes .source .panel-heading { min-height: 0; margin-bottom: 15px; }
.with-scenes .drop-area { min-height: 174px; }
.with-scenes #input-preview { height: 174px; }
.with-scenes .file-meta { padding-bottom: 12px; }
.with-scenes .auth { padding-bottom: 0; }
#scene-picker { min-width: 0; margin: 0; border: 0; padding: 0; }
#scene-picker legend { padding: 0; font-size: 19px; font-weight: 650; line-height: 1.4; }
.scene-tools { margin: 12px 0; display: flex; justify-content: space-between; gap: 6px 13px; align-items: center; flex-wrap: wrap; }
.presets { display: inline-flex; padding: 2px; border: 1px solid #d1d7cd; border-radius: 8px; background: #f1f3ec; }
.presets button { background: transparent; border: 1px solid transparent; border-radius: 5px; padding: 6px 12px; color: var(--mute); font-size: 13px; }
.presets button[aria-pressed="true"] { color: var(--ink); font-weight: 650; background: #fffefa; border-color: #bac9bc; }
#scene-count { color: var(--mute); font-size: 13px; font-variant-numeric: tabular-nums; }
#scene-count.incomplete { color: #913f22; }
.scene-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.scene-option { border: 1px solid #d3d6cb; border-radius: 8px; overflow: hidden; padding: 0; text-align: left; min-width: 0; position: relative; color: #475249; background: #fafaf5; }
.scene-option img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: #ebece4; }
.scene-option span { font-size: 12px; line-height: 1.4; display: block; padding: 5px 7px; overflow-wrap: anywhere; }
.scene-option i { display: grid; place-items: center; position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; color: white; border: 1px solid #fff; background: var(--ink); font-size: 12px; font-weight: bold; font-style: normal; visibility: hidden; }
.scene-option[aria-pressed="true"] { border-color: #42674e; color: var(--ink); background: #eaf0e5; box-shadow: 0 0 0 1px #42674e; }
.scene-option[aria-pressed="true"] i { visibility: visible; }
.scene-option:hover:enabled { border-color: #648369; }
.scene-option[value="street"] { grid-column-start: 1; }
.with-scenes .form-actions { grid-column: 1 / -1; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.with-scenes .submit-notes { margin-right: auto; }
.with-scenes .form-actions #quota, .with-scenes .form-actions #hosted-note { margin-bottom: 0; }
.with-scenes #quota:not([hidden]) + #hosted-note:not([hidden]) { margin-top: 8px; }
.with-scenes .form-actions .primary { width: auto; min-width: 168px; }
.with-scenes .output { min-height: 0; }
.with-scenes .empty { min-height: 100px; }
@media (max-width: 790px) {
  .with-scenes .setup { gap: 15px; grid-template-columns: minmax(190px, .7fr) minmax(0, 1.5fr); }
  .scene-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .with-scenes .setup { grid-template-columns: minmax(0, 1fr); }
  .with-scenes .drop-area { min-height: 124px; }
  .with-scenes #input-preview { height: 144px; }
  .scene-tools { margin: 10px 0 12px; }
  .presets button { padding: 5px 8px; }
  .with-scenes .form-actions { flex-direction: column; align-items: stretch; }
}
