* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0f0f1a; --surface: #1a1a2e; --surface2: #16213e;
  --primary: #e94560; --primary-hover: #ff6b81;
  --text: #eaeaea; --text-muted: #8888aa; --border: #2a2a4a;
  --success: #2ecc71; --radius: 12px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
.hidden { display: none !important; }
#login-screen { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
#login-screen .card { max-width: 360px; width: 100%; text-align: center; padding: 2rem; }
h1 { font-size: 1.6rem; color: var(--primary); }
.subtitle { color: var(--text-muted); margin: 0.4rem 0 1.5rem; font-size: 0.9rem; }
h2 { font-size: 1.05rem; font-weight: 600; }
input, textarea { width: 100%; padding: 0.7rem 0.9rem; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.9rem; outline: none; font-family: inherit; margin-bottom: 0.75rem; }
input:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; margin-bottom: 0; }
button { cursor: pointer; border: none; border-radius: 8px; font-size: 0.9rem; font-weight: 500; transition: background 0.2s, opacity 0.2s; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
#login-form button { width: 100%; padding: 0.7rem; background: var(--primary); color: #fff; margin-top: 0.25rem; }
#login-form button:hover { background: var(--primary-hover); }
.error { color: var(--primary); font-size: 0.85rem; margin-top: 0.5rem; }
header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); }
header h1 { margin: 0; font-size: 1.25rem; }
nav { display: flex; align-items: center; gap: 0.75rem; color: var(--text-muted); font-size: 0.85rem; }
.btn-small { padding: 0.35rem 0.7rem; background: var(--surface2); color: var(--text-muted); font-size: 0.8rem; border: 1px solid var(--border); border-radius: 6px; }
.btn-small:hover { color: var(--text); border-color: var(--text-muted); }
.btn-primary { padding: 0.55rem 1rem; background: var(--primary); color: #fff; font-weight: 600; border-radius: 8px; }
.btn-primary:hover { background: var(--primary-hover); }
#status-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 1.5rem; font-size: 0.75rem; color: var(--text-muted); background: var(--surface2); border-bottom: 1px solid var(--border); }
#comfyui-dot { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; flex-shrink: 0; }
main { max-width: 620px; margin: 1.5rem auto; padding: 0 1rem; display: flex; flex-direction: column; gap: 1.5rem; }
#toolbar { display: flex; gap: 0.75rem; }
#history-section { display: flex; flex-direction: column; gap: 0.75rem; }
.history-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; cursor: pointer; transition: border-color 0.2s; }
.history-card:hover { border-color: var(--primary); }
.history-card .hc-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.4rem; }
.history-card .hc-action { font-weight: 600; font-size: 0.85rem; padding: 0.15rem 0.5rem; border-radius: 5px; }
.hc-action.edit { background: #2d4a3e; color: var(--success); }
.hc-action.video { background: #3a2d4a; color: #b39ddb; }
.history-card .hc-status { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 5px; }
.hc-status.running { background: #4a3d2d; color: #ffb74d; }
.hc-status.complete { background: #2d4a3e; color: var(--success); }
.hc-status.error { background: #4a2d2d; color: var(--primary); }
.history-card .hc-prompt { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-card .hc-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem; font-size: 0.9rem; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 0.4rem; }
.upload-area { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.5rem; text-align: center; cursor: pointer; margin-bottom: 0.75rem; }
.upload-area:hover { border-color: var(--primary); }
.upload-icon { font-size: 2rem; color: var(--text-muted); display: block; margin-bottom: 0.3rem; }
.upload-area p { color: var(--text-muted); font-size: 0.85rem; }
#preview { max-width: 100%; max-height: 240px; border-radius: 8px; }
.actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.btn-action { flex: 1; padding: 0.6rem; background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-action:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); }
#progress-log, #detail-log { list-style: none; max-height: 280px; overflow-y: auto; padding: 0.25rem 0; }
#progress-log li, #detail-log li { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: flex-start; gap: 0.5rem; transition: background 0.3s; }
#progress-log li.current, #detail-log li.current { background: var(--surface2); color: var(--text); }
.step-num { flex-shrink: 0; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface2); border-radius: 50%; font-size: 0.7rem; color: var(--text-muted); font-weight: 600; }
#progress-log li.current .step-num, #detail-log li.current .step-num { background: var(--primary); color: #fff; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0.75rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
#upload-result img, #upload-result video, #detail-result img, #detail-result video { max-width: 100%; border-radius: 8px; }
#upload-result video, #detail-result video { max-height: 350px; }
#upload-result a, #detail-result a { color: var(--primary); text-decoration: none; display: inline-block; margin: 0.4rem 0; font-size: 0.85rem; }
#upload-result a:hover, #detail-result a:hover { text-decoration: underline; }
#detail-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }
