:root {
  --ink: #18201d;
  --muted: #6d7772;
  --paper: #f4f1e9;
  --card: rgba(255, 255, 252, .82);
  --line: rgba(24, 32, 29, .12);
  --acid: #c8f25e;
  --green: #1f4b3f;
  --shadow: 0 24px 70px rgba(36, 48, 40, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(18px); opacity: .6; }
.ambient-one { width: 420px; height: 420px; top: -150px; right: 5%; background: #d9f7a2; }
.ambient-two { width: 360px; height: 360px; left: -170px; top: 45%; background: #dce5d7; }
.shell { width: min(1200px, calc(100% - 40px)); margin: auto; padding-bottom: 80px; }
.topbar { height: 92px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--ink); color: var(--acid); font: 700 22px Georgia, serif; transform: rotate(-4deg); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.connection { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 12px; background: rgba(255,255,255,.45); }
.connection i { width: 7px; height: 7px; border-radius: 50%; background: #c5a970; box-shadow: 0 0 0 4px rgba(197,169,112,.15); }
.connection.ready i { background: #64a45e; box-shadow: 0 0 0 4px rgba(100,164,94,.16); }
.hero { min-height: 350px; padding: 65px 0 48px; display: flex; align-items: flex-end; justify-content: space-between; gap: 60px; }
.eyebrow { display: inline-block; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { max-width: 780px; margin: 16px 0 20px; font: 500 clamp(42px, 6vw, 76px)/1.05 Georgia, "Songti SC", serif; letter-spacing: -.045em; }
h1 em { color: var(--green); font-weight: 400; }
.hero p { max-width: 590px; margin: 0; color: var(--muted); line-height: 1.75; font-size: 15px; }
.hero-stat { flex: 0 0 150px; padding: 20px 0 8px; text-align: right; border-top: 1px solid var(--ink); }
.hero-stat span { display: block; font: 500 46px Georgia, serif; }
.hero-stat small { color: var(--muted); }
.workspace { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: stretch; }
.panel { padding: 28px; border: 1px solid rgba(255,255,255,.8); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.panel-title { display: flex; align-items: center; gap: 13px; margin-bottom: 28px; }
.panel-title .step { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--acid); font-size: 11px; font-weight: 800; }
.panel-title h2 { margin: 0; font-size: 16px; }
.panel-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
label { display: block; margin-top: 16px; }
label > span { display: block; margin-bottom: 8px; color: #55605b; font-size: 12px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--ink); background: rgba(247,247,242,.8); transition: .2s; }
input, select { height: 44px; padding: 0 12px; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,75,63,.08); background: white; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.secret-wrap { position: relative; }
.secret-wrap input { padding-right: 58px; }
.icon-button { position: absolute; right: 6px; top: 6px; height: 32px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.security-note { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.6; }
.prompt-panel { display: flex; flex-direction: column; }
.text-button { margin-left: auto; border: 0; background: none; color: var(--green); font-size: 12px; font-weight: 700; cursor: pointer; }
.prompt-list { flex: 1; min-height: 265px; display: flex; flex-direction: column; gap: 10px; }
.prompt-item { display: grid; grid-template-columns: 38px 1fr 54px; align-items: stretch; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: rgba(247,247,242,.72); transition: .2s; }
.prompt-item:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,75,63,.08); background: white; }
.prompt-number { display: grid; place-items: center; border-right: 1px solid var(--line); color: var(--green); font: 800 11px ui-monospace, monospace; }
.prompt-input { min-height: 66px; padding: 12px 14px; resize: vertical; border: 0; border-radius: 0; background: transparent; font-size: 13px; line-height: 1.65; }
.prompt-input:focus { border: 0; box-shadow: none; }
.prompt-options { grid-column: 2 / 3; display: flex; align-items: center; gap: 8px; padding: 0 12px 9px; color: var(--muted); font-size: 10px; }
.prompt-options select { width: 90px; height: 30px; margin-left: auto; padding: 0 8px; border-radius: 8px; font-size: 11px; }
.reference-chip { grid-column: 2 / 3; margin: 0 12px 10px; padding: 8px; border-radius: 9px; color: var(--green); background: rgba(31,75,63,.07); font-size: 10px; font-weight: 700; }
.reference-title { display: block; margin-bottom: 7px; }
.reference-thumbs { display: flex; flex-wrap: wrap; gap: 7px; }
.reference-thumb { position: relative; display: block; }
.reference-thumb img { display: block; width: 46px; height: 46px; border-radius: 7px; object-fit: cover; }
.reference-thumb button { position: absolute; top: -5px; right: -5px; display: grid; place-items: center; width: 17px; height: 17px; padding: 0; border: 1px solid white; border-radius: 50%; color: white; background: #9a493e; font-size: 11px; cursor: pointer; }
.prompt-tools { position: relative; display: grid; grid-template-rows: 1fr 1fr; border-left: 1px solid var(--line); }
.prompt-tools button { border: 0; background: transparent; cursor: pointer; }
.upload-reference { color: var(--green); border-bottom: 1px solid var(--line) !important; font-size: 11px; font-weight: 800; }
.upload-reference:hover { background: rgba(200,242,94,.18); }
.remove-prompt { color: #929b96; font-size: 19px; }
.remove-prompt:hover { color: #a33f32; background: #f8e9e5; }
.add-prompt { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; height: 46px; margin-top: 11px; border: 1px dashed rgba(31,75,63,.35); border-radius: 12px; color: var(--green); background: rgba(200,242,94,.09); font-size: 12px; font-weight: 800; cursor: pointer; }
.add-prompt:hover { border-style: solid; background: rgba(200,242,94,.18); }
.add-prompt b { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 7px; color: var(--acid); background: var(--green); font-size: 16px; line-height: 1; }
.prompt-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; }
.prompt-footer > span { color: var(--muted); font-size: 12px; }
.primary-button { display: flex; align-items: center; gap: 35px; min-width: 190px; height: 50px; padding: 0 16px 0 20px; border: 0; border-radius: 13px; background: var(--ink); color: white; font-weight: 700; cursor: pointer; box-shadow: 0 8px 20px rgba(24,32,29,.18); }
.primary-button b { display: grid; place-items: center; width: 28px; height: 28px; margin-left: auto; border-radius: 8px; background: var(--acid); color: var(--ink); }
.primary-button:disabled { opacity: .55; cursor: wait; }
.results-section { padding-top: 64px; }
.results-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.results-heading h2 { margin: 8px 0 0; font: 500 34px Georgia, "Songti SC", serif; }
.history-summary { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.result-actions { display: flex; gap: 8px; }
.secondary-button { height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.55); font-size: 12px; cursor: pointer; }
.empty-state { padding: 70px 20px; border: 1px dashed rgba(24,32,29,.2); border-radius: 24px; text-align: center; background: rgba(255,255,255,.28); }
.empty-glyph { display: grid; place-items: center; width: 60px; height: 60px; margin: auto; border-radius: 18px; background: var(--ink); color: var(--acid); font-size: 25px; transform: rotate(5deg); }
.empty-state h3 { margin: 20px 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 22px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.result-card { overflow: hidden; border-radius: 18px; background: rgba(255,255,255,.78); box-shadow: 0 12px 35px rgba(36,48,40,.08); }
.image-wrap { position: relative; aspect-ratio: 1; overflow: hidden; background: #e9e7df; }
.image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; transition: transform .35s ease; }
.image-wrap:hover img { transform: scale(1.025); }
.prompt-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 9px;
  color: white;
  background: rgba(24,32,29,.78);
  box-shadow: 0 5px 16px rgba(0,0,0,.16);
  backdrop-filter: blur(8px);
  font-size: 11px;
  font-weight: 800;
}
.image-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 25px; font-size: 12px; }
.image-placeholder::before { content: ""; position: absolute; width: 52px; height: 52px; border: 2px solid rgba(31,75,63,.12); border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; }
.image-placeholder span { margin-top: 85px; }
.result-card.error .image-placeholder::before { content: "!"; animation: none; border: 0; background: #f4d8cd; display: grid; place-items: center; color: #963c2d; font-size: 22px; }
.result-meta { padding: 15px; }
.prompt-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.copy-prompt { padding: 3px 7px; border: 0; border-radius: 6px; color: var(--green); background: rgba(31,75,63,.07); font-size: 10px; font-weight: 800; cursor: pointer; letter-spacing: 0; }
.full-prompt { margin: 0 0 14px; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.result-references { margin: -2px 0 14px; padding: 9px; border-radius: 9px; background: rgba(31,75,63,.055); }
.result-references > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 700; }
.result-references > div { display: flex; flex-wrap: wrap; gap: 6px; }
.result-reference-image { width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.8); border-radius: 7px; object-fit: cover; cursor: zoom-in; }
.meta-row { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 10px; }
.card-actions { display: flex; align-items: center; gap: 8px; }
.remix { border: 0; background: transparent; color: var(--green); font-weight: 800; cursor: pointer; }
.download { border: 0; background: transparent; color: var(--green); font-weight: 800; cursor: pointer; text-decoration: none; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 10; transform: translate(-50%, 20px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: white; font-size: 12px; opacity: 0; pointer-events: none; transition: .25s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 60px 28px 90px; background: rgba(10,15,13,.91); backdrop-filter: blur(12px); }
.lightbox[hidden] { display: none; }
.lightbox img { display: block; max-width: 94vw; max-height: calc(100vh - 150px); border-radius: 12px; object-fit: contain; box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.lightbox-close { position: absolute; top: 20px; right: 24px; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: white; background: rgba(255,255,255,.08); font-size: 28px; cursor: pointer; }
.lightbox-caption { position: absolute; left: 50%; bottom: 25px; width: min(760px, calc(100% - 50px)); transform: translateX(-50%); color: rgba(255,255,255,.78); font-size: 12px; line-height: 1.55; text-align: center; }
body.lightbox-open { overflow: hidden; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 850px) {
  .hero { min-height: 300px; padding-top: 45px; }
  .hero-stat { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 1200px); }
  .topbar { height: 74px; }
  .hero { padding: 38px 0; }
  h1 { font-size: 40px; }
  .panel { padding: 20px; border-radius: 18px; }
  .two-cols { grid-template-columns: 1fr; }
  .prompt-footer, .results-heading { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .gallery { grid-template-columns: 1fr; }
}
