.community-share-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.community-more-settings-button[hidden] {
  display: none !important;
}

.community-share-primary {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.community-share-summary {
  min-width: 0;
}

.community-more-settings-button {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  border: 0;
  border-top: 1px solid var(--theme-line, var(--line));
  border-radius: 0;
  padding: 10px 0 0;
  background: transparent;
  color: var(--theme-primary-strong, var(--primary-strong));
  box-shadow: none;
  text-align: left;
}

.community-more-settings-button:focus-visible {
  background: transparent;
  color: var(--theme-primary, var(--primary));
  box-shadow: none;
  transform: none;
}

@media (hover: hover) and (pointer: fine) {
  .community-more-settings-button:hover:not(:disabled) {
    background: transparent;
    color: var(--theme-primary, var(--primary));
    box-shadow: none;
    transform: none;
  }
}

.community-more-settings-button:active:not(:disabled) {
  background: transparent;
  transform: scale(0.992);
}

.community-more-settings-label {
  font-size: 13px;
  font-weight: 800;
}

.community-more-settings-meta {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--theme-muted, var(--muted));
  font-size: 12px;
  font-weight: 650;
}

.community-more-settings-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.community-more-settings-arrow {
  color: var(--theme-primary, var(--primary));
  font-size: 19px;
  line-height: 1;
}

.community-ai-review-panel .settings-description {
  max-width: 680px;
}

.community-ai-review-switch-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.community-ai-review-style-fieldset {
  min-width: 0;
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  border: 0;
  padding: 0;
}

.community-ai-review-style-fieldset legend {
  padding: 0;
  color: var(--theme-ink, var(--ink));
  font-size: 14px;
  font-weight: 800;
}

.community-ai-review-style-fieldset > p {
  margin: -4px 0 0;
  color: var(--theme-muted, var(--muted));
  font-size: 12px;
  line-height: 1.55;
}

.community-ai-review-style-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 9px;
}

.community-ai-review-style-option {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.community-ai-review-style-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.community-ai-review-style-option > span {
  position: relative;
  min-height: 58px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--theme-line, var(--line));
  border-radius: 10px;
  padding: 9px 32px 9px 11px;
  background: var(--theme-surface-raised, var(--surface));
  color: var(--theme-ink, var(--ink));
}

.community-ai-review-style-option > span::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 11px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border: 1px solid var(--theme-line-strong, var(--line));
  border-radius: 50%;
  color: var(--theme-on-primary, #fff);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
}

.community-ai-review-style-option strong {
  font-size: 13px;
  line-height: 1.3;
}

.community-ai-review-style-option small {
  color: var(--theme-muted, var(--muted));
  font-size: 11px;
  line-height: 1.4;
}

.community-ai-review-style-option input:checked + span {
  border-color: var(--theme-primary, var(--primary));
  background: var(--theme-primary-wash, color-mix(in srgb, var(--primary) 10%, transparent));
  color: var(--theme-primary-strong, var(--primary-strong));
}

.community-ai-review-style-option input:checked + span::after {
  content: "✓";
  border-color: var(--theme-primary, var(--primary));
  background: var(--theme-primary, var(--primary));
}

.community-ai-review-style-option input:focus-visible + span {
  outline: 2px solid rgb(var(--theme-focus-rgb, 31 122 90) / 0.62);
  outline-offset: 2px;
}

.community-ai-review-style-option input:disabled + span {
  cursor: not-allowed;
  opacity: 0.58;
}

.community-ai-review-regenerate {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.community-ai-review-regenerate-button {
  min-width: 96px;
  min-height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--theme-primary, var(--primary));
  border-radius: 10px;
  padding: 9px 16px;
  background: var(--theme-primary, var(--primary));
  color: var(--theme-on-primary, #fff);
  font-size: 13px;
  font-weight: 800;
}

.community-ai-review-regenerate-button:focus-visible {
  outline: 2px solid rgb(var(--theme-focus-rgb, 31 122 90) / 0.62);
  outline-offset: 2px;
}

.community-ai-review-regenerate-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.community-ai-review-regenerate p {
  margin: 0;
  color: var(--theme-muted, var(--muted));
  font-size: 11px;
  line-height: 1.5;
}

@media (hover: hover) and (pointer: fine) {
  .community-ai-review-style-option:hover input:not(:disabled) + span {
    border-color: var(--theme-line-strong, var(--line));
  }

  .community-ai-review-regenerate-button:hover:not(:disabled) {
    filter: brightness(1.04);
    transform: translateY(-1px);
  }
}

.community-ai-review-regenerate-button:active:not(:disabled) {
  transform: scale(0.985);
}

.community-ai-review-note {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  border: 1px solid var(--theme-line, rgba(31, 122, 90, 0.12));
  border-radius: 8px;
  padding: 14px;
  background: var(--theme-surface-soft, rgba(247, 251, 249, 0.78));
}

.community-ai-review-note strong {
  color: var(--theme-ink, var(--ink));
  font-size: 13px;
}

.community-ai-review-note p {
  margin: 0;
  color: var(--theme-muted, var(--muted));
  font-size: 12px;
  line-height: 1.62;
}

.community-ai-review-status-description {
  margin: 14px 0 0;
  color: var(--theme-muted, var(--muted));
  font-size: 13px;
  line-height: 1.55;
}

.community-ai-review-settings-message {
  min-height: 20px;
  margin-top: 8px;
}

.community-ai-review-settings-message[data-type="success"] {
  color: var(--theme-primary-strong, var(--primary-strong));
}

.community-ai-review-settings-message[data-type="error"] {
  color: var(--theme-danger, #b45143);
}

.community-ai-review-label {
  width: fit-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--theme-primary, var(--primary)) 28%, transparent);
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--theme-primary-wash, color-mix(in srgb, var(--primary) 10%, transparent));
  color: var(--theme-primary-strong, var(--primary-strong));
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.community-card-ai-review-label {
  margin-top: 0;
}

.community-detail-ai-review-label {
  margin-top: -3px;
}

/*
 * Community sharing is loaded as an independent, immutable stylesheet.
 * Keep its entry row and AI settings surface on the same semantic palette as
 * the six selectable brand themes. The tokens below switch automatically with
 * prefers-color-scheme, so no legacy teal or light-only material leaks through.
 */
html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-more-settings-button {
  border-top-color: var(--theme-line);
  background: transparent;
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-more-settings-button:focus-visible {
  background: var(--theme-interactive-hover);
  color: var(--theme-primary-strong);
  box-shadow: none;
  outline: 2px solid rgb(var(--theme-focus-rgb) / 0.56);
  outline-offset: -2px;
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-more-settings-button:active:not(:disabled) {
  background: var(--theme-interactive-active);
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-more-settings-meta {
  color: var(--theme-muted);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] :is(
  .community-more-settings-label,
  .community-more-settings-arrow
) {
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-panel {
  border-color: var(--theme-line);
  color: var(--theme-ink);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-panel :is(
  .settings-description,
  .community-ai-review-status-description,
  .community-ai-review-switch small,
  .community-ai-review-switch em
) {
  color: var(--theme-muted);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-panel :is(
  .settings-kicker,
  .community-ai-review-switch strong
) {
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch {
  border-color: var(--theme-line);
  background: var(--theme-surface-raised);
  color: var(--theme-ink);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch:focus-within {
  border-color: var(--theme-line-strong);
  background: var(--theme-interactive-hover);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch .notification-preference-track {
  border-color: var(--theme-line-strong);
  background: var(--theme-surface-soft);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch .notification-preference-track > span {
  background: var(--theme-surface);
  box-shadow: 0 2px 7px rgb(var(--theme-shadow-rgb) / 0.24);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch input:checked + .notification-preference-track {
  border-color: var(--theme-primary);
  background: var(--theme-primary);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch input:focus-visible + .notification-preference-track {
  outline: 2px solid rgb(var(--theme-focus-rgb) / 0.62);
  outline-offset: 3px;
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-fieldset legend,
html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option strong {
  color: var(--theme-ink);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] :is(
  .community-ai-review-style-fieldset > p,
  .community-ai-review-style-option small,
  .community-ai-review-regenerate p
) {
  color: var(--theme-muted);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option > span {
  border-color: var(--theme-line);
  background: var(--theme-surface-raised);
  color: var(--theme-ink);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option input:checked + span {
  border-color: var(--theme-primary);
  background: var(--theme-primary-wash);
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option input:checked + span strong {
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option > span::after {
  border-color: var(--theme-line-strong);
  color: var(--theme-on-primary);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option input:checked + span::after {
  border-color: var(--theme-primary);
  background: var(--theme-primary);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option input:focus-visible + span {
  outline-color: rgb(var(--theme-focus-rgb) / 0.62);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-regenerate-button {
  border-color: var(--theme-primary);
  background: var(--theme-primary);
  color: var(--theme-on-primary);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-regenerate-button:focus-visible {
  outline-color: rgb(var(--theme-focus-rgb) / 0.62);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-note {
  border-color: var(--theme-line);
  background: var(--theme-surface-soft);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-note strong {
  color: var(--theme-ink);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-note p {
  color: var(--theme-muted);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-settings-message[data-type="success"] {
  color: var(--theme-primary-strong);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-settings-message[data-type="error"] {
  color: var(--theme-danger);
}

html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-label {
  border-color: color-mix(in srgb, var(--theme-primary) 28%, var(--theme-line));
  background: var(--theme-primary-wash);
  color: var(--theme-primary-strong);
}

@media (hover: hover) and (pointer: fine) {
  html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-more-settings-button:hover:not(:disabled) {
    background: var(--theme-interactive-hover);
    color: var(--theme-primary-strong);
    box-shadow: none;
  }

  html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch:hover {
    border-color: var(--theme-line-strong);
    background: var(--theme-interactive-hover);
  }

  html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option:hover input:not(:disabled) + span {
    border-color: var(--theme-line-strong);
    background: var(--theme-interactive-hover);
  }

  html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-style-option:hover input:checked + span {
    border-color: var(--theme-primary);
    background: var(--theme-primary-wash);
  }

  html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-regenerate-button:hover:not(:disabled) {
    border-color: var(--theme-primary-strong);
    background: var(--theme-primary-strong);
  }
}

@media (hover: none), (pointer: coarse) {
  html[data-theme="glass-porcelain-ink"][data-brand-theme] .community-ai-review-switch:hover:not(:focus-within) {
    border-color: var(--theme-line);
    background: var(--theme-surface-raised);
    box-shadow: none;
  }
}

@media (max-width: 1024px), (max-width: 1366px) and (any-pointer: coarse) {
  .community-share-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .community-share-primary {
    gap: 12px;
  }

  .community-more-settings-button {
    min-height: 44px;
    margin-top: 9px;
    padding-top: 9px;
  }

  .community-more-settings-label {
    font-size: 12px;
  }

  .community-more-settings-meta {
    max-width: 66%;
    font-size: 11px;
  }

  .community-ai-review-note {
    border-radius: 16px;
    padding: 13px;
  }

  .community-ai-review-style-option > span,
  .community-ai-review-regenerate-button {
    border-radius: 14px;
  }

  html[data-theme="glass-porcelain-ink"][data-brand-theme] .settings-detail-panel > .community-ai-review-panel {
    border-color: var(--theme-line);
    background: var(--theme-surface-raised);
    color: var(--theme-ink);
    box-shadow: 0 8px 24px rgb(var(--theme-shadow-rgb) / 0.10);
  }

  .community-card-ai-review-label {
    font-size: 10px;
    padding: 2px 6px;
  }
}

@media (max-width: 360px) {
  .community-more-settings-meta {
    max-width: 60%;
  }

  .community-ai-review-style-options {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-ai-review-regenerate {
    align-items: stretch;
    flex-direction: column;
  }

  .community-ai-review-regenerate-button {
    width: 100%;
  }
}
