:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --ink: #18201c;
  --muted: #5f6b63;
  --line: #d9ded7;
  --panel: #ffffff;
  --green: #1f7a4f;
  --green-dark: #145c3b;
  --blue: #1d5f8f;
  --amber: #ad6b00;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(24, 32, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  letter-spacing: 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 4vw, 40px) 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
}

h2 {
  font-size: 17px;
}

.status-pill {
  min-width: 92px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef6f0;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 20px;
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

form.panel {
  display: grid;
  gap: 0;
}

.band {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.band:last-of-type {
  border-bottom: 0;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd2ca;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  padding: 8px 10px;
}

input[type="file"] {
  padding: 8px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 3px solid rgba(29, 95, 143, 0.25);
  outline-offset: 2px;
  border-color: var(--blue);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 104px;
  min-height: 42px;
  border: 1px solid var(--green-dark);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--green-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

button.secondary {
  border-color: #cbd2ca;
  background: #fff;
  color: var(--ink);
}

button.secondary:hover {
  background: #f1f3ef;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 16px;
  line-height: 1;
}

.result-panel {
  align-self: start;
  display: grid;
  gap: 14px;
  padding: 20px;
}

.result-box {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9faf8;
  padding: 14px;
  font-size: 14px;
}

.result-box.empty {
  color: var(--muted);
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.log-box {
  display: grid;
  gap: 8px;
  max-height: 440px;
  overflow: auto;
  font-size: 13px;
}

.log-item {
  border-left: 3px solid var(--amber);
  background: #fff8eb;
  padding: 8px 10px;
}

.error {
  color: var(--danger);
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .grid.four,
  .grid.two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .layout {
    width: min(100% - 20px, 1240px);
    margin-top: 14px;
  }

  .band,
  .result-panel {
    padding: 16px;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
