:root {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1f1a16;
  --muted: #6f675f;
  --line: #e2d9cc;
  --card: #fffdf9;
  --accent: #b8431f;
  --accent-ink: #fff8f4;
  --danger: #8f2d2d;
  --ok: #246b45;
  --shadow: 0 12px 40px rgba(70, 46, 20, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

button, input { font: inherit; color: inherit; }

#app {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lede, .hint, .status { color: var(--muted); }

.lede { margin: 4px 0 0; }

.panel, .gate {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.gate, .panel { padding: 16px; }

.gate { margin-bottom: 16px; }

label.field { display: block; margin: 14px 0; }

label.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
}

input[type="password"] {
  width: 100%;
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

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

button, .file-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  min-height: 48px;
  cursor: pointer;
}

button.secondary, button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.danger { background: var(--danger); color: white; }

button:disabled { opacity: 0.55; cursor: default; }

.file-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 12px 0 4px;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.hint { margin: 8px 0 0; font-size: 0.92rem; }

.status {
  min-height: 1.4em;
  margin: 12px 0;
  font-size: 0.95rem;
}

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

.queue { display: grid; gap: 8px; margin: 12px 0; }

.job {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}

.job .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #app { padding-left: 24px; padding-right: 24px; }
}

.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #ebe4d8;
  border: 1px solid var(--line);
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(31, 26, 22, 0.78);
  color: white;
}

.empty {
  padding: 28px 8px 12px;
  text-align: center;
}

.empty strong {
  display: block;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 6px;
}

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