.profile-edit-panel {
  width: min(680px, 100%);
  max-width: 680px;
}

.profile-edit-panel textarea[name="bio"] {
  resize: none;
  overflow-y: hidden;
}

.settings-theme-card {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-secondary);
}

.settings-theme-note {
  margin: 0;
}

.avatar-editor-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: var(--elevated-soft);
}

.avatar-editor-head h2,
.profile-section-title {
  margin: 0;
}

.avatar-editor-head p {
  margin: 0.35rem 0 0.8rem;
}

.avatar-editor-live {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.avatar-editor-live-preview-wrap {
  width: 114px;
  height: 114px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-editor-live-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-editor-live-fallback {
  color: var(--brand-secondary);
  font-size: 2rem;
  font-weight: 700;
}

.avatar-editor-actions {
  display: grid;
  gap: 0.55rem;
  align-items: start;
}

.avatar-editor-actions .btn-light {
  width: fit-content;
}

.avatar-editor-file-input {
  display: none;
}

.avatar-editor-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  color: var(--btn-secondary-text);
  background: var(--btn-secondary-bg);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  width: fit-content;
}

.avatar-editor-upload-btn:hover {
  background: var(--surface-soft);
  border-color: var(--brand-accent);
}

.avatar-editor-upload-btn input[type="file"] {
  display: none;
}

.avatar-crop-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.avatar-crop-modal-overlay.is-open {
  display: flex;
}

.avatar-crop-modal {
  width: min(1120px, 100%);
  max-height: min(860px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(15, 17, 21, 0.2);
  overflow: hidden;
  padding: 1.35rem;
}

.avatar-crop-head-actions,
.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-actions-owner {
  display: grid;
  justify-items: end;
  align-content: start;
}

.profile-owner-links {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.profile-edit-icon-link {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
}

.profile-edit-icon-link:hover,
.profile-edit-icon-link:focus-visible {
  background: var(--hover);
  border-color: var(--brand-accent);
  color: var(--text);
}

.profile-edit-icon-link svg {
  width: 22px;
  height: 22px;
}

.avatar-crop-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.avatar-crop-topbar-copy {
  display: grid;
  gap: 0.28rem;
}

.avatar-crop-eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.73rem;
  font-weight: 800;
}

.avatar-crop-topbar-copy h3 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
}

.avatar-crop-topbar-copy p.subtle {
  margin: 0;
  max-width: 660px;
}

.avatar-crop-close-btn {
  width: 46px;
  min-width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: none;
}

.avatar-crop-close-btn:hover,
.avatar-crop-close-btn:focus-visible {
  background: var(--surface-soft);
  border-color: var(--accent);
  color: var(--text);
}

.avatar-crop-body {
  display: grid;
  grid-template-columns: minmax(0, 0.96fr) minmax(360px, 1.04fr);
  gap: 1.2rem;
  align-items: stretch;
  padding-top: 1.2rem;
}

.avatar-crop-stage {
  display: grid;
  gap: 1.2rem;
  min-width: 0;
  height: 100%;
}

.avatar-crop-editor-wrap,
.avatar-crop-preview,
.avatar-crop-control-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-secondary) 100%);
  box-shadow: var(--shadow-card);
}

.avatar-crop-editor-wrap {
  height: 100%;
  padding: 1rem 1rem 1.45rem;
  display: flex;
  flex-direction: column;
}

.avatar-crop-frame-note {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.avatar-crop-editor-canvas {
  display: block;
  width: min(100%, 520px);
  max-width: 100%;
  margin: auto auto 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, #eef1f7 0%, #e4e8f0 100%);
  border-radius: 24px;
}

.avatar-crop-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
}

.avatar-crop-preview-copy {
  display: grid;
  gap: 0.2rem;
}

.avatar-crop-preview-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.avatar-crop-preview-copy .subtle {
  margin: 0;
  max-width: 260px;
}

.avatar-crop-preview-canvas {
  width: 120px;
  height: 120px;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, #eef2f8 0%, #e2e7ef 100%);
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 28px rgba(15, 17, 21, 0.12);
}

.avatar-crop-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  height: 100%;
}

.avatar-crop-control-card {
  padding: 1rem;
  display: grid;
  gap: 0.78rem;
}

.avatar-crop-control-card h4 {
  margin: 0;
  font-size: 1rem;
}

.avatar-crop-control-card--soft {
  background: var(--bg-secondary);
  box-shadow: none;
}

.avatar-crop-control-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.avatar-crop-control-head span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.avatar-crop-range-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 0.65rem;
}

.avatar-crop-step-btn {
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: none;
}

.avatar-crop-step-btn:hover,
.avatar-crop-step-btn:focus-visible {
  background: var(--hover);
  border-color: var(--accent);
  color: var(--text);
}

.avatar-crop-range {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 999px;
  height: 12px;
  background: linear-gradient(
    90deg,
    var(--accent) 0,
    var(--accent) var(--avatar-range-progress, 0%),
    rgba(107, 114, 128, 0.28) var(--avatar-range-progress, 0%),
    rgba(107, 114, 128, 0.28) 100%
  );
  box-shadow: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.avatar-crop-range::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.avatar-crop-range::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: transparent;
}

.avatar-crop-range::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--accent);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 6px 14px rgba(15, 17, 21, 0.18);
}

.avatar-crop-range::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(15, 17, 21, 0.18);
}

.avatar-crop-control-note {
  margin: -0.15rem 0 0;
}

.avatar-crop-sidebar-actions {
  display: grid;
  column-gap: 0.7rem;
  row-gap: 1.35rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: auto;
  padding-top: 0.25rem;
}

.avatar-editor-upload-btn-secondary,
.avatar-crop-reset-btn,
.avatar-crop-apply-btn {
  width: 100%;
  min-width: 0;
  justify-content: center;
  padding: 0.82rem 1.2rem;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.avatar-editor-upload-btn-secondary {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}

.avatar-crop-reset-btn {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}

.avatar-editor-upload-btn-secondary:hover,
.avatar-crop-reset-btn:hover,
.avatar-crop-reset-btn:focus-visible {
  background: var(--hover);
  border-color: var(--accent);
  color: var(--text);
}

.avatar-crop-apply-btn {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
  grid-column: 1 / -1;
}

.avatar-crop-apply-btn:hover,
.avatar-crop-apply-btn:focus-visible {
  background: var(--btn-primary-hover);
  color: #ffffff;
}

html[data-theme="dark"] .avatar-crop-editor-canvas,
html[data-theme="dark"] .avatar-crop-preview-canvas,
body[data-theme="dark"] .avatar-crop-editor-canvas,
body[data-theme="dark"] .avatar-crop-preview-canvas {
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 56%),
    linear-gradient(180deg, #1b2230 0%, #151a24 100%);
}

.profile-page {
  display: grid;
  gap: 1.25rem;
}

.profile-shell {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.profile-shell-media {
  display: flex;
  justify-content: center;
}

.profile-shell-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.profile-shell-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  font-weight: 700;
  color: var(--brand-secondary);
}

.profile-shell-content {
  display: grid;
  gap: 0.95rem;
}

.profile-shell-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  flex-wrap: wrap;
}

.profile-shell-name {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.profile-shell-handle,
.profile-shell-meta {
  margin: 0.3rem 0 0;
  color: var(--muted);
}

.profile-shell-stats {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
}

.profile-shell-stat {
  display: inline-flex;
  gap: 0.35rem;
  align-items: baseline;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.profile-shell-stat strong {
  font-size: 1rem;
}

.profile-shell-stat-link {
  text-decoration: none;
  color: inherit;
}

.profile-shell-stat-link:hover {
  border-color: var(--brand-accent);
  background: var(--surface-soft);
}

.profile-shell-bio {
  margin: 0;
  line-height: 1.7;
}

.profile-shell-bio-private {
  font-weight: 600;
}

.profile-posts-section,
.profile-sizes-section {
  display: grid;
  gap: 0.9rem;
}

.profile-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.profile-post-card {
  height: 100%;
}

.profile-post-photo {
  height: 320px;
}

.post-media-viewer {
  position: relative;
}

.post-media-stack {
  position: relative;
}

.post-media-frame {
  margin: 0;
  position: relative;
}

.post-tags-overlay {
  position: absolute;
  inset: 0;
}

.post-tag-marker {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--text);
  box-shadow: var(--shadow-soft);
  transform: translate(-50%, -50%);
  padding: 0;
}

.post-media-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem 0;
}

.post-media-controls button {
  min-width: 42px;
  padding: 0.45rem 0.55rem;
}

.post-tags-toggle {
  margin: 0.85rem;
}

.post-tags-info {
  margin: 0 0.85rem 0.85rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}
