/* Publish-Assistant web app. Colors follow publish-assistant.com: dark header #17140F, cream #F3EEE6, amber #F2B33D. */
:root {
  --ink: #17140F; --ink-2: #3c4456; --muted: #6b7280; --paper: #FAF7F2; --card: #FFFFFF; --line: #E4DDD1;
  --amber: #F2B33D; --amber-dark: #c98f17; --green: #107C10; --red: #c4302b; --blue: #1a5fb4;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif; font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper); }
header { background: var(--ink); color: #F3EEE6; height: 64px; display: flex; align-items: center; padding: 0 20px; gap: 16px; }
header .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
header .brand i { width: 22px; height: 22px; border-radius: 5px; background: var(--amber); display: block; }
header .spacer { flex: 1; }
header .spend { color: #B9B0A3; font-size: 14px; }
header button { background: var(--amber); color: var(--ink); border: 1px solid var(--amber); font-weight: 700; padding: 9px 18px; }
header button:hover { background: #F7C55E; }
main { max-width: 980px; margin: 0 auto; padding: 20px; display: grid; gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
button { font: inherit; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
button:hover { background: #f3efe8; }
button.primary { background: var(--amber); border-color: var(--amber); font-weight: 700; }
button.primary:hover { background: #F7C55E; }
button.danger { color: var(--red); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select, textarea { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; margin: 8px 0 4px; font-weight: 600; font-size: 14px; }
label .restore { margin-left: 10px; padding: 3px 10px; font-size: 13px; font-weight: 600; background: #FFF6DF; border-color: var(--amber); }
label .restore:hover { background: var(--amber); }
.brand { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 700px) { .brand { grid-template-columns: 1fr 1fr; } }
.brand .row { flex-wrap: nowrap; }
.brand input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; flex-shrink: 0; }
.brand input[type=text] { font-family: Consolas, monospace; }
h3 .restore { margin-left: 10px; padding: 3px 10px; font-size: 13px; font-weight: 600; background: #FFF6DF; border-color: var(--amber); }
details.rules { margin: 4px 0 10px; }
details.rules summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 600; }
details.rules pre { white-space: pre-wrap; font: 13px/1.45 'Segoe UI', system-ui, sans-serif; background: #F1EEE8; color: #4b4b4b; border: 1px dashed #cfc6b8; border-radius: 8px; padding: 10px; margin: 6px 0 0; max-height: 260px; overflow: auto; }
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; margin: 0 14px 0 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .grid2 { grid-template-columns: 1fr; } }

#drop { border: 2px dashed #b9b0a3; border-radius: 14px; padding: 34px 18px; text-align: center; background: #fff; transition: background .15s; }
#drop.over { background: #FFF6DF; border-color: var(--amber); }
#drop .big { font-size: 20px; font-weight: 700; }
#drop input { display: none; }

#status { font-weight: 600; min-height: 24px; }
#status.busy { color: var(--blue); }
#status.ok { color: var(--green); }
#status.err { color: var(--red); }
.bar { height: 10px; background: #eee4d4; border-radius: 5px; overflow: hidden; margin: 8px 0; }
.bar i { display: block; height: 100%; width: 0; background: var(--amber); transition: width .2s; }
#elapsed { font-variant-numeric: tabular-nums; }

#results { display: none; }
#results.show { display: block; }
.out { white-space: pre-wrap; background: #FBF9F5; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 14px; max-height: 320px; overflow: auto; }
#thumbPreview { max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--line); display: none; }
#thumbPreview.show { display: block; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 20px; max-width: min(960px, 94vw); width: 100%; color: var(--ink); }
dialog::backdrop { background: rgba(23, 20, 15, .55); }
dialog h2 { margin-top: 0; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.titles li { display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.titles li:hover { background: #FFF6DF; }
.titles li.sel { background: #FFEBB8; }
.titles .score { font-weight: 700; color: var(--green); text-align: right; }
.titles ul { list-style: none; padding: 0; margin: 0; }

.concept { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.concept.off { opacity: .5; }
.concept input[type=text] { margin-bottom: 6px; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.thumbs.vertical { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.thumb { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.thumb img { width: 100%; border-radius: 6px; cursor: pointer; }
.thumb .fail { background: #fde8e7; color: var(--red); padding: 30px 10px; border-radius: 6px; font-size: 13px; }

.photos { display: flex; gap: 10px; flex-wrap: wrap; }
.photo { position: relative; width: 110px; }
.photo img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo button { position: absolute; top: 4px; right: 4px; padding: 2px 7px; font-size: 12px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; }
.tabs button.on { border-bottom-color: var(--amber); font-weight: 700; }
.tab { display: none; }
.tab.on { display: block; }

#toast { position: fixed; right: 18px; bottom: 18px; background: var(--ink); color: #F3EEE6; padding: 12px 16px; border-radius: 10px; max-width: 420px; display: none; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#toast.show { display: block; }
#log { font: 12px/1.4 Consolas, monospace; background: #111; color: #ccc; padding: 10px; border-radius: 8px; max-height: 160px; overflow: auto; display: none; white-space: pre-wrap; }
#log.show { display: block; }
.queue li { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.queue ul { list-style: none; padding: 0; margin: 0; }
