*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #d9dde8;
  --primary: #5b4cf5;
  --primary-hover: #4a3de0;
  --text: #1a1d2e;
  --muted: #6b7280;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

.container {
  width: 100%;
  max-width: 560px;
}

header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.logout-link {
  position: absolute;
  top: 0;
  right: 0;
  font-size: .8rem;
  color: var(--muted);
  text-decoration: none;
  padding: .25rem .5rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.logout-link:hover {
  color: var(--error);
  background: #fef2f2;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

.subtitle {
  margin-top: .5rem;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  margin-bottom: 1.25rem;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #f0eeff;
}

.drop-zone.has-file {
  border-color: var(--success);
  background: #f0fdf4;
}

.drop-icon { font-size: 2rem; margin-bottom: .75rem; }

.drop-label {
  font-size: .95rem;
  color: var(--text);
}

.drop-hint {
  margin-top: .4rem;
  font-size: .8rem;
  color: var(--muted);
}

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}

/* Field */
.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: .4rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field input[type="text"] {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}

.field input[type="text"]:focus {
  border-color: var(--primary);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 1.25rem;
}

.checkbox-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.hint {
  width: 100%;
  font-size: .78rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 1.4rem;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  width: 100%;
  padding: .75rem 1rem;
  background: var(--primary);
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background .15s, opacity .15s;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }

.btn-secondary {
  display: inline-block;
  width: 100%;
  margin-top: 1rem;
  padding: .65rem 1rem;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, color .15s;
}

.btn-secondary:hover { border-color: var(--text); color: var(--text); }

/* Progress */
.progress-wrap {
  margin-top: 1.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 99px;
  transition: width .2s ease;
}

.progress-label {
  margin-top: .6rem;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

/* Result */
.result {
  margin-top: 1.5rem;
}

.result-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: 1rem;
}

.result-icon { font-size: 1.4rem; }

.result-header h2 {
  font-size: 1.1rem;
  color: var(--success);
}

.result-body p {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.meta {
  margin-top: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: .85rem;
}

.meta-label { color: var(--muted); white-space: nowrap; }

.meta-value {
  color: var(--text);
  word-break: break-all;
  text-align: right;
}

a.meta-value { color: var(--primary); }

/* Error */
.error {
  margin-top: 1.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
}

.error-icon { font-size: 1.5rem; }

.error p {
  margin-top: .5rem;
  font-size: .9rem;
  color: var(--error);
}

/* Published list */
.published {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 2rem;
}

.published-header {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: 1rem;
}

.published-title {
  font-size: 1rem;
  font-weight: 600;
}

.published-count {
  color: var(--muted);
  font-size: .85rem;
}

.published-empty {
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
  padding: .5rem 0;
}

.pub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
}

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

.pub-info {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  min-width: 0;
}

.pub-slug {
  font-size: .85rem;
  color: var(--text);
  font-family: ui-monospace, monospace;
}

.pub-url {
  font-size: .8rem;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 370px;
  display: block;
  text-decoration: none;
}

.pub-url:hover { text-decoration: underline; }

.pub-meta {
  font-size: .78rem;
  color: var(--muted);
}

.pub-actions {
  display: flex;
  gap: .4rem;
  flex-shrink: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  transition: border-color .15s, color .15s;
}

.btn-icon:hover { border-color: var(--primary); color: var(--primary); }

.btn-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  border: 1px solid #fecaca;
  background: transparent;
  color: var(--error);
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.btn-delete:hover:not(:disabled) { background: #fef2f2; border-color: var(--error); }
.btn-delete:disabled { opacity: .45; cursor: not-allowed; }

/* Utility */
.hidden { display: none !important; }
