:root {
  color-scheme: light;
  --bg: #eef1df;
  --panel: #fbfbe9;
  --ink: #20231c;
  --muted: #64695d;
  --line: #c9ceb7;
  --accent: #345f8f;
  --accent-ink: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", sans-serif;
}

.app {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
}

.badge {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.45);
  color: var(--muted);
  white-space: nowrap;
}

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

.controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) minmax(140px, 1fr) minmax(130px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
button,
.file-picker span {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0 12px;
  background: #fffef2;
  color: var(--ink);
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-picker span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #fffef2;
  color: var(--ink);
}

button {
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  font-weight: 700;
}

button:disabled {
  opacity: 0.45;
}

.status {
  margin: 12px 0;
  min-height: 24px;
  color: var(--muted);
}

.results {
  display: grid;
  gap: 18px;
}

.page-result {
  padding: 14px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.page-header h2 {
  margin: 0;
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 700;
}

.preview-frame {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #d9dcc8;
}

.preview-frame img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 760px) {
  .app {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
