:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: #f7f7f8;
  color: #1f2937;
}

.container {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

h1, h2 {
  margin-bottom: 0.5rem;
}

.card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
}

section {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin: 0.5rem 0 0.25rem;
}

input[type="file"],
input[type="text"],
select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.6rem;
  background: #fff;
  color: #111827;
}

select option {
  background: #fff;
  color: #111827;
}

input::placeholder {
  color: #6b7280;
  opacity: 1;
}

input[type="checkbox"] {
  margin-right: 0.4rem;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
  margin-bottom: 0.75rem;
}

button {
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: #2563eb;
  color: white;
}

button.secondary {
  background: #e5e7eb;
  color: #111827;
}

.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  max-height: 380px;
  overflow-y: auto;
  background: #ffffff;
}

.page-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid #e5e7eb;
  cursor: grab;
}

.page-item:last-child {
  border-bottom: none;
}

.page-item.dragging {
  opacity: 0.55;
  background: #dbeafe;
}

.page-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.page-thumb-wrap {
  width: 86px;
  min-width: 86px;
  height: 116px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #f8fafc;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.page-thumb-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.page-thumb-loading {
  position: absolute;
  color: #6b7280;
  font-size: 0.72rem;
  text-align: center;
  padding: 0 0.25rem;
}

.drag-handle {
  color: #6b7280;
  font-size: 1.15rem;
  letter-spacing: -0.1rem;
}

.note {
  margin: 0.25rem 0 0.75rem;
  color: #374151;
}

.result.success {
  border-color: #86efac;
  background: #f0fdf4;
}

.result.error {
  border-color: #fca5a5;
  background: #fef2f2;
}

pre {
  white-space: pre-wrap;
  background: #111827;
  color: #f9fafb;
  border-radius: 8px;
  padding: 0.75rem;
  overflow-x: auto;
}

footer {
  margin-top: 1rem;
  color: #4b5563;
}

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