:root {
  --bg: #f7f7f5; --card: #ffffff; --ink: #121417; --muted: #62666d; --line: #e2e3e0; --accent: #0b5cff; --accent-ink: #ffffff;
  --soft: #eef3ff; --warn: #8a5a00; --warn-bg: #fbf3dd; --bad: #b3261e; --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013; --card: #16191e; --ink: #eceef1; --muted: #9ca3ad; --line: #2a2e35; --accent: #7aa6ff; --accent-ink: #0a1a40;
    --soft: #17223a; --warn: #f0c466; --warn-bg: #33270b; --bad: #ff9a92;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013; --card: #16191e; --ink: #eceef1; --muted: #9ca3ad; --line: #2a2e35; --accent: #7aa6ff; --accent-ink: #0a1a40;
  --soft: #17223a; --warn: #f0c466; --warn-bg: #33270b; --bad: #ff9a92;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.7 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; }
main { max-width: 720px; margin: 0 auto; padding: 48px 16px 96px; }
.top { margin-bottom: 28px; }
h1 { font-size: 2rem; margin: 0; letter-spacing: .01em; }
.lead { margin: 4px 0 0; color: var(--muted); }
h2 { font-size: 1.05rem; margin: 0 0 10px; } h3 { font-size: .95rem; margin: 24px 0 8px; color: var(--muted); }
h2 label { cursor: text; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.step { display: grid; grid-template-columns: 40px 1fr; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 20px; margin-bottom: 12px; min-width: 0; }
.num { width: 32px; height: 32px; border-radius: 50%; background: var(--soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; }
.body { min-width: 0; }
textarea, input[type=text], input[type=password] { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; resize: vertical; }
textarea:focus, input:focus { border-color: var(--accent); outline: none; }

.drop { margin-top: 10px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop .add { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--accent); cursor: pointer; font-weight: 600; }
.drop.over .add, .drop input:focus-visible + .add { border-color: var(--accent); background: var(--soft); }
.attached { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.attached li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.attached img { width: 56px; height: 40px; object-fit: cover; border-radius: 8px; flex: none; background: var(--bg); }
.attached .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.attached .meta { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.chips { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chips li { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 14px; border-radius: 999px; background: var(--soft); color: var(--accent); font-weight: 600; max-width: 100%; }
.chips li span { overflow-wrap: anywhere; }
.x { border: 0; background: none; color: inherit; font: inherit; font-size: 1.1rem; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; flex: none; }
.x:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }

button.primary { width: 100%; margin-top: 8px; padding: 16px; border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer; min-height: 56px; }
button.primary[disabled] { opacity: .6; cursor: progress; }
button.ghost { padding: 0 16px; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; flex: none; }
button.ghost.small { min-height: 36px; font-size: .88rem; }
.key { margin: 4px 0 8px; } .key label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
#status { min-height: 1.7em; margin: 12px 0 0; color: var(--muted); text-align: center; }
#status.error { color: var(--bad); font-weight: 600; }

.result { margin-top: 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; }
.result-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.result-head h2 { margin: 0; font-size: 1.25rem; }
.plan { list-style: none; margin: 16px 0 0; padding: 0; counter-reset: s; }
.plan li { position: relative; padding: 0 0 20px 48px; }
.plan li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; }
.plan li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: var(--line); }
.plan .t { font-weight: 700; line-height: 32px; }
.plan .d { margin: 2px 0 0; color: var(--muted); }
.plan .p { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.plan .p span { font-size: .8rem; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--accent); font-weight: 600; }
.outputs { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.outputs dt, .outputs dd { margin: 0; padding: 10px 14px; border-top: 1px solid var(--line); }
.outputs dt:first-of-type, .outputs dt:first-of-type + dd { border-top: 0; }
.outputs dt { font-weight: 600; overflow-wrap: anywhere; } .outputs dd { color: var(--muted); white-space: nowrap; }
.outputs dd.none { color: var(--warn); font-weight: 600; }
.missing { margin-top: 8px; } .missing ul { margin: 0; padding: 12px 14px 12px 32px; background: var(--warn-bg); color: var(--warn); border-radius: 12px; }

@media (max-width: 520px) {
  main { padding-top: 32px; }
  h1 { font-size: 1.6rem; }
  .step { grid-template-columns: 28px 1fr; gap: 10px; padding: 16px 14px; }
  .num { width: 28px; height: 28px; font-size: .9rem; }
}
