* { box-sizing: border-box; }
body { margin: 0; font: 16px system-ui, sans-serif; min-height: 100vh; display: flex; flex-direction: column; transition: background .1s; }
body.idle { background: #f3f4f6; color: #111; }
body.ok { background: #1f9d55; color: #fff; }
body.wait { background: #d99a00; color: #111; }
body.error { background: #c81e1e; color: #fff; }
header { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; background: rgba(255,255,255,.92); color: #111; flex-wrap: wrap; }
header button, dialog button { font: inherit; padding: 6px 12px; cursor: pointer; }
header input { font: inherit; padding: 6px; }
#work { flex: 1; display: flex; align-items: flex-start; }
main { flex: 1; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; gap: 10px; }
#counter { font-size: 40px; font-weight: 700; }
#sub { font-size: 18px; opacity: .85; min-height: 22px; }
#text { font-size: 56px; font-weight: 800; line-height: 1.15; max-width: 1200px; }
body.error #text { font-size: 64px; }
#detail { font-size: 28px; max-width: 1200px; }
#queue, #buffer { font-size: 16px; opacity: .8; min-height: 20px; }
#log { background: rgba(255,255,255,.92); color: #111; font: 13px Consolas, monospace; padding: 8px 16px; max-height: 160px; overflow: auto; }
#log div.err { color: #b00020; font-weight: 700; }
dialog { max-width: 720px; width: 90%; font-size: 16px; }
dialog label { display: block; margin: 10px 0; }
dialog input { display: block; font: inherit; padding: 6px; margin-top: 4px; }
#finishList div { padding: 3px 0; border-bottom: 1px solid #ddd; }
.done { color: #1f9d55; font-weight: 700; font-size: 22px; }
#finishList .head { font-weight: 700; margin-top: 8px; }
#finishList .head.bad { color: #b00020; }
#finishList .head.warn { color: #9a6700; }
#card { display: none; align-items: center; gap: 24px; background: rgba(255,255,255,.95); color: #111; border-radius: 12px; padding: 12px 20px; }
#card.show { display: flex; }
#photo { height: 260px; width: 195px; object-fit: cover; border-radius: 8px; background: #ddd; }
#photo:not([src]), #photo[src=""] { display: none; }
#art { font-size: 34px; font-weight: 700; word-break: break-all; max-width: 640px; text-align: left; }
#size { font-size: 72px; font-weight: 800; text-align: left; }
#updateBar { display: flex; gap: 12px; align-items: center; background: #ffe08a; color: #111; padding: 8px 16px; font-weight: 600; }
#updateBar[hidden], #updateBar [hidden] { display: none; }
#updateBar.err { background: #f5b5b5; }
#updateBar button { font: inherit; padding: 4px 12px; cursor: pointer; }
#updateBar a { color: #0b3d91; }
#counterRow { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
#todoBtn { font: inherit; font-size: 20px; font-weight: 700; padding: 8px 16px; cursor: pointer; }
#todo { width: 470px; height: calc(100vh - 230px); min-height: 320px; position: sticky; top: 0; display: flex; flex-direction: column; background: rgba(255,255,255,.96); color: #111; border-left: 1px solid #aaa; }
#todo[hidden] { display: none; }
#todoHead { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-size: 20px; border-bottom: 1px solid #ccc; }
#todoHead button { font: inherit; font-size: 22px; line-height: 1; padding: 2px 10px; cursor: pointer; }
#todoList { flex: 1; overflow: auto; }
.trow { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid #ddd; }
.trow img { width: 56px; height: 75px; object-fit: cover; border-radius: 6px; background: #ddd; flex: none; }
.trow img:not([src]), .trow img[src=""] { visibility: hidden; }
.tinfo { flex: 1; min-width: 0; text-align: left; }
.tart { font-size: 17px; font-weight: 700; word-break: break-all; }
.tsize { font-size: 24px; font-weight: 800; }
.tno { font-size: 14px; color: #444; }
.tprob { font-size: 13px; color: #b00020; font-weight: 600; }
.tprinted { font-size: 13px; color: #1f7a3d; font-weight: 600; min-height: 16px; }
.tprint { font: inherit; padding: 8px 14px; cursor: pointer; flex: none; }
#todoFoot { padding: 10px 14px; border-top: 1px solid #ccc; }
#printAll { font: inherit; font-size: 18px; font-weight: 700; padding: 8px 14px; width: 100%; cursor: pointer; }
#todoMsg { font-size: 14px; min-height: 18px; margin-top: 6px; }
#todoMsg.bad { color: #b00020; font-weight: 700; }
button:disabled { cursor: default; }
#intro { max-width: 640px; text-align: left; background: rgba(255,255,255,.95); color: #111; border-radius: 12px; padding: 14px 22px; margin-top: 12px; }
#intro[hidden] { display: none; }
#intro h1 { font-size: 24px; margin: 0 0 8px; }
#intro ol { margin: 0 0 10px; padding-left: 22px; }
#intro li { margin: 6px 0; }
#intro p { margin: 0; font-size: 14px; color: #444; }
.hint { font-size: 14px; color: #444; margin: 6px 0; }
dialog menu { display: flex; gap: 8px; padding: 0; margin: 12px 0 0; }
dialog menu #forgetKeys { margin-left: auto; color: #b00020; }
footer { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; padding: 8px 16px; font-size: 13px; background: rgba(255,255,255,.92); color: #444; }
footer a { color: #0b3d91; }
#ver { align-self: center; font-size: 13px; color: #555; margin-right: 6px; }
