:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-alt: #0b1220;
  --border: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #10b981;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --danger-border: rgba(239, 68, 68, 0.45);
  --danger-text: #fca5a5;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  background: radial-gradient(circle at top, #1e293b 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 48px 16px;
  line-height: 1.5;
}

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

.header {
  text-align: center;
  margin-bottom: 28px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.35);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

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

input[type="url"],
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.alias-group {
  display: flex;
  align-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.alias-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.alias-prefix {
  padding: 12px 10px 12px 14px;
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
  user-select: none;
  border-right: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.06);
}

.alias-group input {
  border: none;
  border-radius: 0;
  box-shadow: none !important;
}

.hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.btn-primary {
  width: 100%;
  padding: 13px 18px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-box {
  margin-top: 20px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.result-label {
  font-size: 12px;
  font-weight: 600;
  color: #6ee7b7;
  margin-bottom: 8px;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-link {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}

.result-link:hover {
  text-decoration: underline;
}

.btn-secondary {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

.history {
  margin-top: 28px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-header h2 {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 600;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

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

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-urls {
  min-width: 0;
}

.history-short {
  display: block;
  color: #93c5fd;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  word-break: break-all;
}

.history-short:hover {
  text-decoration: underline;
}

.history-target {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.tester-card {
  margin-top: 20px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.inspect-form {
  display: flex;
  gap: 10px;
}

.inspect-form input {
  flex: 1;
}

.btn-inline {
  width: auto;
  white-space: nowrap;
  padding: 12px 18px;
}

.tester-card .notice {
  margin-top: 14px;
  margin-bottom: 0;
}

.preview-card {
  margin-top: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  overflow: hidden;
}

.preview-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.05);
}

.status-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.status-ok {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-warn {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  text-decoration: none;
}

.preview-image-wrap {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #020617;
}

.preview-image-wrap img {
  width: 100%;
  height: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.preview-body {
  padding: 14px;
}

.preview-site {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.preview-favicon {
  border-radius: 4px;
}

.preview-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  word-break: break-word;
}

.preview-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.preview-urls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  word-break: break-all;
}

.preview-urls a {
  color: #93c5fd;
  text-decoration: none;
}

.preview-urls a:hover {
  text-decoration: underline;
}

.url-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(148, 163, 184, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 6px;
}

.preview-warn {
  margin-top: 10px;
  font-size: 12px;
  color: #fde68a;
}

.hidden {
  display: none;
}
