:root {
  --ink: #1b1917;
  --muted: #7a746d;
  --muted-2: #aaa39b;
  --paper: #f5f2ed;
  --panel: #fffdf9;
  --line: #ded8d0;
  --line-soft: #ece7e0;
  --accent: #ef5d3f;
  --accent-dark: #d9482d;
  --accent-soft: #fff0e9;
  --green: #2d9a67;
  --shadow: 0 18px 50px rgba(60, 48, 36, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 82% 4%, rgba(255, 177, 116, .13), transparent 25rem),
    var(--paper);
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
[hidden] { display: none !important; }

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 246px;
  flex-direction: column;
  padding: 28px 18px 20px;
  color: #f7f2eb;
  background:
    linear-gradient(165deg, rgba(255,255,255,.035), transparent 35%),
    #171514;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 28px; }
.brand strong { display: block; font-family: Georgia, serif; font-size: 21px; letter-spacing: -.3px; }
.brand small { display: block; margin-top: 3px; color: #8e8780; font-size: 9px; font-weight: 700; letter-spacing: 2.2px; }

.brand-mark { position: relative; width: 36px; height: 36px; transform: rotate(-4deg); }
.brand-mark span { position: absolute; display: block; width: 24px; height: 24px; border-radius: 6px; }
.brand-mark span:nth-child(1) { top: 0; left: 0; background: #f06040; }
.brand-mark span:nth-child(2) { right: 0; bottom: 0; background: #ffd5bc; mix-blend-mode: screen; }
.brand-mark span:nth-child(3) { top: 9px; left: 9px; border: 2px solid #171514; background: #f9a13b; }

.main-nav { display: grid; gap: 5px; }
.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 0;
  border-radius: 10px;
  color: #9d9690;
  background: transparent;
  font-size: 14px;
  text-align: left;
  transition: .18s ease;
}
.nav-item svg { width: 19px; height: 19px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-item.active svg { color: #ff795b; }
.nav-count { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 20px; color: #8f8881; background: rgba(255,255,255,.07); font-size: 10px; text-align: center; }

.sidebar-section { margin-top: 35px; }
.eyebrow { margin: 0 0 9px; color: #9b948e; font-size: 9px; font-weight: 800; letter-spacing: 2px; }
.sidebar-section > .eyebrow { padding: 0 12px; color: #655f5a; }
.inspire-card {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 8px 9px;
  border: 0;
  border-radius: 10px;
  color: #d9d3cd;
  background: transparent;
  text-align: left;
  transition: .18s ease;
}
.inspire-card:hover { background: rgba(255,255,255,.055); transform: translateX(2px); }
.inspire-card strong, .inspire-card small { display: block; }
.inspire-card strong { font-size: 12px; font-weight: 600; }
.inspire-card small { margin-top: 2px; color: #716b66; font-size: 10px; }
.inspire-art { display: block; width: 38px; height: 38px; flex: 0 0 auto; overflow: hidden; border-radius: 9px; }
.art-one { background: radial-gradient(circle at 70% 30%, #ffd27d 0 6%, transparent 7%), linear-gradient(160deg, #27324b 0 47%, #aa5a64 48% 63%, #25293a 64%); }
.art-two { background: radial-gradient(circle at 62% 35%, #d7e8e9 0 13%, transparent 14%), linear-gradient(150deg, #283350 0 52%, #746ca6 53% 70%, #24243b 71%); }
.art-three { background: linear-gradient(120deg, transparent 38%, #f6d4c0 39% 59%, transparent 60%), linear-gradient(35deg, #9b3028 0 48%, #f3eae1 49% 67%, #222 68%); }

.sidebar-footer { margin-top: auto; padding: 12px 0 0; border-top: 1px solid rgba(255,255,255,.07); }
.logout-button { display: flex; width: 100%; align-items: center; gap: 9px; margin-bottom: 5px; padding: 8px 10px; border: 0; border-radius: 9px; color: #817a74; background: transparent; font-size: 10px; text-align: left; transition: .18s ease; }
.logout-button:hover { color: #f4eee8; background: rgba(255,255,255,.055); }
.logout-button svg { width: 16px; height: 16px; }
.config-button { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border: 0; border-radius: 9px; color: #bbb4ad; background: transparent; text-align: left; transition: .18s ease; }
.config-button:hover { color: #fff; background: rgba(255,255,255,.055); }
.config-button:disabled { cursor: default; }
.config-button:disabled:hover { color: #bbb4ad; background: transparent; }
.config-button > span:nth-child(2) { min-width: 0; flex: 1; }
.config-button strong, .config-button small { display: block; }
.config-button strong { font-size: 11px; font-weight: 500; }
.config-button small { margin-top: 4px; color: #625c57; font-size: 9px; }
.config-button > svg { width: 16px; height: 16px; color: #6f6862; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #d29a45; box-shadow: 0 0 0 4px rgba(210,154,69,.1); }
.status-dot.online { background: #49b77c; box-shadow: 0 0 0 4px rgba(73,183,124,.1); }
.status-dot.offline { background: #e15c4e; box-shadow: 0 0 0 4px rgba(225,92,78,.1); }

.workspace { width: calc(100% - 246px); min-width: 0; margin-left: 246px; }
.topbar { display: flex; min-height: 104px; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 36px 17px; border-bottom: 1px solid rgba(210,202,192,.72); }
.topbar h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(24px, 2.3vw, 34px); font-weight: 500; letter-spacing: -.7px; }
.topbar .eyebrow { margin-bottom: 7px; color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.shortcut { display: flex; align-items: center; gap: 5px; color: #968f87; font-size: 10px; }
kbd { padding: 3px 6px; border: 1px solid #d9d2ca; border-bottom-width: 2px; border-radius: 5px; color: #777068; background: #fffaf4; font-family: inherit; font-size: 9px; }
.menu-button { display: none !important; }

.studio-grid { display: grid; grid-template-columns: minmax(390px, .82fr) minmax(460px, 1.18fr); min-height: calc(100vh - 104px); }
.control-panel { padding: 28px 34px 55px 36px; border-right: 1px solid var(--line); background: rgba(255,253,249,.44); }
.control-panel form { max-width: 590px; margin: 0 auto; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
label { display: block; margin-bottom: 9px; color: #3e3934; font-size: 12px; font-weight: 700; }
label span { margin-left: 3px; color: #aaa39b; font-size: 10px; font-weight: 400; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 3px; border: 0; color: var(--accent); background: transparent; font-size: 11px; }
.text-button:hover { color: var(--accent-dark); }
.text-button svg { width: 15px; height: 15px; }

.prompt-box { position: relative; }
textarea, input[type="text"], input[type="url"], select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  color: var(--ink);
  background: rgba(255,255,255,.8);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea:focus, input[type="text"]:focus, input[type="url"]:focus, select:focus { border-color: #e7765e; background: #fff; box-shadow: 0 0 0 3px rgba(239,93,63,.1); }
textarea { display: block; min-height: 130px; resize: vertical; padding: 14px 16px 30px; line-height: 1.65; font-size: 13px; }
textarea::placeholder, input::placeholder { color: #b2aba4; }
.char-count { position: absolute; right: 12px; bottom: 9px; color: #b0a9a1; font-size: 9px; }
.field-group { margin-top: 20px; }
.field-group input[type="text"], .field-group input[type="url"] { height: 42px; padding: 0 13px; font-size: 12px; }
.field-hint { margin: 7px 2px 0; color: #a29a92; font-size: 9px; }
.field-hint.warning { color: #be775b; }
.two-columns { display: grid; grid-template-columns: 1.18fr 1fr; gap: 18px; }
.size-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-group input[type="number"] {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  color: var(--ink);
  background: rgba(255,255,255,.8);
  font-size: 12px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.field-group input[type="number"]:focus { border-color: #e7765e; background: #fff; box-shadow: 0 0 0 3px rgba(239,93,63,.1); }
textarea.compact-area { min-height: 76px; padding: 12px 13px; font-size: 12px; }
.select-wrap { position: relative; }
.select-wrap select { height: 42px; padding: 0 38px 0 12px; appearance: none; font-size: 12px; }
.select-wrap svg { position: absolute; top: 11px; right: 11px; width: 18px; pointer-events: none; color: #9c958e; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.7); }
.segmented button { border: 0; border-radius: 7px; color: #8f8880; background: transparent; font-size: 11px; }
.segmented button:hover { color: var(--ink); }
.segmented button.active { color: #fff; background: #262321; box-shadow: 0 2px 6px rgba(30,25,20,.18); }

.ratio-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ratio-grid button { display: flex; min-width: 0; height: 61px; align-items: center; justify-content: center; gap: 9px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.6); }
.ratio-grid button:hover { border-color: #beb6ad; background: #fff; }
.ratio-grid button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.ratio-grid span { color: #48433e; font-size: 10px; font-weight: 600; text-align: left; }
.ratio-grid small { display: block; margin-top: 2px; color: #999189; font-size: 8px; font-weight: 400; }
.ratio-shape { display: block; width: 19px; height: 19px; flex: 0 0 auto; border: 1.5px solid currentColor; border-radius: 3px; color: #857e77; }
.portrait { width: 15px; height: 21px; }
.landscape { width: 23px; height: 17px; }
.cinema { width: 25px; height: 14px; }
.ratio-grid button.active .ratio-shape { color: var(--accent); }

.slider-field output { min-width: 42px; padding: 4px 8px; border-radius: 6px; color: var(--accent); background: var(--accent-soft); font-size: 10px; font-weight: 700; text-align: center; }
input[type="range"] { width: 100%; height: 4px; margin: 10px 0 0; border-radius: 5px; outline: 0; appearance: none; background: linear-gradient(to right, var(--accent) var(--fill, 10%), #ded8d0 var(--fill, 10%)); }
input[type="range"]::-webkit-slider-thumb { width: 15px; height: 15px; border: 3px solid #fff; border-radius: 50%; appearance: none; background: var(--accent); box-shadow: 0 1px 5px rgba(80,50,30,.35); }
.range-labels { display: flex; justify-content: space-between; margin-top: 8px; color: #aaa39b; font-size: 8px; }

.advanced-settings { margin-top: 20px; border: 1px solid var(--line-soft); border-radius: 11px; background: rgba(255,255,255,.46); }
.advanced-settings summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 13px; cursor: pointer; list-style: none; color: #6f6861; font-size: 11px; font-weight: 600; }
.advanced-settings summary::-webkit-details-marker { display: none; }
.advanced-settings summary span { display: flex; align-items: center; gap: 8px; }
.advanced-settings summary svg { width: 17px; height: 17px; }
.advanced-settings .chevron { transition: transform .2s; }
.advanced-settings[open] .chevron { transform: rotate(180deg); }
.advanced-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; padding: 0 13px 15px; border-top: 1px solid var(--line-soft); }
.advanced-body .field-group { margin-top: 14px; }
.compact input[type="range"] { margin-top: 7px; }

.generate-button { width: 100%; height: 50px; margin-top: 22px; border: 0; border-radius: 11px; color: #fff; background: var(--accent); box-shadow: 0 7px 18px rgba(218,68,39,.22); font-size: 13px; font-weight: 700; transition: .18s ease; }
.generate-button:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 9px 22px rgba(218,68,39,.26); }
.generate-button:active { transform: translateY(0); }
.generate-button:disabled { cursor: wait; opacity: .9; }
.button-idle, .button-loading { align-items: center; justify-content: center; gap: 8px; }
.button-idle { display: flex; }
.button-loading { display: none; }
.generate-button.loading .button-idle { display: none; }
.generate-button.loading .button-loading { display: flex; }
.button-idle svg { width: 19px; fill: currentColor; stroke: none; }
.button-loading i { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.38); border-top-color: #fff; border-radius: 50%; animation: spin .75s linear infinite; }
.button-loading b { min-width: 39px; font-variant-numeric: tabular-nums; font-size: 10px; }
.submit-note { margin: 9px 0 0; color: #a29a92; font-size: 9px; text-align: center; }

.result-panel { position: relative; min-width: 0; padding: 29px 32px 50px; overflow: hidden; }
.result-panel::before { position: absolute; inset: 0; pointer-events: none; background-image: radial-gradient(#cfc7be 0.7px, transparent .7px); background-size: 18px 18px; opacity: .2; content: ""; }
.result-toolbar { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.result-toolbar .eyebrow { margin-bottom: 5px; }
.result-toolbar h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 20px; font-weight: 500; }
.result-toolbar h2 span { color: #a89f96; font-family: "Segoe UI", sans-serif; font-size: 11px; }
.icon-button { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.65); }
.icon-button:hover { color: var(--accent); border-color: #d5b3a7; background: #fff; }
.icon-button svg { width: 18px; height: 18px; }

.empty-state { position: relative; z-index: 1; display: flex; min-height: calc(100vh - 220px); align-items: center; flex-direction: column; justify-content: center; padding: 35px 10px 80px; text-align: center; }
.empty-visual { position: relative; width: 225px; height: 190px; margin-bottom: 13px; }
.frame { position: absolute; border: 1px solid rgba(88,75,64,.18); border-radius: 17px; background: rgba(255,255,255,.75); box-shadow: 0 15px 30px rgba(74,55,42,.1); }
.frame-back { top: 30px; left: 45px; width: 135px; height: 130px; transform: rotate(9deg); background: linear-gradient(160deg, #f6d0aa, #e99378); opacity: .7; }
.frame-front { top: 25px; left: 44px; width: 137px; height: 137px; transform: rotate(-5deg); overflow: hidden; background: linear-gradient(155deg, #292d48 0 50%, #e56e56 51% 72%, #f2b573 73%); }
.frame-front::before { position: absolute; top: 18px; right: 19px; width: 25px; height: 25px; border-radius: 50%; background: #ffe5aa; box-shadow: 0 0 20px rgba(255,222,153,.6); content: ""; }
.frame-front i { position: absolute; right: -15px; bottom: -9px; width: 93px; height: 92px; border-radius: 55% 0 0; background: #34364d; transform: rotate(-12deg); }
.frame-front b { position: absolute; bottom: -23px; left: -25px; width: 110px; height: 86px; border-radius: 50%; background: #8f4658; transform: rotate(18deg); }
.orb { position: absolute; border-radius: 50%; filter: blur(1px); }
.orb-one { top: 7px; right: 9px; width: 54px; height: 54px; background: rgba(241,112,75,.25); }
.orb-two { bottom: 3px; left: 10px; width: 73px; height: 73px; background: rgba(247,191,114,.25); }
.spark { position: absolute; z-index: 3; color: var(--accent); }
.spark-one { top: 6px; left: 27px; font-size: 22px; }
.spark-two { right: 24px; bottom: 28px; color: #f5a13e; font-size: 14px; }
.empty-state h3 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 18px; font-weight: 500; }
.empty-state > p { max-width: 330px; margin: 9px auto 21px; color: #968f87; font-size: 11px; line-height: 1.7; }
.empty-tips { display: flex; align-items: center; justify-content: center; color: #aaa29a; font-size: 8px; letter-spacing: .2px; }
.empty-tips i { width: 3px; height: 3px; margin: 0 9px; border-radius: 50%; background: #d5cdc5; }

.loading-grid, .result-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 22px; }
.skeleton { position: relative; aspect-ratio: var(--ratio, 1); overflow: hidden; border-radius: 14px; background: #e7e1da; }
.skeleton::after { position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.5s infinite; content: ""; }
.result-card { position: relative; overflow: hidden; border-radius: 14px; background: #ded8d1; box-shadow: 0 7px 24px rgba(43,35,29,.08); animation: reveal .42s ease both; }
.result-card img { display: block; width: 100%; aspect-ratio: var(--ratio, 1); object-fit: cover; cursor: zoom-in; transition: transform .35s ease; }
.result-card:hover img { transform: scale(1.02); }
.card-actions { position: absolute; right: 9px; bottom: 9px; left: 9px; display: flex; justify-content: flex-end; gap: 7px; opacity: 0; transform: translateY(5px); transition: .2s ease; }
.result-card:hover .card-actions { opacity: 1; transform: translateY(0); }
.card-action { display: inline-flex; height: 32px; align-items: center; justify-content: center; gap: 6px; padding: 0 9px; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; color: #fff; background: rgba(21,18,16,.66); backdrop-filter: blur(10px); font-size: 9px; text-decoration: none; }
.card-action:hover { background: rgba(21,18,16,.86); }
.card-action svg { width: 14px; height: 14px; }

.history-view { padding: 32px 36px 70px; }
.history-empty { display: flex; min-height: calc(100vh - 210px); align-items: center; flex-direction: column; justify-content: center; text-align: center; }
.history-empty-icon { display: flex; width: 65px; height: 65px; align-items: center; justify-content: center; margin-bottom: 17px; border: 1px solid #ead5ca; border-radius: 20px; color: var(--accent); background: var(--accent-soft); transform: rotate(-3deg); }
.history-empty-icon svg { width: 27px; height: 27px; }
.history-empty h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 500; }
.history-empty p { margin: 10px 0 18px; color: var(--muted); font-size: 11px; }
.primary-small, .ghost-button { display: inline-flex; height: 36px; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border-radius: 9px; font-size: 11px; font-weight: 600; text-decoration: none; }
.primary-small { border: 0; color: #fff; background: var(--accent); }
.primary-small:hover { background: var(--accent-dark); }
.ghost-button { border: 1px solid var(--line); color: #5f5953; background: rgba(255,255,255,.7); }
.ghost-button:hover { border-color: #cfc5bb; background: #fff; }
.ghost-button svg { width: 15px; height: 15px; }
.history-list { display: grid; gap: 22px; max-width: 1160px; margin: 0 auto; }
.history-group { padding: 18px; border: 1px solid var(--line-soft); border-radius: 16px; background: rgba(255,253,249,.65); box-shadow: 0 8px 30px rgba(52,42,34,.035); }
.history-meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.history-meta h3 { max-width: 750px; margin: 0 0 6px; overflow: hidden; font-size: 12px; font-weight: 600; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.history-meta p { margin: 0; color: #9a928a; font-size: 9px; }
.history-meta-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.history-meta-actions button { height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; color: #746d66; background: #fff; font-size: 9px; }
.history-meta-actions button:hover { color: var(--accent); border-color: #e2b7a9; }
.history-images { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.history-images img { display: block; width: 100%; aspect-ratio: var(--ratio, 1); border-radius: 10px; object-fit: cover; cursor: zoom-in; background: #e7e0da; }

body.auth-locked { overflow: hidden; }
body.auth-locked .app-shell { pointer-events: none; user-select: none; filter: blur(8px); transform: scale(1.008); }
.auth-gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; min-height: 100dvh; padding: 24px; overflow: auto; background: #151311; }
.auth-gate[hidden] { display: none; }
.auth-backdrop { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(circle at 50% 44%, rgba(239,93,63,.15), transparent 27rem), linear-gradient(145deg, #171412, #221a16 58%, #12110f); }
.auth-backdrop::before { position: absolute; inset: 0; opacity: .13; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 54px 54px; mask-image: radial-gradient(circle at center, #000, transparent 72%); content: ""; }
.auth-backdrop i { position: absolute; display: block; border-radius: 999px; filter: blur(1px); }
.auth-backdrop i:nth-child(1) { top: 13%; left: 16%; width: 170px; height: 170px; background: rgba(239,93,63,.08); }
.auth-backdrop i:nth-child(2) { right: 12%; bottom: 8%; width: 260px; height: 260px; border: 1px solid rgba(255,205,174,.08); }
.auth-backdrop i:nth-child(3) { right: 24%; top: 18%; width: 8px; height: 8px; background: #f28b70; box-shadow: 0 0 28px 8px rgba(239,93,63,.35); }
.auth-card { position: relative; z-index: 1; width: min(430px, 100%); padding: 40px; border: 1px solid rgba(255,255,255,.72); border-radius: 22px; color: var(--ink); background: rgba(255,253,249,.97); box-shadow: 0 35px 100px rgba(0,0,0,.38); animation: reveal .35s ease; }
.auth-mark { display: grid; width: 48px; height: 48px; place-items: center; margin-bottom: 24px; border-radius: 14px; color: #fff8f4; background: linear-gradient(145deg, #f17458, #d7462b); box-shadow: 0 12px 30px rgba(220,72,42,.25); }
.auth-mark svg { width: 24px; height: 24px; }
.auth-card .eyebrow { margin-bottom: 8px; color: var(--accent); }
.auth-card h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 31px; font-weight: 500; letter-spacing: -.7px; }
.auth-copy { margin: 13px 0 25px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.auth-card label { display: block; margin-bottom: 8px; color: #4d4843; font-size: 11px; font-weight: 700; }
.auth-password-wrap { position: relative; }
.auth-password-wrap input { width: 100%; height: 50px; padding: 0 68px 0 14px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: #fff; font-size: 13px; }
.auth-password-wrap input:focus { border-color: #e7765e; box-shadow: 0 0 0 4px rgba(239,93,63,.1); }
.auth-password-wrap button { position: absolute; top: 7px; right: 7px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-size: 10px; }
.auth-error { min-height: 18px; margin: 8px 2px 5px; color: #c7422d; font-size: 10px; line-height: 1.6; }
.auth-submit { display: flex; width: 100%; height: 50px; align-items: center; justify-content: center; gap: 9px; border: 0; border-radius: 11px; color: #fff; background: var(--accent); box-shadow: 0 12px 28px rgba(239,93,63,.2); font-size: 13px; font-weight: 700; transition: .18s ease; }
.auth-submit:hover { background: var(--accent-dark); transform: translateY(-1px); }
.auth-submit:disabled { cursor: wait; opacity: .68; transform: none; }
.auth-submit svg { width: 16px; height: 16px; }
.auth-footnote { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 22px 0 0; color: #9a938c; font-size: 9px; }
.auth-footnote span { width: 6px; height: 6px; border-radius: 50%; background: #48a978; box-shadow: 0 0 0 4px rgba(72,169,120,.1); }

.toast-region { position: fixed; z-index: 100; right: 22px; bottom: 22px; display: grid; gap: 9px; width: min(350px, calc(100vw - 44px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid rgba(255,255,255,.1); border-radius: 11px; color: #f6f1ea; background: rgba(28,25,23,.94); box-shadow: 0 15px 40px rgba(20,17,15,.25); backdrop-filter: blur(14px); font-size: 11px; line-height: 1.5; animation: toast-in .25s ease; pointer-events: auto; }
.toast::before { display: block; width: 7px; height: 7px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: #50bd83; content: ""; }
.toast.error::before { background: #f06c54; }
.toast.warning::before { background: #e8ad4b; }

.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 34px; }
.lightbox-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(17,15,14,.86); backdrop-filter: blur(14px); }
.lightbox-dialog { position: relative; z-index: 1; display: flex; max-width: min(1100px, 92vw); max-height: 90vh; align-items: center; flex-direction: column; }
.lightbox-dialog img { display: block; max-width: 100%; max-height: calc(90vh - 62px); border-radius: 11px; object-fit: contain; box-shadow: 0 25px 80px rgba(0,0,0,.45); }
.lightbox-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.lightbox-actions .ghost-button { color: #e9e3dc; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.09); }
.lightbox-actions .icon-button { color: #eee7e0; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.09); }

.settings-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(24,21,19,.7); backdrop-filter: blur(9px); }
.settings-dialog { position: relative; z-index: 1; width: min(450px, 100%); padding: 28px; border: 1px solid rgba(255,255,255,.65); border-radius: 17px; background: var(--panel); box-shadow: 0 28px 90px rgba(23,18,15,.3); animation: reveal .25s ease; }
.settings-dialog .settings-close { position: absolute; top: 17px; right: 17px; }
.settings-dialog .eyebrow { margin-bottom: 8px; color: var(--accent); }
.settings-dialog h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 500; }
.settings-copy { margin: 12px 42px 21px 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.settings-copy code { padding: 2px 5px; border-radius: 4px; color: #8d503f; background: var(--accent-soft); font-size: 10px; }
.password-wrap { position: relative; }
.password-wrap input { width: 100%; height: 44px; padding: 0 66px 0 13px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: #fff; font-family: Consolas, monospace; font-size: 11px; }
.password-wrap input:focus { border-color: #e7765e; box-shadow: 0 0 0 3px rgba(239,93,63,.1); }
.password-wrap button { position: absolute; top: 6px; right: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: 7px; color: var(--accent); background: var(--accent-soft); font-size: 10px; }
.settings-save { margin-top: 18px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .studio-grid { grid-template-columns: minmax(370px, .92fr) minmax(390px, 1.08fr); }
  .control-panel { padding-right: 25px; padding-left: 25px; }
  .result-panel { padding-right: 23px; padding-left: 23px; }
  .ratio-grid { grid-template-columns: repeat(2, 1fr); }
  .history-images { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.25); transition: transform .25s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .workspace { width: 100%; margin-left: 0; }
  .menu-button { display: inline-flex !important; flex: 0 0 auto; }
  .topbar { justify-content: flex-start; padding: 18px 22px; }
  .topbar-actions { margin-left: auto; }
  .shortcut { display: none; }
  .studio-grid { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .result-panel { min-height: 650px; }
  .ratio-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 560px) {
  .topbar { min-height: 86px; padding: 14px 15px; }
  .topbar h1 { font-size: 22px; }
  .topbar-actions .ghost-button { width: 36px; padding: 0; font-size: 0; }
  .control-panel, .result-panel, .history-view { padding-right: 15px; padding-left: 15px; }
  .two-columns { grid-template-columns: 1fr; gap: 0; }
  .ratio-grid { grid-template-columns: repeat(2, 1fr); }
  .advanced-body { grid-template-columns: 1fr; }
  .loading-grid, .result-grid { grid-template-columns: 1fr; }
  .history-meta { flex-direction: column; }
  .history-images { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .empty-tips { flex-wrap: wrap; gap: 5px; }
  .empty-tips i { margin: 0 4px; }
  .auth-gate { padding: 14px; }
  .auth-card { padding: 30px 23px; border-radius: 18px; }
  .auth-card h1 { font-size: 27px; }
}

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