.profile-page { overflow-x: hidden; }
.profile-main { display: grid; gap: 28px; padding-top: 28px; padding-bottom: 60px; }
.profile-summary { padding: 20px; }
.profile-summary-main { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.profile-avatar, .profile-avatar-fallback { width: 86px; height: 86px; border: 1px solid var(--ui-border-strong); border-radius: 50%; }
.profile-avatar { display: block; object-fit: cover; }
.profile-avatar-fallback { display: grid; place-items: center; background: var(--ui-accent-soft); color: var(--ui-accent-strong); font-size: 30px; font-weight: 750; }
.profile-copy { min-width: 0; }
.profile-copy h1 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(24px, 4vw, 36px); letter-spacing: -.045em; line-height: 1.1; }
.profile-id { margin: 5px 0 10px; color: var(--ui-text-muted); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; margin: 0; color: var(--ui-text-muted); font-size: 12px; }
.profile-meta > div { display: inline-flex; align-items: center; gap: 5px; }
.profile-meta dt { color: var(--ui-text-subtle); }
.profile-meta dd { margin: 0; font-weight: 650; }
.profile-badge { padding: 2px 7px; border: 1px solid var(--ui-border); border-radius: 999px; color: var(--ui-accent-strong); background: var(--ui-accent-soft); font-size: 11px; font-weight: 700; }
.profile-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.profile-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ui-border); }
.profile-stat { min-width: 0; padding: 10px 12px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-raised); }
.profile-stat dt { overflow: hidden; color: var(--ui-text-subtle); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.profile-stat dd { overflow: hidden; margin: 3px 0 0; color: var(--ui-text); font-size: 14px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.profile-sync-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--ui-border); }
.profile-sync-row strong, .profile-sync-row span { display: block; }
.profile-sync-row strong { font-size: 12px; }
.profile-sync-row span { margin-top: 2px; color: var(--ui-text-subtle); font-size: 11px; }

.profile-section { display: grid; gap: 12px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.03em; }
.section-heading p { margin: 4px 0 0; color: var(--ui-text-muted); font-size: 12px; }
.section-heading .ui-button { flex: 0 0 auto; }

.map-panel { overflow: hidden; }
.map-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ui-border); }
.map-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.map-control { display: grid; gap: 5px; }
.map-control-label { color: var(--ui-text-subtle); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.map-meta { display: inline-flex; align-items: center; gap: 7px; color: var(--ui-text-muted); font-size: 11px; }
.map-meta::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ui-accent); }
.map-stage { position: relative; min-height: 560px; overflow: hidden; background: #202720; }
#bubbleMap { position: relative; z-index: 1; display: block; width: 100%; height: 560px; }
.map-state { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; padding: 24px; color: #dfe9df; text-align: center; }
.map-state.is-hidden { display: none; }
.map-state > div { max-width: 360px; }
.map-state strong { color: #fff; }
.map-state p { margin: 4px 0 0; color: #b9c5ba; font-size: 12px; }
.map-state .ui-button { margin-top: 12px; border-color: #526253; background: transparent; color: #eef4ee; }
.map-state .ui-button:hover { background: #2e392f; }
.map-loading-skeleton { position: relative; width: 190px; height: 130px; margin: 0 auto 12px; opacity: .72; }
.map-loading-skeleton i { position: absolute; display: block; border-radius: 50%; background: #334035; box-shadow: inset 0 0 0 1px #526253; animation: profile-pulse 1.3s ease-in-out infinite alternate; }
.map-loading-skeleton i:nth-child(1) { width: 52px; height: 52px; top: 35px; left: 67px; }
.map-loading-skeleton i:nth-child(2) { width: 28px; height: 28px; top: 9px; left: 32px; animation-delay: -.4s; }
.map-loading-skeleton i:nth-child(3) { width: 36px; height: 36px; right: 18px; bottom: 10px; animation-delay: -.8s; }
@keyframes profile-pulse { to { opacity: .42; transform: scale(.9); } }
.map-loader { width: 26px; height: 26px; margin: 0 auto 10px; border: 2px solid rgba(255,255,255,.2); border-top-color: #8fd5a3; border-radius: 50%; animation: profile-spin .8s linear infinite; }
@keyframes profile-spin { to { transform: rotate(360deg); } }
.map-footer { display: flex; justify-content: space-between; gap: 14px; padding: 11px 16px; border-top: 1px solid var(--ui-border); color: var(--ui-text-subtle); font-size: 11px; }
.map-footer strong { color: var(--ui-text-muted); font-weight: 650; }
.bubble { cursor: pointer; outline: none; }
.bubble:hover, .bubble:focus { filter: brightness(1.15); }
.bubble circle.ring { fill: rgba(255,255,255,.04); stroke: rgba(236,247,237,.78); stroke-width: 1.5; }
.bubble text { fill: #fff; text-anchor: middle; pointer-events: none; font-family: Inter, ui-sans-serif, sans-serif; paint-order: stroke; stroke: rgba(10,15,11,.72); stroke-width: 3px; stroke-linejoin: round; }
.map-tooltip { position: absolute; z-index: 10; width: max-content; max-width: 260px; padding: 9px 11px; border: 1px solid #526253; border-radius: var(--ui-radius-sm); background: #172018; color: #f3f8f3; box-shadow: 0 10px 24px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); transition: opacity .12s ease; font-size: 11px; }
.map-tooltip.is-visible { opacity: 1; }
.map-tooltip strong { display: block; margin-bottom: 2px; font-size: 12px; }
.map-tooltip span { color: #bccabd; }

.embed-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 14px; }
.embed-preview-panel, .share-panel { overflow: hidden; }
.embed-picker { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--ui-border); }
.embed-picker label { color: var(--ui-text-muted); font-size: 12px; font-weight: 700; }
.embed-picker .ui-select { width: min(250px, 60%); height: 34px; font-size: 12px; }
.embed-preview-stage { display: flex; align-items: center; justify-content: center; min-height: 300px; padding: 18px; background: var(--ui-surface-muted); }
#embedPreview { display: block; width: min(100%, 560px); min-height: 120px; border: 0; border-radius: var(--ui-radius-md); background: transparent; }
.embed-preview-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--ui-border); color: var(--ui-text-muted); font-size: 11px; }
.share-panel { padding-bottom: 16px; }
.share-panel-header { padding: 16px; border-bottom: 1px solid var(--ui-border); }
.share-panel-header h3 { margin: 0; font-size: 14px; }
.share-panel-header p { margin: 4px 0 0; color: var(--ui-text-muted); font-size: 12px; }
.share-tabs { display: flex; gap: 3px; padding: 12px 16px 0; overflow-x: auto; }
.share-tab { min-height: 30px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ui-text-muted); cursor: pointer; font-size: 11px; font-weight: 650; white-space: nowrap; }
.share-tab:hover { background: var(--ui-surface-muted); color: var(--ui-text); }
.share-tab[aria-selected="true"] { border-color: var(--ui-border); background: var(--ui-surface-muted); color: var(--ui-text); }
.share-output { display: grid; gap: 9px; padding: 12px 16px 0; }
.share-output-label { color: var(--ui-text-subtle); font-size: 11px; }
.share-value { min-height: 100px; width: 100%; padding: 10px; overflow-wrap: anywhere; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface-raised); color: var(--ui-text-muted); font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; }
.share-output-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.share-output-help { margin: 0; color: var(--ui-text-subtle); font-size: 11px; line-height: 1.45; }
.embed-customize { margin: 12px 16px 0; }

.community-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.community-user { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 9px; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm); background: var(--ui-surface); text-decoration: none; }
.community-user:hover, .community-user.is-current { border-color: var(--ui-accent); background: var(--ui-accent-soft); }
.community-user img, .community-fallback { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; }
.community-fallback { display: grid; place-items: center; background: var(--ui-surface-muted); color: var(--ui-accent-strong); font-size: 12px; font-weight: 750; }
.community-user span { min-width: 0; }
.community-user strong, .community-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.community-user strong { font-size: 12px; }
.community-user small { margin-top: 2px; color: var(--ui-text-subtle); font-size: 10px; }

.profile-footer { width: min(var(--ui-content), calc(100% - 40px)); margin: 0 auto; padding: 18px 0 28px; border-top: 1px solid var(--ui-border); color: var(--ui-text-subtle); font-size: 11px; text-align: center; }

@media (max-width: 980px) {
    .profile-summary-main { grid-template-columns: auto minmax(0, 1fr); }
    .profile-actions { grid-column: 1 / -1; justify-content: flex-start; }
    .embed-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .profile-main { gap: 22px; padding-top: 18px; }
    .profile-summary { padding: 16px; }
    .profile-summary-main { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
    .profile-avatar, .profile-avatar-fallback { width: 64px; height: 64px; }
    .profile-copy h1 { font-size: 25px; }
    .profile-stats { grid-template-columns: 1fr; }
    .section-heading { display: block; }
    .section-heading .ui-button { margin-top: 10px; }
    .map-toolbar { align-items: stretch; }
    .map-controls { display: grid; width: 100%; }
    .map-control .ui-segmented { width: 100%; overflow-x: auto; }
    .map-control .ui-segmented > button { flex: 1; }
    .map-meta { justify-content: flex-end; }
    .map-stage { min-height: 470px; }
    #bubbleMap { height: 470px; }
    .map-footer { display: block; }
    .map-footer span { display: block; margin-top: 4px; }
    .embed-picker { align-items: flex-start; flex-direction: column; }
    .embed-picker .ui-select { width: 100%; }
    .embed-preview-stage { min-height: 250px; padding: 12px; }
    .profile-footer { width: min(100% - 24px, var(--ui-content)); }
}
