/**
 * CoCLinks - Single Base Layout Detail Styles (base.css)
 * Conditionally loaded via [aviable=base] in main.tpl
 * Strictly adheres to frontend_layout_rules.md:
 * - 1024px container (clean 992px inner content)
 * - Zero-width ring shadows: border: none; box-shadow: 0 0 0 1px var(--border);
 * - Static hover states (no translateY/scale transforms)
 * - 8px radius (var(--radius-sm)) for interactive buttons & segmented controls
 * - 64px spacing between major logical blocks
 * - Default typography for headings without arbitrary overrides
 */

/* ==========================================================================
   1. Detail View Container & Base Preview Image
   ========================================================================== */
.base-title-link,
.base-title a {
  color: inherit !important;
  text-decoration: none !important;
  cursor: pointer;
}

.base-title-link:hover,
.base-title-link:focus,
.base-title a:hover,
.base-title a:focus {
  color: inherit !important;
  text-decoration: none !important;
}

.detail-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: 48px;
}

/* Base Image Preview Box */
.base-img-box {
  width: 100%;
  background: var(--bg-card);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}

.base-img-box .base-img {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: -webkit-optimize-contrast;
}

.zoom-trigger {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  background-color: rgba(0, 0, 0, 0.65);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 2;
}

.base-img-box:hover .zoom-trigger {
  opacity: 1;
  visibility: visible;
}

/* ==========================================================================
   2. Indicators Bar (Rating, Creator, Views, Copies directly under image)
   ========================================================================== */
.base-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  margin-bottom: 32px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.rating-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  position: relative;
}

.rating-gradient-def {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.stars-picker {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.stars-picker svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--star-color);
  stroke-width: 1.6;
  opacity: 0.35;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

.stars-picker svg.active {
  fill: var(--star-color);
  opacity: 1;
}

.stars-picker svg.half {
  fill: url(#halfStarGrad);
  opacity: 1;
}

.stars-picker svg.hovered {
  fill: var(--star-color) !important;
  opacity: 1 !important;
  transform: scale(1.15);
}

.stars-picker svg.unhovered {
  opacity: 0.25 !important;
}

.rating-stat-item .stat-value {
  font-weight: 700;
  color: var(--text-primary);
  margin-left: 2px;
}

.rating-votes-count {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.stats-items-group {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.stats-items-group .stat-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.stats-items-group .stat-item svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.stats-items-group .stat-item .stat-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* ==========================================================================
   3. Action Block: Prev Base / Copy Layout / Next Base + Tools Row
   ========================================================================== */
.base-actions-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

/* Main CTA Row (Independent Refined Buttons, 44px height, 8px radius) */
.base-cta-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
}

.btn-nav-layout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  background: #f1f5f9;
  color: #334155;
  border: none;
  box-shadow: 0 0 0 1px #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-nav-layout svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: #64748b;
  transition: stroke 0.15s ease;
}

.btn-nav-layout:hover {
  background: #e2e8f0;
  color: var(--brand-blue);
  box-shadow: 0 0 0 1px var(--brand-blue);
}

.btn-nav-layout:hover svg {
  stroke: var(--brand-blue);
}

html.dark .btn-nav-layout {
  background: #1e222e;
  color: #cbd5e1;
  box-shadow: 0 0 0 1px #334155;
}

html.dark .btn-nav-layout:hover {
  background: #282e3f;
  color: var(--brand-blue);
  box-shadow: 0 0 0 1px var(--brand-blue);
}

/* Primary CTA: Copy Layout */
.btn-copy-cta {
  flex: 1;
  width: auto;
  min-height: 44px;
  background: var(--brand-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 4px 14px rgba(0, 102, 204, 0.2);
}

.btn-copy-cta:hover {
  background: var(--brand-blue-hover);
}

.btn-copy-cta:active {
  transform: scale(0.99);
}

.btn-copy-cta.copied {
  background: #16a34a !important;
}

/* Informative Notice when copy link is unavailable (TH3 / BH3) */
.no-copy-notice {
  flex: 1;
  width: auto;
  min-height: 44px;
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-secondary, #475569);
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.no-copy-notice svg {
  flex-shrink: 0;
  color: var(--brand-blue, #0071e3);
}

html.dark .no-copy-notice {
  background: #1e222e;
  border-color: #334155;
  color: #94a3b8;
}

@media (max-width: 520px) {
  .nav-layout-label {
    display: none;
  }

  .btn-nav-layout {
    padding: 0;
    width: 44px;
    min-width: 44px;
    justify-content: center;
  }
}

/* Unified Segmented Toolbar: Scan QR | Favorite | Share | Broken Link? */
.base-tools-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  width: 100%;
  background: var(--bg-card);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.base-tools-row.has-4-tools {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 520px) {
  .base-tools-row.has-4-tools {
    grid-template-columns: repeat(2, 1fr);
  }

  .base-tools-row.has-4-tools .btn-tool-item:nth-child(1),
  .base-tools-row.has-4-tools .btn-tool-item:nth-child(2) {
    border-bottom: 1px solid var(--border);
  }

  .base-tools-row.has-4-tools .btn-tool-item:nth-child(2n) {
    border-right: none;
  }
}

.btn-tool-item {
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-tool-item:last-child {
  border-right: none;
}

.btn-tool-item svg {
  color: var(--text-secondary);
  transition: color 0.15s ease, fill 0.15s ease;
  flex-shrink: 0;
}

.btn-tool-item:hover {
  background: var(--bg-subtle);
  color: var(--brand-blue);
}

.btn-tool-item:hover svg {
  color: var(--brand-blue);
}

.btn-tool-item:disabled,
.btn-tool-item.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-tool-item:disabled:hover,
.btn-tool-item.is-disabled:hover {
  background: transparent !important;
  color: var(--text-primary) !important;
}

.btn-tool-item:disabled svg,
.btn-tool-item.is-disabled svg {
  color: var(--text-secondary) !important;
}

.btn-tool-item.favorited {
  color: #ef4444;
}

.btn-tool-item.favorited svg {
  color: #ef4444 !important;
  fill: #ef4444 !important;
  transform: scale(1.08);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   4. Similar Bases Section (3 rows of 4 cards)
   ========================================================================== */
.related-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 64px;
}

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

.related-heading {
  margin: 0;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.related-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  text-decoration: none;
  transition: box-shadow 0.15s ease;
}

.related-card:hover {
  box-shadow: 0 0 0 1.5px var(--brand-blue), 0 4px 16px -2px rgba(0, 102, 204, 0.12);
}

.related-thumb-box {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-subtle);
  overflow: hidden;
  display: block;
}

.related-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Minimalist stats row under thumbnail */
.related-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
}

.related-stats-group {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.related-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  line-height: 1;
}

.related-stat.rating {
  color: var(--star-color);
  font-weight: 600;
}

.related-stat svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Bottom CTA: View all bases in section */
.related-footer {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.btn-view-all-category {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  background: var(--bg-card);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-view-all-category:hover {
  box-shadow: 0 0 0 1px var(--brand-blue);
  color: var(--brand-blue);
  background: var(--bg-subtle);
}

/* ==========================================================================
   5. Tactical Overview & Base Features Section
   ========================================================================== */
.strategy-box {
  background: var(--bg-card);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 64px;
}

.strategy-header {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.strategy-header-icon {
  width: 19px;
  height: 19px;
  color: var(--brand-blue);
  flex-shrink: 0;
}

.strategy-h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.strategy-body {
  background: var(--bg-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Category Badges inside Strategy Box */
.base-badges-list {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: none;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  transition: background 0.15s ease, color 0.15s ease;
}

.badge-link svg {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.badge-link:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

html.dark .badge-link {
  background: #1e222e;
  color: #94a3b8;
}

html.dark .badge-link:hover {
  background: #282e3f;
  color: #f8fafc;
}

.strategy-p {
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.strategy-summary {
  margin: 0 0 16px;
  font-size: 0.94rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.strategy-summary:last-child {
  margin-bottom: 0;
}

.strategy-features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.strategy-features li {
  margin: 0;
  position: relative;
  padding-left: 18px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.strategy-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-blue);
}

.strategy-features li strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* ==========================================================================
   6. Comments & Reviews Block
   ========================================================================== */
.comments-box {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  padding-top: 48px;
}

.comments-header {
  background: transparent;
  border: none;
  padding: 0 0 18px 0;
  display: flex;
  align-items: center;
}

.comments-title,
.comments-heading {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.015em;
}

.comments-body {
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 640px) {
  .comments-box {
    padding-top: 36px;
  }

  .comments-header {
    padding: 0 0 14px 0;
  }

  .comments-body {
    padding: 0;
    gap: 14px;
  }
}

.comment-form {
  display: flex;
  flex-direction: column;
}

.comment-form-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  gap: 14px;
}

.comment-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.comment-form-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-input-text,
.form-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 12px 14px;
  font-size: 0.93rem;
  line-height: 1.55;
  font-family: inherit;
  outline: none;
  resize: vertical;
  min-height: 85px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.form-input-text:focus,
.form-textarea:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

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

.comment-char-counter {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.btn-submit-review,
.btn-submit-comment {
  background: var(--brand-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}

.btn-submit-review:hover:not(:disabled),
.btn-submit-comment:hover:not(:disabled) {
  background: var(--brand-blue-hover);
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-submit-comment:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-submit-comment:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

/* Guest: disabled form preview with sign-in overlay */
.comment-guest {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  overflow: hidden;
}

.comment-guest-preview {
  display: flex;
  gap: 14px;
  opacity: 0.45;
  filter: grayscale(1);
  pointer-events: none;
  user-select: none;
}

.comment-avatar.comment-avatar-ghost {
  background: var(--border);
  box-shadow: none;
}

.comment-guest-fake {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-guest-textarea {
  min-height: 85px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.93rem;
  color: var(--text-tertiary);
}

.comment-guest-fake .form-footer {
  justify-content: flex-end;
}

.comment-guest-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  background: var(--text-tertiary);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 600;
}

.comment-guest-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.comment-guest-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  text-align: center;
  max-width: 100%;
}

html.dark .comment-guest-panel {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.comment-guest-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.comment-guest-title svg {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.comment-auth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-comment-auth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-comment-login {
  background: var(--brand-blue);
  color: #ffffff;
}

.btn-comment-login:hover {
  background: var(--brand-blue-hover);
}

.btn-comment-register {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-comment-register:hover {
  background: var(--bg-subtle);
}

@media (max-width: 640px) {
  .comment-guest {
    padding: 14px 16px;
  }

  .comment-guest-panel {
    width: 100%;
  }

  .comment-auth-actions {
    width: 100%;
  }

  .btn-comment-auth {
    flex: 1;
  }
}

/* Comments List: flat rows with dividers */
.comments-list {
  display: flex;
  flex-direction: column;
}

.comment-card,
.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  transition: opacity 0.25s ease;
}

.comment-card:last-child {
  border-bottom: none;
}

.comment-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.comment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.comment-card-user {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.comment-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  user-select: none;
  overflow: hidden;
}

.comment-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.comment-avatar.av-blue {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.comment-avatar.av-purple {
  background: linear-gradient(135deg, #a855f7, #7e22ce);
}

.comment-avatar.av-amber {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.comment-avatar.av-emerald {
  background: linear-gradient(135deg, #10b981, #047857);
}

.comment-avatar.av-rose {
  background: linear-gradient(135deg, #f43f5e, #be123c);
}

.comment-avatar.av-indigo {
  background: linear-gradient(135deg, #6366f1, #4338ca);
}

.comment-user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.comment-user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.comment-user-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: -0.01em;
  word-break: break-word;
}

.comment-dot {
  color: var(--text-tertiary);
  font-size: 0.75rem;
  line-height: 1;
  user-select: none;
  opacity: 0.7;
}

.comment-time {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 400;
  white-space: nowrap;
}

.comment-user-role {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 400;
  line-height: 1.3;
  margin-top: 2px;
}

.comment-card-body {
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-top: 8px;
  word-break: break-word;
}

/* Collapsible Long Comments (mask fade works on any background) */
.comment-card.has-collapse .comment-card-body {
  max-height: 120px;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.comment-card.has-collapse:not(.is-expanded) .comment-card-body {
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.comment-card.is-expanded .comment-card-body {
  max-height: 2500px;
}

.btn-comment-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 6px 14px;
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-blue);
  cursor: pointer;
  align-self: center;
  transition: color 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
}

.btn-comment-expand:hover {
  color: var(--brand-blue-hover);
}

.btn-comment-expand .btn-expand-icon {
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.comment-card.is-expanded .btn-comment-expand .btn-expand-icon {
  transform: rotate(180deg);
}

/* Skeleton rows while loading more */
.comment-skeleton {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.comment-skeleton:last-child {
  border-bottom: none;
}

.sk-avatar,
.sk-line {
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--border) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: comment-shimmer 1.2s ease-in-out infinite;
}

.sk-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sk-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.sk-line {
  height: 11px;
  border-radius: 6px;
}

.sk-line-short {
  width: 30%;
}

.sk-line-long {
  width: 75%;
}

@keyframes comment-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  .sk-avatar,
  .sk-line {
    animation: none;
  }
}

@media (max-width: 640px) {
  .comment-form-card {
    padding: 14px 16px;
  }

  .comment-card,
  .comment-skeleton {
    padding: 16px 0;
    gap: 12px;
  }

  .comment-avatar,
  .sk-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }
}

.comments-empty {
  text-align: center;
  padding: 28px 20px;
  font-size: 0.9rem;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}

.comments-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.btn-comments-more {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-comments-more:hover:not(:disabled) {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
}

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

.btn-more-count {
  color: var(--text-tertiary);
  font-weight: 500;
  margin-left: -3px;
  font-variant-numeric: tabular-nums;
}

.btn-comments-more:hover:not(:disabled) .btn-more-count {
  color: inherit;
}

.btn-more-icon {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.btn-comments-more:hover:not(:disabled) .btn-more-icon {
  transform: translateY(2px);
}

/* ==========================================================================
   7. Modals (Lightbox & QR Modal) and Toast Notification
   ========================================================================== */

/* Lightbox Popup (inside #coc_popup.lightbox-popup) */
#coc_popup.lightbox-popup.has-overlay {
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

#coc_popup.lightbox-popup .coc-popup-card {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  width: auto;
  max-width: 96vw;
  display: flex;
  align-items: center;
  justify-content: center;
  position: static;
}

#coc_popup.lightbox-popup .coc-popup-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

#coc_popup.lightbox-popup .coc-popup-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

#coc_popup.lightbox-popup .coc-popup-close:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

#coc_popup.lightbox-popup img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
  display: block;
}

/* QR Code Popup (inside #coc_popup.qr-popup) */
#coc_popup.qr-popup .coc-popup-card {
  padding: 24px;
  border-radius: var(--radius-md);
}

#coc_popup.qr-popup .coc-popup-header {
  margin-bottom: 16px;
}

.qr-popup-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.qr-image-wrapper {
  background: #ffffff;
  padding: 12px;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-img,
.qr-image-wrapper svg {
  display: block;
  width: 200px;
  height: 200px;
}

.qr-modal-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.45;
  margin: 0;
}

/* Broken Link Report Tool Button & Warning Notice */
.btn-tool-report {
  color: var(--text-secondary);
}

.btn-tool-report svg {
  color: var(--text-tertiary);
}

.btn-tool-report:hover:not(:disabled) {
  background: rgba(217, 119, 6, 0.08);
  color: #d97706;
}

.btn-tool-report:hover:not(:disabled) svg {
  color: #d97706;
}

html.dark .btn-tool-report:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

html.dark .btn-tool-report:hover:not(:disabled) svg {
  color: #f59e0b;
}

.btn-tool-report.is-reported,
.btn-tool-report.is-reported:disabled {
  opacity: 0.85;
  color: #16a34a !important;
  cursor: default;
}

.btn-tool-report.is-reported svg,
.btn-tool-report.is-reported:disabled svg {
  color: #16a34a !important;
}

.broken-link-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.28);
  border-radius: var(--radius-sm);
  color: #92400e;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.4;
}

.broken-link-notice svg {
  flex-shrink: 0;
  color: #d97706;
}

html.dark .broken-link-notice {
  background: rgba(245, 158, 11, 0.12);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

html.dark .broken-link-notice svg {
  color: #f59e0b;
}

/* Broken Link Report Popup (inside #coc_popup.report-popup) */
#coc_popup.report-popup .coc-popup-card {
  padding: 22px 24px 24px;
  border-radius: var(--radius-md);
}

#coc_popup.report-popup .coc-popup-header {
  margin-bottom: 12px;
}

.report-popup-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.report-popup-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.report-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-report-reason {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  border: none;
  box-shadow: 0 0 0 1px var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn-report-reason svg {
  flex-shrink: 0;
  color: #d97706;
}

.btn-report-reason:hover:not(:disabled) {
  background: rgba(217, 119, 6, 0.09);
  color: #b45309;
  box-shadow: 0 0 0 1px #d97706;
}

html.dark .btn-report-reason:hover:not(:disabled) {
  background: rgba(245, 158, 11, 0.14);
  color: #fcd34d;
  box-shadow: 0 0 0 1px #f59e0b;
}

.btn-report-reason:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ==========================================================================
   8. AdSense Responsive Fixed-Size Slot (CLS = 0)
   ========================================================================== */

.base-ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 28px;
  padding: 12px 10px 14px;
  background: var(--bg-subtle);
  border: none;
  box-shadow: 0 0 0 1px var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 296px;
  overflow: hidden;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.base-ad-slot:has(ins[data-ad-status="filled"]) {
  background: transparent;
  box-shadow: none;
}

.base-ad-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  line-height: 1;
  user-select: none;
}

.base-ad-unit {
  display: inline-block;
  width: 300px;
  height: 250px;
}

@media (min-width: 768px) {
  .base-ad-slot {
    margin: 0 0 32px;
    min-height: 136px;
    padding: 12px 16px 14px;
  }

  .base-ad-unit {
    width: 728px;
    height: 90px;
  }
}