* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.08);
  padding: 32px;
}

h1 {
  margin: 0 0 12px;
  font-size: 32px;
}

.description {
  margin: 0 0 24px;
  color: #4b5563;
  line-height: 1.6;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.secondary-label {
  margin-top: 18px;
}

textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  resize: vertical;
  min-height: 160px;
}

.cookies-textarea {
  min-height: 140px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
}

.field-hint {
  margin: 10px 0 0;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button.secondary {
  background: #111827;
}

button.ghost {
  background: #e5e7eb;
  color: #111827;
}

button.is-loading {
  position: relative;
  opacity: 1;
}

button.is-loading::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

button.ghost.is-loading::after {
  border: 2px solid rgba(17, 24, 39, 0.25);
  border-top-color: #111827;
}

.loading-tip {
  margin: 14px 0 0;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
}

.loading-tip::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid rgba(37, 99, 235, 0.25);
  border-top-color: #2563eb;
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

.is-submitting textarea {
  opacity: 0.8;
}

.messages {
  margin-bottom: 18px;
}

.message {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

.message.error {
  background: #fef2f2;
  color: #b91c1c;
}

.message.success {
  background: #ecfdf5;
  color: #047857;
  margin-bottom: 18px;
}

.preview-card {
  margin-top: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 20px;
  background: #f9fafb;
}

.preview-card h2 {
  margin: 0 0 16px;
  font-size: 20px;
}

.preview-cover {
  display: block;
  width: 100%;
  max-width: 360px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.preview-meta {
  margin: 0;
}

.preview-meta div + div {
  margin-top: 12px;
}

.preview-meta dt {
  font-weight: 700;
  margin-bottom: 4px;
}

.preview-meta dd {
  margin: 0;
  line-height: 1.6;
  word-break: break-all;
}

.hint {
  margin: 16px 0 0;
  color: #92400e;
  background: #fffbeb;
  border-radius: 10px;
  padding: 12px 14px;
}

.page-list-section {
  margin-top: 20px;
}

.page-list-section h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.page-list-details {
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.page-list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.page-list-summary::-webkit-details-marker {
  display: none;
}

.page-list-summary::after {
  content: "▾";
  margin-left: auto;
  color: #6b7280;
}

.page-list-details:not([open]) .page-list-summary::after {
  content: "▸";
}

.page-list-summary-meta {
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
}

.page-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}

.page-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.page-info {
  min-width: 0;
  flex: 1;
}

.page-title {
  font-weight: 700;
  line-height: 1.5;
  word-break: break-word;
}

.page-duration {
  margin-top: 4px;
  color: #6b7280;
  font-size: 13px;
}

.page-actions {
  flex-shrink: 0;
}

.page-download-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-download-form button {
  min-width: 72px;
  padding: 10px 16px;
}

.page-download-form .loading-tip {
  margin: 0 0 0 8px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


.history-download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  padding: 10px 16px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 640px) {
  .card {
    padding: 24px;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .page-list-summary {
    flex-wrap: wrap;
  }

  .page-list-summary::after {
    width: 100%;
    margin-left: 0;
  }

  .page-list-summary-meta {
    width: 100%;
  }

  .page-item {
    flex-direction: column;
    align-items: stretch;
  }

  .page-download-form {
    flex-wrap: wrap;
  }

  .page-download-form button {
    flex: 1;
  }

  .page-download-form .loading-tip {
    margin-left: 0;
    width: 100%;
  }

  .history-download-link {
    width: 100%;
  }
}
