*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.app {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.tab {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text);
  background: var(--bg);
}

.tab.active {
  color: var(--primary);
  background: #eff6ff;
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.textarea {
  width: 100%;
  min-height: 200px;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: 'Consolas', 'Monaco', monospace;
  resize: vertical;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 0.5rem;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.dropzone .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.file-name {
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 1rem;
  min-height: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--text);
  color: white;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: #0f172a;
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
  white-space: nowrap;
}

.btn-outline:hover {
  background: #eff6ff;
}

.btn-text {
  background: none;
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.btn-danger {
  background: none;
  color: var(--danger);
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.result h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--success);
}

.link-box {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.link-input {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
  background: #f8fafc;
}

.result-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.list-header h2 {
  font-size: 1.1rem;
}

.page-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.page-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--bg);
  border-radius: 8px;
  gap: 1rem;
}

.page-info {
  flex: 1;
  min-width: 0;
}

.page-title {
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.page-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 600px) {
  .link-box {
    flex-direction: column;
  }

  .page-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
