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

:root {
  --bg: #fcfcfc;
  --surface-1: #f8f8f8;
  --surface-2: #f3f3f3;
  --surface-3: #ebebeb;
  --card: #ffffff;
  --text: #2e2f30;
  --text-muted: #6b6c6d;
  --text-faint: #9a9b9c;
  --border: #e5e5e5;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --ring: #5e69d1;
  --primary: #2e2f30;
  --primary-bg: #2e2f30;
  --primary-fg: #fcfcfc;
  --success: #30a46c;
  --warning: #f5a623;
  --destructive: #e5484d;
  --info: #0091ff;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
  --shadow-input: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06), 0 2px 4px 0 rgba(0, 0, 0, 0.04);
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 528px;
  position: relative;
}

/* Header & Logo */

header {
  margin-bottom: 2.5rem;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.logo {
  color: var(--text);
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.subtitle {
  color: var(--text-faint);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

/* URL Input */

.input-section {
  margin-bottom: 1.75rem;
}

.url-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.03);
  box-shadow: var(--shadow-input);
  transition: background 0.2s, box-shadow 0.2s;
}

.url-input-wrapper:focus-within {
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06), 0 2px 4px 0 rgba(0, 0, 0, 0.04);
}

#url-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.95rem;
  padding: 0.55rem 0.65rem;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  border-radius: var(--radius);
}

#url-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

.shorten-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.shorten-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.shorten-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Metadata Card */

.meta-section {
  margin-bottom: 1.75rem;
}

.meta-card {
  display: flex;
  gap: 1rem;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 0.85rem 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.meta-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
  background: var(--surface-1);
}

.meta-image[src=""],
.meta-image:not([src]) {
  display: none;
}

.meta-image.no-image {
  display: none;
}

.meta-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

.meta-title {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta-site {
  color: var(--text-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

.meta-loading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Language Selector */

.service-options {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.service-options label {
  font-size: 0.7rem;
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
}

.lang-select {
  background: var(--surface-1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.lang-select:focus {
  border-color: var(--ring);
}

/* Services */

.services-section {
  margin-bottom: 1.75rem;
}

.services-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 0.75rem 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: background 0.2s, box-shadow 0.2s, opacity 0.2s;
  user-select: none;
}

.service-card:hover {
  background: var(--surface-1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.service-card.selected {
  box-shadow: 0 0 0 1.5px var(--ring), 0 1px 3px rgba(0, 0, 0, 0.08);
  background: rgba(94, 105, 209, 0.05);
}

/* Drag handle */

.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  color: var(--text-muted);
  opacity: 0.6;
  cursor: grab;
  transition: opacity 0.15s;
}

.drag-handle:active {
  cursor: grabbing;
}

.service-card:hover .drag-handle {
  opacity: 0.7;
}

/* Dragging state */

.service-card.dragging {
  opacity: 0.35;
}

/* Drop target indicator */

.service-card.drag-over {
  box-shadow: 0 0 0 2px var(--ring), 0 1px 3px rgba(0, 0, 0, 0.08);
}

.service-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.service-card.selected .service-checkbox {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
}

.service-checkbox svg {
  opacity: 0;
  transition: opacity 0.15s;
}

.service-card.selected .service-checkbox svg {
  opacity: 1;
}

.service-card.selected .service-checkbox svg polyline {
  stroke: var(--primary-fg);
}

.service-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

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

.service-name {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
}

.service-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.05rem;
  line-height: 1.4;
}

.service-url-pattern {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  opacity: 0.8;
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-shorten-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

a.service-buddy-url {
  flex: 1;
  min-width: 0;
  font-size: 0.7rem;
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  color: var(--ring);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.service-buddy-url:hover {
  text-decoration: underline;
}

.service-shorten-btn {
  flex-shrink: 0;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.service-shorten-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.service-shorten-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Scan badges */

.scan-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
  letter-spacing: 0.01em;
}

.scan-badge.scan-good {
  background: rgba(48, 164, 108, 0.12);
  color: #1a7f4b;
}

.scan-badge.scan-ok {
  background: rgba(245, 166, 35, 0.12);
  color: #b47a14;
}

.scan-badge.scan-warn {
  background: rgba(229, 72, 77, 0.12);
  color: #c53030;
}

.scan-badge.scan-unknown {
  background: var(--surface-2);
  color: var(--text-muted);
}

.dismiss-service-btn {
  background: none;
  border: none;
  color: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 0.15rem;
  margin-left: 0.2rem;
  line-height: 1;
  opacity: 0.6;
  vertical-align: middle;
}

.dismiss-service-btn:hover {
  opacity: 1;
}

.scan-badge.scanning {
  background: var(--surface-2);
  color: var(--text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.preview-scan-result {
  margin-top: 0.4rem;
  margin-bottom: 0.2rem;
}

.preview-scan-result .scan-badge {
  margin-left: 0;
  font-size: 0.75rem;
  padding: 0.2rem 0.65rem;
}

.preview-translated {
  margin-top: 0.3rem;
  padding: 0.5rem 0.65rem;
  background: rgba(94, 105, 209, 0.05);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Preview */

.preview-section {
  margin-bottom: 1.75rem;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.preview-header label {
  margin-bottom: 0;
}

.preview-toggle-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.preview-toggle-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.preview-box {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: var(--shadow-card);
}

.preview-box .preview-label {
  color: var(--text-faint);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: block;
  margin-bottom: 0.15rem;
  margin-top: 0.75rem;
}

.preview-box .preview-label:first-child,
.preview-content .preview-label:first-child {
  margin-top: 0;
}

.preview-box .preview-url {
  color: var(--info);
}

.preview-url-row .preview-url {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-box .preview-url a {
  color: inherit;
  text-decoration: none;
}

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

.preview-box .preview-url.buddy {
  color: var(--ring);
}

.preview-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-radius: 6px;
  transition: background 0.15s;
}

.preview-entry.preview-dragging {
  opacity: 0.4;
}

.preview-entry.preview-drag-over {
  background: var(--surface-2);
}

.preview-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  cursor: grab;
  color: var(--text-muted);
  opacity: 0.6;
  transition: opacity 0.15s;
}

.preview-drag-handle:active {
  cursor: grabbing;
}

.preview-entry:hover .preview-drag-handle {
  opacity: 0.7;
}

.preview-dismiss-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: none;
  border: 2px solid var(--border);
  border-radius: 5px;
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.preview-dismiss-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.preview-dismiss-spacer {
  width: 18px;
  flex-shrink: 0;
}

.preview-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.preview-content {
  flex: 1;
  min-width: 0;
}

.preview-name {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.preview-url-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.preview-shorten-all {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.35rem;
}

.shorten-all-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.shorten-all-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.shorten-all-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.shorten-buddy-btn {
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 500;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 0.35rem;
  vertical-align: middle;
  transition: background 0.15s, color 0.15s;
}

.shorten-buddy-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.shorten-buddy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.preview-url-row .shorten-buddy-btn {
  flex-shrink: 0;
  margin-left: 0;
}

.preview-box .preview-meta-header {
  margin-bottom: 0.5rem;
  white-space: normal;
  word-break: normal;
  text-wrap: pretty;
}

/* Share Buttons */

.share-section {
  margin-bottom: 2rem;
}

.share-buttons {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  background: var(--surface-1);
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: 0 0 0 1px var(--border-subtle);
}

.share-btn:hover {
  background: var(--surface-2);
}

.share-btn.primary {
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-weight: 600;
  box-shadow: none;
}

.share-btn.primary:hover {
  background: rgba(46, 47, 48, 0.85);
}

/* Toast */

.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(1rem);
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.5rem 1.25rem;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Utilities */

.hidden {
  display: none !important;
}

/* Fact-Check Panel */

.factcheck-panel {
  margin-top: 0.5rem;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-card);
}

.factcheck-summary {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.factcheck-score-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.factcheck-score-label {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  white-space: nowrap;
}

.factcheck-gauge {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.factcheck-gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.factcheck-gauge-fill.score-high {
  background: var(--success);
}

.factcheck-gauge-fill.score-mid {
  background: var(--warning);
}

.factcheck-gauge-fill.score-low {
  background: var(--destructive);
}

.factcheck-score-value {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 2ch;
  text-align: right;
}

.factcheck-score-value.score-high {
  color: var(--success);
}

.factcheck-score-value.score-mid {
  color: var(--warning);
}

.factcheck-score-value.score-low {
  color: var(--destructive);
}

.factcheck-toggle {
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}

.factcheck-toggle:hover {
  background: var(--surface-3);
  color: var(--text);
}

.factcheck-details {
  margin-top: 0.75rem;
}

.factcheck-section {
  margin-bottom: 0.75rem;
}

.factcheck-section:last-child {
  margin-bottom: 0;
}

.factcheck-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}

.factcheck-claim {
  background: var(--surface-1);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.factcheck-claim-text {
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
}

.factcheck-assessment {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.factcheck-assessment.supported {
  background: rgba(48, 164, 108, 0.12);
  color: #1a7f4b;
}

.factcheck-assessment.unsupported {
  background: rgba(229, 72, 77, 0.12);
  color: #c53030;
}

.factcheck-assessment.misleading {
  background: rgba(245, 166, 35, 0.12);
  color: #b47a14;
}

.factcheck-assessment.unverified {
  background: var(--surface-2);
  color: var(--text-muted);
}

.factcheck-claim-detail {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.factcheck-row {
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: 0.25rem;
}

.factcheck-row strong {
  color: var(--text);
  font-weight: 600;
}

.factcheck-flag {
  background: rgba(245, 166, 35, 0.08);
  border-left: 3px solid var(--warning);
  padding: 0.35rem 0.6rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.factcheck-error {
  color: var(--destructive);
  font-size: 0.8rem;
  padding: 0.5rem 0;
}

.factcheck-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0.5rem 0;
}

/* Chat Panel */

.chat-panel {
  margin-top: 0.5rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--surface-1);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-member-count {
  font-weight: 600;
}

.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.chat-msg {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface-2);
  object-fit: cover;
}

.chat-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ring);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

.chat-msg-body {
  flex: 1;
  min-width: 0;
}

.chat-msg-name {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.chat-msg-time {
  font-size: 0.65rem;
  color: var(--text-faint);
  margin-left: 0.4rem;
  font-weight: 400;
}

.chat-msg-text {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--text);
  word-break: break-word;
}

.chat-system-msg {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-faint);
  padding: 0.25rem 0;
  font-style: italic;
}

.chat-input-row {
  display: flex;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface-1);
}

.chat-input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: var(--ring);
}

.chat-input::placeholder {
  color: var(--text-faint);
}

.chat-send-btn {
  background: var(--primary-bg);
  color: var(--primary-fg);
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.chat-send-btn:hover {
  background: rgba(46, 47, 48, 0.85);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.linkedin-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.65rem 1rem;
  background: #0a66c2;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.linkedin-login-btn:hover {
  background: #004182;
}

.chat-connecting {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.chat-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-faint);
  font-size: 0.8rem;
}

/* SecondLink Public Pages */

.sl-target-url-row {
  margin-bottom: 1.25rem;
}

.sl-target-url {
  color: var(--info);
  font-size: 0.85rem;
  word-break: break-all;
  text-decoration: none;
}

.sl-target-url:hover {
  text-decoration: underline;
}

.sl-score-summary {
  margin-bottom: 1.5rem;
}

.sl-meta-card {
  margin-bottom: 1.25rem;
}

.secondlink-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.action-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s, box-shadow 0.2s;
}

.action-card:hover {
  background: var(--surface-1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.action-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.action-label {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.action-arrow {
  color: var(--text-faint);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.patent-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-faint);
  line-height: 1.5;
}

.patent-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.patent-footer a:hover {
  text-decoration: underline;
}

.sl-not-analyzed {
  text-align: center;
  padding: 2rem 0;
}

.sl-not-analyzed h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.sl-not-analyzed p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.sl-not-analyzed a {
  color: var(--ring);
  text-decoration: none;
}

.sl-not-analyzed a:hover {
  text-decoration: underline;
}

/* SecondLink URL row in SPA */

.secondlink-url-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.75rem;
  background: rgba(94, 105, 209, 0.06);
  border-radius: 8px;
  border: 1px solid rgba(94, 105, 209, 0.15);
}

.secondlink-url-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  white-space: nowrap;
}

.secondlink-url-link {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--ring);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secondlink-url-link:hover {
  text-decoration: underline;
}

.secondlink-copy-btn {
  flex-shrink: 0;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.secondlink-copy-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.secondlink-shorten-btn {
  flex-shrink: 0;
  background: var(--surface-2);
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.25rem 0.55rem;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.secondlink-shorten-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.secondlink-shorten-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Public chat page */

.sl-chat-page {
  min-height: 400px;
}

.sl-chat-login {
  padding: 1rem;
}

/* Responsive */

@media (max-width: 480px) {
  body {
    padding: 1.25rem 0.75rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  .share-buttons {
    flex-direction: column;
  }

  .share-btn {
    justify-content: center;
  }
}
