/* Hallmark · shape: app screen · genre: modern-minimal · theme: Cobalt (deal 2/3, seed personal-utility-toolbox-prompt-e087·ed1f98d4·2026-11-19·r0)
 * nav: top bar, wordmark and one settings link · signature: the ordered image tray beside the finished prompt · states: empty, loading, error, full
 * axes: light/grotesk-sans/cool · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P2 H2 E2 S2 R2 V2 · weakest: S, the ASCII field is left out on purpose so the tool stays quiet; the image tray carries the screen instead */
@import url("./tokens.css");
@import url("./base.css");

:root {
  --bar-h: 56px;
  --color-ok: oklch(52% 0.13 155);
  --color-error: oklch(52% 0.19 25);
  --color-error-wash: oklch(96% 0.025 25);
  --shadow-seg: 0 1px 0 var(--color-key-edge), 0 1px 3px oklch(21% 0.028 262 / 0.12);
  --shadow-toast: 0 8px 24px oklch(21% 0.028 262 / 0.25);
}

body { min-height: 100dvh; display: flex; flex-direction: column; }
main { flex: 1; }

/* ---------- top bar ---------- */
.bar { position: sticky; top: 0; z-index: 10; background: color-mix(in oklab, var(--color-paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: var(--rule-hair) solid var(--color-rule); }
.bar__in { height: var(--bar-h); display: flex; align-items: center; gap: var(--space-md); }
.wordmark { font: 600 var(--text-md)/1 var(--font-display); letter-spacing: var(--tracking-display); text-decoration: none; color: var(--color-ink); display: inline-flex; align-items: baseline; gap: var(--space-3xs); }
.wordmark span { color: var(--color-muted); font-weight: 500; }
.crumb { color: var(--color-muted); font-size: var(--text-sm); display: flex; align-items: center; gap: var(--space-xs); min-width: 0; }
.crumb b { color: var(--color-ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__end { margin-left: auto; display: flex; align-items: center; gap: var(--space-sm); }
.keystate { white-space: nowrap; font-size: var(--text-sm); color: var(--color-muted); display: inline-flex; align-items: center; gap: var(--space-2xs); text-decoration: none; padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-input); }
.keystate:hover { color: var(--color-ink); background: var(--color-paper-2); }
.keystate svg { width: 16px; height: 16px; }
.keystate[data-ok="true"] svg { color: var(--color-ok); }
.keystate[data-ok="false"] svg { color: var(--color-error); }

/* ---------- buttons (keycaps) ---------- */
.key { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-input); padding: 0 var(--space-md); min-height: 40px; background: var(--color-key-face); color: var(--color-ink); font: 500 var(--text-sm)/1 var(--font-display); box-shadow: var(--shadow-key); cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.key svg { width: 16px; height: 16px; flex: none; }
.key:hover { transform: translateY(-1px); }
.key:active { transform: translateY(3px); box-shadow: var(--shadow-key-press); }
.key:disabled { cursor: not-allowed; opacity: 0.55; transform: none; }
.key--primary { background: var(--color-accent); border-color: var(--color-accent-edge); color: var(--color-accent-ink); box-shadow: var(--shadow-key-accent); }
.key--lg { min-height: 48px; padding: 0 var(--space-lg); font-size: var(--text-md); }
.key--sm { min-height: 32px; padding: 0 var(--space-sm); font-size: var(--text-xs); box-shadow: 0 2px 0 0 var(--color-key-edge); }
.key--sm:active { transform: translateY(2px); }
.key[data-done="true"] { color: var(--color-ok); }
.key--primary[data-done="true"] { color: var(--color-accent-ink); }
.ghost { background: none; border: 0; padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius-input); color: var(--color-muted); font: 500 var(--text-xs)/1 var(--font-display); cursor: pointer; }
.ghost:hover { color: var(--color-error); background: var(--color-error-wash); }

/* ---------- surfaces ---------- */
.cut { border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); box-shadow: var(--shadow-card); }
@supports (corner-shape: bevel) { .cut { border-radius: var(--cut-l) 4px var(--cut-l) 4px; corner-shape: bevel round bevel round; } }

.label { display: block; font: 500 var(--text-sm)/1.3 var(--font-display); color: var(--color-ink); }
.hint { font-size: var(--text-sm); color: var(--color-muted); }
.field { width: 100%; border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-input); background: var(--color-key-face); color: var(--color-ink); padding: var(--space-xs) var(--space-sm); line-height: 1.5; transition: border-color var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out); }
.field::placeholder { color: var(--color-muted); }
.field:hover { border-color: var(--color-muted); }
.field:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-wash); }
.field:focus-visible { outline: none; }
textarea.field { resize: vertical; min-height: 160px; }
.mono { font-family: var(--font-outlier); font-size: var(--text-sm); }

/* ---------- home: tool ledger ---------- */
.home { padding-block: var(--space-2xl) var(--space-3xl); }
.home__head { display: flex; align-items: end; justify-content: space-between; gap: var(--space-lg); flex-wrap: wrap; margin-bottom: var(--space-lg); }
.home__head h1 { font-size: var(--text-3xl); }
.home__head p { color: var(--color-muted); margin-top: var(--space-xs); }
.search { position: relative; width: min(100%, 320px); }
.search .field { padding-left: 36px; }
.search svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--color-muted); pointer-events: none; }
.search kbd { position: absolute; right: 8px; top: 50%; translate: 0 -50%; font: 500 var(--text-xs)/1 var(--font-outlier); color: var(--color-muted); border: var(--rule-hair) solid var(--color-rule-2); border-radius: 4px; padding: var(--space-3xs) var(--space-2xs); background: var(--color-paper-2); }

.ledger { list-style: none; margin: 0; padding: 0; border-top: var(--rule-hair) solid var(--color-rule); }
.ledger li { border-bottom: var(--rule-hair) solid var(--color-rule); }
.row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: var(--space-md); padding: var(--space-md) var(--space-sm); text-decoration: none; color: inherit; border-radius: var(--radius-input); transition: background-color var(--dur-micro) var(--ease-out); }
.row:hover { background: var(--color-paper-2); }
.row:hover .row__go { color: var(--color-accent); transform: translateX(2px); }
.row__ico { width: 48px; height: 48px; display: grid; place-items: center; border: var(--rule-hair) solid var(--color-rule); border-radius: var(--radius-input); background: var(--color-paper-2); color: var(--color-accent); }
.row__ico svg { width: 22px; height: 22px; }
.row h2 { font-size: var(--text-lg); max-width: none; }
.row p { color: var(--color-muted); font-size: var(--text-sm); margin-top: var(--space-3xs); }
.row__meta { display: flex; align-items: center; gap: var(--space-md); color: var(--color-muted); font-size: var(--text-sm); }
.row__go { width: 20px; height: 20px; transition: transform var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.row--soon { opacity: 0.6; pointer-events: none; }
.empty-search { padding: var(--space-xl) var(--space-sm); color: var(--color-muted); }

/* ---------- tool screen ---------- */
.tool { padding-block: var(--space-xl) var(--space-3xl); }
.tool__head { margin-bottom: var(--space-lg); }
.tool__head h1 { font-size: var(--text-2xl); max-width: none; }
.tool__head p { color: var(--color-muted); margin-top: var(--space-2xs); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--gap-columns); align-items: start; }
.panel { padding: var(--space-lg); display: grid; gap: var(--space-lg); }
.panel + .panel { margin-top: var(--space-lg); }
.stack { display: grid; gap: var(--space-xs); }
.row-end { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }
.sticky { position: sticky; top: calc(var(--bar-h) + var(--space-md)); }

/* image drop slots */
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.slot { position: relative; aspect-ratio: 1; border: 1.5px dashed var(--color-rule-2); border-radius: var(--radius-input); background: var(--color-paper-2); display: grid; place-items: center; text-align: center; padding: var(--space-xs); cursor: pointer; color: var(--color-muted); transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.slot:hover, .slot[data-over="true"] { border-color: var(--color-accent); background: var(--color-accent-wash); color: var(--color-ink); }
.slot:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.slot__t { font: 500 var(--text-sm)/1.25 var(--font-display); color: var(--color-ink); }
.slot__s { display: block; font-size: var(--text-xs); margin-top: var(--space-3xs); }
.slot__plus { display: block; width: 20px; height: 20px; margin: 0 auto var(--space-2xs); }
.slot__plus svg { width: 100%; height: 100%; }
.slot[data-filled="true"] { border-style: solid; border-color: var(--color-rule); padding: 0; overflow: hidden; }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot__x { position: absolute; top: 6px; right: 6px; z-index: 2; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; border: var(--rule-hair) solid var(--color-rule-2); background: var(--color-key-face); color: var(--color-ink); cursor: pointer; }
.slot__x:hover { color: var(--color-error); }
.slot__x svg { width: 14px; height: 14px; }
.slot__req { color: var(--color-accent); }

/* segmented */
.seg { display: inline-flex; padding: var(--space-2xs); gap: var(--space-2xs); background: var(--color-paper-3); border-radius: var(--radius-input); border: var(--rule-hair) solid var(--color-rule); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: var(--space-xs) var(--space-sm); border-radius: 4px; font: 500 var(--text-sm)/1 var(--font-display); color: var(--color-ink-2); cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.seg input:checked + span { background: var(--color-key-face); color: var(--color-ink); box-shadow: var(--shadow-seg); }
.seg input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 1px; }

.check { display: flex; align-items: flex-start; gap: var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: var(--space-2xs); accent-color: var(--color-accent); }

/* output: image tray */
.tray { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-sm); }
.tray li { display: grid; gap: var(--space-xs); align-content: start; }
.tray__img { position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius-input); overflow: hidden; border: var(--rule-hair) solid var(--color-rule); background: var(--color-paper-2); }
.tray__img img { width: 100%; height: 100%; object-fit: cover; }
.tray__n { position: absolute; left: 6px; top: 6px; z-index: 1; min-width: 26px; height: 26px; padding: 0 var(--space-2xs); display: grid; place-items: center; border-radius: 6px; background: var(--color-graphite); color: var(--color-graphite-ink); font: 600 var(--text-sm)/1 var(--font-display); }
.tray__none { position: absolute; inset: 0; display: grid; place-items: center; padding: var(--space-xs); text-align: center; font-size: var(--text-xs); color: var(--color-muted); }
.tray__cap { font: 500 var(--text-sm)/1.25 var(--font-display); }
.tray__acts { display: flex; gap: var(--space-2xs); flex-wrap: wrap; }
.tray li[data-empty="true"] .tray__acts { display: none; }

/* output: prompt blocks */
.out { display: grid; gap: var(--space-xs); }
.out textarea { min-height: 360px; font-family: var(--font-outlier); font-size: 13px; line-height: 1.6; background: var(--color-paper); }
.out--short textarea { min-height: 120px; }
.meta { font-size: var(--text-xs); color: var(--color-muted); font-variant-numeric: tabular-nums; }

.words { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.word { border: var(--rule-hair) solid var(--color-rule-2); border-radius: var(--radius-input); padding: var(--space-2xs) var(--space-xs); font: 500 var(--text-sm)/1.2 var(--font-outlier); background: var(--color-paper-2); }
.word small { color: var(--color-muted); font-family: var(--font-body); margin-left: var(--space-2xs); }

.note { border-left: 2px solid var(--color-accent); padding: var(--space-xs) var(--space-sm); background: var(--color-accent-wash); font-size: var(--text-sm); color: var(--color-ink-2); border-radius: 0 var(--radius-input) var(--radius-input) 0; }
.note ul { margin: 0; padding-left: var(--space-md); }
.note--warn { border-color: var(--color-error); background: var(--color-error-wash); }

/* states */
.state { padding: var(--space-xl) var(--space-lg); text-align: center; display: grid; gap: var(--space-xs); justify-items: center; color: var(--color-muted); }
.state h2 { color: var(--color-ink); font-size: var(--text-lg); }
.state svg { width: 28px; height: 28px; color: var(--color-rule-2); }
.err { display: grid; gap: var(--space-xs); padding: var(--space-md); border: var(--rule-hair) solid color-mix(in oklab, var(--color-error) 35%, transparent); background: var(--color-error-wash); border-radius: var(--radius-input); color: var(--color-ink); font-size: var(--text-sm); }
.err b { color: var(--color-error); font-family: var(--font-display); font-weight: 600; }
.skel { display: grid; gap: var(--space-sm); }
.skel i { display: block; height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--color-paper-2), var(--color-paper-3), var(--color-paper-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel i:nth-child(3n) { width: 72%; } .skel i:nth-child(4n) { width: 88%; }
.skel .skel__tray { height: 140px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot 0.7s linear infinite; }
@keyframes rot { to { transform: rotate(1turn); } }

details.how { font-size: var(--text-sm); color: var(--color-ink-2); }
details.how summary { cursor: pointer; font: 500 var(--text-sm)/1.4 var(--font-display); color: var(--color-ink); }
details.how summary:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
details.how ol { margin: var(--space-xs) 0 0; padding-left: var(--space-lg); display: grid; gap: var(--space-2xs); }

.toast { position: fixed; left: 50%; bottom: var(--space-lg); translate: -50% 0; z-index: 50; background: var(--color-graphite); color: var(--color-graphite-ink); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-input); font-size: var(--text-sm); box-shadow: var(--shadow-toast); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.toast[data-show="true"] { opacity: 1; transform: none; }

/* xoá icon flow */
.drop { position: relative; display: grid; justify-items: center; gap: var(--space-2xs); padding: var(--space-lg) var(--space-md); text-align: center; border: var(--rule-hair) dashed var(--color-rule-2); border-radius: var(--radius-input); background: var(--color-paper-2); cursor: pointer; transition: border-color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.drop:hover, .drop[data-over="true"] { border-color: var(--color-accent); background: var(--color-accent-wash); }
.drop:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop__ico { display: grid; }
.drop__ico svg { width: 24px; height: 24px; color: var(--color-accent); }
.drop__t { font: 500 var(--text-md)/1.3 var(--font-display); color: var(--color-ink); }
.drop + .row-end { flex-wrap: wrap; justify-content: space-between; align-items: end; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-md); }
.cards:empty { display: none; }
.card { display: grid; gap: var(--space-xs); align-content: start; }
.card__view { position: relative; border-radius: var(--radius-input); overflow: hidden; border: var(--rule-hair) solid var(--color-rule); background: var(--color-paper-2); }
.card__full { display: block; width: 100%; height: auto; }
.card__zoom { position: absolute; right: var(--space-xs); bottom: var(--space-xs); width: 42%; padding: 0; border: 2px solid var(--color-key-face); border-radius: var(--radius-input); overflow: hidden; background: var(--color-paper-2); box-shadow: var(--shadow-toast); cursor: zoom-in; touch-action: none; }
.card__zoom canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.card__zoom[data-before="true"] { border-color: var(--color-accent); }
.card__zoom:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.card__tag { position: absolute; left: var(--space-2xs); top: var(--space-2xs); padding: 2px var(--space-2xs); border-radius: 4px; background: var(--color-graphite); color: var(--color-graphite-ink); font: 600 var(--text-xs)/1.2 var(--font-display); }
.card__meta { display: grid; gap: 2px; min-width: 0; }
.card__name { font: 500 var(--text-sm)/1.3 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__st { font-size: var(--text-xs); color: var(--color-ok); }
.card__st[data-warn="true"] { color: var(--color-muted); }
.card__acts { display: flex; gap: var(--space-2xs); flex-wrap: wrap; align-items: center; }
.card__acts .field { width: auto; flex: 1 1 96px; min-height: 32px; padding-block: 0; font-size: var(--text-xs); }

/* settings */
.narrow { max-width: 640px; }

.foot { border-top: var(--rule-hair) solid var(--color-rule); padding-block: var(--space-md); font-size: var(--text-xs); color: var(--color-muted); }

@media (max-width: 60rem) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 40rem) {
  .panel { padding: var(--space-md); }
  .tray { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 40px minmax(0, 1fr) auto; padding-inline: 0; }
  .row__ico { width: 40px; height: 40px; }
  .row__tag { display: none; }
  .home__head h1 { font-size: var(--text-2xl); }
  .crumb { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .skel i, .spin { animation: none; }
}
