:root {
  color-scheme: light;
  --ink: #181b19;
  --muted: #6d736f;
  --line: #dfe3df;
  --line-strong: #cbd1cc;
  --surface: #ffffff;
  --canvas: #f4f5f3;
  --soft: #f7f8f6;
  --green: #135c43;
  --green-soft: #eaf2ee;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --warning: #9a5b13;
  --warning-soft: #fff7e8;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
[hidden] { display: none !important; }
i.ph { line-height: 1; }

.login-view { min-height: 100vh; padding: 48px 24px; background: var(--canvas); }
.login-shell { display: grid; grid-template-columns: 1fr 420px; gap: 72px; width: min(100%, 980px); margin: 10vh auto 0; align-items: center; }
.login-copy { display: grid; gap: 28px; }
.login-copy p { max-width: 440px; margin: 0; color: var(--muted); font-size: 22px; line-height: 1.7; }
.login-panel { padding: 32px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.login-heading span, .panel-heading span, .task-panel-heading span, .library-heading span { color: var(--green); font-size: 12px; font-weight: 800; }
.login-heading h1 { margin: 8px 0 6px; font-size: 28px; }
.login-heading p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.auth-switch { width: 100%; margin-top: 12px; padding: 8px; border: 0; background: transparent; color: var(--green); font-size: 13px; font-weight: 800; }
.auth-switch:hover { text-decoration: underline; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 68px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 4px; background: var(--ink); color: #fff; font-weight: 800; }
.brand strong { font-size: 17px; white-space: nowrap; }
nav { display: flex; height: 68px; align-items: stretch; gap: 2px; margin-left: 44px; }
nav button { position: relative; display: inline-flex; align-items: center; gap: 8px; min-width: 108px; justify-content: center; border: 0; background: transparent; color: var(--muted); font-size: 14px; }
nav button::after { position: absolute; right: 18px; bottom: 0; left: 18px; height: 2px; background: transparent; content: ""; }
nav button:hover { color: var(--ink); }
nav button.active { color: var(--ink); font-weight: 800; }
nav button.active::after { background: var(--green); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.balance-copy { padding-right: 12px; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.balance-copy strong { margin-left: 5px; color: var(--ink); }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font-size: 18px; }
.icon-button:hover { border-color: var(--line-strong); background: var(--soft); }
.account-chip { display: flex; min-height: 40px; align-items: center; gap: 8px; padding: 4px 8px 4px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); }
.account-chip > span { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 3px; background: var(--green-soft); color: var(--green); font-weight: 800; }
.account-chip strong { max-width: 110px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-chip > i { color: var(--muted); font-size: 12px; }

main { min-width: 0; padding: 22px 24px 56px; }
.page { display: none; width: min(100%, 1380px); margin: 0 auto; }
.page.active { display: block; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, .85fr); gap: 14px; align-items: start; }
.work-panel, .task-panel, .library-panel, .account-page { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.work-panel { padding: 24px 26px 28px; }
.task-panel { position: sticky; top: 90px; min-height: 570px; padding: 22px; }
.panel-heading, .task-panel-heading, .library-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.panel-heading h1, .library-heading h1 { margin: 4px 0 0; font-size: 24px; line-height: 1.25; }
.panel-heading > i { margin-top: 4px; color: var(--green); font-size: 24px; }
.task-panel-heading h2 { margin: 4px 0 0; font-size: 19px; }

.field { position: relative; display: grid; gap: 8px; margin-top: 18px; color: var(--ink); font-size: 13px; font-weight: 800; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); outline: none; }
.field input, .field select { height: 44px; padding: 0 12px; }
.field textarea { min-height: 132px; padding: 13px 14px 28px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(19,92,67,.08); }
.prompt-field small { position: absolute; right: 11px; bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: 1fr 200px; gap: 12px; }

.generation-settings { display: grid; gap: 0; margin-top: 24px; border-top: 1px solid var(--line); }
.settings-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 10px; }
.settings-header > div { display: grid; gap: 3px; }
.settings-header span { color: var(--green); font-size: 11px; font-weight: 800; }
.settings-header strong { font-size: 14px; }
.settings-header > i { color: var(--muted); font-size: 20px; }
.setting-row { min-width: 0; margin: 0; padding: 14px 0; border: 0; border-top: 1px solid var(--line); }
.setting-row legend, .count-setting strong { padding: 0; font-size: 12px; font-weight: 800; }
.setting-row legend small { margin-left: 8px; color: var(--muted); font-size: 10px; font-weight: 400; }
.count-warning { display: block; margin-bottom: 5px; color: #9a5b13; font-size: 11px; font-style: normal; font-weight: 700; }
.ratio-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.ratio-choice { position: relative; cursor: pointer; }
.ratio-choice input, .segmented-setting input { position: absolute; opacity: 0; pointer-events: none; }
.ratio-choice > span { display: flex; min-height: 43px; align-items: center; justify-content: space-between; gap: 5px; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); }
.ratio-choice strong { font-size: 11px; }
.ratio-choice em { color: var(--muted); font-size: 9px; font-style: normal; }
.ratio-choice input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.ratio-choice input:checked + span em { color: var(--green); }
.custom-ratio { margin-top: 8px; color: var(--muted); font-size: 11px; }
.custom-ratio summary { cursor: pointer; }
.custom-ratio > div { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.custom-ratio input[type="number"] { width: 60px; height: 34px; border: 1px solid var(--line); border-radius: 3px; text-align: center; }
.custom-ratio label { display: flex; align-items: center; gap: 5px; color: var(--ink); }
.count-setting { display: flex; align-items: center; justify-content: space-between; }
.count-setting > div:first-child { display: grid; gap: 3px; }
.count-setting > div:first-child span { color: var(--muted); font-size: 10px; }
.stepper { display: grid; grid-template-columns: 36px 42px 36px; overflow: hidden; border: 1px solid var(--line); border-radius: 3px; }
.stepper button, .stepper output, .stepper input { display: grid; height: 36px; place-items: center; border: 0; background: var(--surface); }
.stepper button { color: var(--muted); }
.stepper button:hover { background: var(--soft); color: var(--ink); }
.stepper output, .stepper input { width: 42px; border-right: 1px solid var(--line); border-left: 1px solid var(--line); color: var(--green); font-size: 13px; font-weight: 800; text-align: center; }
.stepper input::-webkit-inner-spin-button { display: none; }
.segmented-setting { display: grid; grid-template-columns: 145px minmax(0, 1fr); align-items: center; gap: 16px; }
.segmented-setting > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 3px; }
.segmented-setting label { position: relative; cursor: pointer; }
.segmented-setting label + label { border-left: 1px solid var(--line); }
.segmented-setting label span { display: grid; min-height: 36px; place-items: center; background: var(--surface); color: var(--muted); font-size: 11px; }
.segmented-setting input:checked + span { background: var(--green); color: #fff; font-weight: 800; }
.segmented-setting label.locked { cursor: not-allowed; }
.segmented-setting label.locked span { gap: 1px; background: #eef0ee; color: #9aa19d; }
.segmented-setting label.locked span small { display: block; font-size: 8px; line-height: 1; }

.primary-action { display: flex; width: 100%; min-height: 50px; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; border: 0; border-radius: 4px; background: var(--green); color: #fff; font-size: 14px; font-weight: 800; }
.primary-action:hover { background: #0e4d38; }
.primary-action:disabled { background: #8fa99e; cursor: wait; }
.generation-time-hint { display: flex; align-items: center; gap: 8px; margin: 16px 0 -8px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.generation-time-hint i { flex: 0 0 auto; color: var(--green); font-size: 17px; }
.generation-time-hint strong { color: var(--ink); }
.primary-button, .secondary-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border-radius: 4px; font-size: 12px; font-weight: 800; }
.primary-button { border: 0; background: var(--green); color: #fff; }
.primary-button:disabled { background: #aab4af; cursor: not-allowed; }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.text-button { display: flex; min-height: 42px; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 14px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--green); font-size: 12px; font-weight: 800; }

.compact-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.section-copy { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 12px; }
.section-copy > span { display: grid; flex: 0 0 28px; height: 28px; place-items: center; border-radius: 3px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; }
.section-copy h2 { margin: 0; font-size: 15px; }
.section-copy p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.drop-zone { display: grid; min-height: 112px; place-items: center; align-content: center; gap: 5px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--soft); text-align: center; cursor: pointer; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone > i { color: var(--green); font-size: 24px; }
.drop-zone strong { font-size: 13px; }
.drop-zone em { color: var(--muted); font-size: 10px; font-style: normal; }
.inline-status, .error-message { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--green); background: var(--green-soft); color: var(--green); font-size: 11px; line-height: 1.5; }
.inline-status.error, .error-message { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.select-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.select-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.select-card.selected { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.select-card input { position: absolute; opacity: 0; }
.select-card img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.select-card > span { display: grid; gap: 2px; padding: 7px; }
.select-card strong { font-size: 10px; }
.select-card em { overflow: hidden; color: var(--muted); font-size: 9px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.select-card > i { position: absolute; top: 5px; right: 5px; display: none; width: 22px; height: 22px; place-items: center; border-radius: 3px; background: var(--green); color: #fff; font-size: 11px; font-style: normal; }
.select-card.selected > i { display: grid; }
.preview-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; margin-top: 10px; }
.preview-strip figure { min-width: 0; margin: 0; }
.preview-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.preview-strip figcaption { overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.today-task-list { display: grid; gap: 0; }
.today-task-item { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 4px 11px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.today-task-item > img, .task-icon { display: grid; grid-row: 1 / 3; width: 58px; height: 58px; place-items: center; border-radius: 3px; background: var(--soft); object-fit: cover; }
.task-icon { color: var(--muted); font-size: 21px; }
.today-task-item.failed .task-icon { background: var(--danger-soft); color: var(--danger); }
.today-task-copy { display: grid; min-width: 0; gap: 4px; }
.today-task-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.today-task-copy span, .today-task-copy small { color: var(--muted); font-size: 10px; }
.today-task-copy small { overflow: hidden; color: var(--danger); text-overflow: ellipsis; white-space: nowrap; }
.today-task-item > b { align-self: start; padding: 4px 6px; border-radius: 3px; background: var(--soft); color: var(--muted); font-size: 9px; }
.today-task-item.queued > b, .today-task-item.running > b, .today-task-item.upstream-confirming > b, .today-task-item.canceling > b { background: var(--warning-soft); color: var(--warning); }
.today-task-item.succeeded > b { background: var(--green-soft); color: var(--green); }
.today-task-item.partial > b { background: var(--warning-soft); color: var(--warning); }
.today-task-item.failed > b, .today-task-item.canceled > b { background: var(--danger-soft); color: var(--danger); }
.today-task-item > button { grid-column: 3; display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; border: 1px solid #efb4ae; border-radius: 3px; background: #fff; color: var(--danger); font-size: 9px; font-weight: 800; }
.retry-error { grid-column: 1 / -1; margin: 5px 0 0; color: var(--danger); font-size: 10px; }

.library-panel, .account-page { padding: 26px; }
.library-heading p { max-width: 700px; margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.task-list { display: grid; gap: 8px; margin: 20px 0; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px 16px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.task-row > span { display: grid; min-width: 0; gap: 3px; }
.task-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.task-row em { color: var(--muted); font-size: 10px; font-style: normal; }
.task-row > b { padding: 5px 7px; border-radius: 3px; background: var(--soft); color: var(--muted); font-size: 10px; }
.task-row.running > b, .task-row.queued > b, .task-row.upstream-confirming > b, .task-row.canceling > b { background: var(--warning-soft); color: var(--warning); }
.task-row.succeeded > b { background: var(--green-soft); color: var(--green); }
.task-row.partial > b { background: var(--warning-soft); color: var(--warning); }
.task-row.failed > b, .task-row.canceled > b { background: var(--danger-soft); color: var(--danger); }
.generation-timer { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 2px; border-top: 1px solid var(--line); }
.generation-timer > span { display: flex; min-width: 0; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.generation-timer > span i { color: var(--green); font-size: 15px; }
.generation-timer > span strong { overflow: visible; color: var(--ink); font-size: 10px; white-space: nowrap; }
.generation-timer > span em { font-style: normal; white-space: nowrap; }
.generation-timer button { min-height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 3px; background: var(--soft); color: var(--muted); font-size: 9px; font-weight: 800; }
.generation-timer button:disabled { cursor: not-allowed; opacity: .72; }
.generation-timer.cancel-ready button { border-color: var(--danger); background: var(--danger); color: #fff; box-shadow: 0 0 0 3px rgba(180,35,24,.1); }
.generation-timer.cancel-ready button:hover { background: #8f1c13; }
.generation-timer.compact { grid-column: 1 / -1; padding-top: 8px; }
.generation-timer.compact > span { flex-wrap: wrap; gap: 3px 6px; }
.generation-timer.compact button { flex: 0 0 auto; }
.task-failure { display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px 12px; padding-top: 10px; border-top: 1px solid #f0c6c2; }
.task-failure p { grid-column: 1 / -1; margin: 0; color: var(--danger); font-size: 10px; line-height: 1.5; }
.task-failure p strong { overflow: visible; white-space: normal; }
.task-failure span { color: var(--muted); font-size: 10px; }
.task-failure.partial-result { border-top-color: #efd7b7; }
.task-failure.partial-result p { color: var(--warning); }
.task-failure.upstream-confirming-result { border-top-color: #efd7b7; }
.task-failure.upstream-confirming-result p { color: var(--warning); }
.task-failure.canceled-result { border-top-color: #f0c6c2; }
.task-failure button, .image-card button { display: inline-flex; min-height: 32px; align-items: center; justify-content: center; gap: 5px; padding: 0 10px; border: 1px solid var(--line); border-radius: 3px; background: #fff; color: var(--ink); font-size: 10px; font-weight: 800; }
.download-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 22px 0 14px; padding: 13px 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--soft); }
.download-toolbar > div { display: grid; gap: 2px; }
.download-toolbar span { color: var(--muted); font-size: 10px; }
.download-toolbar .download-actions { display: flex; grid-auto-flow: column; align-items: center; gap: 8px; }
.download-toolbar .download-actions span { color: inherit; font-size: inherit; }
.image-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.image-card { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.image-card.selected { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); }
.image-card > img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--soft); }
.image-card > div { display: grid; gap: 5px; padding: 10px; }
.image-card > div > span { color: var(--green); font-size: 9px; font-weight: 800; }
.image-card > div > strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.image-card .asset-slot { color: var(--muted); font-size: 9px; line-height: 1.45; }
.image-card button { margin-top: 3px; color: var(--green); }
.asset-selector { position: absolute; z-index: 1; top: 7px; right: 7px; display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid rgba(255,255,255,.9); border-radius: 3px; background: rgba(24,27,25,.6); color: transparent; cursor: pointer; }
.asset-selector input { position: absolute; opacity: 0; }
.asset-selector:has(input:checked) { border-color: var(--green); background: var(--green); color: #fff; }
.asset-selector span { color: inherit; font-size: 13px; }

.account-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.profile-panel, .balance-panel, .account-actions { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.profile-panel { display: flex; align-items: center; gap: 14px; padding: 22px; }
.profile-panel > span { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 4px; background: var(--green-soft); color: var(--green); font-size: 19px; font-weight: 800; }
.profile-panel div, .balance-panel { display: grid; gap: 4px; }
.profile-panel small, .balance-panel span { color: var(--muted); font-size: 10px; }
.profile-panel strong { font-size: 17px; }
.profile-panel em { color: var(--muted); font-size: 10px; font-style: normal; }
.balance-panel { padding: 22px; }
.balance-panel strong { font-size: 28px; }
.balance-panel small { margin-top: 6px; color: var(--muted); }
.balance-panel small b { margin-left: 4px; color: var(--ink); }
.balance-panel button { justify-self: start; min-height: 36px; margin-top: 8px; padding: 0 15px; border: 0; border-radius: 3px; background: var(--green); color: #fff; font-size: 11px; font-weight: 800; }
.account-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 12px; padding: 18px 20px; }
.account-actions p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.account-actions button { min-height: 36px; padding: 0 13px; border: 1px solid #efb4ae; border-radius: 3px; background: #fff; color: var(--danger); font-size: 11px; font-weight: 800; }

.empty-state { display: grid; grid-column: 1 / -1; min-height: 150px; place-items: center; align-content: center; gap: 6px; border: 1px dashed var(--line); border-radius: 4px; color: var(--muted); text-align: center; }
.empty-state.compact { min-height: 92px; }
.empty-state i { font-size: 22px; }
.empty-state strong { color: var(--ink); font-size: 12px; }
.empty-state span { font-size: 10px; }
.fatal-error { position: fixed; z-index: 50; right: 18px; bottom: 18px; max-width: 420px; padding: 12px 14px; border-radius: 4px; background: var(--danger); color: #fff; font-size: 12px; }

@media (max-width: 1040px) {
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; padding: 0 16px; }
  nav { margin-left: 20px; }
  nav button { min-width: 92px; }
  .balance-copy { display: none; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .task-panel { position: static; min-height: 0; }
  .today-task-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
}

@media (max-width: 720px) {
  .login-shell { grid-template-columns: 1fr; gap: 32px; margin-top: 2vh; }
  .login-copy p { font-size: 17px; }
  .topbar { position: static; display: flex; min-height: auto; flex-wrap: wrap; padding: 12px 14px 0; }
  .topbar > .brand { flex: 1; }
  .topbar-actions .icon-button { display: none; }
  nav { order: 3; width: calc(100% + 28px); height: 52px; margin: 10px -14px 0; overflow-x: auto; border-top: 1px solid var(--line); }
  nav button { flex: 1 0 104px; min-width: 104px; }
  main { padding: 12px 10px 36px; }
  .work-panel, .task-panel, .library-panel, .account-page { padding: 18px 15px; }
  .panel-heading h1, .library-heading h1 { font-size: 21px; }
  .ratio-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented-setting { grid-template-columns: 1fr; gap: 8px; }
  .form-grid, .account-layout { grid-template-columns: 1fr; }
  .today-task-list { grid-template-columns: 1fr; }
  .select-grid, .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .download-toolbar { align-items: stretch; flex-direction: column; }
  .download-toolbar .download-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .task-failure { grid-template-columns: 1fr; }
  .task-failure button { justify-self: start; }
  .generation-timer { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 420px) {
  .brand strong { font-size: 15px; }
  .account-chip > strong, .account-chip > i { display: none; }
  .setting-row legend small { display: block; margin: 4px 0 0; }
  .select-grid, .image-grid { grid-template-columns: 1fr 1fr; }
  .library-heading { flex-direction: column; }
  .account-actions { align-items: flex-start; flex-direction: column; }
}
