:root {
  --bg: #f0f4fa;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fef2f2;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(37, 99, 235, 0.18);
}

* {
  box-sizing: border-box;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", Arial, sans-serif;
  background:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(37, 99, 235, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  padding: 32px 20px 48px;
}

.page {
  max-width: 760px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 36px);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 16px;
}

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

textarea,
input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: #fff;
  resize: vertical;
}

.url-input-wrap {
  position: relative;
}

.url-input-wrap textarea {
  padding-right: 48px;
}

.url-clear-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.url-clear-icon {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

.url-clear-btn:hover {
  background: #fff;
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.18);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.12);
  transform: scale(1.04);
}

.url-clear-btn:active {
  transform: scale(0.96);
}

.url-clear-btn:focus-visible {
  outline: none;
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.progress-row .progress-text {
  margin: 0;
  flex: 1;
}

.btn-cancel {
  flex-shrink: 0;
}

.settings-toggle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  text-align: left;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  color: var(--text);
}

.settings-toggle:hover {
  color: var(--primary);
}

.client-id-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.btn-import-current {
  width: 100%;
  flex: 1 1 100%;
}

.cookie-browser-import {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.cookie-actions-upload {
  margin-top: 4px;
}

.cookie-upload-field {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.hidden-input {
  display: none !important;
}

.extension-hint code {
  font-size: 11px;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  padding: 24px;
}

.modal-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.modal-message {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-actions .btn-primary {
  width: auto;
  flex: 1 1 100%;
}

.modal-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 1.2em;
}

textarea:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.mode-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 14px;
}

.mode-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  padding: 11px 12px;
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mode-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

.mode-btn.active {
  background: var(--card);
  border-color: rgba(37, 99, 235, 0.12);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.batch-preview {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.batch-item {
  display: grid;
  grid-template-columns: 32px 88px 72px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

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

.batch-item-error {
  background: var(--danger-soft);
}

.batch-index {
  color: var(--muted);
  font-weight: 600;
}

.batch-platform {
  font-weight: 600;
}

.batch-media {
  color: var(--primary);
}

.batch-url {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-section {
  margin-top: 20px;
}

.queue-section h2 {
  margin: 0 0 10px;
  font-size: 16px;
}

.queue-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.queue-list li {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.queue-list li:last-child {
  border-bottom: none;
}

.queue-ok {
  background: var(--success-soft);
  color: var(--success);
}

.queue-fail {
  background: var(--danger-soft);
  color: var(--danger);
}

.queue-run {
  background: var(--primary-soft);
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.cookie-actions-label {
  font-size: 14px;
  font-weight: 600;
}

.cookie-import-status {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 14px 0 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge-muted {
  background: #f1f5f9;
  color: var(--muted);
}

.badge-ok {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.parse-message {
  color: var(--muted);
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  max-width: 18px;
  max-height: 18px;
  flex: 0 0 18px;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.mode-btn .btn-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  flex: 0 0 16px;
}

.btn-lg {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  border-radius: 14px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, var(--primary-hover), #2563eb);
}

.btn-primary:not(:disabled):active {
  transform: translateY(0);
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:not(:disabled):hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.btn-danger:not(:disabled):hover {
  background: var(--danger);
  color: #fff;
}

.progress-section,
.result-section,
.log-section {
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

.progress-bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  transition: width 0.2s ease;
}

.progress-text,
.result-text {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.result-text.success {
  color: var(--success);
}

.result-text.error {
  color: var(--danger);
}

.result-actions {
  margin-top: 12px;
}

.log-section h2,
.recent-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

#logOutput {
  margin: 0;
  padding: 14px 16px;
  background: #0f172a;
  color: #cbd5e1;
  border-radius: 14px;
  min-height: 120px;
  max-height: 220px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

#logOutput.log-empty {
  color: #64748b;
  font-family: inherit;
  font-size: 13px;
}

.settings-panel {
  margin-top: 16px;
}

.settings-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.settings-grid label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

.dir-field {
  display: grid;
  gap: 10px;
}

.dir-field-label {
  font-size: 14px;
  font-weight: 600;
}

.dir-display {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  word-break: break-all;
  color: var(--text);
}

.dir-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dir-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.dir-manual {
  font-size: 13px;
  color: var(--muted);
}

.dir-manual summary {
  cursor: pointer;
  user-select: none;
  margin-bottom: 8px;
}

.dir-manual input {
  width: 100%;
}

@media (max-width: 640px) {
  .dir-actions .btn {
    flex: 1 1 100%;
  }
}

.status-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.recent-list li:last-child {
  border-bottom: none;
}

.recent-empty {
  color: var(--muted);
}

.recent-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.recent-meta {
  color: var(--muted);
  font-size: 13px;
}

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.mobile-cookie-section {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--primary-soft);
}

.mobile-cookie-hint {
  margin-bottom: 12px !important;
}

.mobile-cookie-paste {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 80px;
  margin-bottom: 10px;
}

.mobile-cookie-actions {
  align-items: stretch;
}

.cookie-platform-select {
  flex: 1;
  min-width: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  background: #fff;
}

.cookie-sync-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.cookie-tab {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cookie-tab.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.cookie-tab-panel {
  display: grid;
  gap: 10px;
}

.cookie-guide-details {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.cookie-guide-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}

.cookie-guide-list {
  margin: 8px 0 0;
  padding-left: 20px;
  line-height: 1.6;
}

.cookie-bookmark-cards {
  display: grid;
  gap: 12px;
}

.cookie-bookmark-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.cookie-bookmark-card h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.bookmarklet-link {
  width: 100%;
  margin-top: 8px;
  text-decoration: none;
}

.cookie-modal-mobile {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.cookie-modal-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.client-id-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

.cookie-platform-overview {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.cookie-overview-title {
  margin: 0 0 12px;
  font-size: 16px;
}

.cookie-platform-grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 640px) {
  .cookie-platform-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.cookie-platform-group {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.cookie-platform-group h3 {
  margin: 0 0 6px;
  font-size: 14px;
}

.cookie-required h3 {
  color: var(--primary);
}

.cookie-optional h3 {
  color: var(--success);
}

.cookie-platform-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.cookie-platform-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.cookie-platform-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.cookie-platform-name {
  font-weight: 600;
}

.cookie-platform-types {
  color: var(--muted);
  font-size: 12px;
}

.cookie-overview-note {
  margin: 12px 0 0 !important;
}

.cookie-platform-sync-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.cookie-platform-select-full {
  width: 100%;
  margin-bottom: 6px;
}

.cookie-bookmark-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cookie-bookmark-head h3 {
  margin: 0;
}
