:root {
  --bg: #151212; --panel: #1e1a1b; --panel-2: #241f20; --ivory: #f6f1e8; --dim: #c9bfb2; --muted: #8a8686;
  --gold: #c9a46c; --gold-2: #e2c48d; --line: rgba(255,255,255,.12); --gold-line: rgba(201,164,108,.28);
  --rose: #e8577a; --rose-2: #f07895; --rose-soft: rgba(232,87,122,.14); --ok: #7fc8a0; --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ivory); font: 15px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", sans-serif; }
body { background: radial-gradient(1200px 600px at 50% -12%, rgba(232,87,122,.14), transparent 60%), var(--bg); min-height: 100vh; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--rose-2); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.login-card { width: min(440px, 100%); padding: 44px 38px 34px; border: 1px solid var(--line); border-radius: 28px; background: rgba(18,14,16,.88); display: grid; gap: 16px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.brand { margin: 0; color: var(--rose); letter-spacing: .28em; font-size: 12px; font-weight: 600; text-align: center; }
.login-card h1 { margin: 0; text-align: center; font-size: 32px; font-weight: 500; font-family: "Songti SC", "Noto Serif CJK SC", serif; letter-spacing: .08em; }
.note { margin: 0; text-align: center; color: var(--muted); font-size: 14px; }
input[type=password], textarea { width: 100%; background: #121011; border: 1px solid var(--line); border-radius: 12px; color: var(--ivory); padding: 12px 14px; font: inherit; outline: none; transition: border-color .15s; }
input[type=password]:focus, textarea:focus { border-color: var(--rose); }
textarea { resize: vertical; min-height: 96px; }

/* layout */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 14px 24px; background: rgba(21,18,18,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.logo { font-size: 17px; font-weight: 600; letter-spacing: .06em; display: flex; flex-direction: column; line-height: 1.2; }
.logo span { font-size: 11px; font-weight: 400; color: var(--gold); letter-spacing: .08em; margin-top: 3px; }
.tabs { display: flex; gap: 6px; margin: 0 auto; background: #120f10; border: 1px solid var(--line); padding: 4px; border-radius: 999px; }
.tabs button { border: 0; background: transparent; padding: 7px 22px; border-radius: 999px; color: var(--dim); font-size: 14px; }
.tabs button.on { background: var(--rose); color: #fff; box-shadow: 0 6px 18px rgba(232,87,122,.35); }
.spend { font-size: 12px; color: var(--muted); white-space: nowrap; }
.spend b { color: var(--gold-2); font-weight: 500; }
main { width: min(1080px, 100%); margin: 0 auto; padding: 28px 20px 80px; }
.page-head { margin: 6px 0 18px; }
.page-head.with-side { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; font-weight: 500; letter-spacing: .06em; }
.lede { margin: 0; color: var(--muted); font-size: 14px; }
.section-title { font-size: 13px; letter-spacing: .14em; color: var(--gold); margin: 30px 0 12px; font-weight: 500; }

/* form */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; }
.form { display: grid; gap: 8px; }
.field-label { display: block; margin: 10px 0 6px; font-size: 13px; color: var(--dim); letter-spacing: .04em; }
.field-label em { font-style: normal; color: var(--muted); font-size: 12px; margin-left: 6px; }
.hint { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 720px) { .row { grid-template-columns: 1fr; gap: 0; } .top { flex-wrap: wrap; padding: 10px 14px; } .tabs { order: 3; width: 100%; justify-content: center; } }
.seg { display: inline-flex; gap: 6px; flex-wrap: nowrap; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: #151213; padding: 6px 14px; border-radius: 999px; font-size: 13px; color: var(--dim); transition: all .15s; }
.seg button:hover { border-color: var(--gold-line); }
.seg button.on { border-color: var(--rose); color: var(--ivory); background: var(--rose-soft); }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
input[type=range] { width: 100%; accent-color: var(--rose); margin-top: 8px; }

.drop { border: 1px dashed var(--gold-line); border-radius: 14px; padding: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-height: 104px; background: rgba(255,255,255,.015); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--rose); background: var(--rose-soft); }
.thumbs { display: contents; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #241f1f; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .idx { position: absolute; left: 4px; top: 4px; background: rgba(0,0,0,.6); font-size: 11px; padding: 0 6px; border-radius: 6px; }
.thumb .x { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); font-size: 13px; line-height: 22px; padding: 0; }
.add { border: 1px solid var(--line); background: #171415; color: var(--dim); border-radius: 10px; padding: 0 16px; height: 84px; font-size: 13px; }
.add:hover { border-color: var(--rose); color: var(--ivory); }
.drop.single.has .add { display: none; }

.submit-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.estimate { font-size: 13.5px; color: var(--dim); }
.estimate b { color: var(--gold-2); font-size: 18px; font-weight: 500; margin: 0 2px; }
.estimate small { display: block; color: var(--muted); font-size: 12px; }
.btn { border: 1px solid var(--line); border-radius: 999px; padding: 10px 26px; background: #1b1718; font-size: 14px; }
.btn.primary { background: linear-gradient(135deg, var(--rose), #d1406a); border-color: transparent; color: #fff; font-weight: 500; box-shadow: 0 10px 26px rgba(232,87,122,.3); }
.btn.primary:disabled { opacity: .5; cursor: wait; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; }
.err { color: #ff8fa6; font-size: 13.5px; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }

/* results */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.empty { grid-column: 1 / -1; color: var(--muted); font-size: 13.5px; text-align: center; padding: 30px 0; border: 1px dashed var(--line); border-radius: 14px; margin: 0; }
.item { background: #1b1717; border: 1px solid var(--gold-line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; transition: transform .15s, border-color .15s; }
.item:hover { border-color: rgba(201,164,108,.55); transform: translateY(-1px); }
.media { position: relative; aspect-ratio: 3 / 4; background: #241f1f; cursor: zoom-in; overflow: hidden; }
.media img, .media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media .badge { position: absolute; left: 8px; top: 8px; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: rgba(0,0,0,.6); color: var(--gold-2); }
.pending, .failed { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 14px; cursor: default; }
.pending { background: linear-gradient(100deg, #231e1e 30%, #2e2828 50%, #231e1e 70%); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; }
.pending .stage { font-size: 14px; color: var(--ivory); }
.pending .elapsed { font-size: 12px; color: var(--muted); margin-top: 4px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(232,87,122,.25); border-top-color: var(--rose); animation: spin 1s linear infinite; margin: 0 auto 10px; }
.failed { background: #1d1517; color: #ffb3c2; font-size: 13px; line-height: 1.55; }
.failed strong { display: block; color: #ff8fa6; margin-bottom: 4px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.meta { padding: 9px 11px 11px; display: grid; gap: 7px; }
.meta .p { font-size: 12.5px; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.meta .sub { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button, .actions a { border: 1px solid var(--line); background: #151213; color: var(--dim); border-radius: 999px; padding: 3px 10px; font-size: 12px; text-decoration: none; }
.actions button:hover, .actions a:hover { border-color: var(--rose); color: var(--ivory); }
.actions .main { border-color: rgba(232,87,122,.5); color: var(--rose-2); }

.usage { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.usage .u { flex: 1 1 180px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; }
.usage .u span { font-size: 12px; color: var(--muted); display: block; }
.usage .u b { font-size: 20px; color: var(--gold-2); font-weight: 500; }
.usage .u i { font-style: normal; font-size: 12px; color: var(--dim); margin-left: 6px; }
.usage p { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--muted); }
.more { text-align: center; margin-top: 18px; }

/* detail */
.detail { width: min(980px, calc(100% - 24px)); max-height: calc(100vh - 40px); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ivory); padding: 0; }
.detail::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(3px); }
.d-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 760px) { .d-wrap { grid-template-columns: 1fr; } }
.d-media { background: #0e0c0c; display: grid; place-items: center; min-height: 320px; max-height: calc(100vh - 40px); }
.d-media img, .d-media video { max-width: 100%; max-height: calc(100vh - 40px); display: block; }
.d-info { padding: 22px 22px 20px; display: grid; gap: 12px; align-content: start; overflow: auto; max-height: calc(100vh - 40px); }
.d-info h3 { margin: 0; font-weight: 500; font-size: 18px; }
.d-info .close { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; font-size: 22px; color: var(--muted); }
.d-prompt { background: #141112; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.kv { display: grid; grid-template-columns: 74px 1fr; gap: 4px 10px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--dim); }
.d-inputs { display: flex; gap: 8px; flex-wrap: wrap; }
.d-inputs img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.d-err { background: #22161a; border: 1px solid rgba(232,87,122,.35); border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #ffc2cf; }
.d-err code { display: block; margin-top: 6px; color: var(--muted); font-size: 11.5px; word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #2a2224; border: 1px solid var(--gold-line); color: var(--ivory); padding: 10px 18px; border-radius: 999px; font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
