:root {
  --bg: #f4efe6;
  --bg-deep: #e7dcc8;
  --ink: #1f1a17;
  --muted: #655d57;
  --panel: rgba(255, 252, 247, 0.88);
  --line: rgba(31, 26, 23, 0.12);
  --accent: #b54a2f;
  --accent-dark: #8f3520;
  --ok: #1f7a4d;
  --err: #b3261e;
  --shadow: 0 20px 60px rgba(47, 31, 20, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
}
.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(181, 74, 47, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(38, 92, 79, 0.14), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  pointer-events: none;
}
.shell {
  position: relative;
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 32px;
}
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 28px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: var(--shadow);
  border-radius: 16px;
}
.brand {
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.navlinks { display: flex; gap: 8px; flex-wrap: wrap; }
.navlinks a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.navlinks a:hover { color: var(--ink); background: rgba(31,26,23,0.04); }
.navlinks a.active {
  color: var(--accent-dark);
  background: rgba(181,74,47,0.1);
  border-color: rgba(181,74,47,0.15);
}
.hero { margin-bottom: 28px; }
h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4.6vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.lead {
  margin: 18px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--muted);
}
.panel {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 24px;
}
input[type="file"][hidden] { display: none; }
.field { margin-bottom: 16px; }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 0.95rem; }
.field input[type="text"] {
  width: 100%;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.field input[type="text"]:focus {
  outline: 2px solid rgba(181, 74, 47, 0.2);
  border-color: rgba(181, 74, 47, 0.45);
}
.angle-options { display: flex; gap: 10px; flex-wrap: wrap; }
.angle-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}
.angle-option:has(input:checked) {
  border-color: rgba(181,74,47,0.45);
  background: rgba(181,74,47,0.08);
  color: var(--accent-dark);
}
.angle-option input { accent-color: var(--accent); }
.hint { color: var(--muted); font-size: 0.92rem; margin: 10px 0 0; line-height: 1.5; }
.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
button, .download {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, opacity .12s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .download:hover { transform: translateY(-1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.primary, .download { background: var(--accent); color: #fff; }
.primary:hover, .download:hover { background: var(--accent-dark); }
.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.list-wrap { margin-top: 24px; }
.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.list-head h2 { margin: 0; font-size: 1rem; }
.list-head p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.file-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.file-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.idx {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(181,74,47,0.12);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}
.meta { min-width: 0; }
.name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.size { color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
.item-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  line-height: 1;
}
.icon-btn.remove { color: var(--err); }
.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.35);
}
.status {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
}
.status p { margin: 0; }
.status-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.status-text { flex: 1; min-width: 0; }
#status-title, #rotate-status-title { font-weight: 700; font-size: 0.95rem; }
#status-detail, #rotate-status-detail { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.status-percent {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  min-width: 48px;
  text-align: right;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  background: #999;
  flex: 0 0 auto;
}
.progress {
  margin-top: 12px;
  height: 10px;
  background: rgba(31, 26, 23, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #d66a4d);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.status.processing .dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(181,74,47,0.15); }
.status.processing .status-percent { color: var(--accent-dark); }
.status.done .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(31,122,77,0.12); }
.status.done .progress-bar { background: linear-gradient(90deg, var(--ok), #35a065); }
.status.done .status-percent { color: var(--ok); }
.status.error .dot { background: var(--err); box-shadow: 0 0 0 4px rgba(179,38,30,0.12); }
.status.error .progress-bar { background: linear-gradient(90deg, var(--err), #d84a3f); }
.status.error .status-percent { color: var(--err); }
.result { margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hidden { display: none !important; }
.footer { padding: 18px 4px 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 960px); padding-top: 28px; }
  .panel { padding: 16px; }
  .file-item { grid-template-columns: auto 1fr; }
  .item-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
