/* ============================================================================
   COMMENTS — public per-game comment thread + composer + report modal.
   Reuses the existing token palette (--surface / --surface-2 / --border /
   --text / --muted / --warn). Conversation-style layout: avatar circle on
   the left, header (author + meta) + body + actions on the right.
   ========================================================================= */

.wfe-comments-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.wfe-comments-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.wfe-comments-title {
  font-size: 18px;
  margin: 0;
  color: var(--text, #f1e8de);
}

.wfe-comments-count {
  color: var(--muted, #b3a89c);
  font-variant-numeric: tabular-nums;
}

/* --- composer ------------------------------------------------------------ */

.wfe-comments-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface, #221d19);
  border: 1px solid var(--border, rgba(255, 220, 180, 0.07));
  border-radius: 10px;
  padding: 12px;
}

.wfe-comments-composer-anon {
  align-items: flex-start;
  gap: 12px;
}

.wfe-comments-anon-hint {
  color: var(--muted, #b3a89c);
  font-size: 14px;
}

.wfe-comments-input {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: var(--surface-2, #2a231e);
  color: var(--text, #f1e8de);
  border: 1px solid var(--border-2, rgba(255, 220, 180, 0.12));
  border-radius: 8px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.wfe-comments-input:focus {
  outline: 2px solid var(--warn, #d59148);
  outline-offset: -1px;
}

.wfe-comments-composer-actions {
  display: flex;
  justify-content: flex-end;
}

/* --- list / item -------------------------------------------------------- */

.wfe-comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wfe-comments-empty {
  color: var(--muted, #b3a89c);
  font-size: 14px;
  padding: 18px 12px;
  text-align: center;
  background: var(--surface, #221d19);
  border-radius: 8px;
  border: 1px dashed var(--border-2, rgba(255, 220, 180, 0.12));
}

.wfe-comment {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  background: var(--surface, #221d19);
  border: 1px solid var(--border, rgba(255, 220, 180, 0.07));
  border-radius: 10px;
  padding: 12px;
}

.wfe-comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text, #f1e8de);
  background: linear-gradient(135deg, rgba(213, 145, 72, 0.45), rgba(213, 145, 72, 0.15));
  border: 1px solid var(--border-2, rgba(255, 220, 180, 0.12));
  font-size: 15px;
  text-transform: uppercase;
}

.wfe-comment-body {
  min-width: 0;
}

.wfe-comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 13px;
}

.wfe-comment-author {
  font-weight: 600;
  color: var(--text, #f1e8de);
}

.wfe-comment-meta {
  color: var(--muted, #b3a89c);
  font-size: 12px;
  display: inline-flex;
  gap: 6px;
}

.wfe-comment-edited {
  color: var(--warn, #d59148);
  opacity: 0.7;
  font-style: italic;
}

.wfe-comment-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text, #f1e8de);
  white-space: pre-wrap;
  word-break: break-word;
}

.wfe-comment-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.wfe-comment-act {
  background: transparent;
  border: 1px solid var(--border-2, rgba(255, 220, 180, 0.12));
  color: var(--muted, #b3a89c);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.wfe-comment-act:hover {
  color: var(--text, #f1e8de);
  border-color: var(--warn, #d59148);
}

.wfe-comment-act-danger:hover {
  color: #ff7c5e;
  border-color: #ff7c5e;
}

.wfe-comment-act-flag {
  margin-left: auto;
}

/* --- inline edit -------------------------------------------------------- */

.wfe-comment-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wfe-comment-edit-input {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  background: var(--surface-2, #2a231e);
  color: var(--text, #f1e8de);
  border: 1px solid var(--border-2, rgba(255, 220, 180, 0.12));
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.wfe-comment-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* --- report modal ------------------------------------------------------- */

.wfe-report-modal-back {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.wfe-report-modal {
  width: min(420px, 100%);
  background: var(--surface, #221d19);
  border: 1px solid var(--border-2, rgba(255, 220, 180, 0.12));
  border-radius: 12px;
  padding: 18px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.wfe-report-title {
  margin: 0;
  font-size: 16px;
  color: var(--text, #f1e8de);
}

.wfe-report-reasons {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wfe-report-reason {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text, #f1e8de);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.wfe-report-reason:hover {
  background: var(--surface-2, #2a231e);
}

.wfe-report-note-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, #b3a89c);
}

.wfe-report-note {
  width: 100%;
  min-height: 56px;
  resize: vertical;
  background: var(--surface-2, #2a231e);
  color: var(--text, #f1e8de);
  border: 1px solid var(--border-2, rgba(255, 220, 180, 0.12));
  border-radius: 8px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
}

.wfe-report-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ============================================================================
   MOBILE ADAPTIVITY
   ========================================================================== */

/* --- iOS zoom: textarea font-size override (specificity fix) -------------- */
/* Global responsive.css sets input font-size:16px, but .wfe-comments-input
   has font-size:14px which overrides it on mobile → triggers iOS zoom.
   Fix only on touch/mobile where zoom is a problem. */
@media (max-width: 640px), (pointer: coarse) {
  .wfe-comments-input,
  .wfe-comment-edit-input {
    font-size: 16px;
  }
}

/* --- tap target: action buttons ------------------------------------------ */
/* Buttons have padding:4px 10px which is too small for touch (< 44px).
   Use position:relative + ::after hit-area to avoid layout changes. */
@media (max-width: 640px), (pointer: coarse) {
  .wfe-comment-act {
    position: relative;
    min-height: 36px;
    padding: 6px 12px;
  }
  .wfe-comment-act::after {
    content: "";
    position: absolute;
    inset: -6px -4px;
  }
}

/* --- hover → touch visibility: action buttons ---------------------------- */
/* On desktop actions are visually muted until :hover.
   On touch devices there is no hover state — make them always visible. */
@media (hover: none) {
  .wfe-comment-act {
    color: var(--text, #f1e8de);
    border-color: var(--border-2, rgba(255, 220, 180, 0.12));
  }
  .wfe-comment-act-danger {
    color: #ff7c5e;
    border-color: #ff7c5e;
  }
}

/* --- report reason tap targets ------------------------------------------- */
@media (max-width: 640px), (pointer: coarse) {
  .wfe-report-reason {
    padding: 8px 6px;
  }
}

/* --- narrow screen: reduce composer padding, tighten comment grid --------- */
@media (max-width: 380px) {
  .wfe-comments-composer {
    padding: 10px;
  }
  .wfe-comment {
    grid-template-columns: 30px 1fr;
    gap: 8px;
    padding: 10px;
  }
  .wfe-comment-avatar {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .wfe-comment-actions {
    gap: 6px;
  }
}
