/* ==========================================
   Design Tokens
   ========================================== */
:root {
  --bg: #f0f4f8;
  --card: #ffffff;
  --card-hover: #fafcff;
  --accent: #6c5ce7;
  --accent-2: #06b6d4;
  --accent-hover: #5a4ed1;
  --text: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12), 0 4px 8px rgba(0,0,0,0.06);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --transition: 0.2s ease;
}

/* ==========================================
   Reset & Base
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

/* ==========================================
   Reading Progress Bar (article page)
   ========================================== */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 1000;
  transition: width 0.08s linear;
  border-radius: 0 2px 2px 0;
}

/* ==========================================
   Header
   ========================================== */
.site-header {
  background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 40%, var(--accent-2) 100%);
  color: #fff;
  padding: 2.5rem 1.5rem 2.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle dot pattern overlay */
.site-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

/* Bottom fade */
.site-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255,255,255,0.15);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw + 0.5rem, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  position: relative;
  text-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

/* Ensure header title links are highly visible on the gradient background */
.site-header h1 a {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.85);
  text-underline-offset: 4px;
  transition: opacity var(--transition), color var(--transition);
}

.site-header h1 a:hover {
  opacity: 0.98;
  color: #fff;
  text-decoration-color: rgba(255,255,255,0.95);
}

.site-header .tagline {
  margin: 0.6rem 0 0;
  opacity: 0.88;
  font-size: clamp(0.875rem, 1.5vw + 0.2rem, 1.1rem);
  font-weight: 400;
  position: relative;
}

.site-header .tagline a,
.site-header .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.92);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.35);
  text-underline-offset: 3px;
  transition: opacity var(--transition), color var(--transition);
}

.site-header .tagline a:hover,
.site-header .back-link:hover {
  opacity: 1;
  color: #fff;
  text-decoration-color: rgba(255,255,255,0.7);
}

/* ==========================================
   Article Images (hero & inline)
   ========================================== */
.article-img-wrap {
  display: flex;
  justify-content: center;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.article-img {
  width: 100%;
  max-width: 1100px;
  height: auto;
  max-height: 460px;
  display: block;
  border-radius: calc(var(--radius) - 6px);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  object-fit: cover;
}

@media (max-width: 540px) {
  .article-img-wrap {
    margin: 1rem auto;
    padding: 0 1rem;
  }
  .article-img {
    border-radius: 10px;
    max-height: 220px;
  }
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 1.5rem;
}

/* ==========================================
   Featured Section
   ========================================== */
.featured {
  display: block;
}

.featured > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.section-subtitle {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.925rem;
}

/* Grid lives on featured-list */
.featured-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ==========================================
   Cards
   ========================================== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

/* Article cards on the index listing */
.article-card {
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(108, 92, 231, 0.18);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
  background: rgba(108, 92, 231, 0.09);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  width: fit-content;
  border: 1px solid rgba(108, 92, 231, 0.12);
}

.card h3 {
  margin: 0;
  font-size: 1.075rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: -0.01em;
}

.card h3 a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

.card h3 a:hover {
  color: var(--accent);
}

.card-excerpt {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}

.card-read-more {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap var(--transition), color var(--transition);
  user-select: none;
}

.card-read-more::after {
  content: '→';
  display: inline-block;
  transition: transform var(--transition);
}

.card:hover .card-read-more {
  color: var(--accent-hover);
}

.card:hover .card-read-more::after {
  transform: translateX(3px);
}

/* ==========================================
   Skeleton Loaders
   ========================================== */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #dde3ed 25%, #eaeff5 50%, #dde3ed 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 6px;
  display: block;
}

.skeleton-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.sk-badge  { height: 20px; width: 74px; }
.sk-title  { height: 22px; width: 88%; }
.sk-title2 { height: 22px; width: 62%; }
.sk-line   { height: 13px; width: 100%; }
.sk-line2  { height: 13px; width: 92%; }
.sk-line3  { height: 13px; width: 74%; }
.sk-divider{ height: 1px;  background: var(--border); margin: 0.2rem 0; }
.sk-cta    { height: 14px; width: 78px; }

/* Article page skeleton */
.article-skeleton {
  padding: 2rem 2.5rem;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sk-art-badge  { height: 22px; width: 84px; }
.sk-art-h1     { height: 34px; width: 90%; }
.sk-art-h1b    { height: 34px; width: 68%; margin-bottom: 0.5rem; }
.sk-art-p      { height: 15px; width: 100%; }
.sk-art-p2     { height: 15px; width: 88%; }
.sk-art-p3     { height: 15px; width: 94%; }
.sk-art-gap    { height: 8px; background: transparent; }
.sk-art-short  { height: 15px; width: 72%; }

/* ==========================================
   Button
   ========================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.28);
}

.btn:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(108, 92, 231, 0.38);
  filter: brightness(1.06);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(108, 92, 231, 0.2);
}

/* Load more button styling to match site theme */
.load-more-btn,
#load-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  margin: 1.5rem auto 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition), opacity var(--transition);
  box-shadow: 0 6px 18px rgba(108,92,231,0.18);
}

.load-more-btn:hover,
#load-more-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  box-shadow: 0 10px 28px rgba(108,92,231,0.22);
}

.load-more-btn:active,
#load-more-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(108,92,231,0.14);
}

@media (max-width: 540px) {
  .load-more-btn,
  #load-more-btn {
    width: 100%;
    padding: 0.75rem 1.25rem;
  }
}

/* ==========================================
   Article Detail Card
   ========================================== */
#item-detail {
  padding: 2rem 2.5rem;
  max-width: 720px;
  margin: 0 auto;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.article-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(108, 92, 231, 0.09);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(108, 92, 231, 0.15);
}

/* Slightly different purple for category badges */
.category-badge {
  /* Green variant to match site shading */
  color: #15803d; /* emerald-700 */
  background: rgba(21, 128, 61, 0.08);
  border: 1px solid rgba(21, 128, 61, 0.14);
}

/* Prose / markdown rendering */
#item-description {
  font-size: 1rem;
  line-height: 1.85;
  color: var(--text-secondary);
}

#item-description h1,
#item-description h2,
#item-description h3,
#item-description h4 {
  color: var(--text);
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

#item-description h1 { font-size: 1.75rem; }
#item-description h2 { font-size: 1.375rem; }
#item-description h3 { font-size: 1.125rem; }
#item-description h4 { font-size: 1rem; }

#item-description p { margin: 0 0 1.2rem; }

#item-description ul,
#item-description ol {
  padding-left: 1.6rem;
  margin: 0 0 1.2rem;
}

#item-description li { margin-bottom: 0.4rem; }

#item-description a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(108,92,231,0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition);
}

#item-description a:hover {
  text-decoration-color: var(--accent);
}

#item-description blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: rgba(108, 92, 231, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
  font-style: italic;
}

#item-description code {
  font-family: 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: rgba(0,0,0,0.055);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--accent);
}

#item-description pre {
  background: #1a202c;
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

#item-description pre code {
  background: none;
  color: #e2e8f0;
  font-size: 0.875rem;
  padding: 0;
}

#item-description table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

#item-description th {
  background: rgba(108,92,231,0.07);
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

#item-description td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

#item-description tr:last-child td {
  border-bottom: none;
}

#item-description hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

#item-description img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

/* Affiliate link section */
.affiliate-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.affiliate-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================
   Toast Notification
   ========================================== */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);    }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(-50%) translateY(0);    }
  to   { opacity: 0; transform: translateX(-50%) translateY(10px); }
}

.toast {
  position: fixed;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 32, 44, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
  animation: toastIn 0.28s ease, toastOut 0.28s ease 1.5s forwards;
  white-space: nowrap;
  pointer-events: none;
}

/* ==========================================
   Animations
   ========================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);     }
}

.animate-in {
  animation: fadeInUp 0.38s ease both;
}

/* ==========================================
   Empty / Error States
   ========================================== */
.empty-state,
.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
}

.empty-state .state-icon,
.error-state .state-icon {
  font-size: 2.75rem;
  margin-bottom: 0.75rem;
  display: block;
}

.empty-state p,
.error-state p {
  font-size: 0.95rem;
  margin: 0;
}

/* ==========================================
   Useful Tools Section
   ========================================== */
.useful-tools {
  margin-bottom: 3rem;
}

.useful-tools > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.tool-card-header {
  padding: 1.4rem 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tool-card-header h3 {
  margin: 0;
}

.tool-card-body {
  padding: 0 1.5rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tool-input-row {
  display: flex;
  gap: 0.6rem;
}

.tool-input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-width: 0;
}

.tool-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.tool-btn {
  padding: 0.6rem 1.1rem;
  font-size: 0.875rem;
  white-space: nowrap;
  box-shadow: none;
}

.tool-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.qr-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.qr-image {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  image-rendering: pixelated;
}

.qr-download-btn {
  font-size: 0.85rem;
  padding: 0.55rem 1.2rem;
  box-shadow: none;
}

.tool-error {
  margin: 0;
  font-size: 0.85rem;
  color: #dc2626;
}

@media (max-width: 540px) {
  .tools-grid {
    grid-template-columns: 1fr;
  }

  .tool-input-row {
    flex-direction: column;
  }

  .tool-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================
   Footer
   ========================================== */
.site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 768px) {
  .site-header {
    padding: 2rem 1rem 1.75rem;
  }

  .container {
    padding: 1.5rem 1rem 1.25rem;
  }

  .featured-list {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  #item-detail {
    padding: 1.5rem 1.25rem;
  }

  .article-skeleton {
    padding: 1.5rem 1.25rem;
  }

  .affiliate-section {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (min-width: 541px) and (max-width: 768px) {
  .featured-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large screens: vertically center content when viewport is tall */
@media (min-width: 1000px) and (min-height: 900px) {
  .container {
    min-height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .container > .featured {
    align-self: center;
    width: 100%;
  }
}

/* ==========================================
   Tool Detail Pages
   ========================================== */
.tool-page-card {
  padding: 1.75rem;
}

.tool-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.tool-label-note {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.tool-textarea {
  display: block;
  width: 100%;
  min-height: 320px;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.6;
}

.tool-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.char-counter {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 0.3rem;
}

.char-counter.near-limit { color: #f59e0b; }
.char-counter.at-limit   { color: #dc2626; }

.tool-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.5rem;
}

/* Tool page input section spacing */
.tool-page-card > * + * { margin-top: 1rem; }
.tool-page-card > *:first-child { margin-top: 0; }

/* Results */
.tool-results {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-top: 0.25rem;
}

.metrics-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.metric-card {
  flex: 1;
  min-width: 110px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: var(--shadow-sm);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Sentence Counts table */
.sc-table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.sc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sc-table th {
  background: rgba(108, 92, 231, 0.06);
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.sc-th-num { text-align: center; }

.sc-table td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.sc-table tr:last-child td { border-bottom: none; }
.sc-table tr:hover td { background: rgba(108, 92, 231, 0.025); }

.sc-td-num {
  text-align: center;
  color: var(--text-muted);
  white-space: nowrap;
  width: 64px;
}

.sc-td-text {
  line-height: 1.65;
  color: var(--text-secondary);
}

/* Word Chips (phrase-classifier) */
.word-chips-area {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.5rem;
}

.word-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: #0e7490;
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.4rem 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 500;
}

.word-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #0e7490;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  opacity: 0.7;
  transition: opacity var(--transition), background var(--transition);
}

.word-chip-remove:hover {
  opacity: 1;
  background: rgba(6, 182, 212, 0.2);
}

.word-chip-input-row {
  display: flex;
  gap: 0.6rem;
}

/* Phrase Classifier sentence results */
.pc-sentences-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pc-sentence {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  line-height: 1.75;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: border-color var(--transition);
}

.pc-sentence--match {
  border-left-color: var(--accent);
}

.pc-sentence-num {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  margin-top: 0.25rem;
  line-height: 1.5;
  min-width: 24px;
  text-align: center;
}

.pc-sentence-text { flex: 1; }

/* Phrase highlights with tooltip */
mark.phrase-highlight {
  position: relative;
  background: rgba(108, 92, 231, 0.14);
  border-bottom: 2px solid var(--accent);
  border-radius: 2px;
  padding: 0 1px;
  cursor: default;
  color: inherit;
}

mark.phrase-highlight:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.phrase-tooltip {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}

.phrase-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a202c;
}

mark.phrase-highlight:hover .phrase-tooltip,
mark.phrase-highlight:focus .phrase-tooltip {
  opacity: 1;
}

/* Clickable tool cards on index */
.tool-card--page { cursor: pointer; }

.tool-page-btn {
  font-size: 0.875rem;
  padding: 0.6rem 1.1rem;
  box-shadow: none;
  align-self: flex-start;
  width: fit-content;
}

@media (max-width: 540px) {
  .tool-page-card { padding: 1.25rem; }
  .metrics-row { gap: 0.75rem; }
  .metric-card { min-width: calc(50% - 0.375rem); }
  .metric-value { font-size: 1.4rem; }
  .word-chip-input-row { flex-direction: column; }
  .word-chip-input-row .tool-btn { width: 100%; justify-content: center; }
}
