:root {
  color-scheme: light;
  --ink: #14212b;
  --muted: #66727c;
  --paper: #f3f0e8;
  --surface: #fffdf8;
  --line: #cbc6ba;
  --signal: #e8562a;
  --signal-dark: #b83b18;
  --screen: #17252d;
  --screen-text: #b9f5cb;
  --focus: #1678a5;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 56px; }
.masthead { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.kicker { margin: 0 0 7px; color: var(--signal-dark); font: 700 12px/1.2 ui-monospace, SFMono-Regular, monospace; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font: 800 clamp(34px, 6vw, 72px)/.94 "Arial Narrow", "Helvetica Neue", sans-serif; letter-spacing: -.055em; }
.lead { max-width: 470px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.75; }

.workflow { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 22px; margin-top: 22px; }
.panel { background: var(--surface); border: 1px solid var(--line); box-shadow: 4px 4px 0 rgba(20,33,43,.12); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: .04em; }
.count { border: 1px solid var(--ink); padding: 3px 8px; font: 700 12px/1 ui-monospace, monospace; }

.dropzone { margin: 16px; min-height: 174px; display: grid; place-items: center; text-align: center; border: 2px dashed #8b938f; background: repeating-linear-gradient(-45deg, transparent, transparent 8px, rgba(20,33,43,.025) 8px, rgba(20,33,43,.025) 16px); transition: border-color .18s, background .18s, transform .18s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-dragging { outline: none; border-color: var(--signal); background-color: #fff2e9; transform: translateY(-2px); }
.drop-mark { display: block; color: var(--signal); font: 800 44px/.8 ui-monospace, monospace; }
.dropzone strong { display: block; margin-top: 14px; font-size: 18px; }
.dropzone small { display: block; margin-top: 7px; color: var(--muted); }

.file-wrap { border-top: 1px solid var(--line); }
.file-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; }
.file-toolbar span { color: var(--muted); font-size: 12px; }
.text-btn { border: 0; background: none; color: var(--signal-dark); font-size: 12px; font-weight: 700; }
.file-list { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; gap: 8px; }
.file-item { display: grid; grid-template-columns: 32px minmax(120px, 1fr) 24px minmax(120px, 1fr) 32px; align-items: center; gap: 8px; min-height: 54px; padding: 7px 9px; border: 1px solid var(--line); background: white; }
.file-index { color: var(--signal-dark); font: 700 12px ui-monospace, monospace; }
.file-copy { min-width: 0; }
.file-copy strong, .file-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy strong { font-size: 13px; }
.file-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.file-arrow { color: var(--signal); font-weight: 800; }
.file-item code { overflow: hidden; color: #42525e; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.remove-btn { width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.remove-btn:hover { color: var(--signal-dark); }
.empty-list { margin: 0; padding: 25px 16px 30px; text-align: center; color: var(--muted); font-size: 13px; }

.options { padding: 16px; display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label, legend { font-size: 12px; font-weight: 750; }
input[type="text"], select { width: 100%; height: 40px; border: 1px solid #9fa49f; border-radius: 0; background: white; padding: 0 10px; color: var(--ink); }
.field-help { color: var(--muted); font-size: 10px; line-height: 1.5; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 2px; }
.option-group { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); display: grid; gap: 11px; }
.option-group legend { padding: 0 5px; }
.check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
.check-grid label, .radio-row label { display: flex; align-items: center; gap: 6px; font-weight: 650; }
.check-grid input, .radio-row input { margin: 0; accent-color: var(--signal); }
.radio-row { display: flex; flex-wrap: wrap; gap: 9px 16px; }
.option-group input:disabled { background: #ecebe6; color: var(--muted); }
.range-head { display: flex; justify-content: space-between; }
.range-value { color: var(--signal-dark); font: 800 14px ui-monospace, monospace; }
input[type="range"] { width: 100%; accent-color: var(--signal); }
.range-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.switch-copy strong, .switch-copy small { display: block; }
.switch-copy strong { font-size: 12px; }
.switch-copy small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { display: block; width: 100%; height: 100%; border: 1px solid #8d948f; background: #dadbd6; }
.switch span::after { content: ""; position: absolute; top: 4px; left: 4px; width: 18px; height: 18px; background: white; border: 1px solid #7b817d; transition: transform .18s; }
.switch input:checked + span { background: var(--signal); border-color: var(--signal-dark); }
.switch input:checked + span::after { transform: translateX(20px); }
.reset-row { text-align: right; }
.has-error input:invalid { border-color: #ba2015; }

.output { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; background: var(--screen); color: white; border: 1px solid #0a1419; box-shadow: 4px 4px 0 rgba(20,33,43,.18); }
.output-copy { padding: 18px 20px; }
.output-copy h2 { margin: 0 0 7px; font-size: 16px; }
.output-copy p { margin: 0; color: #b6c2c8; font-size: 12px; line-height: 1.6; }
.download-actions { display: grid; grid-template-columns: 1fr 1fr; min-width: 430px; }
.download-btn { min-width: 0; border: 0; border-left: 1px solid #0a1419; background: var(--signal); color: white; padding: 18px 22px; font-weight: 850; letter-spacing: .02em; }
.download-btn.mac { background: #26708f; }
.download-btn:not(:disabled):hover { filter: brightness(1.12); }

.security-note { margin-top: 14px; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 15px 18px; border: 1px solid #c98d39; background: #fff7df; color: #3a2a15; }
.security-mark { display: grid; place-items: center; width: 28px; height: 28px; background: #d98519; color: white; font: 900 18px/1 ui-monospace, monospace; }
.security-note h2 { margin: 2px 0 6px; font-size: 14px; }
.security-note p { margin: 0; font-size: 12px; line-height: 1.65; }
.security-note details { margin-top: 8px; border-top: 1px solid rgba(118, 76, 19, .24); padding-top: 8px; }
.security-note summary { cursor: pointer; font-size: 12px; font-weight: 800; }
.security-note details p { margin-top: 7px; }
.security-note pre { margin: 8px 0 0; overflow-x: auto; padding: 9px 10px; background: #2e281f; color: #fff6dd; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }

.preview-panel { margin-top: 22px; }
.preview { margin: 0; padding: 18px; min-height: 110px; max-height: 270px; overflow: auto; background: #101c22; color: var(--screen-text); font: 12px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice { position: fixed; right: 20px; bottom: 20px; max-width: min(440px, calc(100vw - 40px)); padding: 12px 16px; background: var(--ink); color: white; border-left: 5px solid var(--signal); box-shadow: 0 8px 30px rgba(0,0,0,.22); font-size: 13px; z-index: 10; }

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 650px); padding-top: 24px; }
  .masthead, .workflow { grid-template-columns: 1fr; }
  .lead { max-width: none; }
  .output { grid-template-columns: 1fr; }
  .download-actions { min-width: 0; border-top: 1px solid #0a1419; }
  .download-btn { border-left: 0; min-height: 62px; }
  .download-btn + .download-btn { border-left: 1px solid #0a1419; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr 1fr; }
  .file-item { grid-template-columns: 26px minmax(0, 1fr) 28px; }
  .file-arrow, .file-item code { display: none; }
  h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
