/* PeopleSay share UI */
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.share-modal.hidden { display: none !important; }

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23,23,23,.52);
  backdrop-filter: blur(5px);
}

.share-modal-panel {
  position: relative;
  width: min(100%, 760px);
  max-height: min(97vh, 900px);
  overflow: auto;
  padding: 18px 24px 20px;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
  animation: shareModalIn .22s cubic-bezier(.16,1,.3,1);
}

@keyframes shareModalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.share-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.share-modal-kicker {
  color: #a3a3a3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}

.share-modal-header h3 {
  margin: 4px 0 0;
  color: #171717;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.02em;
}

.share-modal-close {
  width: 34px;
  height: 34px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #f5f5f5;
  color: #525252;
  font-size: 22px;
  line-height: 1;
}

.share-modal-close:hover { background: #eaeaea; }

.share-preview-wrap {
  width: min(100%, 600px);
  aspect-ratio: 1 / 1;
  height: auto;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #fff;
}

.share-preview-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.share-streak-toggle {
  width: min(100%, 600px);
  min-height: 50px;
  margin: 8px auto 0;
  padding: 8px 12px 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  user-select: none;
}

.share-streak-toggle > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.share-streak-toggle strong {
  color: #404040;
  font-size: 12px;
  font-weight: 700;
}

.share-streak-toggle small {
  color: #a3a3a3;
  font-size: 10px;
  line-height: 1.3;
}

.share-streak-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.share-switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border: 1px solid #d4d4d4;
  border-radius: 999px;
  background: #e5e5e5;
  transition: background .15s ease, border-color .15s ease;
}

.share-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
  transition: transform .15s ease;
}

.share-streak-toggle input:checked + .share-switch {
  background: #171717;
  border-color: #171717;
}

.share-streak-toggle input:checked + .share-switch::after {
  transform: translateX(18px);
}

.share-streak-toggle:focus,
.share-streak-toggle:focus-within,
.share-streak-toggle input:focus,
.share-streak-toggle input:focus-visible,
.share-switch:focus,
.share-switch:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.share-actions {
  width: min(100%, 600px);
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.share-action-primary { grid-column: 1 / -1; }

.share-actions .secondary-button,
.share-actions .primary-button {
  min-height: 42px;
}

.share-modal-note {
  width: min(100%, 600px);
  margin: 8px auto 0;
  color: #a3a3a3;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 1010;
  max-width: calc(100vw - 32px);
  padding: 9px 13px;
  border-radius: 999px;
  background: #171717;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .18s ease, transform .18s ease;
}

.share-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.modal-open { overflow: hidden; }

@media (min-width: 768px) and (max-height: 800px) {
  .share-modal-panel {
    max-height: 99vh;
    padding: 12px 18px 14px;
  }

  .share-modal-header { margin-bottom: 8px; }

  .share-preview-wrap {
    width: min(100%, 500px);
  }

  .share-streak-toggle,
  .share-actions,
  .share-modal-note {
    width: min(100%, 500px);
  }
}

@media (max-width: 767px) {
  .share-modal {
    align-items: center;
    padding: 12px;
  }

  .share-modal-panel {
    width: 100%;
    max-width: 760px;
    max-height: calc(100vh - 24px);
    padding: 14px 18px 16px;
    border-radius: 18px;
    border: 1px solid #e5e5e5;
  }

  .share-preview-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: none;
  }

  .share-preview-wrap img {
    width: 100%;
    height: 100%;
  }

  .share-streak-toggle,
  .share-actions,
  .share-modal-note {
    width: 100%;
  }
}

/* Statistics answer-list layout fixes */
.stats-content .answer-row {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.stats-content .answer-row:last-child {
  border-bottom: 0;
}

.stats-content .answer-text {
  min-width: 0;
  flex: 1 1 auto;
  color: #525252;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.stats-content .answer-like-button {
  flex: 0 0 auto;
}

/* Most Common */
.stats-content .stats-grid {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stats-content .stat-row {
  min-height: 44px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.stats-content .stat-row:last-child {
  border-bottom: 0;
}

.stats-content .stat-row span {
  min-width: 0;
  color: #525252;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.stats-content .stat-row strong {
  flex: 0 0 auto;
  min-width: 28px;
  color: #171717;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

@media (max-width: 680px) {
  .stats-content .answer-row {
    min-height: 46px;
    padding: 9px 10px;
    gap: 10px;
  }

  .stats-content .answer-text,
  .stats-content .stat-row span {
    font-size: 12px;
  }

  .stats-content .stat-row {
    min-height: 42px;
    padding: 9px 12px;
  }
}

/* Answer-area Share trigger */
.answer-area-share-button {
  width: 100%;
  margin-top: 14px;
}
