:root {
  --bg: #ffffff;
  --text: #0d0d0d;
  --muted: #666;
  --line: #e5e5e5;
  --soft: #f4f4f4;
  --accent: #10a37f;
  --accent-hover: #0d8a6a;
  --error: #ef4444;
  --font: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tabs a {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.tabs a.active {
  background: var(--accent);
  color: #fff;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.lead {
  margin: 0 0 24px;
  color: var(--muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.file {
  min-height: 180px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--soft);
}

input[type="file"] {
  font-weight: 400;
}

img,
video {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
  font: inherit;
  font-weight: 400;
}

.actions {
  display: flex;
  gap: 10px;
}

.actions button {
  flex: 1;
}

button {
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: var(--accent-hover); }

.demos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.demos button {
  height: auto;
  min-height: 40px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  font-size: 13px;
}

button.secondary,
.demos button {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

button.secondary:hover,
.demos button:hover { background: var(--soft); }

button:disabled { opacity: 0.6; cursor: wait; }

details summary {
  cursor: pointer;
  font-weight: 600;
}

.status {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.status.error { color: var(--error); }

.result h2,
.library h2,
.progress h2 {
  margin: 8px 0 12px;
  font-size: 18px;
}

.progress {
  margin-bottom: 28px;
}

.progress article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.progress article + article {
  margin-top: 10px;
}

.progress strong {
  display: block;
  font-size: 15px;
}

.progress p {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5e5e5;
}

.bar span {
  display: block;
  width: 35%;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}

.bar.running span {
  animation: progress-slide 1.4s ease-in-out infinite;
}

.bar.queued span {
  width: 18%;
}

.bar.meter span {
  width: 0;
  animation: none;
}

@keyframes progress-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(340%); }
}

.library {
  margin-bottom: 28px;
}

.library-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.library-grid article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.library-grid video {
  max-height: 280px;
  background: #111;
}

.library-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.card-actions a,
.card-actions button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.card-actions a:hover,
.card-actions button:hover {
  background: var(--soft);
}

.card-actions button.danger {
  color: var(--error);
}

@media (max-width: 720px) {
  .grid,
  .library-grid { grid-template-columns: 1fr; }
  .top { align-items: flex-start; flex-direction: column; }
}
