@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:ital,wght@0,300;0,400;0,600;1,300&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,700;1,9..144,300&display=swap');

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

  :root {
    --c-bg: #ffffff;
    --c-surface: #f8f9fa;
    --c-border: #d0c9be;
    --c-text: #1a1a2e;
    --c-text-soft: #6b7280;
    --c-accent: #1a1a1a;
    --c-accent-hover: #1a1a1a;
    --c-success: #059669;
    --c-error: #dc2626;
    --c-reply-line: #cbd5e1;
    --radius: 8px;
    --font: 'IBM Plex Mono', monospace;
    --font-mono: 'IBM Plex Mono', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --transition: 0.2s ease;
    --serif: 'Fraunces', serif;
    --black:   #f5f2ed;
    --dark:    #ede9e2;
    --panel:   #eae6df;
    --panel2:  #e2ddd6;
    --border:  #d0c9be;
    --muted:   #a89f93;
    --dim:     #6b635a;
    --white:   #1a1612;
    --cream:   #1a1612;
    --green:   #1a7a4a;
    --green2:  #2a9d5c;
    --amber:   #b85c00;
    --red:     #c0392b;
  }

  body {
    font-family: var(--font);
    color: var(--white);
    background: var(--black);
    line-height: 1.6;
  }

  .comments-widget {
    max-width: 720px;
    margin: 0 auto;
  }

  /* ── Header ── */
  .comments-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
  }

  .comments-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    font-family: var(--serif);
    color: var(--cream);
  }

  .comments-count {
    font-size: 0.875rem;
    color: var(--dim);
    font-weight: 500;
  }

  /* ── Form ── */
  .comment-form {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
  }

  .comment-form.replying {
    border-left: 3px solid var(--c-accent);
  }

  .reply-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--c-bg);
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    color: var(--c-text-soft);
  }

  .reply-indicator button {
    background: none;
    border: none;
    color: var(--c-error);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .form-field.full {
    grid-column: 1 / -1;
  }

  .form-field label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--c-text);
  }

  .form-field input,
  .form-field textarea {
    font-family: var(--font);
    font-size: 0.9375rem;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 2px);
    background: var(--panel2);
    color: var(--white);
    transition: border-color var(--transition);
    outline: none;
  }

  .form-field input:focus,
  .form-field textarea:focus {
    border-color: var(--white);
  }

  .form-field textarea {
    min-height: 100px;
    resize: vertical;
  }

  .form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
  }

  .form-hint {
    font-size: 0.75rem;
    color: var(--c-text-soft);
  }

  .btn-submit {
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 10px 24px;
    border: none;
    background: transparent;
    border: 1px solid var(--green); 
    color: var(--green);
    cursor: pointer;
    text-transform: uppercase;
    transition: background var(--transition), transform var(--transition);
  }

  .btn-submit:hover {
    background: var(--green); 
    color: #fff;
  }

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

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

  /* ── Messages ── */
  .form-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
  }

  .form-message.success {
    background: #ecfdf5;
    color: var(--c-success);
    border: 1px solid #a7f3d0;
  }

  .form-message.error {
    background: #fef2f2;
    color: var(--c-error);
    border: 1px solid #fecaca;
  }


  /* ── Comment list ── */
  .comments-list {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .comment {
    padding: 16px 0;
    border-bottom: 1px solid var(--c-border);
  }

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

  .comment-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
  }

  .comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
  }

  .comment-author {
    font-weight: 700;
    font-size: 0.9375rem;
  }

  .comment-author a {
    color: var(--c-text);
    text-decoration: none;
  }

  .comment-author a:hover {
    color: var(--c-accent);
  }

  .comment-date {
    font-size: 0.75rem;
    color: var(--c-text-soft);
    font-family: var(--font-mono);
  }

  .comment-body {
    font-size: 0.9375rem;
    line-height: 1.7;
    margin-left: 42px;
  }

  .comment-body p {
    margin-bottom: 8px;
  }

  .comment-body p:last-child {
    margin-bottom: 0;
  }

  .comment-body code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--c-surface);
    padding: 2px 6px;
    border-radius: 3px;
  }

  .comment-body pre {
    background: var(--c-surface);
    padding: 12px;
    border-radius: calc(var(--radius) - 2px);
    overflow-x: auto;
    margin: 8px 0;
  }

  .comment-actions {
    margin-left: 42px;
    margin-top: 8px;
  }

  .btn-reply {
    background: none;
    border: none;
    color: var(--c-text-soft);
    font-family: var(--font);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    transition: color var(--transition);
  }

  .btn-reply:hover {
    color: var(--c-accent);
  }

  /* ── Replies (nidificazione) ── */
  .comment-replies {
    margin-left: 24px;
    padding-left: 20px;
    border-left: 2px solid var(--c-reply-line);
  }

  .comment-replies .comment {
    padding: 12px 0;
  }

  .comment-replies .comment-replies {
    margin-left: 16px;
    padding-left: 16px;
  }

  /* ── Loading & empty ── */
  .comments-loading,
  .comments-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--c-text-soft);
    font-size: 0.9375rem;
  }

  .comments-loading::after {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    margin: 12px auto 0;
    border: 2px solid var(--c-border);
    border-top-color: var(--c-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

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

  /* ── Responsive ── */
  @media (max-width: 600px) {
    .form-row {
      grid-template-columns: 1fr;
    }
    .comment-replies {
      margin-left: 12px;
      padding-left: 12px;
    }
  }