:root {
  color-scheme: light;
  --dv-ink: #25342d;
  --dv-muted: #69786f;
  --dv-accent: #315c4d;
  --dv-paper: rgba(250, 250, 244, .9);
  --dv-line: rgba(41, 67, 55, .16);
  --dv-shadow: 0 18px 48px rgba(26, 48, 38, .13);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  overflow-x: hidden;
  background: #e8ede3;
  color: var(--dv-ink);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.activity-background {
  position: fixed;
  z-index: 0;
  inset: -18px;
  overflow: hidden;
  pointer-events: none;
  background: #e8ede3;
}
.activity-background::before,
.activity-background::after {
  position: absolute;
  content: "";
  inset: 0;
}
.activity-background::before {
  background: url("/img/da-vinci-cover.jpg") center 38% / cover no-repeat;
  filter: blur(17px) saturate(.72);
  transform: scale(1.06);
}
.activity-background::after {
  background: linear-gradient(180deg, rgba(243, 245, 236, .58), rgba(239, 242, 233, .7) 45%, rgba(234, 239, 229, .8));
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 820px);
  min-height: 72px;
  margin: 0 auto;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(54, 77, 64, .08);
  background: rgba(246, 247, 240, .42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--dv-ink); text-decoration: none; }
.brand-mark { display: grid; width: 38px; height: 38px; overflow: hidden; place-items: center; border-radius: 12px; background: rgba(255,255,255,.75); }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy strong { font-size: 15px; letter-spacing: .08em; }
.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.token-chip, .login-button, .account-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(49, 77, 61, .16);
  border-radius: 999px;
  background: rgba(255, 255, 250, .72);
  color: #425b4c;
  font-size: 13px;
  white-space: nowrap;
}
.login-button, .account-button { cursor: pointer; }

.page { position: relative; z-index: 1; width: min(100% - 40px, 680px); margin: 0 auto; padding: 28px 0 72px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.intro h1 { margin: 0; font-size: clamp(25px, 6vw, 34px); line-height: 1.2; letter-spacing: -.045em; }
.lead { margin: 8px 0 0; color: var(--dv-muted); font-size: 14px; line-height: 1.65; }
.history-jump { flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--dv-line); border-radius: 999px; background: rgba(255,255,250,.52); color: #465b4d; font-size: 12px; cursor: pointer; }

.workshop, .history-section {
  padding: 16px;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 22px;
  background: var(--dv-paper);
  box-shadow: var(--dv-shadow);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}
.upload-stage {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 360px;
  max-height: min(62svh, 570px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  place-items: center;
  border: 1px dashed rgba(48, 83, 65, .34);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(241,244,234,.92), rgba(223,232,218,.86));
  cursor: pointer;
  isolation: isolate;
  transition: border-color .18s ease, background .18s ease;
}
.upload-stage:hover, .upload-stage.is-dragging { border-color: rgba(45, 94, 71, .72); background: rgba(231, 238, 226, .96); }
.upload-stage input {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.upload-placeholder {
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 24px;
  color: var(--dv-muted);
  text-align: center;
  pointer-events: none;
}
.upload-placeholder strong { color: #31483a; font-size: 17px; font-weight: 650; }
.upload-placeholder strong::before {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 15px;
  place-items: center;
  border: 1px solid rgba(50, 88, 67, .28);
  border-radius: 50%;
  background: rgba(255,255,250,.55);
  color: var(--dv-accent);
  content: "+";
  font-size: 28px;
  font-weight: 400;
}
.upload-placeholder span { font-size: 13px; }
.upload-placeholder small { color: #7f8c83; font-size: 11px; }

/* The pending source stays in the center of the upload surface, not in a second queue below it. */
.selected-photo {
  position: absolute;
  z-index: 1;
  inset: 12px;
  display: grid;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
  background: rgba(246, 247, 241, .62);
  pointer-events: none;
}
.selected-photo img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  padding: 10px 10px 58px;
  object-fit: contain;
}
.selected-photo-meta {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 11px;
  background: rgba(34, 61, 49, .88);
  color: #fff;
  box-shadow: 0 5px 18px rgba(25, 43, 34, .18);
}
.selected-photo-meta strong { overflow: hidden; font-size: 12px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.selected-photo-meta small { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.15); color: #f0f5ee; font-size: 10px; }
.selected-photo-meta small.state-error { background: rgba(160, 70, 57, .86); }
.upload-change {
  position: absolute;
  z-index: 5;
  top: 12px;
  right: 12px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 999px;
  background: rgba(36, 61, 49, .82);
  color: white;
  font-size: 11px;
  pointer-events: none;
}
.remove-photo { display: block; margin: 10px 2px 0 auto; padding: 5px 0 5px 12px; border: 0; background: transparent; color: #77847a; font-size: 12px; cursor: pointer; }
.photo-grid:empty { display: none; }
.generated-result { display: grid; gap: 12px; margin-top: 14px; }
.generated-image { display: block; width: 100%; max-height: 680px; border-radius: 13px; background: #e8ece5; object-fit: contain; }
.save-result, .history-save, .history-refresh, .history-more {
  padding: 10px 14px;
  border: 1px solid var(--dv-line);
  border-radius: 999px;
  background: rgba(255,255,250,.8);
  color: #395747;
  font-size: 12px;
  cursor: pointer;
}
.save-result { justify-self: end; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 2px 2px; }
.usage { display: grid; gap: 5px; }
.usage strong { font-size: 13px; font-weight: 650; }
.usage span { color: var(--dv-muted); font-size: 11px; line-height: 1.5; }
.generate { min-width: 116px; min-height: 44px; padding: 0 19px; border: 0; border-radius: 999px; background: linear-gradient(145deg, #3e6a58, #284c3e); color: #fff; font-size: 13px; font-weight: 650; box-shadow: 0 7px 16px rgba(40,76,62,.2); cursor: pointer; }
.generate:disabled { opacity: .46; box-shadow: none; cursor: not-allowed; }
.batch-progress { margin: 12px 2px 0; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--dv-muted); font-size: 11px; }
.progress-track { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: rgba(54,84,67,.12); }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,#6d9a7c,#315c4d); transition: width .25s ease; }
.status { min-height: 18px; margin: 11px 2px 0; color: var(--dv-muted); font-size: 12px; line-height: 1.55; }
.status.error { color: #a64d42; }
.rules { margin: 14px 2px 0; color: #617268; font-size: 12px; line-height: 1.8; }
.rules p { margin: 0; }

.history-section { margin-top: 28px; scroll-margin-top: 20px; }
.history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.03em; }
.history-caption { margin: 6px 0 0; color: var(--dv-muted); font-size: 12px; }
.history-state { color: var(--dv-muted); font-size: 12px; line-height: 1.6; }
.history-state.is-error { color: #a64d42; }
.history-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.history-item { min-width: 0; overflow: hidden; border: 1px solid var(--dv-line); border-radius: 12px; background: rgba(255,255,250,.78); }
.history-item > img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.history-item-footer { display: grid; gap: 7px; padding: 9px; }
.history-item-footer time { overflow: hidden; color: var(--dv-muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-save { padding: 7px 8px; font-size: 10px; }
.history-more { display: block; margin: 15px auto 0; }
footer { position: relative; z-index: 1; padding: 20px 16px 28px; color: #78857c; font-size: 11px; text-align: center; }
.toast { position: fixed; z-index: 20; right: 20px; bottom: 24px; left: 20px; width: fit-content; max-width: min(420px,calc(100% - 40px)); margin: auto; padding: 11px 16px; border-radius: 999px; background: rgba(42,45,39,.92); color: white; font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
.login { position: fixed; z-index: 30; inset: 0; display: grid; padding: 20px; place-items: center; background: rgba(25,34,29,.42); backdrop-filter: blur(12px); }
.login-card { position: relative; display: grid; gap: 13px; width: min(100%,420px); padding: 28px; border: 1px solid rgba(255,255,255,.68); border-radius: 21px; background: #f8f8f2; box-shadow: 0 24px 70px rgba(22,37,29,.22); }
.login-close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(56,78,63,.09); font-size: 21px; cursor: pointer; }
.login-card .eyebrow { margin: 0; color: var(--dv-muted); font-size: 10px; letter-spacing: .14em; }
.login-card h2 { margin: 0; font-size: 23px; }
.login-card > p:not(.eyebrow):not(.login-error) { margin: 0; color: var(--dv-muted); font-size: 13px; line-height: 1.6; }
.login-card label { display: grid; gap: 6px; color: #53645a; font-size: 12px; }
.login-card input { height: 42px; padding: 0 12px; border: 1px solid var(--dv-line); border-radius: 10px; outline-color: #50735f; background: white; }
.login-card [type="submit"] { height: 44px; border: 0; border-radius: 999px; background: var(--dv-accent); color: white; cursor: pointer; }
.login-error { margin: 0; color: #a64d42; font-size: 12px; }

@media (max-width: 560px) {
  .topbar { min-height: 64px; padding: 10px 16px; }
  .brand-mark { width: 34px; height: 34px; }
  .top-actions { gap: 6px; }
  .token-chip, .login-button, .account-button { min-height: 36px; padding: 0 10px; font-size: 11px; }
  .page { width: min(100% - 28px, 480px); padding-top: 22px; }
  .intro { align-items: flex-start; }
  .intro h1 { font-size: 27px; }
  .lead { max-width: 255px; font-size: 12px; }
  .history-jump { padding: 8px 10px; font-size: 11px; }
  .workshop, .history-section { padding: 11px; border-radius: 18px; }
  .upload-stage { min-height: 300px; max-height: 58svh; aspect-ratio: 4 / 5; border-radius: 14px; }
  .selected-photo { inset: 8px; }
  .selected-photo img { padding: 7px 7px 52px; }
  .selected-photo-meta { right: 9px; bottom: 9px; left: 9px; min-height: 35px; padding: 7px 10px; }
  .upload-change { top: 9px; right: 9px; padding: 7px 9px; }
  .submit-row { align-items: flex-start; padding-top: 13px; }
  .usage strong { font-size: 12px; }
  .usage span { max-width: 190px; font-size: 10px; }
  .generate { min-width: 102px; min-height: 41px; padding: 0 14px; font-size: 12px; }
  .history-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Da Vinci: an airy botanical research atelier, distinct from the warm print studio. */
:root {
  --dv-ink: #4a554a;
  --dv-muted: #7b8578;
  --dv-accent: #839b80;
  --dv-paper: rgba(255, 254, 248, .72);
  --dv-line: rgba(101, 122, 98, .19);
  --dv-shadow: 0 22px 70px rgba(82, 91, 70, .12);
}
html, body { background: #f3f1e8; color: var(--dv-ink); }
body { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.activity-background::before { filter: blur(12px) saturate(.68); opacity: .8; }
.activity-background::after { background: linear-gradient(180deg, rgba(250, 249, 239, .63), rgba(248, 247, 239, .73) 54%, rgba(244, 244, 236, .82)); }
.topbar { position: sticky; top: 0; width: min(100%, 1120px); min-height: 68px; padding: max(9px, env(safe-area-inset-top)) 30px; border-bottom-color: rgba(103, 119, 93, .12); background: rgba(252, 251, 244, .78); }
.brand, .token-chip, .login-button, .account-button { color: #5d6b5d; }
.token-chip, .login-button, .account-button { border-color: rgba(101, 122, 98, .19); background: rgba(255, 255, 250, .74); }
.page { width: min(100% - 56px, 1040px); padding: 35px 0 76px; }
.intro { align-items: flex-end; margin-bottom: 23px; }
.intro-copy { min-width: 0; }
.intro-kicker, .creation-kicker { display: block; color: #84947f; font-size: 11px; letter-spacing: .08em; }
.intro h1 { margin-top: 8px; color: #485448; font: 600 clamp(38px, 6vw, 58px)/1.16 "Songti SC", "Noto Serif SC", Georgia, serif; letter-spacing: -.045em; }
.lead { max-width: 480px; margin-top: 10px; color: #798477; font-size: 13px; }
.history-jump { border-color: rgba(106, 129, 102, .2); background: rgba(255, 254, 248, .76); color: #647460; }
.workshop, .history-section { border: 1px solid rgba(255, 255, 255, .72); background: var(--dv-paper); box-shadow: var(--dv-shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.workshop { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 20px; padding: clamp(18px, 3.4vw, 30px); border-radius: 27px; }
.upload-column { min-width: 0; }
.upload-stage { min-height: min(60vw, 620px); max-height: 620px; border-color: rgba(119, 143, 115, .38); border-radius: 19px; background: linear-gradient(145deg, rgba(255, 255, 248, .78), rgba(232, 237, 222, .68)); }
.upload-stage:hover, .upload-stage.is-dragging { border-color: rgba(104, 136, 106, .72); background: rgba(247, 249, 240, .88); }
.upload-placeholder { gap: 11px; }
.upload-placeholder strong { color: #53634f; font-size: 18px; }
.upload-placeholder strong::before { width: 50px; height: 50px; border-color: rgba(115, 146, 116, .36); background: rgba(255, 255, 250, .72); color: #789377; }
.upload-placeholder span { color: #748172; }
.upload-placeholder small { color: #8c9587; }
.selected-photo img { background: rgba(255, 254, 248, .42); }
.selected-photo-meta { border: 1px solid rgba(255,255,255,.72); background: rgba(255,254,248,.88); color: #53634f; }
.selected-photo-meta small { color: #82917e; }
.upload-change { border-color: rgba(111, 139, 111, .24); background: rgba(255, 254, 248, .92); color: #637961; }
.remove-photo { border-radius: 999px; padding: 7px 12px; background: rgba(255, 254, 248, .7); color: #788873; }
.creation-panel { display: flex; min-width: 0; flex-direction: column; justify-content: center; padding: 31px 23px 27px; border-left: 1px solid rgba(111, 132, 105, .15); }
.creation-kicker { margin-bottom: 19px; }
.creation-panel h2 { margin: 0; color: #53634f; font: 500 clamp(30px, 4vw, 44px)/1.42 "Songti SC", "Noto Serif SC", Georgia, serif; letter-spacing: -.04em; }
.creation-panel h2 span { color: #82987c; }
.creation-panel>p:not(.status) { max-width: 290px; margin: 14px 0 0; color: #7c8679; font-size: 12px; line-height: 1.9; }
.creation-divider { width: 44px; height: 2px; margin: 27px 0 22px; border-radius: 9px; background: #b6c2a9; }
.creation-panel .submit-row { display: grid; justify-content: stretch; gap: 17px; margin: auto 0 0; padding: 0; border: 0; }
.creation-panel .usage { gap: 6px; }
.creation-panel .usage strong { color: #586953; font-size: 15px; }
.creation-panel .usage span { color: #879182; font-size: 11px; line-height: 1.6; }
.creation-panel .generate { min-height: 48px; justify-content: space-between; padding: 0 19px; border: 1px solid rgba(104, 136, 106, .16); border-radius: 13px; background: linear-gradient(110deg, #a9bba1, #879f88); color: #fffdf5; font-size: 13px; box-shadow: 0 9px 22px rgba(101, 133, 102, .18); }
.creation-panel .generate:disabled { opacity: .56; }
.creation-panel .status { color: #7d897a; }
.batch-progress { margin-top: 18px; }
.progress-track { background: rgba(107, 133, 101, .14); }
.progress-track i { background: linear-gradient(90deg, #b7c4a4, #809b80); }
.rules { margin: 14px 5px 0; color: #838b7b; font-size: 11px; }
.history-section { margin-top: 38px; border-radius: 22px; }
.history-heading h2 { color: #53634f; }
.history-refresh, .history-more, .history-save { border-color: rgba(103, 128, 100, .2); background: rgba(255, 254, 248, .8); color: #65765f; }
.history-item { border-color: rgba(111, 132, 105, .14); background: rgba(255, 254, 248, .75); }
.toast { border: 1px solid rgba(112, 134, 107, .18); background: rgba(255, 254, 248, .96); color: #596d58; box-shadow: 0 12px 35px rgba(66, 83, 61, .13); }
.login { background: rgba(240, 241, 230, .62); }
.login-card { border-color: rgba(255,255,255,.86); background: #fffdf7; }
.login-card button[type="submit"] { background: #91a88f; }
@media (max-width: 760px) {
  .page { width: calc(100% - 32px); padding-top: 25px; }
  .workshop { grid-template-columns: 1fr; gap: 13px; padding: 13px; border-radius: 21px; }
  .upload-stage { min-height: 0; max-height: 58svh; aspect-ratio: 4 / 5; }
  .creation-panel { padding: 22px 9px 7px; border-top: 1px solid rgba(111, 132, 105, .15); border-left: 0; }
  .creation-kicker { margin-bottom: 9px; }
  .creation-panel h2 { font-size: 29px; line-height: 1.28; }
  .creation-panel>p:not(.status) { margin-top: 8px; }
  .creation-divider { margin: 16px 0; }
  .creation-panel .submit-row { gap: 12px; }
  .history-section { margin-top: 29px; padding: 16px; }
}
@media (max-width: 560px) {
  .topbar { min-height: 58px; padding: 8px 12px; }
  .page { width: calc(100% - 28px); }
  .intro { align-items: flex-start; }
  .intro h1 { font-size: 36px; }
  .lead { font-size: 12px; }
  .history-jump { padding: 8px 10px; }
  .workshop .generate { width: 100%; }
}
