:root {
  --ink: #e8e2d4;
  --muted: #a89b82;
  --accent: #c4a35a;
  --accent-soft: #d4b56e;
  --line: #b39b6740;
  --bg: #14110c;
  --panel: #1f1a13d9;
  --paper: #f4efe4;
  --paper-ink: #2a2418;
  --danger: #c46b5a;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", serif;
  color: var(--ink);
  background: var(--bg);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}
.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 18%, #5a452866, transparent 55%),
    radial-gradient(ellipse at 80% 92%, #3d4a3528, transparent 45%),
    linear-gradient(180deg, #1a1610, #12100c 70%);
}
.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .35;
  background-image:
    radial-gradient(circle at 20% 30%, #c7ba88 0 1px, transparent 1.5px),
    radial-gradient(circle at 70% 60%, #9eac9d 0 1px, transparent 1.5px);
  background-size: 420px 380px, 560px 500px;
  animation: drift 40s linear infinite;
}
@keyframes drift {
  from { transform: translateY(0); }
  to { transform: translateY(-40px); }
}
.shell {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}
.brand { margin-bottom: 1.5rem; }
.brand-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: rise .7s ease both;
}
.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: contain;
  background: transparent;
  flex-shrink: 0;
  box-shadow: 0 0 22px #c4a35a28;
}
.mark {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.8rem);
  letter-spacing: .04em;
  color: var(--accent-soft);
}
.tag {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .95rem;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 1.25rem 1.35rem 1.4rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
  animation: rise .75s ease both;
}
.panel h1, .panel h2 {
  margin: 0 0 .4rem;
  font-size: 1.25rem;
  font-weight: 600;
}
.lead, .muted, .identity { color: var(--muted); }
.lead { margin: 0 0 1rem; line-height: 1.5; }
.stack { display: grid; gap: .75rem; }
label {
  display: grid;
  gap: .35rem;
  font-size: .92rem;
  color: var(--muted);
}
input, select, textarea, button {
  font: inherit;
  color: var(--ink);
  background: #0f0d0a;
  border: 1px solid var(--line);
  padding: .55rem .7rem;
}
button, .file-btn {
  cursor: pointer;
  background: linear-gradient(180deg, #8f7340, #6d552e);
  border-color: #a8884a88;
  color: #f5edd8;
  text-align: center;
}
button:disabled, .file-btn:has(input:disabled) {
  opacity: .45;
  cursor: not-allowed;
}
button.ghost, .ghost {
  background: transparent;
  color: var(--muted);
}
button.danger { background: linear-gradient(180deg, #8a4a3d, #6a352c); }
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-top: .25rem;
}
.file-btn {
  display: inline-block;
  padding: .55rem .9rem;
}
.toolbar, .list-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .75rem;
}
.identity { margin: 0; color: var(--ink); }
.error { color: #e0a090; margin: .75rem 0 0; }
.page-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .75rem;
}
.page-card {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: .75rem;
  align-items: center;
  background: #15120e;
  border: 1px solid var(--line);
  padding: .65rem;
  touch-action: manipulation;
}
.page-card.dragging {
  opacity: .55;
  outline: 1px dashed var(--accent);
}
.page-card.drag-over {
  outline: 2px solid var(--accent-soft);
}
.page-thumb {
  width: 88px;
  height: 110px;
  object-fit: contain;
  background: var(--paper);
  border: 1px solid #0003;
}
.page-meta {
  display: grid;
  gap: .2rem;
  min-width: 0;
}
.page-meta .title {
  color: var(--ink);
  font-size: 1.02rem;
}
.page-meta .meta {
  color: var(--muted);
  font-size: .88rem;
}
.page-controls {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.page-controls button {
  min-width: 2.4rem;
  padding: .4rem .5rem;
}
.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-top: .5rem;
}
.export-bar input[type="text"] {
  flex: 1 1 12rem;
  min-width: 0;
}
.hint {
  margin: .75rem 0 0;
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.45;
}
@media (max-width: 560px) {
  .page-card {
    grid-template-columns: 72px 1fr;
  }
  .page-controls {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .page-thumb {
    width: 72px;
    height: 90px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sky::after, .mark, .tag, .panel { animation: none; }
}
