:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --surface: #fff;
  --wash: #eff6f0;
  --track: #e7eee7;
  --ink: #1b2c27;
  --muted: #486058;
  --green: #14523f;
  --green-dark: #0b3d2e;
  --stroke: #d4ded6;
  --warning: #7c460f;
  --warning-bg: #fff2dd;
  --error: #8a2d23;
  --error-bg: #faeeeb;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Meiryo", system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
button, select, input { font: inherit; }
button, select, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #266d56; outline-offset: 3px; }
.wrap { width: min(1112px, calc(100% - 72px)); margin-inline: auto; }
.masthead { background: #173830; color: #f5faf6; }
.brand { min-height: 62px; display: flex; align-items: center; gap: 12px; font-size: .89rem; font-weight: 700; letter-spacing: .05em; }
.brand-icon { width: 23px; height: 25px; border: 1.5px solid #acd5bc; border-radius: 4px; position: relative; }
.brand-icon::before { content: ""; position: absolute; inset: 5px; background: repeating-linear-gradient(to bottom, #acd5bc 0 1px, transparent 1px 5px); }
.hero { padding: 49px 0 32px; }
.hero h1 { font-size: clamp(2rem, 4.8vw, 3.28rem); line-height: 1.2; letter-spacing: -.035em; font-weight: 800; }
.hero > p:not(.privacy) { color: var(--muted); margin-top: 16px; line-height: 1.85; }
.hero .privacy { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 8px 13px; border-radius: 6px; background: #e6f0e7; color: var(--green-dark); font-weight: 700; font-size: .88rem; }
.lock-icon { flex: 0 0 auto; position: relative; display: inline-block; width: 13px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; margin-top: 4px; }
.lock-icon::before { content: ""; width: 7px; height: 6px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 4px 4px 0 0; position: absolute; top: -6px; left: 1.5px; }
.steps ol { display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; margin: 0 0 13px; padding: 0; border: 1px solid var(--stroke); background: var(--surface); border-radius: 12px; overflow: hidden; }
.steps li { display: flex; align-items: center; gap: .55rem; justify-content: center; padding: 11px 8px; min-height: 49px; color: var(--muted); font-size: .86rem; font-weight: 650; }
.steps li + li { border-left: 1px solid var(--stroke); }
.steps li span { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; background: var(--track); font-size: .78rem; }
.steps li[aria-current] { color: var(--green-dark); background: var(--wash); }
.steps li[aria-current] span { color: var(--surface); background: var(--green); }
.card { background: var(--surface); border: 1px solid var(--stroke); border-radius: 14px; }
.format-panel { margin-bottom: 12px; padding: 15px 17px; }
.format-panel .section-head { margin-bottom: 8px; }
.format-panel h2 { font-size: 1.21rem; }
.format-panel h3 { font-size: .91rem; overflow-wrap: anywhere; }
.format-summary, .format-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.format-summary { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.format-summary .button { min-height: 32px; padding-block: 4px; }
.format-columns { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 0; padding: 0; list-style: none; }
.format-columns li { border-radius: 5px; background: var(--wash); color: var(--green-dark); padding: 2px 7px; font-size: .79rem; overflow-wrap: anywhere; }
.format-panel textarea { display: block; min-height: 100px; width: min(100%, 35rem); margin-top: 6px; padding: 7px; color: var(--ink); border: 1px solid #a7bbaf; border-radius: 6px; font: inherit; }
.format-panel .editor-block { padding-bottom: 0; }
.format-panel #format-notice:not(:empty) { margin-top: 8px; }
#presets-panel summary { width: fit-content; font-size: .9rem; color: var(--green-dark); font-weight: 700; }
#presets-panel .field-help { margin-top: 4px; }
#preset-select { max-width: min(100%, 27rem); }
#preset-name { width: min(100%, 16rem); }
.saved-choice { display: grid; gap: 4px; margin-top: 7px; justify-items: start; font-size: .86rem; }
.saved-choice select { width: min(100%, 36rem); }
.upload { padding: 17px; }
.drop { border: 1.5px dashed #8aaa98; border-radius: 10px; background: #f4f9f5; text-align: center; display: flex; flex-direction: column; align-items: center; padding: 32px 16px 30px; transition: background-color .15s ease, border-color .15s ease; }
.drop.dragging { border-color: var(--green-dark); background: #e0efe5; }
.upload-icon { width: 57px; height: 57px; display: grid; place-items: center; border-radius: 14px; color: var(--green); background: #e2efe6; margin-bottom: 12px; }
.upload-icon span { display: block; position: relative; width: 23px; height: 11px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 4px 4px; top: 7px; }
.upload-icon span::before { content: ""; position: absolute; height: 17px; width: 2px; background: currentColor; inset: -14px auto auto 8.5px; }
.upload-icon span::after { content: ""; position: absolute; width: 9px; height: 9px; border-top: 2px solid currentColor; border-left: 2px solid currentColor; transform: rotate(45deg); inset: -14px auto auto 5px; }
.drop h2 { font-size: clamp(1.05rem, 2.6vw, 1.36rem); line-height: 1.4; }
.drop p, .demo-row p { color: var(--muted); font-size: .86rem; }
.drop p { margin: 7px 0 18px; }
.button { padding: 9px 15px; min-height: 43px; border: 1px solid transparent; border-radius: 7px; font-size: .88rem; font-weight: 700; line-height: 1.45; white-space: normal; }
.button.primary { color: #fff; background: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-dark); }
.button.secondary { color: var(--green-dark); background: #fff; border-color: #9eb6a7; }
.button.secondary:hover:not(:disabled), .button.subtle:hover:not(:disabled) { background: var(--wash); }
.button.subtle { color: var(--muted); background: transparent; }
.button:disabled { cursor: default; opacity: .55; }
.demo-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 14px 4px 0; padding: 1px 9px 2px; }
.demo-row strong { font-size: .91rem; }
.status, .error { margin: 10px 0; overflow-wrap: anywhere; font-size: .9rem; }
.status { color: var(--green-dark); }
.status:empty { margin: 0; }
.error { background: var(--error-bg); border: 1px solid #e5bcb5; color: var(--error); border-radius: 7px; padding: 9px 12px; }
.work, .output { margin-top: 26px; }
.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 13px; }
.section-head h2 { font-size: 1.48rem; line-height: 1.4; }
.section-head h2[tabindex] { scroll-margin-top: 16px; }
.section-head p, .field-help { font-size: .87rem; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.metrics div { background: var(--surface); padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 9px; }
.metrics dt { color: var(--muted); font-size: .81rem; }
.metrics dd { font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 750; }
.workspace { display: grid; grid-template-columns: minmax(235px, .83fr) minmax(0, 2fr); gap: 12px; align-items: start; }
.file-head { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--stroke); }
.file-head h3 { font-size: .92rem; margin-right: auto; }
.file-head label { font-size: .77rem; color: var(--muted); }
select, input[type="number"], input[type="text"] { color: var(--ink); border: 1px solid #a7bbaf; border-radius: 6px; padding: 6px 8px; background: #fff; min-width: 0; max-width: 100%; font-size: .84rem; }
.file-list { max-height: 505px; overflow-y: auto; padding: 6px 10px; scrollbar-gutter: stable; }
.file-item { padding: 8px 0; }
.file-item + .file-item { border-top: 1px solid var(--track); }
.file-top { display: flex; gap: 5px; align-items: start; justify-content: space-between; }
.file-name { font-size: .82rem; overflow-wrap: anywhere; }
.pill { display: inline-block; flex-shrink: 0; border-radius: 4px; padding: 1px 5px; background: var(--track); color: var(--muted); font-size: .71rem; font-weight: 700; }
.pill.attention { background: var(--warning-bg); color: var(--warning); }
.file-item p { font-size: .78rem; margin: 3px 0; overflow-wrap: anywhere; }
.file-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.file-actions .button { min-height: 32px; padding: 3px 7px; font-size: .75rem; text-align: left; max-width: 100%; overflow-wrap: anywhere; }
.file-actions [aria-pressed="true"] { background: #e2efe6; color: var(--green-dark); }
.editor { padding: 14px; min-width: 0; overflow-wrap: anywhere; }
.editor h3 { font-size: 1.07rem; line-height: 1.4; }
.editor h4 { font-size: .94rem; }
.editor > p { margin-top: 5px; }
.editor-block { padding: 12px 0; border-top: 1px solid var(--stroke); margin-top: 12px; }
.form-row, .control-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; font-size: .85rem; }
.form-row input[type="number"] { width: 6em; }
.form-row .button, .control-row .button { padding: 4px 8px; min-height: 34px; font-size: .8rem; }
.editor table, .output table { width: 100%; border-spacing: 0; font-size: .83rem; }
.table-scroll { overflow: auto; margin-top: 9px; max-height: 460px; }
.table-scroll td, .table-scroll th { padding: 7px 9px; border-bottom: 1px solid var(--stroke); text-align: left; vertical-align: top; }
.table-scroll th { position: sticky; top: 0; background: #eaf2eb; color: var(--green-dark); z-index: 1; white-space: nowrap; }
.table-scroll tr:nth-child(even) td { background: #f8faf8; }
.table-scroll select { min-width: 7.4rem; }
.column-table td:nth-child(2) { min-width: 5rem; }
.source-lines td:nth-child(2) { min-width: 9.3rem; max-width: 30rem; }
.source-value { white-space: pre-wrap; margin: 0 6px 3px 0; display: inline; }
.source-value strong { font-size: .74rem; color: var(--muted); margin-right: 3px; }
.bad { color: var(--warning); font-size: .78rem; }
.preview td { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 4.5rem; max-width: 24rem; }
.merge-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding: 12px 14px; font-size: .89rem; }
.output { padding: 15px; }
.output-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.output > p { margin-top: 9px; }
footer { display: flex; align-items: first baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px 0 28px; color: var(--muted); font-size: .83rem; }
footer details { max-width: 75ch; }
footer summary { width: fit-content; }
footer p { margin-top: 6px; }
footer a { color: var(--green-dark); }

@media (max-width: 760px) {
  .wrap { width: calc(100% - 30px); }
  .hero { padding-top: 32px; }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .file-list { max-height: 240px; }
}
@media (max-width: 450px) {
  .wide { display: none; }
  .brand { min-height: 53px; }
  .steps li { font-size: .73rem; gap: 4px; padding-inline: 3px; }
  .steps li span { width: 20px; height: 20px; flex-basis: 20px; font-size: .72rem; }
  .upload { padding: 10px; }
  .demo-row { padding-inline: 4px; }
  .metrics { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .drop { padding: 24px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .drop { transition: none; }
}
