.chronos-community {
  --community-surface: #19191b;
  --community-control: #232326;
  --community-muted: #aca9b6;
  --community-border: #ffffff12;
  --community-tint: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--text);
  container: community / inline-size;
}

.chronos-community h2,
.chronos-community h3,
.chronos-community p,
.chronos-community dl,
.chronos-community dd { margin: 0; }

.chronos-community h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.02em;
}

.chronos-community p {
  color: var(--community-muted);
  font-size: .875rem;
  line-height: 1.5;
}

.community-cover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 150px;
  padding: clamp(18px, 3.5cqi, 32px);
  border: 1px solid var(--community-border);
  border-radius: 11px;
  background:
    linear-gradient(100deg, #17161bee 9%, #17161bb5 54%, #17161b50),
    linear-gradient(104deg, transparent, var(--community-tint)),
    url("./chronos-world.png") center 43% / cover;
}

.community-cover-title {
  min-width: 0;
}

.community-cover-title h2 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 4.4cqi, 2.25rem);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -.045em;
}

.community-cover-title p {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e3deed;
}

.community-online-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #81dcbb;
  box-shadow: 0 0 10px #81dcbb4d;
}

.community-level {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 15px 11px 11px;
  border: 1px solid #ffffff1c;
  border-radius: 10px;
  background: #19191bee;
}

.community-level div {
  display: grid;
  gap: 2px;
}

.community-level div span {
  color: var(--community-muted);
  font-size: .8125rem;
}

.community-level strong {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
}

.community-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--community-tint);
  color: var(--accent);
}

.chronos-community svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.community-overview {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 14px;
  margin-top: 14px;
}

.chronos-community .community-card {
  min-width: 0;
  padding: clamp(16px, 2.4cqi, 23px);
  border: 1px solid var(--community-border);
  border-radius: 11px;
  background: var(--community-surface);
}

.chronos-community .community-visit {
  display: grid;
  gap: 15px;
  background: linear-gradient(130deg, var(--community-tint), transparent 65%), var(--community-surface);
}

.community-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.community-heading h3 + p {
  margin-top: 3px;
}

.community-visit-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.community-visit-stats div {
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
  padding: 8px 12px;
  border: 1px solid var(--community-border);
  border-radius: 8px;
  background: #ffffff04;
}

.community-visit-stats dt {
  color: var(--community-muted);
  font-size: .8125rem;
}

.community-visit-stats dd {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chronos-community .community-actions {
  display: grid;
  grid-template-rows: 1fr 1fr;
  padding-block: 4px;
}

.community-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
  align-items: center;
  gap: 10px 16px;
  padding-block: 14px;
}

.community-action + .community-action {
  border-top: 1px solid var(--community-border);
}

html[data-recode] .chronos-community .button {
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 13px;
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

.chronos-community .button--ghost {
  border: 1px solid var(--community-border);
  background: #ffffff06;
  color: var(--accent-soft);
}

.chronos-community .button--ghost:hover {
  background: var(--community-tint);
}

.chronos-community .button svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.chronos-community .button:disabled {
  opacity: 1;
  border: 1px solid var(--community-border);
  background: #ffffff06;
  color: var(--community-muted);
  cursor: default;
  transform: none;
}

.chronos-community .community-feedback {
  overflow-wrap: anywhere;
}

.chronos-community > .community-feedback:not(:empty) {
  padding: 10px 0 0;
}

.community-achievements {
  margin-top: 14px;
}

.community-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 14px;
}

.community-achievement-summary:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 10px;
}

.community-achievement-summary p {
  color: var(--accent-soft);
  font-variant-numeric: tabular-nums;
}

.community-achievement-summary progress {
  appearance: none;
  width: clamp(60px, 13cqi, 126px);
  height: 5px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #ffffff12;
  color: var(--accent);
  accent-color: var(--accent);
}

.community-achievement-summary progress::-webkit-progress-bar { background: #ffffff12; }
.community-achievement-summary progress::-webkit-progress-value { border-radius: 99px; background: var(--accent); }
.community-achievement-summary progress::-moz-progress-bar { border-radius: 99px; background: var(--accent); }

.community-achievements ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.community-achievements li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #ffffff04;
}

.community-achievements li[data-earned="true"] {
  border-color: color-mix(in srgb, var(--accent) 16%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--community-surface));
}

.community-achievements li strong {
  display: block;
  margin-bottom: 2px;
  font-size: .875rem;
  font-weight: 600;
}

.community-achievements li p {
  font-size: .8125rem;
}

.community-achievements li[data-earned="false"] .community-icon {
  background: #ffffff08;
  color: var(--community-muted);
}

.chronos-community .community-preferences {
  display: block;
  margin-top: 14px;
}

.community-profile-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  margin-top: 18px;
}

.community-profile-fields .community-bio {
  grid-column: 1 / -1;
}

.community-profile-fields label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--community-muted);
  font-size: .875rem;
}

html[data-recode] .account-dialog .community-profile-fields :is(input:not([type="checkbox"]), select, textarea) {
  width: 100%;
  min-height: 43px;
  margin: 0;
  border: 1px solid var(--community-border);
  background-color: var(--community-control);
  color-scheme: dark;
  font: inherit;
}

html[data-recode] .account-dialog .community-profile-fields textarea {
  min-height: 80px;
  resize: vertical;
}

html[data-recode] .account-dialog .community-profile-fields select {
  appearance: none;
  padding-inline-end: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--accent) 51%),
    linear-gradient(135deg, var(--accent) 50%, transparent 51%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

@supports (appearance: base-select) {
  html[data-recode] .account-dialog .community-profile-fields select,
  .community-profile-fields select::picker(select) { appearance: base-select; }
  html[data-recode] .account-dialog .community-profile-fields select {
    padding-inline-end: 13px;
    background-image: none;
  }
  .community-profile-fields select::picker-icon { color: var(--accent); }
  .community-profile-fields select::picker(select) {
    margin-block-start: 5px;
    padding: 4px;
    border: 1px solid var(--community-border);
    border-radius: 8px;
    background: var(--community-control);
    color: var(--text);
    box-shadow: 0 12px 28px #0008;
  }
  .community-profile-fields option {
    min-height: 38px;
    padding: 8px;
    border-radius: 5px;
    font-size: .875rem;
  }
  .community-profile-fields option:is(:checked, :hover, :focus-visible) {
    background: var(--community-tint);
  }
}

.community-profile-fields .community-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 43px;
  padding: 7px 11px 7px 13px;
  border: 1px solid var(--community-border);
  border-radius: 7px;
  background: var(--community-control);
  color: var(--text);
  cursor: pointer;
}

html[data-recode] .account-dialog .community-check > input[type="checkbox"] {
  appearance: none;
  flex: 0 0 36px;
  width: 36px;
  height: 21px;
  min-height: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 1px solid #ffffff26;
  border-radius: 99px;
  background: #373641;
  cursor: pointer;
}

.community-check > input::before {
  display: block;
  width: 13px;
  height: 13px;
  margin: 3px;
  border-radius: 50%;
  background: #f3f1fa;
  content: "";
  transition: translate .18s ease;
}

html[data-recode] .account-dialog .community-check > input:checked {
  border-color: transparent;
  background: var(--accent);
}

.community-check > input:checked::before {
  translate: 15px 0;
  background: var(--accent-ink);
}

.chronos-community :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.community-profile-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--community-border);
}

.community-profile-footer p:empty { display: none; }

.community-friend-bio { display: block; white-space: pre-wrap; overflow-wrap: anywhere; color: #c3cee6; }

@container community (max-width: 690px) {
  .community-overview { grid-template-columns: 1fr; }
}

@container community (min-width: 840px) {
  .community-achievements ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@container community (max-width: 470px) {
  .community-achievements ul,
  .community-profile-fields { grid-template-columns: 1fr; }
}

@container community (max-width: 390px) {
  .community-action { grid-template-columns: 1fr; }
  .community-action .button,
  .community-profile-footer .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .community-check > input::before { transition: none; }
}
